PND
pnd.hpp
1 //
2 // Created by USCCACS02 on 1/12/20.
3 //
4 
5 #ifndef DSN_MD_PND_HPP
6 #define DSN_MD_PND_HPP
7 
8 #include <torch/torch.h>
9 
10 class PND {
11 public:
12  int PreTrainEpochs, MainTrainEpochs, StepTrain, nodes;
13  torch::Tensor params;
14 
15  PND();
16 
17  void defineParams(int numberOfAtoms);
18 
19  std::pair<torch::Tensor, torch::Tensor> LossPreTrain(torch::Tensor t_seq,
20  std::tuple<torch::Tensor, torch::Tensor, torch::Tensor, torch::Tensor> icfs,
21  int n, int Np, int d);
22 
23  virtual std::tuple<torch::Tensor, torch::Tensor, torch::Tensor, torch::Tensor, torch::Tensor, torch::Tensor>
24  Loss(torch::Tensor t_seq,
25  std::tuple<torch::Tensor, torch::Tensor, torch::Tensor, torch::Tensor> icfs,
26  torch::Tensor totalEnergy, torch::Tensor kineticEnergy, torch::Tensor potentialEnergy, int n, int Np, int d);
27 
28  virtual std::tuple<torch::Tensor, torch::Tensor, torch::Tensor, torch::Tensor>
29  UpdateParamsNADAM(torch::Tensor t_seq,
30  std::tuple<torch::Tensor, torch::Tensor, torch::Tensor, torch::Tensor> icfs,
31  torch::Tensor velocities,
32  torch::Tensor S, torch::Tensor totalEnergy, torch::Tensor kineticEnergy, torch::Tensor potentialEnergy, int epoch, int n, int Np, int d, double alpha,
33  double epsilon, torch::Tensor beta);
34 
35  virtual std::pair<torch::Tensor, torch::Tensor> mainTrain(torch::Tensor params, torch::Tensor t_seq,
36  std::tuple<torch::Tensor, torch::Tensor, torch::Tensor, torch::Tensor> icfs,
37  int num_epochs, torch::Tensor totalEnergy, torch::Tensor kineticEnergy, torch::Tensor potentialEnergy, int n, int Np,
38  int d, double learn_rate = 0.0001,
39  double momentum = 0.99);
40 
41 
42  std::tuple<torch::Tensor, torch::Tensor, torch::Tensor, torch::Tensor> UpdatePreParamsNADAM(torch::Tensor t_seq,
43  std::tuple<torch::Tensor, torch::Tensor, torch::Tensor, torch::Tensor> icfs,
44  torch::Tensor velocities,
45  torch::Tensor S,
46  int epoch, int n,
47  int Np, int d,
48  double alpha = 0.001,
49  double epsilon = pow(10,
50  -7),
51  torch::Tensor beta = torch::tensor(
52  {0.999,
53  0.999}));
54 
55  std::pair<torch::Tensor, torch::Tensor> PreTrain(torch::Tensor t_seq,
56  std::tuple<torch::Tensor, torch::Tensor, torch::Tensor, torch::Tensor> icfs,
57  int num_epochs, int n, int Np, int d, double learn_rate = 0.001,
58  double momentum = 0.99);
59 };
60 
61 #endif //DSN_MD_PND_HPP
62 
Definition: pnd.hpp:10
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)
Definition: pnd.cpp:184
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)
Definition: pnd.cpp:126
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)
Definition: pnd.cpp:74
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)
Definition: pnd.cpp:249
PND()
Definition: pnd.cpp:26
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)
Definition: pnd.cpp:223
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}))
Definition: pnd.cpp:145
void defineParams(int numberOfAtoms)
Definition: pnd.cpp:50