Skip to content

Commit f8d79b3

Browse files
authored
Merge pull request #191 from haidi-ustc/devel
update calculator type_dict
2 parents 17338c2 + c09cdcb commit f8d79b3

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

source/train/calculator.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,10 @@ class DP(Calculator):
3535
def __init__(self, model, label="DP", **kwargs):
3636
Calculator.__init__(self, label=label, **kwargs)
3737
self.dp = DeepPot(model)
38-
self.type_dict = dict(zip(self.dp.get_type_map(), range(self.dp.get_ntypes())))
38+
try:
39+
self.type_dict=kwargs['type_dict']
40+
except:
41+
self.type_dict = dict(zip(self.dp.get_type_map(), range(self.dp.get_ntypes())))
3942

4043
def calculate(self, atoms=None, properties=["energy", "forces", "stress"], system_changes=all_changes):
4144
coord = atoms.get_positions().reshape([1, -1])

0 commit comments

Comments
 (0)