Closed alinelena closed 4 months ago
Hi @alinelena, thank you very much for reporting this issue. I did the test with your script including the following line:
from ase import build from matgl import version from matgl import load_model from matgl.ext.ase import PESCalculator import torch
print(version)
torch.set_default_device('cuda') model = load_model("M3GNet-MP-2021.2.8-DIRECT-PES") calculator = PESCalculator(potential=model)
benzene = build.molecule('C6H6') benzene.calc = calculator
print(f"E_config= {benzene.get_potential_energy()} eV")
I am not able to reproduce your error and the following is my output.
1.0.0 /home/t1ko/miniconda3/envs/mavrl/lib/python3.9/site-packages/torch/utils/_device.py:77: UserWarning: To copy construct from a tensor, it is recommended to use sourceTensor.clone().detach() or sourceTensor.clone().detach().requiresgrad(True), rather than torch.tensor(sourceTensor). return func(*args, *kwargs) /home/t1ko/miniconda3/envs/mavrl/lib/python3.9/site-packages/torch/utils/_device.py:77: UserWarning: TypedStorage is deprecated. It will be removed in the future and UntypedStorage will be the only storage class. This should only matter to you if you are using storages directly. To access UntypedStorage directly, use tensor.untyped_storage() instead of tensor.storage() return func(args, **kwargs) E_config= -76.01427459716797 eV
Btw, it should be noted that the M3GNet-DIRECT potential is trained from the material project database and I believe that the performance for molecular systems will be less accurate.
odd, thank you for testing I will look in another machine to see if I can reproduce it. this is just for testing so I am not for accurate results. I will keep you posted
just one thing, this is cuda 12 and pythorch 2.2.1-nigtly so maybe something from there.
@alinelena I would recommend not using pytorch nightly. We stipulate all the supported requirements in our repo. If you use those and there are issues, you can reopen this issue.
Setting torch.set_default_device('cuda') solved the issue for me, just FYI.
Email (Optional)
alin@elena.re
Version
git
Which OS(es) are you using?
What happened?
running a simpler example with matgl on gpu seems not to be happy.. it is perfectly fine if I run cpu only.
also tried the variations of commented code with no success.. just diversity in the errors.
Code snippet
Log output
Code of Conduct