Skip to content

Commit

Permalink
Fix: remove the reading of ntype in the parsing of abacus structure (
Browse files Browse the repository at this point in the history
…#394)

The latest ABACUS 3.0.5 have removed the key word `ntype` in INPUT
  • Loading branch information
pxlxingliang authored Dec 15, 2022
1 parent c218a77 commit 6b1bb7e
Show file tree
Hide file tree
Showing 7 changed files with 3 additions and 15 deletions.
10 changes: 2 additions & 8 deletions dpdata/abacus/scf.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,21 +59,15 @@ def get_cell(geometry_inlines):
cell = celldm*np.array(cell)
return celldm, cell

def get_coords(celldm, cell, geometry_inlines, inlines):
def get_coords(celldm, cell, geometry_inlines, inlines=None):
coords_lines = get_block(geometry_inlines, "ATOMIC_POSITIONS", skip=0)
# assuming that ATOMIC_POSITIONS is at the bottom of the STRU file
coord_type = coords_lines[0].split()[0].lower() # cartisan or direct
atom_names = [] # element abbr in periodic table
atom_types = [] # index of atom_names of each atom in the geometry
atom_numbs = [] # of atoms for each element
coords = [] # coordinations of atoms
ntype = 0
for line in inlines:
if "ntype" in line and "ntype"==line.split()[0]:
ntype = int(line.split()[1])
break
if ntype <= 0:
raise RuntimeError('ntype cannot be found in INPUT file.')
ntype = get_nele_from_stru(geometry_inlines)
line_idx = 1 # starting line of first element
for it in range(ntype):
atom_names.append(coords_lines[line_idx].split()[0])
Expand Down
3 changes: 1 addition & 2 deletions tests/abacus.md.nostress/INPUT
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
INPUT_PARAMETERS
#Parameters (General)
suffix autotest
pseudo_dir ./
ntype 1
pseudo_dir ./
nbands 8
calculation md

Expand Down
1 change: 0 additions & 1 deletion tests/abacus.md.unconv/INPUT
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
INPUT_PARAMETERS
calculation md
ntype 2
nbands 8

ecutwfc 50.000000
Expand Down
1 change: 0 additions & 1 deletion tests/abacus.md/INPUT
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ INPUT_PARAMETERS
#Parameters (1.General)
suffix abacus
calculation md
ntype 2
nbands 6
symmetry 0

Expand Down
1 change: 0 additions & 1 deletion tests/abacus.relax/INPUT
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ INPUT_PARAMETERS
#Parameters (1.General)
suffix abacus
calculation cell-relax
ntype 2
nbands 6
symmetry 1

Expand Down
1 change: 0 additions & 1 deletion tests/abacus.scf/INPUT.fail
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ suffix ch4fail
stru_file STRU.ch4 #the filename of file containing atom positions
kpoint_file KPT.ch4 #the name of file containing k points
pseudo_dir ./
ntype 2
nbands 8
#Parameters (Accuracy)
ecutwfc 100
Expand Down
1 change: 0 additions & 1 deletion tests/abacus.scf/INPUT.ok
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ suffix ch4
stru_file STRU.ch4 #the filename of file containing atom positions
kpoint_file KPT.ch4 #the name of file containing k points
pseudo_dir ./
ntype 2
nbands 8
#Parameters (Accuracy)
ecutwfc 100
Expand Down

0 comments on commit 6b1bb7e

Please sign in to comment.