Loading...
Searching...
No Matches
PYTORCH_MODEL
This is part of the pytorch module
It is only available if you configure PLUMED with ./configure –enable-modules=pytorch . Furthermore, this feature is still being developed so take care when using it and report any problems on the mailing list.

Load a PyTorch model compiled with TorchScript.

This can be a function defined in Python or a more complex model, such as a neural network optimized on a set of data. In both cases the derivatives of the outputs with respect to the inputs are computed using the automatic differentiation (autograd) feature of Pytorch.

By default it is assumed that the model is saved as: model.ptc, unless otherwise indicated by the FILE keyword. The function automatically checks for the number of output dimensions and creates a component for each of them. The outputs are called node-i with i between 0 and N-1 for N outputs.

Note that this function is active only if LibTorch is correctly linked against PLUMED. Please check the instructions in the PYTORCH (Machine Learning Collective Variables) page.

Examples
Load a model called torch_model.ptc that takes as input two dihedral angles and returns two outputs.
Click on the labels of the actions for more information on what each action computes
tested on v2.9
#SETTINGS AUXFILE=regtest/pytorch/rt-pytorch_model_2d/torch_model.ptc
phi: TORSION 
ATOMS
the four atoms involved in the torsional angle
=5,7,9,15 psi: TORSION
ATOMS
the four atoms involved in the torsional angle
=7,9,15,17 model: PYTORCH_MODEL
FILE
could not find this keyword
=torch_model.ptc
ARG
could not find this keyword
=phi,psi PRINT
FILE
the name of the file on which to output these quantities
=COLVAR
ARG
the input for this action is the scalar output from one or more other actions.
=model.node-0,model.node-1
Glossary of keywords and components