PND
Public Member Functions | Public Attributes | List of all members
PND Class Reference
Inheritance diagram for PND:
ScratchPad

Public Member Functions

 PND ()
 
void defineParams (int numberOfAtoms)
 
std::pair< torch::Tensor, torch::Tensor > LossPreTrain (torch::Tensor t_seq, std::tuple< torch::Tensor, torch::Tensor, torch::Tensor, torch::Tensor > icfs, int n, int Np, int d)
 
virtual std::tuple< torch::Tensor, torch::Tensor, torch::Tensor, torch::Tensor, torch::Tensor, torch::Tensor > Loss (torch::Tensor t_seq, std::tuple< torch::Tensor, torch::Tensor, torch::Tensor, torch::Tensor > icfs, torch::Tensor totalEnergy, torch::Tensor kineticEnergy, torch::Tensor potentialEnergy, int n, int Np, int d)
 
virtual std::tuple< torch::Tensor, torch::Tensor, torch::Tensor, torch::Tensor > UpdateParamsNADAM (torch::Tensor t_seq, std::tuple< torch::Tensor, torch::Tensor, torch::Tensor, torch::Tensor > icfs, torch::Tensor velocities, torch::Tensor S, torch::Tensor totalEnergy, torch::Tensor kineticEnergy, torch::Tensor potentialEnergy, int epoch, int n, int Np, int d, double alpha, double epsilon, torch::Tensor beta)
 
virtual std::pair< torch::Tensor, torch::Tensor > mainTrain (torch::Tensor params, torch::Tensor t_seq, std::tuple< torch::Tensor, torch::Tensor, torch::Tensor, torch::Tensor > icfs, int num_epochs, torch::Tensor totalEnergy, torch::Tensor kineticEnergy, torch::Tensor potentialEnergy, int n, int Np, int d, double learn_rate=0.0001, double momentum=0.99)
 
std::tuple< torch::Tensor, torch::Tensor, torch::Tensor, torch::Tensor > UpdatePreParamsNADAM (torch::Tensor t_seq, std::tuple< torch::Tensor, torch::Tensor, torch::Tensor, torch::Tensor > icfs, torch::Tensor velocities, torch::Tensor S, int epoch, int n, int Np, int d, double alpha=0.001, double epsilon=pow(10, -7), torch::Tensor beta=torch::tensor({0.999, 0.999}))
 
std::pair< torch::Tensor, torch::Tensor > PreTrain (torch::Tensor t_seq, std::tuple< torch::Tensor, torch::Tensor, torch::Tensor, torch::Tensor > icfs, int num_epochs, int n, int Np, int d, double learn_rate=0.001, double momentum=0.99)
 

Public Attributes

int PreTrainEpochs
 
int MainTrainEpochs
 
int StepTrain
 
int nodes
 
torch::Tensor params
 

Constructor & Destructor Documentation

◆ PND()

PND::PND ( )

Constructor definition - prompts objects to read input file which specifies the number of time grids to predict, epochs for training and other network properties such as number of nodes.

Default input file /Source/pnd.in

Member Function Documentation

◆ defineParams()

void PND::defineParams ( int  numberOfAtoms)

Method to define the number of atoms that the system comprises of. Used while reading the atom trajectories from the simulation data

Parameters
numberOfAtomsThis is the number of atoms in the molecular dynamics simulation

◆ Loss()

std::tuple< torch::Tensor, torch::Tensor, torch::Tensor, torch::Tensor, torch::Tensor, torch::Tensor > PND::Loss ( torch::Tensor  t_seq,
std::tuple< torch::Tensor, torch::Tensor, torch::Tensor, torch::Tensor >  icfs,
torch::Tensor  totalEnergy,
torch::Tensor  kineticEnergy,
torch::Tensor  potentialEnergy,
int  n,
int  Np,
int  d 
)
virtual

Define a Loss function for the network which is a set of DEs governing the evolution of the system. Only method declaration provided, method must be defined when user's working class inherits from PND

Parameters
t_seqtime sequences for which the pre-training is carried out
icfsinitial and final positions and velocites that are to be used for the pre-training task
totalEnergysystem total energy across time steps
kineticEnergysystem kinetic energy across time steps
potentialEnergysystem potential energy across time steps
nNumber of neurons in the NN
NpNumber of atoms in the MD system
ddimensionality of the space (d = 3 when data in x,y,z co-ordinates is available)
Returns
returns a tuple of sum of gradients, mean squared error(MSE) loss, boundary loss, Least Action Loss, Hamiltonian Loss, momentum Loss

Reimplemented in ScratchPad.

◆ LossPreTrain()

std::pair< torch::Tensor, torch::Tensor > PND::LossPreTrain ( torch::Tensor  t_seq,
std::tuple< torch::Tensor, torch::Tensor, torch::Tensor, torch::Tensor >  icfs,
int  n,
int  Np,
int  d 
)

Define a Loss function for the network and before starting the main training task. Method can be overridden when class inherits from PND

Parameters
t_seqtime sequences for which the pre-training is carried out
icfsinitial and final positions and velocites that are to be used for the pre-training task
nnumber of neurons in the NN
Npnumber of atoms in the MD system
ddimensionality of the space (d = 3 when data in x,y,z co-ordinates is available)
Returns
returns the the tuple containing sum of gradients of outputs with respect to the input as specified in the DE as well and the root mean square(RMS) loss value

◆ mainTrain()

std::pair< torch::Tensor, torch::Tensor > PND::mainTrain ( torch::Tensor  params,
torch::Tensor  t_seq,
std::tuple< torch::Tensor, torch::Tensor, torch::Tensor, torch::Tensor >  icfs,
int  num_epochs,
torch::Tensor  totalEnergy,
torch::Tensor  kineticEnergy,
torch::Tensor  potentialEnergy,
int  n,
int  Np,
int  d,
double  learn_rate = 0.0001,
double  momentum = 0.99 
)
virtual

Routine to follow for main-training the NN, i.e., training for the target data. Users may decide to call their parameter updating algorithm implementation in each training iteration.

Parameters
paramsinital parameters of the NN which will be trained
t_seqtime sequences for which the pre-training is carried out
icfsinitial and final positions and velocites that are to be used for the pre-training task
num_epochsnumber of epochs for which training is to be carried out
totalEnergysystem total energy across time steps
kineticEnergysystem kinetic energy across time steps
potentialEnergysystem potential energy across time steps
nnumber of neurons in the NN
Npnumber of atoms in the MD system
dnumber of atoms in the MD system
learn_ratelearning rate for optimizer
momentumparameter to pass to the optimizer that uses momentum
Returns
the tuple of trained weights and mean loss value at the end of training

Reimplemented in ScratchPad.

◆ PreTrain()

std::pair< torch::Tensor, torch::Tensor > PND::PreTrain ( torch::Tensor  t_seq,
std::tuple< torch::Tensor, torch::Tensor, torch::Tensor, torch::Tensor >  icfs,
int  num_epochs,
int  n,
int  Np,
int  d,
double  learn_rate = 0.001,
double  momentum = 0.99 
)

Routine to follow for pre-training the NN, i.e., training with a data set. Method definition trains the NN over a number of epochs with the UpdatePreParams(...) optimizer

Parameters
t_seqtime sequences for which the pre-training is carried out
icfsinitial and final positions and velocites that are to be used for the pre-training task
num_epochsnumber of epochs for which pre-trainig is to be carried out
nnumber of neurons in the NN
Npnumber of atoms in the MD system
ddimensionality of the space (d = 3 when data in x,y,z co-ordinates is available)
learn_rateparameter to pass to the optimizer
momentumparameter to pass to the optimizer that uses momentum
Returns
the tuple of trained weights and mean loss value at the end of training

◆ UpdateParamsNADAM()

std::tuple< torch::Tensor, torch::Tensor, torch::Tensor, torch::Tensor > PND::UpdateParamsNADAM ( torch::Tensor  t_seq,
std::tuple< torch::Tensor, torch::Tensor, torch::Tensor, torch::Tensor >  icfs,
torch::Tensor  velocities,
torch::Tensor  S,
torch::Tensor  totalEnergy,
torch::Tensor  kineticEnergy,
torch::Tensor  potentialEnergy,
int  epoch,
int  n,
int  Np,
int  d,
double  alpha,
double  epsilon,
torch::Tensor  beta 
)
virtual

Defines an optimizer for adjusting the parameters in each main training iteration. We provide the declaration and method must be defined when user's working class inherits from PND

Parameters
t_seqtime sequences for which the pre-training is carried out
icfsinitial and final positions and velocites that are to be used for the pre-training task
velocities
S
totalEnergysystem total energy across time steps
kineticEnergysystem kinetic energy across time steps
potentialEnergysystem potential energy across time steps
epochdefines the number of steps
nnumber of neurons in the NN
Npnumber of atoms in the MD system
ddimensionality of the space (d = 3 when data in x,y,z co-ordinates is available)
alphaparameters for optimizers
epsilonconstant for stability
betaparameters for optimizers
Returns
the tuple of trained weights and mean loss value at the end of training

Reimplemented in ScratchPad.

◆ UpdatePreParamsNADAM()

std::tuple< torch::Tensor, torch::Tensor, torch::Tensor, torch::Tensor > PND::UpdatePreParamsNADAM ( torch::Tensor  t_seq,
std::tuple< torch::Tensor, torch::Tensor, torch::Tensor, torch::Tensor >  icfs,
torch::Tensor  velocities,
torch::Tensor  S,
int  epoch,
int  n,
int  Np,
int  d,
double  alpha = 0.001,
double  epsilon = pow(10,                                                                                                                     -7),
torch::Tensor  beta = torch::tensor(                                                                                                        {0.999,                                                                                                         0.999}) 
)

Defines an optimizer for adjusting the parameters in each pre-training iteration

Parameters
t_seqtime sequences for which the pre-training is carried out
icfsinitial and final positions and velocites that are to be used for the pre-training task
velocities
S
epochdefines the number of steps
nnumber of neurons in the NN
Npnumber of atoms in the MD system
ddimensionality of the space (d = 3 when data in x,y,z co-ordinates is available)
alphaa parameter for optimizer
epsilonconstant for stability
betatuple with values for the exponential decay rate for the 1st moment estimates and exponential decay rate for the exponentially weighted infinity norm
Returns
tuple of optimized parameters, optimizer values and RMS loss value

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