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

Nose Hoover Chain. More...

#include <nhchain.h>

Inheritance diagram for Nose_Hoover:
Collaboration diagram for Nose_Hoover:

Public Member Functions

 Nose_Hoover (const MD_para &mdp_in, const bool cal_stress_in, const bool init_vel, const int my_rank_in, MDCell &mdcell_in)
 ~Nose_Hoover ()
const double * get_eta () const
 positions of the thermostats coupled with the particles (md_tchain entries)
const double * get_v_eta () const
 velocities of the thermostats coupled with the particles (md_tchain entries)
const double * get_peta () const
 positions of the thermostats coupled with the barostat (md_pchain entries)
const double * get_v_peta () const
 velocities of the thermostats coupled with the barostat (md_pchain entries)
const double * get_v_omega () const
 velocities of the six lattice components
Public Member Functions inherited from 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
virtual ~MD_base ()
double get_md_dt () const
 the time increment in a.u., converted from mdp.md_dt

Private Member Functions

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.
void first_half (std::ofstream &ofs)
 the first half of equation of motion, update velocities and positions
void second_half ()
 the second half of equation of motion, update velocities
void print_md (std::ofstream &ofs, const bool &cal_stress)
 output MD information such as energy, temperature, and pressure
void write_restart (const std::string &global_out_dir)
 write the information into files used for MD restarting
void restart (const std::string &global_readin_dir)
 restart MD when md_restart is true
void particle_thermo ()
 perform half-step update of thermostats coupled with particles
void baro_thermo ()
 perform half-step update of thermostats coupled with barostat
void update_baro ()
 perform half-step update of barostat velocity
void vel_baro ()
 perform half-step update of velocity due to barostat
void target_stress ()
 determine target stress
void couple_stress ()
 couple stress component due to md_pcouple
void update_volume (std::ofstream &ofs)
 perform half-step update of volume

Private Attributes

const int nc_tchain = 1
 the number of nc for nvt
const int nc_pchain = 1
 the number of nc for npt
double w [nys]
 scale evolution operator
std::int64_t tdof
 particle degree of freedom
double t_target = 0.0
 target temperature
double * mass_eta = nullptr
 mass of thermostats coupled with particles
double * eta = nullptr
 position of thermostats coupled with particles
double * v_eta = nullptr
 velocity of thermostats coupled with particles
double * g_eta = nullptr
 acceleration of thermostats coupled with particles
int npt_flag
 whether NPT ensemble
double mass_omega [6]
 mass of lattice component
double v_omega [6]
 velocity of lattice component
double pstart [6]
 initial stress components
double pstop [6]
 final stress components
double pfreq [6]
 Oscillation frequency, used to determine qmass of thermostats coupled with barostat.
int pflag [6]
 control stress components
int pdim
 pdim = pflag[0] + pflag[1] + pflag[2], number of barostatted dims
double p_target [6]
 target stress components
double p_hydro = 0.0
 target hydrostatic target pressure
double p_current [6] = {0.0}
 current stress after coupled
double * mass_peta = nullptr
 mass of thermostats coupled with barostat
double * peta = nullptr
 position of thermostats coupled with barostat
double * v_peta = nullptr
 velocity of thermostats coupled with barostat
double * g_peta = nullptr
 acceleration of thermostats coupled with barostat
double mtk_term = 0
 mtk correction
double md_tfreq
 Oscillation frequency, used to determine qmass of thermostats coupled with particles.
double md_pfirst
 Initial pressure.
double md_plast
 Final pressure.
double md_pfreq
 Oscillation frequency, used to determine qmass of thermostats coupled with barostat.

Static Private Attributes

static const int nys = 7
 the number of scale evolution operator

Additional Inherited Members

Public Attributes inherited from MD_base
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 inherited from MD_base
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 inherited from MD_base
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

Nose Hoover Chain.

Nose-Hoover style non-Hamiltonian equations of motion. [Phys. Rev. A 31, 1695 (1985)] Designed to generate positions and velocities sampled from NVT and NPT ensemble.

Constructor & Destructor Documentation

◆ Nose_Hoover()

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

init NPT related variables

determine the NPT methods

The lattice must be lower-triangular under tri mode. e11 0 0 e21 e22 0 e31 e32 e33 Under Voigt notation, xx, yy, zz, yz, xz, xy.

determine whether NPT ensemble

allocate thermostats coupled with particles

allocate barostat and thermostats coupled with barostat

w[0] = 1;

Here is the call graph for this function:

◆ ~Nose_Hoover()

Nose_Hoover::~Nose_Hoover ( )

Member Function Documentation

◆ baro_thermo()

void Nose_Hoover::baro_thermo ( )
private

perform half-step update of thermostats coupled with barostat

the freedom of lattice

update kenetic energy of lattice

update force

integrate loop

propogate v_peta

propogate peta

update rescale factor of lattice velocity

propogate g_peta

propogate v_peta

rescale lattice due to thermostats

Here is the caller graph for this function:

◆ couple_stress()

void Nose_Hoover::couple_stress ( )
private

couple stress component due to md_pcouple

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

◆ first_half()

void Nose_Hoover::first_half ( std::ofstream & ofs)
privatevirtual

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

Parameters
ofsdetermine the output files

update thermostats coupled with barostat if NPT ensemble

update target T

update thermostats coupled with particles

update temperature and stress due to velocity rescaling

couple stress component due to md_pcouple

determine target stress

update v_omega

update vel due to barostat

perform half-step update of vel due to atomic force

perform half-step update of volume

perform one step update of pos due to atomic velocity

perform half-step update of volume

Reimplemented from MD_base.

Here is the call graph for this function:

◆ get_eta()

const double * Nose_Hoover::get_eta ( ) const
inline

positions of the thermostats coupled with the particles (md_tchain entries)

Here is the caller graph for this function:

◆ get_peta()

const double * Nose_Hoover::get_peta ( ) const
inline

positions of the thermostats coupled with the barostat (md_pchain entries)

Here is the caller graph for this function:

◆ get_v_eta()

const double * Nose_Hoover::get_v_eta ( ) const
inline

velocities of the thermostats coupled with the particles (md_tchain entries)

Here is the caller graph for this function:

◆ get_v_omega()

const double * Nose_Hoover::get_v_omega ( ) const
inline

velocities of the six lattice components

Here is the caller graph for this function:

◆ get_v_peta()

const double * Nose_Hoover::get_v_peta ( ) const
inline

velocities of the thermostats coupled with the barostat (md_pchain entries)

Here is the caller graph for this function:

◆ particle_thermo()

void Nose_Hoover::particle_thermo ( )
private

perform half-step update of thermostats coupled with particles

update mass_eta

propogate g_eta

integrate loop

propogate v_eta

propogate eta

update rescale factor of particle velocity

propogate g_eta

propogate v_eta

rescale velocity due to thermostats

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

◆ print_md()

void Nose_Hoover::print_md ( std::ofstream & ofs,
const bool & cal_stress )
privatevirtual

output MD information such as energy, temperature, and pressure

Parameters
ofsdetermine the output files
cal_stresswhether calculate and output stress

Reimplemented from MD_base.

Here is the call graph for this function:

◆ restart()

void Nose_Hoover::restart ( const std::string & global_readin_dir)
privatevirtual

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

npt

Reimplemented from MD_base.

Here is the call graph for this function:

◆ second_half()

void Nose_Hoover::second_half ( void )
privatevirtual

the second half of equation of motion, update velocities

perform half-step update of vel due to atomic force

update vel due to barostat

update temperature and kinetic energy due to velocity rescaling

update stress due to velocity rescaling

couple stress component due to md_pcouple

update v_omega

update thermostats coupled with particles

update thermostats coupled with barostat if NPT ensemble

Reimplemented from MD_base.

Here is the call graph for this function:

◆ setup()

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

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

determine target temperature

init thermostats coupled with particles

NPT ensemble

determine target stress

couple stress component due to md_pcouple

init barostat

init thermostats coupled with barostat

Reimplemented from MD_base.

Here is the call graph for this function:

◆ target_stress()

void Nose_Hoover::target_stress ( )
private

determine target stress

Here is the caller graph for this function:

◆ update_baro()

void Nose_Hoover::update_baro ( )
private

perform half-step update of barostat velocity

Here is the caller graph for this function:

◆ update_volume()

void Nose_Hoover::update_volume ( std::ofstream & ofs)
private

perform half-step update of volume

Parameters
ofsdetermine the output files

tri mode, off-diagonal components, first half

Diagonal components

tri mode, off-diagonal components, second half

Here is the caller graph for this function:

◆ vel_baro()

void Nose_Hoover::vel_baro ( )
private

perform half-step update of velocity due to barostat

Note: I am not sure whether fixed atoms should update here

Here is the caller graph for this function:

◆ write_restart()

void Nose_Hoover::write_restart ( const std::string & global_out_dir)
privatevirtual

write the information into files used for MD restarting

Parameters
global_out_dirdirectory of output files

npt

Reimplemented from MD_base.

Here is the call graph for this function:

Member Data Documentation

◆ eta

double* Nose_Hoover::eta = nullptr
private

position of thermostats coupled with particles

◆ g_eta

double* Nose_Hoover::g_eta = nullptr
private

acceleration of thermostats coupled with particles

◆ g_peta

double* Nose_Hoover::g_peta = nullptr
private

acceleration of thermostats coupled with barostat

◆ mass_eta

double* Nose_Hoover::mass_eta = nullptr
private

mass of thermostats coupled with particles

◆ mass_omega

double Nose_Hoover::mass_omega[6]
private

mass of lattice component

◆ mass_peta

double* Nose_Hoover::mass_peta = nullptr
private

mass of thermostats coupled with barostat

◆ md_pfirst

double Nose_Hoover::md_pfirst
private

Initial pressure.

◆ md_pfreq

double Nose_Hoover::md_pfreq
private

Oscillation frequency, used to determine qmass of thermostats coupled with barostat.

◆ md_plast

double Nose_Hoover::md_plast
private

Final pressure.

◆ md_tfreq

double Nose_Hoover::md_tfreq
private

Oscillation frequency, used to determine qmass of thermostats coupled with particles.

◆ mtk_term

double Nose_Hoover::mtk_term = 0
private

mtk correction

◆ nc_pchain

const int Nose_Hoover::nc_pchain = 1
private

the number of nc for npt

◆ nc_tchain

const int Nose_Hoover::nc_tchain = 1
private

the number of nc for nvt

◆ npt_flag

int Nose_Hoover::npt_flag
private

whether NPT ensemble

◆ nys

const int Nose_Hoover::nys = 7
staticprivate

the number of scale evolution operator

◆ p_current

double Nose_Hoover::p_current[6] = {0.0}
private

current stress after coupled

◆ p_hydro

double Nose_Hoover::p_hydro = 0.0
private

target hydrostatic target pressure

◆ p_target

double Nose_Hoover::p_target[6]
private

target stress components

◆ pdim

int Nose_Hoover::pdim
private

pdim = pflag[0] + pflag[1] + pflag[2], number of barostatted dims

◆ peta

double* Nose_Hoover::peta = nullptr
private

position of thermostats coupled with barostat

◆ pflag

int Nose_Hoover::pflag[6]
private

control stress components

◆ pfreq

double Nose_Hoover::pfreq[6]
private

Oscillation frequency, used to determine qmass of thermostats coupled with barostat.

◆ pstart

double Nose_Hoover::pstart[6]
private

initial stress components

◆ pstop

double Nose_Hoover::pstop[6]
private

final stress components

◆ t_target

double Nose_Hoover::t_target = 0.0
private

target temperature

◆ tdof

std::int64_t Nose_Hoover::tdof
private

particle degree of freedom

◆ v_eta

double* Nose_Hoover::v_eta = nullptr
private

velocity of thermostats coupled with particles

◆ v_omega

double Nose_Hoover::v_omega[6]
private

velocity of lattice component

◆ v_peta

double* Nose_Hoover::v_peta = nullptr
private

velocity of thermostats coupled with barostat

◆ w

double Nose_Hoover::w[nys]
private

scale evolution operator


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