Jump to content

Requests for technical support from the VASP team should be posted in the VASP Forum.

Running GRACE force fields in VASP: Difference between revisions

From VASP Wiki
Singraber (talk | contribs)
Created page with "{{available|6.6.0}} Pre-trained [https://gracemaker.readthedocs.io/ GRACE] machine-learned force fields can be used as an alternative to {{VASP}}-native force fields to drive essentially every {{VASP}} simulation which uses the the prediction-only mode {{TAG|ML_MODE|run}}. This includes molecular dynamics simulations, ionic optimization (see {{TAG|IBRION}}) and :Categ..."
 
Singraber (talk | contribs)
No edit summary
Line 1: Line 1:
{{available|6.6.0}}
{{available|6.6.0}}
Pre-trained [https://gracemaker.readthedocs.io/ GRACE] machine-learned force fields can be used as an alternative to [[:Category:Machine-learned_force_fields|{{VASP}}-native force fields]] to drive essentially every {{VASP}} simulation which uses the the prediction-only mode {{TAG|ML_MODE|run}}. This includes [[:Category:Molecular_dynamics|molecular dynamics simulations]], [[Structure_optimization|ionic optimization]] (see {{TAG|IBRION}}) and [[:Category:Advanced_molecular-dynamics_sampling|advanced sampling techniques]]. To be able to use GRACE force fields {{VASP}} must be built with [[VASPml_library|VASPml]] (<code>-Dlibvaspml</code>) '''and''' GRACE support (<code>-DVASPML_ENABLE_GRACE</code>), for details see the [[Makefile.include#VASPml_(experimental)|build customization options]]. {{NB|warning|Due to an incompatibility in the interface layer GRACE force fields from versions 0.5.8 and 0.5.9 of <code>tensorpotential</code> cannot be used together with {{VASP}}. A fix is currently work in progress. In the meantime please use force fields from <code>tensorpotential</code> 0.5.7. Be aware that for these models the <code>metadata.json</code> file generation step is mandatory (see box below).}}
Pre-trained [https://gracemaker.readthedocs.io/ GRACE] machine-learned force fields can be used as an alternative to [[:Category:Machine-learned_force_fields|{{VASP}}-native force fields]] to drive essentially every {{VASP}} simulation which uses the the prediction-only mode {{TAG|ML_MODE|run}}. This includes [[:Category:Molecular_dynamics|molecular dynamics simulations]], [[Structure_optimization|ionic optimization]] (see {{TAG|IBRION}}) and [[:Category:Advanced_molecular-dynamics_sampling|advanced sampling techniques]]. To be able to use GRACE force fields {{VASP}} must be built with [[VASPml_library|VASPml]] (<code>-Dlibvaspml</code>) '''and''' GRACE support (<code>-DVASPML_ENABLE_GRACE</code>), for details see the [[Makefile.include#VASPml_(experimental)|build customization options]]. {{NB|warning|Due to an incompatibility in the interface layer GRACE force fields from versions 0.5.8 and newer of <code>tensorpotential</code> cannot be used together with {{VASP}} 6.6.0. For this {{VASP}} version please use force fields from <code>tensorpotential</code> 0.5.7. Be aware that for these models the <code>metadata.json</code> file generation step is mandatory (see box below). This issue was resolved in {{VASP}} 6.6.1 which was tested with <code>tensorpotential</code> 0.5.9 and above.}}


== Models ==
== Models ==
Line 6: Line 6:
The easiest way to obtain [https://gracemaker.readthedocs.io/en/latest/gracemaker/foundation/ GRACE models] is to download them via the [https://pypi.org/project/tensorpotential/ tensorpotential package], directly with <code>pip</code> or within a dedicated [https://en.wikipedia.org/wiki/Conda_(package_manager) conda] environment. {{NB|tip|The <code>tensorpotential</code> package is '''not''' a runtime dependency of {{VASP}} but the most convenient way of listing and retrieving available models. Besides downloading a model the package is neither required for compiling nor for running {{VASP}} with GRACE force fields.}} Install <code>tensorpotential</code> and all its dependencies simply with:
The easiest way to obtain [https://gracemaker.readthedocs.io/en/latest/gracemaker/foundation/ GRACE models] is to download them via the [https://pypi.org/project/tensorpotential/ tensorpotential package], directly with <code>pip</code> or within a dedicated [https://en.wikipedia.org/wiki/Conda_(package_manager) conda] environment. {{NB|tip|The <code>tensorpotential</code> package is '''not''' a runtime dependency of {{VASP}} but the most convenient way of listing and retrieving available models. Besides downloading a model the package is neither required for compiling nor for running {{VASP}} with GRACE force fields.}} Install <code>tensorpotential</code> and all its dependencies simply with:


  pip install tensorpotential==0.5.7
  pip install tensorpotential==0.6.0


After installation the command line tool <code>grace_models</code> becomes available. First, inspect available models with
After installation the command line tool <code>grace_models</code> becomes available. First, inspect available models with

Revision as of 12:26, 20 July 2026

Pre-trained GRACE machine-learned force fields can be used as an alternative to VASP-native force fields to drive essentially every VASP simulation which uses the the prediction-only mode ML_MODE = run. This includes molecular dynamics simulations, ionic optimization (see IBRION) and advanced sampling techniques. To be able to use GRACE force fields VASP must be built with VASPml (-Dlibvaspml) and GRACE support (-DVASPML_ENABLE_GRACE), for details see the build customization options.

Models

The easiest way to obtain GRACE models is to download them via the tensorpotential package, directly with pip or within a dedicated conda environment.

Install tensorpotential and all its dependencies simply with:

pip install tensorpotential==0.6.0

After installation the command line tool grace_models becomes available. First, inspect available models with

grace_models list

which will produce output like this:

...
Available models:
...
================================================================================
GRACE-2L-OMAT
	DESCRIPTION: A two-layer semi-local GRACE model, fitted on the OMat24 dataset, with fixed 6 A cutoff.
	PATH: /fsc/home/singraber/.cache/grace/GRACE-2L-OMAT
	CHECKPOINT: AVAILABLE, BUT NOT DOWNLOADED
	LICENSE: Academic Software License
================================================================================
...

Select a model and download it with the following command:

grace_models download [MODEL_NAME]

Given the example model above the command would be grace_models download GRACE-2L-OMAT. The GRACE model will be automatically downloaded and unpacked to the directory ~/.cache/grace/.

Select GRACE model in VASP

In the INCAR file the GRACE force field method must be selected via ML_TYPE = grace and the model may be specified via ML_GRACE_MODEL. A minimal block of tags could look like this:

...
# MD related settings, etc.
...
# ML force field settings
ML_LMLFF       = .TRUE.
ML_LIB         = .TRUE.
ML_MODE        = run
ML_TYPE        = grace
ML_GRACE_MODEL = GRACE-2L-OMAT
...