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

Public Member Functions

void setCheckPoint (SubSystem checkPointState)
 
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 H0, torch::Tensor kineticEnergy, torch::Tensor potentialEnergy, int n, int Np, int d)
 
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)
 
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, double momentum)
 
- Public Member Functions inherited from PND
 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)
 
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

SubSystem checkPointState
 
- Public Attributes inherited from PND
int PreTrainEpochs
 
int MainTrainEpochs
 
int StepTrain
 
int nodes
 
torch::Tensor params
 

Detailed Description

scratch_pad.cpp is an examlpe to demonstrates how users implement loss functions, specify intial and boundary conditions, and conservation laws for their systems

Member Function Documentation

◆ Loss()

std::tuple<torch::Tensor, torch::Tensor, torch::Tensor, torch::Tensor, torch::Tensor, torch::Tensor> ScratchPad::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 
)
inlinevirtual

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 from PND.

◆ mainTrain()

std::pair<torch::Tensor, torch::Tensor> ScratchPad::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,
double  momentum 
)
inlinevirtual

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 from PND.

◆ UpdateParamsNADAM()

std::tuple<torch::Tensor, torch::Tensor, torch::Tensor, torch::Tensor> ScratchPad::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 
)
inlinevirtual

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 from PND.


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