ABACUS develop
Atomic-orbital Based Ab-initio Computation at UStc
Loading...
Searching...
No Matches
esolver_dp.h
Go to the documentation of this file.
1#ifndef ESOLVER_DP_H
2#define ESOLVER_DP_H
3
4#include "esolver.h"
5#ifdef __DPMD
6#ifdef __DPMDC
7#include "deepmd/deepmd.hpp"
8#else
9#include "deepmd/DeepPot.h"
10#endif
11#endif
12
13namespace ModuleESolver
14{
15
16class ESolver_DP : public ESolver
17{
18 public:
19#ifdef __DPMD
20 ESolver_DP(const std::string& pot_file) : dp(pot_file)
21 {
22 classname = "ESolver_DP";
23 dp_file = pot_file;
24 }
25#else
26 ESolver_DP(const std::string& pot_file)
27 {
28 classname = "ESolver_DP";
29 dp_file = pot_file;
30 }
31#endif
32
39 void before_all_runners(UnitCell& ucell, const Input_para& inp) override;
40
47 void runner(UnitCell& cell, const int istep) override;
48
55 double cal_energy() override;
56
62 void cal_force(UnitCell& ucell, ModuleBase::matrix& force) override;
63
69 void cal_stress(UnitCell& ucell, ModuleBase::matrix& stress) override;
70
76 void after_all_runners(UnitCell& ucell) override;
77
78 private:
84 void type_map(const UnitCell& ucell);
85
94#ifdef __DPMD
95#ifdef __DPMDC
96 deepmd::hpp::DeepPot dp;
97#else
98 deepmd::DeepPot dp;
99#endif
100#endif
101
110 std::string dp_file;
111 std::vector<int> atype = {};
112 std::vector<double> fparam = {};
113 std::vector<double> aparam = {};
114 double rescaling = 1.0;
115 double dp_potential = 0.0;
118};
119
120} // namespace ModuleESolver
121
122#endif
Definition matrix.h:19
Definition esolver_dp.h:17
void cal_force(UnitCell &ucell, ModuleBase::matrix &force) override
get the computed atomic forces
Definition esolver_dp.cpp:128
std::string dp_file
DeePMD related variables for ESolver_DP class.
Definition esolver_dp.h:110
std::vector< int > atype
atom type corresponding to DP model
Definition esolver_dp.h:111
std::vector< double > aparam
atomic parameter for dp potential: natoms x dim_aparam
Definition esolver_dp.h:113
void type_map(const UnitCell &ucell)
determine the type map of DP model
double rescaling
rescaling factor for DP model
Definition esolver_dp.h:114
void runner(UnitCell &cell, const int istep) override
Run the DP solver for a given ion/md step and unit cell.
Definition esolver_dp.cpp:56
double dp_potential
computed potential energy
Definition esolver_dp.h:115
ModuleBase::matrix dp_virial
computed lattice virials
Definition esolver_dp.h:117
void cal_stress(UnitCell &ucell, ModuleBase::matrix &stress) override
get the computed lattice virials
Definition esolver_dp.cpp:134
ModuleBase::matrix dp_force
computed atomic forces
Definition esolver_dp.h:116
void before_all_runners(UnitCell &ucell, const Input_para &inp) override
Initialize the DP solver with given input parameters and unit cell.
Definition esolver_dp.cpp:33
std::vector< double > fparam
frame parameter for dp potential: dim_fparam
Definition esolver_dp.h:112
double cal_energy() override
get the total energy without ion kinetic energy
Definition esolver_dp.cpp:123
void after_all_runners(UnitCell &ucell) override
Prints the final total energy of the DP model to the output file.
Definition esolver_dp.cpp:149
ESolver_DP(const std::string &pot_file)
Definition esolver_dp.h:26
Definition esolver.h:11
std::string classname
Definition esolver.h:46
Definition unitcell.h:16
plane wave basis
Definition opt_test_tools.cpp:93
Definition input_parameter.h:12