ABACUS develop
Atomic-orbital Based Ab-initio Computation at UStc
Loading...
Searching...
No Matches
Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
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 Parameter &param_in, UnitCell &unit_in)
 
 ~Nose_Hoover ()
 
- Public Member Functions inherited from MD_base
 MD_base (const Parameter &param_in, UnitCell &unit_in)
 
virtual ~MD_base ()
 

Private Member Functions

void setup (ModuleESolver::ESolver *p_esolver, const std::string &global_readin_dir)
 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
 
int tdof
 particle degree of freedom
 
double t_target =0.0
 target temperature
 
double * mass_eta
 mass of thermostats coupled with particles
 
double * eta
 position of thermostats coupled with particles
 
double * v_eta
 velocity of thermostats coupled with particles
 
double * g_eta
 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
 mass of thermostats coupled with barostat
 
double * peta
 position of thermostats coupled with barostat
 
double * v_peta
 velocity of thermostats coupled with barostat
 
double * g_peta
 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
 
int frozen_freedom_
 the fixed freedom of the system
 
double * allmass
 atom mass
 
ModuleBase::Vector3< double > * pos
 atom displacements liuyu modify 2023-03-22
 
ModuleBase::Vector3< double > * vel
 atom velocity
 
ModuleBase::Vector3< int > * ionmbl
 atom is frozen or not
 
ModuleBase::Vector3< double > * force
 force of each atom
 
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 (const ModuleBase::Vector3< double > *force)
 perform half-step update of vel due to atomic force
 
- Protected Attributes inherited from MD_base
const MD_paramdp
 input parameters used in md
 
UnitCellucell
 unitcell 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 Parameter param_in,
UnitCell unit_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:

◆ 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

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 
)
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 call graph for this function:
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

reset ucell and pos due to change of lattice

Here is the call graph for this function:
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
private

position of thermostats coupled with particles

◆ g_eta

double* Nose_Hoover::g_eta
private

acceleration of thermostats coupled with particles

◆ g_peta

double* Nose_Hoover::g_peta
private

acceleration of thermostats coupled with barostat

◆ mass_eta

double* Nose_Hoover::mass_eta
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
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
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

int Nose_Hoover::tdof
private

particle degree of freedom

◆ v_eta

double* Nose_Hoover::v_eta
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
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: