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.
torch_model.ptc
that takes as input two dihedral angles and returns two outputs.#SETTINGS AUXFILE=regtest/pytorch/rt-pytorch_model_2d/torch_model.ptc phi: TORSIONATOMS=5,7,9,15 psi: TORSIONthe four atoms involved in the torsional angleATOMS=7,9,15,17 model: PYTORCH_MODELthe four atoms involved in the torsional angleFILE=torch_model.ptcFilename of the PyTorch compiled modelARG=phi,psi PRINTthe input for this action is the scalar output from one or more other actions.FILE=COLVARthe name of the file on which to output these quantitiesARG=model.node-0,model.node-1the input for this action is the scalar output from one or more other actions.
By default the value of the calculated quantity can be referenced elsewhere in the input file by using the label of the action. Alternatively this Action can be used to calculate the following quantities by employing the keywords listed below. These quantities can be referenced elsewhere in the input by using this Action's label followed by a dot and the name of the quantity required from the list below.
Quantity | Description |
node | Model outputs |
NUMERICAL_DERIVATIVES | ( default=off ) calculate the derivatives for these quantities numerically |
ARG | the input for this action is the scalar output from one or more other actions. The particular scalars that you will use are referenced using the label of the action. If the label appears on its own then it is assumed that the Action calculates a single scalar value. The value of this scalar is thus used as the input to this new action. If * or *.* appears the scalars calculated by all the proceeding actions in the input file are taken. Some actions have multi-component outputs and each component of the output has a specific label. For example a DISTANCE action labelled dist may have three components x, y and z. To take just the x component you should use dist.x, if you wish to take all three components then use dist.*.More information on the referencing of Actions can be found in the section of the manual on the PLUMED Getting Started. Scalar values can also be referenced using POSIX regular expressions as detailed in the section on Regular Expressions. To use this feature you you must compile PLUMED with the appropriate flag.. You can use multiple instances of this keyword i.e. ARG1, ARG2, ARG3... |
FILE | Filename of the PyTorch compiled model |