Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix #359: read atom names from POTCAR if not present in OUTCAR #443

Open
wants to merge 4 commits into
base: devel
Choose a base branch
from
Open
Changes from 2 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
8 changes: 8 additions & 0 deletions dpdata/vasp/outcar.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,14 @@ def system_info(lines, type_idx_zero=False):
atom_names.append(_ii.split("_")[0])
else:
atom_names.append(_ii)
elif "POTCAR" in ii:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

my outcar reads

 INCAR:
 POTCAR:    PAW_PBE Mg 13Apr2007                  
 POTCAR:    PAW_PBE Mg 13Apr2007                  
   VRHFIN =Mg: s2p0                                                             
   LEXCH  = PE                                                                  
   EATOM  =    23.0369 eV,    1.6932 Ry                                         
                                                                                
   TITEL  = PAW_PBE Mg 13Apr2007                                                
   LULTRA =        F    use ultrasoft PP ?                                      
   IUNSCR =        1    unscreen: 0-lin 1-nonlin 2-no                           

Then the same atom name will be added three times.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new commit don't allow duplicated atom names

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The dpdata is expected to abstract atom names in an order that is exact the same as how the potcars are concatenated.
Your implementation does not work for the cases like "A" "B" "A" "B"

# get atom names from POTCAR info, tested only for PAW_PBE ...
_ii = ii.split()[2]
if "_" in _ii:
# for case like : POTCAR: PAW_PBE Ti_sv 26Sep2005
atom_names.append(_ii.split("_")[0])
else:
atom_names.append(_ii)
# a stricker check for "NELM"; compatible with distingct formats in different versions(6 and older, newers_expect-to-work) of vasp
elif nelm is None:
m = re.search(r"NELM\s*=\s*(\d+)", ii)
Expand Down