Closed ajhoffman1229 closed 3 days ago
Currently, the python packages for DFT-D3 and DFT-D4 dispersion models from the Grimme group are not compatible with torch, so the conventional method of adding the dispersion does not work with CHGNet.
See https://github.com/dftd3/tad-dftd3 and https://github.com/dftd4/tad-dftd4.
Currently, the python packages for DFT-D3 and DFT-D4 dispersion models from the Grimme group are not compatible with torch, so the conventional method of adding the dispersion does not work with CHGNet.
See https://github.com/dftd3/tad-dftd3 and https://github.com/dftd4/tad-dftd4.
Thanks, I am aware of these repositories, but I don't think they yet have an implementation with ASE and can't be simply plugged into an ASE SumCalculator
instance. I'd be willing to help develop something for them elsewhere (such as within ASE or adding the D4 implementation to the torch-dftd repo), but in the meantime, it would be great to fold in the existing torch-dftd implementations with CHGNet or create a tutorial showing users how to use them on their own.
Makes sense! Definitely in the meantime, torch-dftd
seems like the way to go here.
@ajhoffman1229 Can you please give some tests on the DFTD and SumCalculator and share a notebook example or open a PR? Happy to help and merge if the combined calculator works stably on your side.
If the above code works smoothly with no compatibility issues, the easiest thing is to add a DFT-D3.ipynb under chgnet/examples
Yes, I can make a notebook and submit a PR so it can be added as an example to the repo. The code above worked when I tested it locally. I will try to polish it later this week and submit for review.
Hi folks, I am not sure what I did but the code that I wrote earlier this week now seems to be working now and I can compute energies with a CHGNet+D4 SumCalculator
instance in ASE, in addition to the torch-dftd D3 calculator. There does not appear to be the incompatibility I was running into earlier, and I apologize for any wild goose chases opening this issue might have caused. I made a notebook tutorial showing how to add a dispersion correction, which is in #192.
That's wonderful! Thanks for the update!
Email (Optional)
ajhoff29@mit.edu
Problem
I would like to be able to add a dispersion/van der Waals correction to the pre-trained CHGNet model. A similar option is available in the MACE-MP-0 model here.
Proposed Solution
I believe that an option can be added to the CHGNetCalculator for a dispersion correction similar to the option in MACE-MP-0. Their implementation requires installing torch-dftd, and creates an instance of an ASE
SumCalculator
that adds the energies, forces, and stresses of each contribution together.Alternatives
If this feature cannot be added, it would be great if a note could be added to the README pointing users to the torch-dftd implementation in the event that they want to add a dispersion correction to CHGNet independent of the repo. Currently, the python packages for DFT-D3 and DFT-D4 dispersion models from the Grimme group are not compatible with torch, so the conventional method of adding the dispersion does not work with CHGNet.
Here is some example code where this works with CHGNet and the torch-dftd implementation:
Code of Conduct