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 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
16 changes: 10 additions & 6 deletions dpdata/vasp/outcar.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,16 @@ def system_info(lines, type_idx_zero=False):
ii_word_list = ii.split()
if "TITEL" in ii:
# get atom names from POTCAR info, tested only for PAW_PBE ...
_ii = ii.split()[3]
if "_" in _ii:
# for case like : TITEL = PAW_PBE Sn_d 06Sep2000
atom_names.append(_ii.split("_")[0])
else:
atom_names.append(_ii)
# for case like : TITEL = PAW_PBE Sn_d 06Sep2000
atom_name = ii.split()[3].split("_")[0]
if atom_name not in atom_names:
atom_names.append(atom_name)
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 ...
# for case like : POTCAR: PAW_PBE Ti_sv 26Sep2005
atom_name = ii.split()[2].split("_")[0]
if atom_name not in atom_names:
atom_names.append(atom_name)
# 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