Skip to content

Commit c2a6a8b

Browse files
authored
Add files via upload
1 parent 673a135 commit c2a6a8b

1 file changed

Lines changed: 8 additions & 5 deletions

File tree

multioptpy/Calculator/ase_tools/fairchem.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,23 @@ def __init__(self, **kwargs):
99
self.device_mode = kwargs.get('device_mode', "cpu")
1010
self.software_type = kwargs.get('software_type', None)
1111
print(f"ASE_FAIRCHEM: software_type = {self.software_type}")
12-
13-
14-
def run(self): # fairchem.core: version 2.x.x
1512
try:
1613
from fairchem.core import FAIRChemCalculator
14+
self.FAIRChemCalculator = FAIRChemCalculator
1715
from fairchem.core.units.mlip_unit import load_predict_unit
16+
self.load_predict_unit = load_predict_unit
1817
except ImportError:
1918
raise ImportError("FAIRChem.core modules not found")
19+
20+
21+
def run(self): # fairchem.core: version 2.x.x
22+
2023
# Load the prediction unit
21-
predict_unit = load_predict_unit(path=self.software_path, device=self.device_mode)
24+
predict_unit = self.load_predict_unit(path=self.software_path, device=self.device_mode)
2225
print(f"ASE_FAIRCHEM: device_mode = {self.device_mode}")
2326
print(f"ASE_FAIRCHEM: task_name = {self.task_name}")
2427
# Set up the FAIRChem calculator
25-
fairchem_calc = FAIRChemCalculator(predict_unit=predict_unit, task_name=self.task_name)
28+
fairchem_calc = self.FAIRChemCalculator(predict_unit=predict_unit, task_name=self.task_name)
2629
self.atom_obj.info = {"charge": int(self.electric_charge_and_multiplicity[0]),
2730
"spin": int(self.electric_charge_and_multiplicity[1])}
2831
self.atom_obj.calc = fairchem_calc

0 commit comments

Comments
 (0)