Correlation 4.10.0
An Analysis Tool for Liquids and for Amorphous Solids
Loading...
Searching...
No Matches
correlation::mlip::TorchGNNModel Class Reference

High-performance TorchScript GNN inference engine for atomic systems. More...

#include <TorchGNNModel.hpp>

Inheritance diagram for correlation::mlip::TorchGNNModel:
Collaboration diagram for correlation::mlip::TorchGNNModel:

Classes

struct  Impl

Public Member Functions

 TorchGNNModel (std::string model_path, std::string device="cpu", real_t cutoff=static_cast< real_t >(5.0))
 Constructs a TorchScript GNN model from a serialized .pt file.
 ~TorchGNNModel () override
 TorchGNNModel (TorchGNNModel &&) noexcept
TorchGNNModel & operator= (TorchGNNModel &&) noexcept
 TorchGNNModel (const TorchGNNModel &)=delete
TorchGNNModel & operator= (const TorchGNNModel &)=delete
std::string getModelName () const override
 Returns the model architecture and source path identifier.
MLIPOutput evaluate (const correlation::core::Cell &cell) const override
 Evaluates potential properties (energy, forces, LDOS) on an atomic Cell.
real_t cutoff () const noexcept
 Gets the radial neighbor cutoff radius.
void setCutoff (real_t cutoff) noexcept
 Sets the radial neighbor cutoff radius.
bool isLoaded () const noexcept
 Checks if LibTorch backend is compiled and model successfully loaded.
Public Member Functions inherited from correlation::mlip::MLIPInterface
virtual ~MLIPInterface ()=default

Private Attributes

std::unique_ptr< Impl > impl_
std::string model_path_
std::string device_str_
real_t cutoff_ {static_cast<real_t>(5.0)}

Detailed Description

High-performance TorchScript GNN inference engine for atomic systems.

Constructor & Destructor Documentation

◆ TorchGNNModel() [1/3]

correlation::mlip::TorchGNNModel::TorchGNNModel ( std::string model_path,
std::string device = "cpu",
real_t cutoff = static_cast<real_t>(5.0) )
explicit

Constructs a TorchScript GNN model from a serialized .pt file.

Parameters
[in]model_pathPath to the compiled TorchScript model artifact (.pt).
[in]deviceExecution target device (e.g. "cpu", "cuda", "cuda:0").
[in]cutoffRadial neighbor cutoff radius in Angstroms (default: 5.0).
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ~TorchGNNModel()

correlation::mlip::TorchGNNModel::~TorchGNNModel ( )
overridedefault

◆ TorchGNNModel() [2/3]

correlation::mlip::TorchGNNModel::TorchGNNModel ( TorchGNNModel && )
defaultnoexcept
Here is the call graph for this function:

◆ TorchGNNModel() [3/3]

correlation::mlip::TorchGNNModel::TorchGNNModel ( const TorchGNNModel & )
delete
Here is the call graph for this function:

Member Function Documentation

◆ cutoff()

real_t correlation::mlip::TorchGNNModel::cutoff ( ) const
inlinenodiscardnoexcept

Gets the radial neighbor cutoff radius.

Returns
Cutoff distance in Angstroms.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ evaluate()

MLIPOutput correlation::mlip::TorchGNNModel::evaluate ( const correlation::core::Cell & cell) const
nodiscardoverridevirtual

Evaluates potential properties (energy, forces, LDOS) on an atomic Cell.

Parameters
[in]cellAtomic configuration cell.
Returns
MLIPOutput containing atomic forces and site-resolved LDOS bins.

Implements correlation::mlip::MLIPInterface.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getModelName()

std::string correlation::mlip::TorchGNNModel::getModelName ( ) const
nodiscardoverridevirtual

Returns the model architecture and source path identifier.

Returns
Model descriptor string.

Implements correlation::mlip::MLIPInterface.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ isLoaded()

bool correlation::mlip::TorchGNNModel::isLoaded ( ) const
nodiscardnoexcept

Checks if LibTorch backend is compiled and model successfully loaded.

Returns
True if model is ready for forward evaluation.
Here is the caller graph for this function:

◆ operator=() [1/2]

TorchGNNModel & correlation::mlip::TorchGNNModel::operator= ( const TorchGNNModel & )
delete
Here is the call graph for this function:

◆ operator=() [2/2]

TorchGNNModel & correlation::mlip::TorchGNNModel::operator= ( TorchGNNModel && )
defaultnoexcept
Here is the call graph for this function:

◆ setCutoff()

void correlation::mlip::TorchGNNModel::setCutoff ( real_t cutoff)
inlinenoexcept

Sets the radial neighbor cutoff radius.

Parameters
[in]cutoffNew cutoff distance in Angstroms.
Here is the call graph for this function:

Member Data Documentation

◆ cutoff_

real_t correlation::mlip::TorchGNNModel::cutoff_ {static_cast<real_t>(5.0)}
private

◆ device_str_

std::string correlation::mlip::TorchGNNModel::device_str_
private

◆ impl_

std::unique_ptr<Impl> correlation::mlip::TorchGNNModel::impl_
private

◆ model_path_

std::string correlation::mlip::TorchGNNModel::model_path_
private

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