Skip to content

Commit f342c35

Browse files
committed
fix bug ase calculator None-PBC system
1 parent 93aa907 commit f342c35

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

source/train/calculator.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,13 @@ def __init__(self, model, label="DP", type_dict=None, **kwargs):
4242

4343
def calculate(self, atoms=None, properties=["energy", "forces", "stress"], system_changes=all_changes):
4444
coord = atoms.get_positions().reshape([1, -1])
45-
cell = atoms.get_cell().reshape([1, -1])
45+
if sum(atoms.get_pbc())>0:
46+
cell = atoms.get_cell().reshape([1, -1])
47+
else:
48+
cell = None
4649
symbols = atoms.get_chemical_symbols()
4750
atype = [self.type_dict[k] for k in symbols]
48-
e, f, v = self.dp.eval(coord, cell, atype)
51+
e, f, v = self.dp.eval(coords=coord, cells=cell, atom_types=atype)
4952
self.results['energy'] = e[0]
5053
self.results['forces'] = f[0]
5154
self.results['stress'] = v[0]

0 commit comments

Comments
 (0)