Created
          May 22, 2023 06:16 
        
      - 
      
- 
        Save Asif-Iqbal-Bhatti/e497da9e3c7194a7d250dcd195b73872 to your computer and use it in GitHub Desktop. 
    NequIP data file from VASP OUTCAR file without ML
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | #!/usr/bin/env python3.11 | |
| ''' | |
| # AIB_EM | |
| # Asif Iqbal | |
| ''' | |
| import os, sys | |
| import pandas as pd | |
| import numpy as np | |
| from ase.io import read, write | |
| import dpdata | |
| inpFilename = 'OUTCAR' | |
| outFilename = 'heaData.extxyz' | |
| os.system('rm -r ' + outFilename) | |
| # | |
| data = dpdata.LabeledSystem('OUTCAR', fmt = 'vasp/outcar') | |
| print(f'# the data contains {len(data)} frames, {data["coords"].shape}') | |
| # | |
| all_atoms = read(inpFilename, format='vasp-out', index=':') | |
| print("READING LATTICE DIM:: ", all_atoms[-1].get_positions().shape) | |
| print("# of Frames:: ", len(all_atoms)) | |
| for i, curr_atoms in enumerate(all_atoms): | |
| write(outFilename, curr_atoms, append=True, format='extxyz') | |
| # CHECK | |
| dd = [] | |
| rd = read(outFilename, format='extxyz', index=':') | |
| for k, i in enumerate(rd): | |
| dd.append({'Frame': k, | |
| 'Formula':i.get_chemical_formula(), | |
| 'TotENE':i.get_potential_energy()}) | |
| df = pd.DataFrame(dd) | |
| print(df) | |
| minENEinMD = df['TotENE'].idxmin() | |
| print('Min Frame idx and Frame TotENE:: ', minENEinMD, df['TotENE'].min()) | |
| print(all_atoms[minENEinMD].get_potential_energy()) | |
| write('CONTCAR_min', all_atoms[minENEinMD], format='vasp') | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment