Skip to content

Commit 6b1bb7e

Browse files
authored
Fix: remove the reading of ntype in the parsing of abacus structure (#394)
The latest ABACUS 3.0.5 have removed the key word `ntype` in INPUT
1 parent c218a77 commit 6b1bb7e

File tree

7 files changed

+3
-15
lines changed

7 files changed

+3
-15
lines changed

dpdata/abacus/scf.py

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -59,21 +59,15 @@ def get_cell(geometry_inlines):
5959
cell = celldm*np.array(cell)
6060
return celldm, cell
6161

62-
def get_coords(celldm, cell, geometry_inlines, inlines):
62+
def get_coords(celldm, cell, geometry_inlines, inlines=None):
6363
coords_lines = get_block(geometry_inlines, "ATOMIC_POSITIONS", skip=0)
6464
# assuming that ATOMIC_POSITIONS is at the bottom of the STRU file
6565
coord_type = coords_lines[0].split()[0].lower() # cartisan or direct
6666
atom_names = [] # element abbr in periodic table
6767
atom_types = [] # index of atom_names of each atom in the geometry
6868
atom_numbs = [] # of atoms for each element
6969
coords = [] # coordinations of atoms
70-
ntype = 0
71-
for line in inlines:
72-
if "ntype" in line and "ntype"==line.split()[0]:
73-
ntype = int(line.split()[1])
74-
break
75-
if ntype <= 0:
76-
raise RuntimeError('ntype cannot be found in INPUT file.')
70+
ntype = get_nele_from_stru(geometry_inlines)
7771
line_idx = 1 # starting line of first element
7872
for it in range(ntype):
7973
atom_names.append(coords_lines[line_idx].split()[0])

tests/abacus.md.nostress/INPUT

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
INPUT_PARAMETERS
22
#Parameters (General)
33
suffix autotest
4-
pseudo_dir ./
5-
ntype 1
4+
pseudo_dir ./
65
nbands 8
76
calculation md
87

tests/abacus.md.unconv/INPUT

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
INPUT_PARAMETERS
22
calculation md
3-
ntype 2
43
nbands 8
54

65
ecutwfc 50.000000

tests/abacus.md/INPUT

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ INPUT_PARAMETERS
22
#Parameters (1.General)
33
suffix abacus
44
calculation md
5-
ntype 2
65
nbands 6
76
symmetry 0
87

tests/abacus.relax/INPUT

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ INPUT_PARAMETERS
22
#Parameters (1.General)
33
suffix abacus
44
calculation cell-relax
5-
ntype 2
65
nbands 6
76
symmetry 1
87

tests/abacus.scf/INPUT.fail

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ suffix ch4fail
44
stru_file STRU.ch4 #the filename of file containing atom positions
55
kpoint_file KPT.ch4 #the name of file containing k points
66
pseudo_dir ./
7-
ntype 2
87
nbands 8
98
#Parameters (Accuracy)
109
ecutwfc 100

tests/abacus.scf/INPUT.ok

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ suffix ch4
44
stru_file STRU.ch4 #the filename of file containing atom positions
55
kpoint_file KPT.ch4 #the name of file containing k points
66
pseudo_dir ./
7-
ntype 2
87
nbands 8
98
#Parameters (Accuracy)
109
ecutwfc 100

0 commit comments

Comments
 (0)