diff --git a/doc/Eqs/stress_tensor.tex b/doc/Eqs/stress_tensor.tex index d3f09ec74f..db1f0fde63 100644 --- a/doc/Eqs/stress_tensor.tex +++ b/doc/Eqs/stress_tensor.tex @@ -2,10 +2,16 @@ \begin{document} -$$ - S_{ab} = - \left[ m v_a v_b + - \frac{1}{2} \sum_{j = 1}^{N_p} (a_i - a_j) F_{p_{ij}} + - \frac{1}{2} \sum_{j = 1}^{N_b} (a_i - a_j) F_{b_{ij}} \right] -$$ +\begin{eqnarray*} +S_{ab} & = & - \left[ m v_a v_b + + \frac{1}{2} \sum_{n = 1}^{N_p} (r_{1_a} F_{1_b} + r_{2_a} F_{2_b}) + + \frac{1}{2} \sum_{n = 1}^{N_b} (r_{1_a} F_{1_b} + r_{2_a} F_{2_b}) + + \frac{1}{3} \sum_{n = 1}^{N_a} (r_{1_a} F_{1_b} + r_{2_a} F_{2_b} + + r_{3_a} F_{3_b}) + \\ +&& \frac{1}{4} \sum_{n = 1}^{N_d} (r_{1_a} F_{1_b} + r_{2_a} F_{2_b} + + r_{3_a} F_{3_b} + r_{4_a} F_{4_b}) + + \frac{1}{4} \sum_{n = 1}^{N_i} (r_{1_a} F_{1_b} + r_{2_a} F_{2_b} + + r_{3_a} F_{3_b} + r_{4_a} F_{4_b}) \right] +\end{eqnarray*} -\end{document} \ No newline at end of file +\end{document} diff --git a/doc/Section_commands.html b/doc/Section_commands.html index d5717f0085..19e6018e47 100644 --- a/doc/Section_commands.html +++ b/doc/Section_commands.html @@ -318,12 +318,12 @@ of each style or click on the style itself for a full description:
These are compute styles contributed by users, which can be used if diff --git a/doc/compute.html b/doc/compute.html index 3c8eeb05c3..1916f27a8d 100644 --- a/doc/compute.html +++ b/doc/compute.html @@ -93,10 +93,9 @@ defined in LAMMPS:
Examples:
compute 1 all pe -compute molPE all bond angle dihedral improper +compute molPE all pe bond angle dihedral improper
Description:
Define a computation that calculates the potential energy of the entire system of atoms. The specified group must be "all". See the -compute epair/atom and compute -ebond/atom commands if you want per-atom +compute pe/atom command if you want per-atom energies. These per-atom values could be summed for a group of atoms via the compute sum command.
@@ -57,7 +56,9 @@ LAMMPS starts up, as if this command were in the input script:Restrictions: none
-Related commands: none +
Related commands: +
+Default: none
diff --git a/doc/compute_pe.txt b/doc/compute_pe.txt index cef0cc0e7a..a696e67f25 100644 --- a/doc/compute_pe.txt +++ b/doc/compute_pe.txt @@ -20,14 +20,13 @@ keyword = {pair} or {bond} or {angle} or {dihedral} or {improper} or {kspace} :u [Examples:] compute 1 all pe -compute molPE all bond angle dihedral improper :pre +compute molPE all pe bond angle dihedral improper :pre [Description:] Define a computation that calculates the potential energy of the entire system of atoms. The specified group must be "all". See the -"compute epair/atom"_compute_epair_atom.html and "compute -ebond/atom"_compute_ebond_atom.html commands if you want per-atom +"compute pe/atom"_compute_pe_atom.html command if you want per-atom energies. These per-atom values could be summed for a group of atoms via the "compute sum"_compute_sum.html command. @@ -54,6 +53,8 @@ See the "thermo_style" command for more details. [Restrictions:] none -[Related commands:] none +[Related commands:] + +"compute pe/atom"_compute_pe_atom.html [Default:] none diff --git a/doc/compute_pressure.html b/doc/compute_pressure.html index af675c03ae..381407f9b8 100644 --- a/doc/compute_pressure.html +++ b/doc/compute_pressure.html @@ -13,15 +13,18 @@Syntax:
-compute ID group-ID pressure compute-ID +compute ID group-ID pressure temp-ID keyword ...
Examples:
-compute 1 all pressure myTemp +compute 1 all pressure myTemp +compute 1 all pressure thermo_temp pair bondDescription:
@@ -39,26 +42,35 @@ of atoms via the compute sum command. below), Kb is the Boltzmann constant, T is the temperature, d is the dimensionality of the system (2 or 3 for 2d/3d), V is the system volume (or area in 2d), and the second term is the virial, computed -within LAMMPS for all pairwise as well as 2-body, 3-body, 4-body, and -long-range interactions. Fixes that impose constraints +within LAMMPS for all pairwise as well as 2-body, 3-body, and 4-body, +and long-range interactions. Fixes that impose constraints (e.g. the fix shake command) also contribute to the virial term. -A 6-component pressure tensor is also calculated by this compute which -can be output by the thermo_style custom command. -The formula for the components of the tensor is the same as in above -formula, except that the first term uses the components of the kinetic -energy tensor (vx * vy instead of v^2 for temperature) and the second -term uses Rx * Fy for the Wxy component of the virial tensor, etc. +
A 6-component pressure tensor is also calculated by this compute whose +componenents can be output by the thermo_style +custom command or accessed by other +compute and fix commands. The equation for +the components of the tensor is the same as in above formula, except +that the first term uses the components of the kinetic energy tensor +(vx * vy instead of v^2 for temperature) and the second term uses Rx * +Fy for the Wxy component of the virial tensor, etc. +
+If no extra keywords are listed, the entire equation above is +calculated which includes a temperature term (or kinetic energy +tensor) and the virial as the sum of pair, bond, angle, dihedral, +improper, kspace (long-range), and fix contributions. If any extra +keywords are listed, then only those components are summed to compute +ke and/or the virial.
The temperature and kinetic energy tensor is not calculated by this -compute, but rather by the temperature compute specified as the last -argument of the command. Normally this compute should calculate the -temperature of all atoms for consistency with the virial term, but any -compute style that calculates temperature can be used, e.g. one that -excludes frozen atoms or other degrees of freedom. +compute, but rather by the temperature compute specified with the +command. Normally this compute should calculate the temperature of +all atoms for consistency with the virial term, but any compute style +that calculates temperature can be used, e.g. one that excludes frozen +atoms or other degrees of freedom.
-Note that the N is the above formula is really degrees-of-freedom/d +
Note that the N is the above formula is really degrees-of-freedom where the DOF is specified by the temperature compute. See the various compute temperature styles for details.
@@ -74,7 +86,9 @@ LAMMPS starts up, as if this command were in the input script:Related commands:
-compute temp, compute +stress/atom, +thermo_style,
Default: none
diff --git a/doc/compute_pressure.txt b/doc/compute_pressure.txt index 830359bcd0..283635e4c4 100644 --- a/doc/compute_pressure.txt +++ b/doc/compute_pressure.txt @@ -10,15 +10,18 @@ compute pressure command :h3 [Syntax:] -compute ID group-ID pressure compute-ID :pre +compute ID group-ID pressure temp-ID keyword ... :pre ID, group-ID are documented in "compute"_compute.html command pressure = style name of this compute command -compute-ID = ID of compute that calculates temperature :ul +temp-ID = ID of compute that calculates temperature +zero or more keywords may be appended +keyword = {ke} or {pair} or {bond} or {angle} or {dihedral} or {improper} or {kspace} or {fix} :ul [Examples:] -compute 1 all pressure myTemp :pre +compute 1 all pressure myTemp +compute 1 all pressure thermo_temp pair bond :pre [Description:] @@ -36,26 +39,35 @@ where N is the number of atoms in the system (see discussion of DOF below), Kb is the Boltzmann constant, T is the temperature, d is the dimensionality of the system (2 or 3 for 2d/3d), V is the system volume (or area in 2d), and the second term is the virial, computed -within LAMMPS for all pairwise as well as 2-body, 3-body, 4-body, and -long-range interactions. "Fixes"_fix.html that impose constraints +within LAMMPS for all pairwise as well as 2-body, 3-body, and 4-body, +and long-range interactions. "Fixes"_fix.html that impose constraints (e.g. the "fix shake"_fix_shake.html command) also contribute to the virial term. -A 6-component pressure tensor is also calculated by this compute which -can be output by the "thermo_style custom"_thermo_style.html command. -The formula for the components of the tensor is the same as in above -formula, except that the first term uses the components of the kinetic -energy tensor (vx * vy instead of v^2 for temperature) and the second -term uses Rx * Fy for the Wxy component of the virial tensor, etc. +A 6-component pressure tensor is also calculated by this compute whose +componenents can be output by the "thermo_style +custom"_thermo_style.html command or accessed by other +"compute"_compute.html and "fix"_fix.html commands. The equation for +the components of the tensor is the same as in above formula, except +that the first term uses the components of the kinetic energy tensor +(vx * vy instead of v^2 for temperature) and the second term uses Rx * +Fy for the Wxy component of the virial tensor, etc. + +If no extra keywords are listed, the entire equation above is +calculated which includes a temperature term (or kinetic energy +tensor) and the virial as the sum of pair, bond, angle, dihedral, +improper, kspace (long-range), and fix contributions. If any extra +keywords are listed, then only those components are summed to compute +ke and/or the virial. The temperature and kinetic energy tensor is not calculated by this -compute, but rather by the temperature compute specified as the last -argument of the command. Normally this compute should calculate the -temperature of all atoms for consistency with the virial term, but any -compute style that calculates temperature can be used, e.g. one that -excludes frozen atoms or other degrees of freedom. +compute, but rather by the temperature compute specified with the +command. Normally this compute should calculate the temperature of +all atoms for consistency with the virial term, but any compute style +that calculates temperature can be used, e.g. one that excludes frozen +atoms or other degrees of freedom. -Note that the N is the above formula is really degrees-of-freedom/d +Note that the N is the above formula is really degrees-of-freedom where the DOF is specified by the temperature compute. See the various "compute temperature"_compute.html styles for details. @@ -71,6 +83,8 @@ where "thermo_temp" is the ID of a similarly defined compute of style [Related commands:] -"compute temp"_compute_temp.html, "thermo_style"_themo_style.html +"compute temp"_compute_temp.html, "compute +stress/atom"_compute_stress_atom.html, +"thermo_style"_themo_style.html, [Default:] none diff --git a/doc/compute_stress_atom.html b/doc/compute_stress_atom.html index eedac23195..004a0a219a 100644 --- a/doc/compute_stress_atom.html +++ b/doc/compute_stress_atom.html @@ -13,97 +13,99 @@Syntax:
-compute ID group-ID stress/atom keyword value ... +compute ID group-ID stress/atom keyword ...-
ke arg = yes or no - yes/no = include/exclude kinetic energy contribution to stress - pair arg = yes or no - yes/no = include/exclude pairwise energy contribution to stress - bond arg = yes or no - yes/no = include/exclude bond energy contribution to stress -- +
Examples:
compute 1 mobile stress/atom-
compute 1 all stress/atom ke no +compute 1 all stress/atom pair bondDescription:
-Define a computation that computes the per-atom stress tensor for each -atom in a group. The tensor for each atom has 6 components: xx, yy, -zz, xy, xz, yz. The resulting values can be accessed by indices 1-6 -by any command that uses per-atom computes, e.g. the dump +
Define a computation that computes the symmetric per-atom stress +tensor for each atom in a group. The tensor for each atom has 6 +components: xx, yy, zz, xy, xz, yz. See the compute +pressure command if you want the stress tensor +(pressure) of the entire system. The 6 components can be accessed by +indices 1-6 by any command that uses per-atom computes, e.g. the dump custom command or fix ave/spatial -command or fix ave/atom command. +command or fix ave/atom command. See this +section for an overview.
-The stress tensor for each atom is the sum of 3 terms in the following -formula. Any of the terms can be excluded by setting the ke, -pair, or bond keywords to no. The ab component of stress on -atom I is as follows, where a and b take on values x,y,z to -generate the 6 components of the symmetric tensor: +
The stress tensor for each atom is given by the following formula. +where the ab component of stress on atom I is as shown where a and +b take on values x,y,z to generate the 6 components of the symmetric +tensor:
![]()
The first term is a kinetic energy contribution for atom I. The -second term is a pairwise energy contribution where J loops over the -Np neighbors of atom I, and Fp is one of 3 components of force -on atom I due to the pairwise interaction with atom J. The third -term is a bond energy contribution where J loops over the Nb bonds -which atom I is part of, and Fb is one of 3 components of force on -atom I due to the bonded interaction with atom J. +second term is a pairwise energy contribution where N loops over the +Np neighbors of atom I, r1 and r2 are the positions of the 2 +atoms, and F1 and F2 are the forces on the 2 atoms. The third +term is a bond contribution for the Nb bonds whihc atom I is part +of. And similarly for the Na angle, Nd dihedral, and Ni +improper interactions atom I is part of.
-If two atoms interact, either pairwise or in a bond, and only one of -them is in the compute group, the interaction is included in the -per-atom stress of the atom in the group. +
As the formula implies, a virial contribution produced by a small set +of atoms (e.g. 4 atoms in a dihedral or 3 atoms in a Tersoff 3-body +interaction) is assigned in equal portions to each atom in the set. +E.g. 1/4 of the dihedral virial to each of the 4 atoms.
-For force fields that include a contribution to the pairwise -interaction that is computed as part of dihedral terms (i.e. 1-4 -interactions), this contribution is NOT included in the per-atom -pairwise stress. +
If no extra keywords are listed, all of the terms in this formula are +included in the per-atom stress tensor. If any extra keywords are +listed, only those terms are summed to compute the tensor.
-IMPORTANT NOTE: The per-atom stress does NOT include contributions due -to angles, dihedrals, impropers that the atom is part of, or a -long-range Coulombic contribution. Currently, there is no way in -LAMMPS to calculate per-atom stress from angles, dihedrals, improper, -or long-range interactions. +
Note that the stress for each atom is due to its interaction with all +other atoms in the simulation, not just with other atoms in the group.
-Note that as defined above, per-atom stress is the negative of the -per-atom pressure tensor. It is also really a stress-volume +
The dihedral_style charmm style calculates +pairwise interactions between 1-4 atoms. The virial contribution of +these terms is included in the pair virial, not the dihedral virial. +
+Note that as defined in the formula, per-atom stress is the negative +of the per-atom pressure tensor. It is also really a stress-volume formulation. It would need to be divided by a per-atom volume to have units of stress, but an individual atom's volume is not easy to -compute in a deformed solid. Thus, if you sum the diagonal components -of the per-atom stress tensor for all atoms in the system and divide -the sum by 3V, where V is the volume of the system, you should get -P, -where P is the total pressure of the system (assuming there is no -angle, dihedral, improper, or long-range contribution to the total -pressure). +compute in a deformed solid or a liquid. Thus, if the diagonal +components of the per-atom stress tensor are summed for all atoms in +the system and the sum is divided by 3V, where V is the volume of the +system, the result should be -P, where P is the total pressure of the +system.
-Computation of per-atom stress tensor components requires a loop thru -the pairwise and bond neighbor lists and inter-processor -communication, so it can be inefficient to compute/dump this quantity -too frequently or to have multiple compute/dump commands, each of a -stress/atom style. +
These lines in an input script should yield that result (assuming +there is no fix or long-range contribution to the stress): +
+compute global all pressure thermo_temp +compute peratom all stress/atom +compute p all sum peratom +variable p equal div(add(add(c_p1,c_p2),c_p3),mult(3.0,vol)) +thermo_style custom step temp etotal c_global v_p ++IMPORTANT NOTE: The per-atom stress does NOT include contributions due +to fixes (e.g. SHAKE) or long-range Coulombic +interactions (via the kspace_style command). The +former needs to be added to LAMMPS. We're not sure if the latter is +possible to compute. There are also a few pair styles for manybody +potentials that are not yet instrumented to yield per-atom stress. +See the Restrictions below.
Restrictions:
-Some pair potentials do not allow the calculation of per-atom stress -via this command. An error will be generated if this is the case. +
These pair styles do not yet work with this compute: "airebo", "meam", +and "TIP4P".
-Related commands: none +
Related commands:
-Default: +
compute pe, compute +stress/atom
-The option defaults are ke = yes, pair = yes, bond = yes. +
Default: none