# how to compute strain energy in LAMMPS?

hello, LAMMPS members:
I’m dealing with a cantilever beam bending problem , which quantity should i use to compute the system strain energy or per atom strain energy?

hello, i’d found some similar quesions in the mail list… there is a variable " PE_strain " in ensemble fix.I can output it by command:
variable E equal f_1[N]
fix print all print 100 “\${E}” file strain_energy.txt

HOWEVER, i still can’t determine the “N” correspond to " PE_strain " , IF my ensemble command is :
#fix 1 all nvt temp 10.0 10.0 0.1
then my tchain should be 3 as a default vaule, and the pchain and ndof should be zero for no barostat is used. then i thought the “N”=13 ,for there only varibales PE_eta,KE_eta_dot,eta and eta_dot left .and 4*3+1=13, but the error message said: "Variable formula fix vector is accessed out-of-range "

hello, i’d found some similar quesions in the mail list… there is a variable " PE_strain " in ensemble fix.I can output it by command:
variable E equal f_1[N]
fix print all print 100 “\${E}” file strain_energy.txt

HOWEVER, i still can’t determine the “N” correspond to " PE_strain " , IF my ensemble command is :
#fix 1 all nvt temp 10.0 10.0 0.1
then my tchain should be 3 as a default vaule, and the pchain and ndof should be zero for no barostat is used. then i thought the “N”=13 ,for there only varibales PE_eta,KE_eta_dot,eta and eta_dot left .and 4*3+1=13, but the error message said: "Variable formula fix vector is accessed out-of-range "

This is all complete nonsense.

RTFM

Don’t guess.

the manual said:

· eta[tchain] = particle thermostat displacements (unitless)
· eta_dot[tchain] = particle thermostat velocities (1/time units)
· omega[ndof] = barostat displacements (unitless)
· omega_dot[ndof] = barostat velocities (1/time units)
· etap[pchain] = barostat thermostat displacements (unitless)
· etap_dot[pchain] = barostat thermostat velocities (1/time units)
· PE_eta[tchain] = potential energy of each particle thermostat displacement (energy units)
· KE_eta_dot[tchain] = kinetic energy of each particle thermostat velocity (energy units)
· PE_omega[ndof] = potential energy of each barostat displacement (energy units)
· KE_omega_dot[ndof] = kinetic energy of each barostat velocity (energy units)
· PE_etap[pchain] = potential energy of each barostat thermostat displacement (energy units)
· KE_etap_dot[pchain] = kinetic energy of each barostat thermostat velocity (energy units)
· PE_strain = scalar strain energy (energy units)

The vector stores internal Nose/Hoover thermostat and barostat variables. The number and meaning of the vector
values depends on which fix is used and the settings for keywords tchain and pchain, which specify the number of
Nose/Hoover chains for the thermostat and barostat. If no thermostatting is done, then tchain is 0. If no
barostatting is done, then pchain is 0. In the following list, “ndof” is 0, 1, 3, or 6, and is the number of degrees of
freedom in the barostat. Its value is 0 if no barostat is used, else its value is 6 if any off-diagonal stress tensor
component is barostatted, else its value is 1 if couple xyz is used or couple xy for a 2d simulation, otherwise its
value is 3.
611

what should i do to output the" PE_strain = scalar strain energy (energy units)" quantity ?

the manual said:

please keep in mind that the LAMMPS manual is *large*, so don't just
quote some random section, but also say in which section you took it
from, so that one doesn't have to search through the entire manual to
find out what you are referring to.

· eta[tchain] = particle thermostat displacements (unitless)
· eta_dot[tchain] = particle thermostat velocities (1/time units)
· omega[ndof] = barostat displacements (unitless)
· omega_dot[ndof] = barostat velocities (1/time units)
· etap[pchain] = barostat thermostat displacements (unitless)
· etap_dot[pchain] = barostat thermostat velocities (1/time units)
· PE_eta[tchain] = potential energy of each particle thermostat displacement
(energy units)
· KE_eta_dot[tchain] = kinetic energy of each particle thermostat velocity
(energy units)
· PE_omega[ndof] = potential energy of each barostat displacement (energy
units)
· KE_omega_dot[ndof] = kinetic energy of each barostat velocity (energy
units)
· PE_etap[pchain] = potential energy of each barostat thermostat
displacement (energy units)
· KE_etap_dot[pchain] = kinetic energy of each barostat thermostat velocity
(energy units)
· PE_strain = scalar strain energy (energy units)

The vector stores internal Nose/Hoover thermostat and barostat variables.
The number and meaning of the vector
values depends on which fix is used and the settings for keywords tchain and
pchain, which specify the number of
Nose/Hoover chains for the thermostat and barostat. If no thermostatting is
done, then tchain is 0. If no
barostatting is done, then pchain is 0. In the following list, "ndof" is 0,
1, 3, or 6, and is the number of degrees of
freedom in the barostat. Its value is 0 if no barostat is used, else its
value is 6 if any off-diagonal stress tensor
component is barostatted, else its value is 1 if couple xyz is used or
couple xy for a 2d simulation, otherwise its
value is 3.
611

what should i do to output the" PE_strain = scalar strain energy (energy
units)" quantity ?

you follow the instructions from the quoted segment. since that
requires to know *which* of the nose-hoover fixes you are using with
which parameters, it is impossible to give you a precise answer.

besides, this still doesn't make any sense at all.
what has a nose-hoover barostat to do with bending of a cantilevel??

axel.

allright. IT’s from the “fix nvt command” section

allright. IT’s from the “fix nvt command” section

I know. I looked it up.

But that still doesn’t explain what it has to do with you simulation, since you are referring to a barostat property.

which quantity should i use to compute the system strain energy or per atom strain energy?

maybe compute stress/atom or compute ke/atom ?

Steve