-
Notifications
You must be signed in to change notification settings - Fork 124
Open
Description
Describe the bug
ForceFieldRelaxMaker does not compatible with molecule. Is there any effort in making them compatible with each other?
To Reproduce
The code to generate the problem:
from atomate2.forcefields.jobs import ForceFieldRelaxMaker
from pymatgen.core import Molecule
from jobflow import run_locally
from atomate2.forcefields import MLFF
molecule = Molecule.from_str(
"""3
Properties=species:S:1:pos:R:3 pbc="F F F"
O 0.0 0.0 0.0
H 1.0 0.0 0.0
H 0.0 1.0 0.0
""",
fmt="xyz",
)
job_relax = ForceFieldRelaxMaker(
force_field_name = MLFF.MACE,
relax_kwargs = {'fmax':0.025}).make(molecule)
response_relax = run_locally(job_relax)
And here is the result.
2025-02-14 15:13:45,456 INFO Started executing jobs locally
2025-02-14 15:13:45,463 INFO Starting job - Force field relax (bb32706c-9a5c-4f38-986f-141ccfd08f64)
/home/yiy/Test/000-active-learning-workflow/test_env/mace_env/lib/python3.10/site-packages/e3nn/o3/_wigner.py:10: FutureWarning: You are using `torch.load` with `weights_only=False` (the current default value), which uses the default pickle module implicitly. It is possible to construct malicious pickle data which will execute arbitrary code during unpickling (See https://github.com/pytorch/pytorch/blob/main/SECURITY.md#untrusted-models for more details). In a future release, the default value for `weights_only` will be flipped to `True`. This limits the functions that could be executed during unpickling. Arbitrary objects will no longer be allowed to be loaded via this mode unless they are explicitly allowlisted by the user via `torch.serialization.add_safe_globals`. We recommend you start setting `weights_only=True` for any use case where you don't have full control of the loaded file. Please open an issue on GitHub for any issues related to this experimental feature.
_Jd, _W3j_flat, _W3j_indices = torch.load(os.path.join(os.path.dirname(__file__), 'constants.pt'))
cuequivariance or cuequivariance_torch is not available. Cuequivariance acceleration will be disabled.
Using medium MPA-0 model as default MACE-MP model, to use previous (before 3.10) default model please specify 'medium' as model argument
Using Materials Project MACE for MACECalculator with /home/yiy/.cache/mace/macempa0mediummodel
Using float32 for MACECalculator, which is faster but less accurate. Recommended for MD. Use float64 for geometry optimization.
['/home/yiy/.cache/mace/macempa0mediummodel']
/home/yiy/Test/000-active-learning-workflow/test_env/mace_env/lib/python3.10/site-packages/mace/calculators/mace.py:140: FutureWarning: You are using `torch.load` with `weights_only=False` (the current default value), which uses the default pickle module implicitly. It is possible to construct malicious pickle data which will execute arbitrary code during unpickling (See https://github.com/pytorch/pytorch/blob/main/SECURITY.md#untrusted-models for more details). In a future release, the default value for `weights_only` will be flipped to `True`. This limits the functions that could be executed during unpickling. Arbitrary objects will no longer be allowed to be loaded via this mode unless they are explicitly allowlisted by the user via `torch.serialization.add_safe_globals`. We recommend you start setting `weights_only=True` for any use case where you don't have full control of the loaded file. Please open an issue on GitHub for any issues related to this experimental feature.
torch.load(f=model_path, map_location=device)
Default dtype float32 does not match model dtype float64, converting models to float32.
/home/yiy/Test/000-active-learning-workflow/test_env/mace_env/lib/python3.10/site-packages/atomate2/ase/utils.py:368: FutureWarning: Please use atoms.calc = calc
atoms.set_calculator(self.calculator)
2025-02-14 15:13:55,169 INFO Force field relax failed with exception:
Traceback (most recent call last):
File "/home/yiy/Test/000-active-learning-workflow/test_env/mace_env/lib/python3.10/site-packages/jobflow/managers/local.py", line 117, in _run_job
response = job.run(store=store)
File "/home/yiy/Test/000-active-learning-workflow/test_env/mace_env/lib/python3.10/site-packages/jobflow/core/job.py", line 604, in run
response = function(*self.function_args, **self.function_kwargs)
File "/home/yiy/Test/000-active-learning-workflow/test_env/mace_env/lib/python3.10/site-packages/atomate2/forcefields/jobs.py", line 169, in make
return ForceFieldTaskDocument.from_ase_compatible_result(
File "/home/yiy/Test/000-active-learning-workflow/test_env/mace_env/lib/python3.10/site-packages/atomate2/forcefields/schemas.py", line 153, in from_ase_compatible_result
return cls.from_ase_task_doc(ase_task_doc, **ff_kwargs)
File "/home/yiy/Test/000-active-learning-workflow/test_env/mace_env/lib/python3.10/site-packages/atomate2/ase/schemas.py", line 253, in from_ase_task_doc
return cls(**task_document_kwargs)
File "/home/yiy/Test/000-active-learning-workflow/test_env/mace_env/lib/python3.10/site-packages/pydantic/main.py", line 214, in __init__
validated_self = self.__pydantic_validator__.validate_python(data, self_instance=self)
pydantic_core._pydantic_core.ValidationError: 1 validation error for ForceFieldTaskDocument
structure
Value error, Must provide Structure, the as_dict form, or the proper [type=value_error, input_value=Molecule Summary
Site: O ...-0.0655, 1.0145, 0.0000), input_type=Molecule]
For further information visit https://errors.pydantic.dev/2.10/v/value_error
INFO:jobflow.managers.local:Force field relax failed with exception:
Traceback (most recent call last):
File "/home/yiy/Test/000-active-learning-workflow/test_env/mace_env/lib/python3.10/site-packages/jobflow/managers/local.py", line 117, in _run_job
response = job.run(store=store)
File "/home/yiy/Test/000-active-learning-workflow/test_env/mace_env/lib/python3.10/site-packages/jobflow/core/job.py", line 604, in run
response = function(*self.function_args, **self.function_kwargs)
File "/home/yiy/Test/000-active-learning-workflow/test_env/mace_env/lib/python3.10/site-packages/atomate2/forcefields/jobs.py", line 169, in make
return ForceFieldTaskDocument.from_ase_compatible_result(
File "/home/yiy/Test/000-active-learning-workflow/test_env/mace_env/lib/python3.10/site-packages/atomate2/forcefields/schemas.py", line 153, in from_ase_compatible_result
return cls.from_ase_task_doc(ase_task_doc, **ff_kwargs)
File "/home/yiy/Test/000-active-learning-workflow/test_env/mace_env/lib/python3.10/site-packages/atomate2/ase/schemas.py", line 253, in from_ase_task_doc
return cls(**task_document_kwargs)
File "/home/yiy/Test/000-active-learning-workflow/test_env/mace_env/lib/python3.10/site-packages/pydantic/main.py", line 214, in __init__
validated_self = self.__pydantic_validator__.validate_python(data, self_instance=self)
pydantic_core._pydantic_core.ValidationError: 1 validation error for ForceFieldTaskDocument
structure
Value error, Must provide Structure, the as_dict form, or the proper [type=value_error, input_value=Molecule Summary
Site: O ...-0.0655, 1.0145, 0.0000), input_type=Molecule]
For further information visit https://errors.pydantic.dev/2.10/v/value_error
2025-02-14 15:13:55,170 INFO Finished executing jobs locally
INFO:jobflow.managers.local:Finished executing jobs locally
Expected behavior
No validation error.
Metadata
Metadata
Assignees
Labels
No labels