Skip to content

[Feature Request]: Add dispersion to ASE calculator #188

@ajhoffman1229

Description

@ajhoffman1229

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:

from ase.build import fcc111
from ase.calculators.mixing import SumCalculator
from chgnet.model.dynamics import CHGNetCalculator
from chgnet.model.model import CHGNet
from torch_dftd.torch_dftd3_calculator import TorchDFTD3Calculator

# pre-trained chgnet model
chgpotential = CHGNet.load()
chgcalc = CHGNetCalculator(model=chgpotential)

# Calculate reference values:
atoms = fcc111("Cu", (2, 2, 1), vacuum=10.0)
atoms[0].x += 0.2

chgd3 = SumCalculator([chgcalc, TorchDFTD3Calculator()])
atoms.calc = chgd3
stress = atoms.get_stress()
print(chgd3.name)
print(atoms.get_chemical_formula(), stress.shape, stress)

Code of Conduct

  • I agree to follow this project's Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions