ABACUS develop
Atomic-orbital Based Ab-initio Computation at UStc
Loading...
Searching...
No Matches
MD_base Class Reference

base class of md More...

#include <md_base.h>

Inheritance diagram for MD_base:
Collaboration diagram for MD_base:

Public Member Functions

 MD_base (const MD_para &mdp_in, const bool cal_stress_in, const bool init_vel, const int my_rank_in, MDCell &mdcell_in)
 construct the integrator from the values it actually uses
virtual ~MD_base ()
virtual void setup (ModuleESolver::ESolver *p_esolver, const std::string &global_readin_dir, DomainDecomposition &decomp)
 init before running md, calculate energy, force, and stress of the initial configuration.
virtual void first_half (std::ofstream &ofs)
 the first half of equation of motion, update velocities and positions
virtual void second_half ()
 the second half of equation of motion, update velocities
virtual void print_md (std::ofstream &ofs, const bool &cal_stress)
 output MD information such as energy, temperature, and pressure
virtual void write_restart (const std::string &global_out_dir)
 write the information into files used for MD restarting
virtual void restart (const std::string &global_readin_dir)
 restart MD when md_restart is true
double get_md_dt () const
 the time increment in a.u., converted from mdp.md_dt

Public Attributes

bool stop
 MD stop or not.
double t_current
 current temperature
int step_
 the MD step finished in current calculation
int step_rst_
 the MD step finished in previous calculations
std::int64_t frozen_freedom_
 the fixed freedom of the system
ModuleBase::matrix virial
 virial for this lattice
ModuleBase::matrix stress
 stress for this lattice
double potential = 0.0
 potential energy
double kinetic
 kinetic energy

Protected Member Functions

virtual void update_pos ()
 perform one step update of pos due to atomic velocity
virtual void update_vel ()
 perform half-step update of vel due to atomic force

Protected Attributes

const MD_para & mdp
 input parameters used in md
MDCell & mdcell
 mdcell information
double energy_ = 0.0
 total energy of the system
bool cal_stress
 whether calculate stress
int my_rank
 MPI rank of the processor.
double md_dt
 Time increment (hbar/E_hartree).
double md_tfirst
 Temperature (in Hartree, 1 Hartree ~ 3E5 K).
double md_tlast
 Target temperature.

Detailed Description

base class of md

This class implements the velocity-Verlet method. The system is assumed to be isolated in the sense that it cannot exchange energy or particles with its environment, so that the energy of the system does not change with time.

Constructor & Destructor Documentation

◆ MD_base()

MD_base::MD_base ( const MD_para & mdp_in,
const bool cal_stress_in,
const bool init_vel,
const int my_rank_in,
MDCell & mdcell_in )

construct the integrator from the values it actually uses

Parameters
mdp_inthe md input parameters; the reference is kept, so it must outlive the integrator
cal_stress_inwhether stress is calculated
init_velwhether initial velocities are read from STRU
my_rank_inMPI rank of the processor; only consulted in serial builds, where MDCell cannot supply it
mdcell_inmdcell information

convert to a.u. unit

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

◆ ~MD_base()

MD_base::~MD_base ( )
virtual

Member Function Documentation

◆ first_half()

void MD_base::first_half ( std::ofstream & ofs)
virtual

the first half of equation of motion, update velocities and positions

Parameters
ofsdetermine the output files

Reimplemented in FIRE, Langevin, MSST, Nose_Hoover, and Verlet.

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

◆ get_md_dt()

double MD_base::get_md_dt ( ) const
inline

the time increment in a.u., converted from mdp.md_dt

Here is the caller graph for this function:

◆ print_md()

void MD_base::print_md ( std::ofstream & ofs,
const bool & cal_stress )
virtual

output MD information such as energy, temperature, and pressure

Parameters
ofsdetermine the output files
cal_stresswhether calculate and output stress

Reimplemented in FIRE, Langevin, MSST, Nose_Hoover, and Verlet.

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

◆ restart()

void MD_base::restart ( const std::string & global_readin_dir)
virtual

restart MD when md_restart is true

Public counterpart of write_restart(): setup() calls it internally when md_restart is set, and a caller that has just written a restart file may read it back through here.

Parameters
global_readin_dirdirectory of files for reading

Reimplemented in FIRE, Langevin, MSST, Nose_Hoover, and Verlet.

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

◆ second_half()

void MD_base::second_half ( void )
virtual

the second half of equation of motion, update velocities

Reimplemented in FIRE, Langevin, MSST, Nose_Hoover, and Verlet.

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

◆ setup()

void MD_base::setup ( ModuleESolver::ESolver * p_esolver,
const std::string & global_readin_dir,
DomainDecomposition & decomp )
virtual

init before running md, calculate energy, force, and stress of the initial configuration.

Parameters
p_esolverthe energy solver used in md
global_readin_dirdirectory of files for reading

Reimplemented in FIRE, Langevin, MSST, Nose_Hoover, and Verlet.

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

◆ update_pos()

void MD_base::update_pos ( )
protectedvirtual

perform one step update of pos due to atomic velocity

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

◆ update_vel()

void MD_base::update_vel ( )
protectedvirtual

perform half-step update of vel due to atomic force

Parameters
forceatomic forces
Here is the caller graph for this function:

◆ write_restart()

void MD_base::write_restart ( const std::string & global_out_dir)
virtual

write the information into files used for MD restarting

Parameters
global_out_dirdirectory of output files

Reimplemented in FIRE, Langevin, MSST, Nose_Hoover, and Verlet.

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

Member Data Documentation

◆ cal_stress

bool MD_base::cal_stress
protected

whether calculate stress

◆ energy_

double MD_base::energy_ = 0.0
protected

total energy of the system

◆ frozen_freedom_

std::int64_t MD_base::frozen_freedom_

the fixed freedom of the system

◆ kinetic

double MD_base::kinetic

kinetic energy

◆ md_dt

double MD_base::md_dt
protected

Time increment (hbar/E_hartree).

◆ md_tfirst

double MD_base::md_tfirst
protected

Temperature (in Hartree, 1 Hartree ~ 3E5 K).

◆ md_tlast

double MD_base::md_tlast
protected

Target temperature.

◆ mdcell

MDCell& MD_base::mdcell
protected

mdcell information

◆ mdp

const MD_para& MD_base::mdp
protected

input parameters used in md

◆ my_rank

int MD_base::my_rank
protected

MPI rank of the processor.

◆ potential

double MD_base::potential = 0.0

potential energy

◆ step_

int MD_base::step_

the MD step finished in current calculation

◆ step_rst_

int MD_base::step_rst_

the MD step finished in previous calculations

◆ stop

bool MD_base::stop

MD stop or not.

◆ stress

ModuleBase::matrix MD_base::stress

stress for this lattice

◆ t_current

double MD_base::t_current

current temperature

◆ virial

ModuleBase::matrix MD_base::virial

virial for this lattice


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