Tinker9 70bd052 (Thu Nov 9 12:11:35 2023 -0800)
Loading...
Searching...
No Matches
Typedefs | Functions | Variables
Energy

Energy, gradient, virial tensor, and number of interactions. More...

Typedefs

typedef std::map< std::string, int > tinker::TimeScaleConfig
 

Functions

void tinker::zeroEGV (int vers=rc_flag)
 Zero out all of the counts, energies, gradients, and virials on device. More...
 
void tinker::scaleGradient (double scale, grad_prec *g0x, grad_prec *g0y, grad_prec *g0z)
 g0 *= scale. More...
 
void tinker::sumGradient (grad_prec *g0x, grad_prec *g0y, grad_prec *g0z, const grad_prec *g1x, const grad_prec *g1y, const grad_prec *g1z)
 g0 += g1. More...
 
void tinker::sumGradient (double scale, grad_prec *g0x, grad_prec *g0y, grad_prec *g0z, const grad_prec *g1x, const grad_prec *g1y, const grad_prec *g1z)
 g0 += scale*g1. More...
 
void tinker::copyGradientSync (int vers, double *grdx, double *grdy, double *grdz, const grad_prec *gx_src, const grad_prec *gy_src, const grad_prec *gz_src, int queue)
 Copies the energy gradients from device to host. More...
 
void tinker::copyGradient (int vers, double *grdx, double *grdy, double *grdz, const grad_prec *gx_src, const grad_prec *gy_src, const grad_prec *gz_src)
 Copies the energy gradients from device to host. More...
 
void tinker::copyGradient (int vers, double *grdx, double *grdy, double *grdz)
 
void tinker::copyEnergy (int vers, energy_prec *eng)
 
void tinker::energy_core (int vers, unsigned tsflag, const TimeScaleConfig &tsconfig)
 
void tinker::energy (int vers)
 
void tinker::energy (int vers, unsigned tsflag, const TimeScaleConfig &tsconfig)
 
void tinker::energyData (RcOp)
 Entry point to the setup functions of all the potential energy terms. More...
 
bool tinker::useEnergyVdw ()
 Logical flag for use of VDW, repulsion, dispersion, etc. terms. More...
 
bool tinker::useEnergyElec ()
 Logical flag for use of electrostatic terms. More...
 
void tinker::egvData (RcOp)
 Sets up data on device. More...
 
const TimeScaleConfigtinker::defaultTSConfig ()
 

Variables

grad_prectinker::gx
 Gradient of valence terms; also works as total gradient array. More...
 
grad_prectinker::gy
 Gradient of valence terms; also works as total gradient array. More...
 
grad_prectinker::gz
 Gradient of valence terms; also works as total gradient array. More...
 
grad_prectinker::gx_vdw
 Gradient of VDW, repulsion, dispersion, etc. terms. More...
 
grad_prectinker::gy_vdw
 Gradient of VDW, repulsion, dispersion, etc. terms. More...
 
grad_prectinker::gz_vdw
 Gradient of VDW, repulsion, dispersion, etc. terms. More...
 
grad_prectinker::gx_elec
 Gradient of electrostatic terms. More...
 
grad_prectinker::gy_elec
 Gradient of electrostatic terms. More...
 
grad_prectinker::gz_elec
 Gradient of electrostatic terms. More...
 
EnergyBuffer tinker::eng_buf
 Energy buffer for the valence terms. More...
 
EnergyBuffer tinker::eng_buf_vdw
 Energy buffer for the vdw terms. More...
 
EnergyBuffer tinker::eng_buf_elec
 Energy buffer for the electrostatic terms. More...
 
VirialBuffer tinker::vir_buf
 Virial buffer for the valence terms. More...
 
VirialBuffer tinker::vir_buf_vdw
 Virial buffer for the vdw terms. More...
 
VirialBuffer tinker::vir_buf_elec
 Virial buffer for the electrostatic terms. More...
 
energy_prec tinker::esum
 Total potential energy. More...
 
energy_prec tinker::energy_valence
 Total valence energy. More...
 
energy_prec tinker::energy_vdw
 Total vdw energy. More...
 
energy_prec tinker::energy_elec
 Total electrostatic energy. More...
 
virial_prec tinker::vir [9]
 Total potential virial tensor. More...
 
virial_prec tinker::virial_valence [9]
 Total valence virial tensor. More...
 
virial_prec tinker::virial_vdw [9]
 Total vdw virial tensor. More...
 
virial_prec tinker::virial_elec [9]
 Total electrostatic virial tensor. More...
 

Detailed Description

Energy, gradient, virial tensor, and number of interactions.

Underlying arrays used in energy, gradient, and viria calculation

Electrostatic terms

.not. analyz analyz
ebuf_elec new array nullptr
vbuf_elec new array nullptr
g_elec new array new array
em alias ebuf_elec new array
vir_em alias vbuf_elec new array
dem alias g_elec new array

VDW terms

.not. analyz analyz
ebuf_vdw new array nullptr
vbuf_vdw new array nullptr
g_vdw new array new array
ev alias ebuf_vdw new array
vir_ev alias vbuf_vdw new array
dev alias g_vdw new array

Valence terms

.not. analyz analyz
ebuf new array nullptr
vbuf new array nullptr
g new array new array
eb alias ebuf new array
vir_eb alias vbuf new array
deb alias g new array

Typedef Documentation

◆ TimeScaleConfig

typedef std::map<std::string, int> tinker::TimeScaleConfig

Time scale configuration that assigns a group number to every energy term. Up to 32 different group numbers are supported, from 0 to 31.

This class must:

  • implement a C++ style .at(arg) member function where arg is the name of an energy term;
  • return the group to which arg belongs;
  • throw an exception if arg is an invalid energy name.

If the k-th bit of the flag is set, all of the energies in Group k will be calculated.

Example 1.

Every energy term in the Verlet integrator is computed at every time-step. Therefore, all of the terms are in the same group. This group (G) can be any number from 0 to 31. Accordingly, the flag must be \( 2^G \).

Example 2.

There are usually two groups, "high frequency" (fast) and "low frequency" (slow), of energy terms in the RESPA integrator. If one decides to assign 3 and 5 to these two groups, respectively, tsconfig.at("ebond") shall return 3 and tsconfig.at("evdw") shall return 5.

The values of flags shall be:

  • 8 ( \( 2^3 \)) for only the fast terms;
  • 32 ( \( 2^5 \)) for only the slow terms;
  • 40 (8 + 32) for both groups.
Note
To use a new energy term in an existing integrator, the force field developers are responsible to update the time scale configuration of this integrator.

Function Documentation

◆ copyEnergy()

void tinker::copyEnergy ( int  vers,
energy_prec eng 
)

Copies the total potential energy to another variable on host. Avoid accessing esum directly because the potential energy may not be evaluated on the current MD step.

◆ copyGradient() [1/2]

void tinker::copyGradient ( int  vers,
double *  grdx,
double *  grdy,
double *  grdz 
)

Copies the energy gradients from gx, gy, gz to host.

See also
gx
gy
gz

◆ copyGradient() [2/2]

void tinker::copyGradient ( int  vers,
double *  grdx,
double *  grdy,
double *  grdz,
const grad_prec gx_src,
const grad_prec gy_src,
const grad_prec gz_src 
)

Copies the energy gradients from device to host.

◆ copyGradientSync()

void tinker::copyGradientSync ( int  vers,
double *  grdx,
double *  grdy,
double *  grdz,
const grad_prec gx_src,
const grad_prec gy_src,
const grad_prec gz_src,
int  queue 
)

Copies the energy gradients from device to host.

◆ defaultTSConfig()

const TimeScaleConfig & tinker::defaultTSConfig ( )
Returns
The default TimeScaleConfig object. All of the energy terms are in group 0, and can only be accessed via flag 1.

◆ egvData()

void tinker::egvData ( RcOp  )

Sets up data on device.

◆ energy() [1/2]

void tinker::energy ( int  vers)

First, energy buffers, virial buffers, gradient arrays, and count buffers are set to 0. Then, evaluate energies, gradients, virials, and count interactions. Last, update the global energy and virial tensor variables. Counts are not updated until countReduce() is explicitly called. May skip some steps based on the version parameter.

◆ energy() [2/2]

void tinker::energy ( int  vers,
unsigned  tsflag,
const TimeScaleConfig tsconfig 
)

Initializes to zero and evaluates potential energy with time scale configuration.

See also
TimeScaleConfig

◆ energy_core()

void tinker::energy_core ( int  vers,
unsigned  tsflag,
const TimeScaleConfig tsconfig 
)

Evaluates potential energy.

Parameters
versFlag to select the version of energy routines.
tsflagTime scale flag, a 32-bit encrypted integer.
tsconfigConstant reference to a TimeScaleConfig object.
See also
TimeScaleConfig

◆ energyData()

void tinker::energyData ( RcOp  )

Entry point to the setup functions of all the potential energy terms.

◆ scaleGradient()

void tinker::scaleGradient ( double  scale,
grad_prec g0x,
grad_prec g0y,
grad_prec g0z 
)

g0 *= scale.

◆ sumGradient() [1/2]

void tinker::sumGradient ( double  scale,
grad_prec g0x,
grad_prec g0y,
grad_prec g0z,
const grad_prec g1x,
const grad_prec g1y,
const grad_prec g1z 
)

g0 += scale*g1.

◆ sumGradient() [2/2]

void tinker::sumGradient ( grad_prec g0x,
grad_prec g0y,
grad_prec g0z,
const grad_prec g1x,
const grad_prec g1y,
const grad_prec g1z 
)

g0 += g1.

◆ useEnergyElec()

bool tinker::useEnergyElec ( )

Logical flag for use of electrostatic terms.

◆ useEnergyVdw()

bool tinker::useEnergyVdw ( )

Logical flag for use of VDW, repulsion, dispersion, etc. terms.

◆ zeroEGV()

void tinker::zeroEGV ( int  vers = rc_flag)

Zero out all of the counts, energies, gradients, and virials on device.

Variable Documentation

◆ energy_elec

energy_prec tinker::energy_elec
extern

Total electrostatic energy.

◆ energy_valence

energy_prec tinker::energy_valence
extern

Total valence energy.

◆ energy_vdw

energy_prec tinker::energy_vdw
extern

Total vdw energy.

◆ eng_buf

EnergyBuffer tinker::eng_buf
extern

Energy buffer for the valence terms.

◆ eng_buf_elec

EnergyBuffer tinker::eng_buf_elec
extern

Energy buffer for the electrostatic terms.

◆ eng_buf_vdw

EnergyBuffer tinker::eng_buf_vdw
extern

Energy buffer for the vdw terms.

◆ esum

energy_prec tinker::esum
extern

Total potential energy.

◆ gx

grad_prec* tinker::gx
extern

Gradient of valence terms; also works as total gradient array.

◆ gx_elec

grad_prec* tinker::gx_elec
extern

Gradient of electrostatic terms.

◆ gx_vdw

grad_prec* tinker::gx_vdw
extern

Gradient of VDW, repulsion, dispersion, etc. terms.

◆ gy

grad_prec* tinker::gy
extern

Gradient of valence terms; also works as total gradient array.

◆ gy_elec

grad_prec* tinker::gy_elec
extern

Gradient of electrostatic terms.

◆ gy_vdw

grad_prec* tinker::gy_vdw
extern

Gradient of VDW, repulsion, dispersion, etc. terms.

◆ gz

grad_prec* tinker::gz
extern

Gradient of valence terms; also works as total gradient array.

◆ gz_elec

grad_prec* tinker::gz_elec
extern

Gradient of electrostatic terms.

◆ gz_vdw

grad_prec* tinker::gz_vdw
extern

Gradient of VDW, repulsion, dispersion, etc. terms.

◆ vir

virial_prec tinker::vir[9]
extern

Total potential virial tensor.

◆ vir_buf

VirialBuffer tinker::vir_buf
extern

Virial buffer for the valence terms.

◆ vir_buf_elec

VirialBuffer tinker::vir_buf_elec
extern

Virial buffer for the electrostatic terms.

◆ vir_buf_vdw

VirialBuffer tinker::vir_buf_vdw
extern

Virial buffer for the vdw terms.

◆ virial_elec

virial_prec tinker::virial_elec[9]
extern

Total electrostatic virial tensor.

◆ virial_valence

virial_prec tinker::virial_valence[9]
extern

Total valence virial tensor.

◆ virial_vdw

virial_prec tinker::virial_vdw[9]
extern

Total vdw virial tensor.