Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,4 @@ dist
dpdata.egg-info
_version.py
!tests/cp2k/aimd/cp2k.log
__pycache__
23 changes: 23 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ The `System` or `LabeledSystem` can be constructed from the following file forma
| QE | log | False | True | LabeledSystem | 'qe/pw/scf' |
| QE | log | True | False | System | 'qe/cp/traj' |
| QE | log | True | True | LabeledSystem | 'qe/cp/traj' |
| Fhi-aims| output | True | True | LabeledSystem | 'fhi_aims/md' |
| Fhi-aims| output | False | True | LabeledSystem | 'fhi_aims/scf' |
|quip/gap|xyz|True|True|MultiSystems|'quip/gap/xyz'|
| PWmat | atom.config | False | False | System | 'pwmat/atom.config' |
| PWmat | movement | True | True | LabeledSystem | 'pwmat/movement' |
Expand Down Expand Up @@ -112,6 +114,27 @@ xyz_multi_systems.systems['B1C9'].to_deepmd_raw('./my_work_dir/B1C9_raw')
xyz_multi_systems.to_deepmd_raw('./my_deepmd_data/')
```

You may also use the following code to parse muti-system:
```
from dpdata import LabeledSystem,MultiSystems
from glob import glob
"""
process multi systems
"""
fs=glob('./*/OUTCAR') # remeber to change here !!!
ms=MultiSystems()
for f in fs:
try:
ls=LabeledSystem(f)
except:
print(f)
if len(ls)>0:
ms.append(ls)

ms.to_deepmd_raw('deepmd')
ms.to_deepmd_npy('deepmd')
```

## Access data
These properties stored in `System` and `LabeledSystem` can be accessed by operator `[]` with the key of the property supplied, for example
```python
Expand Down
25 changes: 12 additions & 13 deletions dpdata/fhi_aims/output.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
eng_patt="Total energy uncorrected.*([-]?[0-9]{1,}[.][0-9]*[E][+-][0-9]{1,})\s+eV"
#atom_numb_patt="Number of atoms.*([0-9]{1,})"

debug = False
def get_info (lines, type_idx_zero = False) :

atom_types = []
Expand All @@ -31,26 +32,23 @@ def get_info (lines, type_idx_zero = False) :
v_str=ii.split('|')[1].split()
vect=[float(kk) for kk in v_str]
cell.append(vect)
# print(cell)
#atom name

_tmp=re.findall(pos_patt_first,contents)
for ii in _tmp:
_atom_names.append(ii[0])
atom_names=[]
for ii in _atom_names:
if not ii in atom_names:
atom_names.append(ii)
#atom number
#_atom_numb_patt=re.compile(atom_numb_patt)

atom_numbs =[_atom_names.count(ii) for ii in atom_names]
if type_idx_zero :
type_map=dict(zip(atom_names,range(len(atom_names))))
else:
type_map=dict(zip(atom_names,range(1,len(atom_names)+1)))
atom_types=list(map(lambda k: type_map[k], _atom_names))
assert(atom_numbs is not None), "cannot find ion type info in aims output"

for idx,ii in enumerate(atom_numbs) :
for jj in range(ii) :
if type_idx_zero :
atom_types.append(idx)
else :
atom_types.append(idx+1)


return [cell, atom_numbs, atom_names, atom_types ]

Expand Down Expand Up @@ -81,8 +79,9 @@ def get_frames (fname, md=True, begin = 0, step = 1) :

cc = 0
while len(blk) > 0 :
# with open(str(cc),'w') as f:
# f.write('\n'.join(blk))
if debug:
with open(str(cc),'w') as f:
f.write('\n'.join(blk))
if cc >= begin and (cc - begin) % step == 0 :
if cc==0:
coord, _cell, energy, force, virial, is_converge = analyze_block(blk, first_blk=True, md=md)
Expand Down
Empty file modified tests/fhi_aims/out_md
100755 → 100644
Empty file.
Empty file modified tests/fhi_aims/out_scf
100755 → 100644
Empty file.
Loading