Gromacs  2026.0-dev-20250320-627336d
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
List of all members | Public Member Functions
gmx::TorchModel Class Reference

#include <gromacs/applied_forces/nnpot/torchmodel.h>

+ Inheritance diagram for gmx::TorchModel:
+ Collaboration diagram for gmx::TorchModel:

Description

Class responsible for loading and evaluating a TorchScript-compiled neural network model. Inherits from NNPotModel.

Public Member Functions

 TorchModel (const std::string &filename, const MDLogger &logger)
 Constructor for TorchModel. More...
 
void evaluateModel (gmx_enerdata_t *enerd, const ArrayRef< RVec > &forces, ArrayRef< const int > &indexLookup, ArrayRef< const std::string > &inputs, ArrayRef< RVec > &positions, ArrayRef< int > &atomNumbers, matrix *box=nullptr, PbcType *pbcType=nullptr) override
 
void setCommRec (const t_commrec *cr) override
 Set communication record for possible communication of input/output data between ranks.
 
bool outputsForces () const override
 helper function to check if model outputs forces
 

Constructor & Destructor Documentation

gmx::TorchModel::TorchModel ( const std::string &  filename,
const MDLogger logger 
)

Constructor for TorchModel.

Parameters
[in]filenamepath to the TorchScript model file
[in]loggerhandle to MDLogger

Member Function Documentation

void gmx::TorchModel::evaluateModel ( gmx_enerdata_t enerd,
const ArrayRef< RVec > &  forces,
ArrayRef< const int > &  indexLookup,
ArrayRef< const std::string > &  inputs,
ArrayRef< RVec > &  positions,
ArrayRef< int > &  atomNumbers,
matrix *  box = nullptr,
PbcType pbcType = nullptr 
)
overridevirtual

Call inference on NN model and retrieve outputs

Parameters
[in]indexLookuplookup table for local atom indices
[out]enerdenergy data struct
[out]forcesforces on atoms
[in]indexLookuplookup table for atom indices
[in]inputslist of strings specifying input data
[in]positionsatom positions
[in]atomNumbersatom numbers
[in]boxsimulation box
[in]pbcTypeperiodic boundary conditions

Implements gmx::INNPotModel.


The documentation for this class was generated from the following files: