|
Gromacs
2026.0-dev-20251109-f20ba35
|
#include <gromacs/applied_forces/nnpot/torchmodel.h>
Inheritance diagram for gmx::TorchModel:
Collaboration diagram for gmx::TorchModel:Class responsible for loading and evaluating a TorchScript-compiled neural network model. Inherits from NNPotModel.
Public Member Functions | |
| TorchModel (const std::string &filename, NNPotEmbedding embedding, const MDLogger &logger, const MpiComm &mpiComm) | |
| Constructor for TorchModel. More... | |
| void | evaluateModel (gmx_enerdata_t *enerd, ArrayRef< RVec > forces, ArrayRef< const int > indexLookup, ArrayRef< const int > mmIndices, ArrayRef< const std::string > inputs, ArrayRef< RVec > positions, ArrayRef< int > atomNumbers, ArrayRef< int > atomPairs, ArrayRef< RVec > pairShifts, ArrayRef< RVec > positionsMM, ArrayRef< real > chargesMM, real nnpCharge, ArrayRef< const LinkFrontierAtom > linkFrontier, matrix *box=nullptr, PbcType *pbcType=nullptr) override |
| bool | outputsForces () const override |
| helper function to check if model outputs forces | |
| gmx::TorchModel::TorchModel | ( | const std::string & | filename, |
| NNPotEmbedding | embedding, | ||
| const MDLogger & | logger, | ||
| const MpiComm & | mpiComm | ||
| ) |
Constructor for TorchModel.
| [in] | filename | path to the TorchScript model file |
| [in] | embedding | embedding scheme used for NNP/MM interaction |
| [in] | logger | handle to MDLogger |
| [in] | mpiComm | handle to MpiComm |
|
overridevirtual |
Call inference on NN model and retrieve outputs
| [out] | enerd | energy data struct |
| [out] | forces | forces on atoms |
| [in] | indexLookup | lookup table for atom indices |
| [in] | mmIndices | indices of MM atoms |
| [in] | inputs | list of strings specifying input data |
| [in] | positions | atom positions |
| [in] | atomNumbers | atom numbers |
| [in] | atomPairs | list of all input atom pairs within cutoff |
| [in] | pairShifts | list of periodic shift vectors corresponding to atom pairs |
| [in] | positionsMM | MM atom positions |
| [in] | chargesMM | MM atom charges |
| [in] | nnpCharge | total charge of NNP region |
| [in] | linkFrontier | link frontier atoms |
| [in] | box | simulation box |
| [in] | pbcType | periodic boundary conditions |
Implements gmx::INNPotModel.
1.8.5