initial commit. doc is in the works

This commit is contained in:
David Nicholson
2017-09-28 16:34:18 -04:00
parent f2c1172741
commit 855b6000ef
28 changed files with 6261 additions and 1 deletions

View File

@ -715,8 +715,10 @@ package"_Section_start.html#start_3.
"nve/manifold/rattle"_fix_nve_manifold_rattle.html,
"nvk"_fix_nvk.html,
"nvt/manifold/rattle"_fix_nvt_manifold_rattle.html,
"nvt/uef"_fix_nh_uef.html,
"nph/eff"_fix_nh_eff.html,
"npt/eff"_fix_nh_eff.html,
"npt/uef"_fix_nh_uef.html,
"nve/eff"_fix_nve_eff.html,
"nvt/eff"_fix_nh_eff.html,
"nvt/sllod/eff"_fix_nvt_sllod_eff.html,
@ -856,6 +858,7 @@ package"_Section_start.html#start_3.
"meso/t/atom"_compute_meso_t_atom.html,
"pe/tally"_compute_tally.html,
"pe/mol/tally"_compute_tally.html,
"pressure/uef"_compute_pressure_uef.html,
"saed"_compute_saed.html,
"smd/contact/radius"_compute_smd_contact_radius.html,
"smd/damage"_compute_smd_damage.html,
@ -884,6 +887,7 @@ package"_Section_start.html#start_3.
"temp/deform/eff"_compute_temp_deform_eff.html,
"temp/region/eff"_compute_temp_region_eff.html,
"temp/rotate"_compute_temp_rotate.html,
"temp/uef"_compute_temp_uef.html,
"xrd"_compute_xrd.html :tb(c=6,ea=c)
:line

View File

@ -150,6 +150,7 @@ Package, Description, Doc page, Example, Library
"USER-SMTBQ"_#USER-SMTBQ, second moment tight binding QEq potential,"pair_style smtbq"_pair_smtbq.html, USER/smtbq, -
"USER-SPH"_#USER-SPH, smoothed particle hydrodynamics,"SPH User Guide"_PDF/SPH_LAMMPS_userguide.pdf, USER/sph, -
"USER-TALLY"_#USER-TALLY, pairwise tally computes,"compute XXX/tally"_compute_tally.html, USER/tally, -
"USER-UEF"_#USER-UEF, NEMD under extensional flow,"fix nvt/uef"_fix_nh_uef.html, USER/uef, -
"USER-VTK"_#USER-VTK, dump output via VTK, "compute vtk"_dump_vtk.html, -, ext :tb(ea=c,ca1=l)
:line
@ -2770,6 +2771,33 @@ examples/USER/tally :ul
:line
UEF package :link(UEF),h4
[Contents:]
A fix style for the integration of the equations of motion under
extensional flow with proper boundary conditions, as well
as several supporting compute styles and an output option.
[Install or un-install:]
make yes-user-uef
make machine :pre
make no-user-uef
make machine :pre
[Supporting info:]
src/USER-UEF: filenames -> commands
"fix nvt/uef"_fix_nh_uef.html
"compute pressure/uef"_compute_pressure_uef.html
"compute temp/uef"_compute_temp_uef.html
"dump cfg/uef"_dump_cfg_uef.html
examples/uef :ul
:line
USER-VTK package :link(USER-VTK),h4
[Contents:]

View File

@ -0,0 +1,52 @@
"LAMMPS WWW Site"_lws - "LAMMPS Documentation"_ld - "LAMMPS Commands"_lc :c
:link(lws,http://lammps.sandia.gov)
:link(ld,Manual.html)
:link(lc,Section_commands.html#comm)
:line
compute temp command :h3
compute temp/kk command :h3
[Syntax:]
compute ID group-ID temp :pre
ID, group-ID are documented in "compute"_compute.html command
temp = style name of this compute command :ul
[Examples:]
compute 1 all temp/uef
[Description:]
This command is used to compute the kinetic energy tensor in
the correct reference frame when the USER-UEF package is used.
It is not necessary to use this command to compute the scalar
value of the temperature. A "compute temp"_compute_temp.html
may be used for that purpose.
[Output info:]
Output information for this command can be found in the
documentation for "compute temp"_compute_temp.html.
[Restrictions:]
This fix is part of the USER-UEF package. It is only enabled if
LAMMPS was built with that package. See the
"Making LAMMPS"_Section_start.html#start-3 section for more info.
This command can only be used when "fix nvt/uef"_fix_nh_uef.html
or "fix npt/uef"_fix_nh_uef.html is active.
[Related commands:]
"compute temp"_compute_temp.html,
"fix nvt/uef"_fix_nh_uef.html,
"compute pressure/uef"_compute_pressure_uef.html
[Default:] none

715
doc/src/fix_nh_uef.txt Normal file
View File

@ -0,0 +1,715 @@
<"LAMMPS WWW Site"_lws - "LAMMPS Documentation"_ld - "LAMMPS Commands"_lc :c
:link(lws,http://lammps.sandia.gov)
:link(ld,Manual.html)
:link(lc,Section_commands.html#comm)
:line
fix nvt/uef command :h3
fix npt/uef command :h3
[Syntax:]
fix ID group-ID style_name erate eps_x eps_y temp Tstart Tstop Tdamp keyword value ... :pre
ID, group-ID are documented in "fix"_fix.html command :ulb,l
style_name = {nvt/uef} or {npt/uef} :l
Tstart, Tstop, and Tdamp are documented in the "fix_npt"_fix_nh.html command :l
edot_x and edot_y are the strain rates in the x and y directions (1/(time units)) :l
one or more keyword/value pairs may be appended :l
keyword = {ext} or {strain} or {iso} or {x} or {y} or {z} or {tchain} or {pchain} or {tloop} or {ploop} or {mtk}
{ext} value = {x} or {y} or {z} or {xy} or {yz} or {xz} = external dimensions
This keyword sets the external dimensions used to calculate the scalar pressure
{strain} values = e_x e_y = initial strain
Use of this keyword is usually not necessary, but may be needed to resume a run with a data file.
The {iso}, {x}, {y}, {z}, {tchain}, {pchain}, {tloop}, {ploop}, and {mtk} keywords are documented in the "fix_npt"_fix_nh.html command. :pre
:ule
[Examples:]
fix uniax_nvt all nvt/uef temp 400 400 100 erate 0.00001 -0.000005
fix biax_nvt all nvt/uef temp 400 400 100 erate 0.000005 0.000005
fix uniax_npt all npt/uef temp 400 400 300 iso 1 1 3000 erate 0.00001 -0.000005 ext yz
fix biax_npt all npt/uef temp 400 400 100 erate 0.00001 -0.000005 :pre
[Description:]
This fix is used to simulate non-equilibrium molecular dynamics (NEMD)
under diagonal flow fields, including uniaxial and biaxial flow.
Simulations under extensional flow may be carried out for an
indefinite amount of time. It is an implementation of the boundary
conditions from "(Dobson)"_#Dobson, and also uses numerical lattice reduction
as was proposed by "(Hunt)"_#Hunt. The lattice reduction algorithm is from
"(Semaev)"_Semaev. The package is intended for simulations of
homogeneous flows, and integrates the SLLOD equations of motion,
originally proposed by Hoover and Ladd (see "(Evans and Morriss)"_#Sllod).
NOTE: Due to an instability in the SLLOD equations under extension,
"fix_momentum"_fix_momentum.html should be used to regularly reset the
linear momentum.
The boundary conditions require a simulation box that does not have a
consistent alignment relative to the applied flow field. Since LAMMPS
utilizes an upper-triangular simulation box, it is not possible to express
the evolving simulation box in the same coordinate system as the flow field.
This fix keeps track of two coordinate systems: the flow frame, and the
upper triangular LAMMPS frame. The coordinate systems are related to
each other through the QR decomposition, as is illustrated in the image below.
image
During most molecular dynamics operations, the system is represented in the
LAMMPS frame. Only when the positions and velocities are updated is the system
rotated to the flow frame, and it is rotated back to the LAMMPS frame
immediately afterwards. For this reason, all vector-valued quantities
(except for the tensors from compute pressure/uef and compute temp/uef) will
be computed in the LAMMPS frame. Rotationally invariant scalar quantities like
the temperature and hydrostatic pressure, on the other hand, will be computed
correctly. Additionally, the system is in the LAMMPS frame during all of the
output steps, and therefore trajectory files made using the dump command
will be in the LAMMPS frame unless the dump cfg/uef command is used.
:line
Temperature control is achieved with the default Nose-Hoover style
thermostat documented in "fix_npt"_fix_nh.html. When this fix is active,
only the peculiar velocity of each atom is stored, defined as the velocity
relative to the streaming velocity. This is in contrast to
"fix_nvt/sllod"_fix_nvt_sllod.html, which uses a lab-frame velocity, and
removes the contribution from the streaming velocity in order to compute
the temperature.
Pressure control is achieved using the default Nose-Hoover barostat documented
in "fix_npt"_fix_npt.html. There are two ways to control the pressure using this
fix. The first method involves using the {ext} keyword along with the {iso} pressure
style. With this method, the pressure is controlled by scaling the simulation box
isotropically to achieve the average pressure in the directions specified by {ext}.
For example, if {ext xy} is used, the average pressure (Pxx+Pyy)/2 will be controlled.
This command will control the total hydrostatic pressure under uniaxial tension:
fix f1 all npt/uef temp 0.7 0.7 0.5 iso 1 1 5 erate -0.5 -0.5 ext xyz :pre
This command will control the average stress in compression directions, which would
correspond to free surfaces for fiber drawing, under uniaxial tension:
fix f2 all npt/uef temp 0.7 0.7 0.5 iso 1 1 5 erate -0.5 -0.5 ext xy :pre
The second method for pressure control involves setting the normal stresses using
the x, y , and/or z keywords. When using this method, the same pressure must be
specified via {Pstart} and {Pstop} for all dimensions controlled. Any choice of
pressure conditions that would cause LAMMPS to compute a deviatoric stress are not
permissible and will result in an error. Additionally, all dimensions with
controlled stress must have the same applied strain rate. The {ext} keyword must be
set to the default value ({xyz}) when using this method.
For example, the following commands will work:
fix f3 all npt/uef temp 0.7 0.7 0.5 x 1 1 5 y 1 1 5 erate -0.5 -0.5
fix f4 all npt/uef temp 0.7 0.7 0.5 z 1 1 5 erate 0.5 0.5 :pre
The following commands will not work:
fix f5 all npt/uef temp 0.7 0.7 0.5 x 1 1 5 z 1 1 5 erate -0.5 -0.5
fix f6 all npt/uef temp 0.7 0.7 0.5 x 1 1 5 z 2 2 5 erate 0.5 0.5 :pre
:line
[Restrictions:]
Due to requirements of the boundary conditions, when the strain keyword
is unset, or set to zero, the initial simulation box must be cubic and
have style triclinic. If the box is initially of type ortho, use
"change_box"_change_box.html before invoking the fix.
When this fix is applied, any orientation-dependent vector or
tensor-valued quantities computed, except for the tensors from
compute pressure/uef/compute temp/uef and coordinates from
dump cfg/uef, will not be in the same coordinate system as
the flow field.
:link(Dobson)
[(Dobson)] Dobson, J Chem Phys, 141, 184103 (2014).
:link(Hunt)
[(Hunt)] Hunt, Mol Simul, 42, 347 (2016).
:link(Semaev)
[(Semaev)] Semaev, Cryptography and Lattices, 181 (2001).
:link(Sllod)
[(Evans and Morriss)] Evans and Morriss, Phys Rev A, 30, 1528 (1984).
These commands perform time integration on Nose-Hoover style
non-Hamiltonian equations of motion which are designed to generate
positions and velocities sampled from the canonical (nvt),
isothermal-isobaric (npt), and isenthalpic (nph) ensembles. This
updates the position and velocity for atoms in the group each
timestep.
The thermostatting and barostatting is achieved by adding some dynamic
variables which are coupled to the particle velocities
(thermostatting) and simulation domain dimensions (barostatting). In
addition to basic thermostatting and barostatting, these fixes can
also create a chain of thermostats coupled to the particle thermostat,
and another chain of thermostats coupled to the barostat
variables. The barostat can be coupled to the overall box volume, or
to individual dimensions, including the {xy}, {xz} and {yz} tilt
dimensions. The external pressure of the barostat can be specified as
either a scalar pressure (isobaric ensemble) or as components of a
symmetric stress tensor (constant stress ensemble). When used
correctly, the time-averaged temperature and stress tensor of the
particles will match the target values specified by Tstart/Tstop and
Pstart/Pstop.
The equations of motion used are those of Shinoda et al in
"(Shinoda)"_#nh-Shinoda, which combine the hydrostatic equations of
Martyna, Tobias and Klein in "(Martyna)"_#nh-Martyna with the strain
energy proposed by Parrinello and Rahman in
"(Parrinello)"_#nh-Parrinello. The time integration schemes closely
follow the time-reversible measure-preserving Verlet and rRESPA
integrators derived by Tuckerman et al in "(Tuckerman)"_#nh-Tuckerman.
:line
The thermostat parameters for fix styles {nvt} and {npt} is specified
using the {temp} keyword. Other thermostat-related keywords are
{tchain}, {tloop} and {drag}, which are discussed below.
The thermostat is applied to only the translational degrees of freedom
for the particles. The translational degrees of freedom can also have
a bias velocity removed before thermostatting takes place; see the
description below. The desired temperature at each timestep is a
ramped value during the run from {Tstart} to {Tstop}. The {Tdamp}
parameter is specified in time units and determines how rapidly the
temperature is relaxed. For example, a value of 10.0 means to relax
the temperature in a timespan of (roughly) 10 time units (e.g. tau or
fmsec or psec - see the "units"_units.html command). The atoms in the
fix group are the only ones whose velocities and positions are updated
by the velocity/position update portion of the integration.
NOTE: A Nose-Hoover thermostat will not work well for arbitrary values
of {Tdamp}. If {Tdamp} is too small, the temperature can fluctuate
wildly; if it is too large, the temperature will take a very long time
to equilibrate. A good choice for many models is a {Tdamp} of around
100 timesteps. Note that this is NOT the same as 100 time units for
most "units"_units.html settings.
:line
The barostat parameters for fix styles {npt} and {nph} is specified
using one or more of the {iso}, {aniso}, {tri}, {x}, {y}, {z}, {xy},
{xz}, {yz}, and {couple} keywords. These keywords give you the
ability to specify all 6 components of an external stress tensor, and
to couple various of these components together so that the dimensions
they represent are varied together during a constant-pressure
simulation.
Other barostat-related keywords are {pchain}, {mtk}, {ploop},
{nreset}, {drag}, and {dilate}, which are discussed below.
Orthogonal simulation boxes have 3 adjustable dimensions (x,y,z).
Triclinic (non-orthogonal) simulation boxes have 6 adjustable
dimensions (x,y,z,xy,xz,yz). The "create_box"_create_box.html, "read
data"_read_data.html, and "read_restart"_read_restart.html commands
specify whether the simulation box is orthogonal or non-orthogonal
(triclinic) and explain the meaning of the xy,xz,yz tilt factors.
The target pressures for each of the 6 components of the stress tensor
can be specified independently via the {x}, {y}, {z}, {xy}, {xz}, {yz}
keywords, which correspond to the 6 simulation box dimensions. For
each component, the external pressure or tensor component at each
timestep is a ramped value during the run from {Pstart} to {Pstop}.
If a target pressure is specified for a component, then the
corresponding box dimension will change during a simulation. For
example, if the {y} keyword is used, the y-box length will change. If
the {xy} keyword is used, the xy tilt factor will change. A box
dimension will not change if that component is not specified, although
you have the option to change that dimension via the "fix
deform"_fix_deform.html command.
Note that in order to use the {xy}, {xz}, or {yz} keywords, the
simulation box must be triclinic, even if its initial tilt factors are
0.0.
For all barostat keywords, the {Pdamp} parameter operates like the
{Tdamp} parameter, determining the time scale on which pressure is
relaxed. For example, a value of 10.0 means to relax the pressure in
a timespan of (roughly) 10 time units (e.g. tau or fmsec or psec - see
the "units"_units.html command).
NOTE: A Nose-Hoover barostat will not work well for arbitrary values
of {Pdamp}. If {Pdamp} is too small, the pressure and volume can
fluctuate wildly; if it is too large, the pressure will take a very
long time to equilibrate. A good choice for many models is a {Pdamp}
of around 1000 timesteps. However, note that {Pdamp} is specified in
time units, and that timesteps are NOT the same as time units for most
"units"_units.html settings.
Regardless of what atoms are in the fix group (the only atoms which
are time integrated), a global pressure or stress tensor is computed
for all atoms. Similarly, when the size of the simulation box is
changed, all atoms are re-scaled to new positions, unless the keyword
{dilate} is specified with a {dilate-group-ID} for a group that
represents a subset of the atoms. This can be useful, for example, to
leave the coordinates of atoms in a solid substrate unchanged and
controlling the pressure of a surrounding fluid. This option should
be used with care, since it can be unphysical to dilate some atoms and
not others, because it can introduce large, instantaneous
displacements between a pair of atoms (one dilated, one not) that are
far from the dilation origin. Also note that for atoms not in the fix
group, a separate time integration fix like "fix nve"_fix_nve.html or
"fix nvt"_fix_nh.html can be used on them, independent of whether they
are dilated or not.
:line
The {couple} keyword allows two or three of the diagonal components of
the pressure tensor to be "coupled" together. The value specified
with the keyword determines which are coupled. For example, {xz}
means the {Pxx} and {Pzz} components of the stress tensor are coupled.
{Xyz} means all 3 diagonal components are coupled. Coupling means two
things: the instantaneous stress will be computed as an average of the
corresponding diagonal components, and the coupled box dimensions will
be changed together in lockstep, meaning coupled dimensions will be
dilated or contracted by the same percentage every timestep. The
{Pstart}, {Pstop}, {Pdamp} parameters for any coupled dimensions must
be identical. {Couple xyz} can be used for a 2d simulation; the {z}
dimension is simply ignored.
:line
The {iso}, {aniso}, and {tri} keywords are simply shortcuts that are
equivalent to specifying several other keywords together.
The keyword {iso} means couple all 3 diagonal components together when
pressure is computed (hydrostatic pressure), and dilate/contract the
dimensions together. Using "iso Pstart Pstop Pdamp" is the same as
specifying these 4 keywords:
x Pstart Pstop Pdamp
y Pstart Pstop Pdamp
z Pstart Pstop Pdamp
couple xyz :pre
The keyword {aniso} means {x}, {y}, and {z} dimensions are controlled
independently using the {Pxx}, {Pyy}, and {Pzz} components of the
stress tensor as the driving forces, and the specified scalar external
pressure. Using "aniso Pstart Pstop Pdamp" is the same as specifying
these 4 keywords:
x Pstart Pstop Pdamp
y Pstart Pstop Pdamp
z Pstart Pstop Pdamp
couple none :pre
The keyword {tri} means {x}, {y}, {z}, {xy}, {xz}, and {yz} dimensions
are controlled independently using their individual stress components
as the driving forces, and the specified scalar pressure as the
external normal stress. Using "tri Pstart Pstop Pdamp" is the same as
specifying these 7 keywords:
x Pstart Pstop Pdamp
y Pstart Pstop Pdamp
z Pstart Pstop Pdamp
xy 0.0 0.0 Pdamp
yz 0.0 0.0 Pdamp
xz 0.0 0.0 Pdamp
couple none :pre
:line
In some cases (e.g. for solids) the pressure (volume) and/or
temperature of the system can oscillate undesirably when a Nose/Hoover
barostat and thermostat is applied. The optional {drag} keyword will
damp these oscillations, although it alters the Nose/Hoover equations.
A value of 0.0 (no drag) leaves the Nose/Hoover formalism unchanged.
A non-zero value adds a drag term; the larger the value specified, the
greater the damping effect. Performing a short run and monitoring the
pressure and temperature is the best way to determine if the drag term
is working. Typically a value between 0.2 to 2.0 is sufficient to
damp oscillations after a few periods. Note that use of the drag
keyword will interfere with energy conservation and will also change
the distribution of positions and velocities so that they do not
correspond to the nominal NVT, NPT, or NPH ensembles.
An alternative way to control initial oscillations is to use chain
thermostats. The keyword {tchain} determines the number of thermostats
in the particle thermostat. A value of 1 corresponds to the original
Nose-Hoover thermostat. The keyword {pchain} specifies the number of
thermostats in the chain thermostatting the barostat degrees of
freedom. A value of 0 corresponds to no thermostatting of the
barostat variables.
The {mtk} keyword controls whether or not the correction terms due to
Martyna, Tuckerman, and Klein are included in the equations of motion
"(Martyna)"_#nh-Martyna. Specifying {no} reproduces the original
Hoover barostat, whose volume probability distribution function
differs from the true NPT and NPH ensembles by a factor of 1/V. Hence
using {yes} is more correct, but in many cases the difference is
negligible.
The keyword {tloop} can be used to improve the accuracy of integration
scheme at little extra cost. The initial and final updates of the
thermostat variables are broken up into {tloop} substeps, each of
length {dt}/{tloop}. This corresponds to using a first-order
Suzuki-Yoshida scheme "(Tuckerman)"_#nh-Tuckerman. The keyword {ploop}
does the same thing for the barostat thermostat.
The keyword {nreset} controls how often the reference dimensions used
to define the strain energy are reset. If this keyword is not used,
or is given a value of zero, then the reference dimensions are set to
those of the initial simulation domain and are never changed. If the
simulation domain changes significantly during the simulation, then
the final average pressure tensor will differ significantly from the
specified values of the external stress tensor. A value of {nstep}
means that every {nstep} timesteps, the reference dimensions are set
to those of the current simulation domain.
The {scaleyz}, {scalexz}, and {scalexy} keywords control whether or
not the corresponding tilt factors are scaled with the associated box
dimensions when barostatting triclinic periodic cells. The default
values {yes} will turn on scaling, which corresponds to adjusting the
linear dimensions of the cell while preserving its shape. Choosing
{no} ensures that the tilt factors are not scaled with the box
dimensions. See below for restrictions and default values in different
situations. In older versions of LAMMPS, scaling of tilt factors was
not performed. The old behavior can be recovered by setting all three
scale keywords to {no}.
The {flip} keyword allows the tilt factors for a triclinic box to
exceed half the distance of the parallel box length, as discussed
below. If the {flip} value is set to {yes}, the bound is enforced by
flipping the box when it is exceeded. If the {flip} value is set to
{no}, the tilt will continue to change without flipping. Note that if
applied stress induces large deformations (e.g. in a liquid), this
means the box shape can tilt dramatically and LAMMPS will run less
efficiently, due to the large volume of communication needed to
acquire ghost atoms around a processor's irregular-shaped sub-domain.
For extreme values of tilt, LAMMPS may also lose atoms and generate an
error.
The {fixedpoint} keyword specifies the fixed point for barostat volume
changes. By default, it is the center of the box. Whatever point is
chosen will not move during the simulation. For example, if the lower
periodic boundaries pass through (0,0,0), and this point is provided
to {fixedpoint}, then the lower periodic boundaries will remain at
(0,0,0), while the upper periodic boundaries will move twice as
far. In all cases, the particle trajectories are unaffected by the
chosen value, except for a time-dependent constant translation of
positions.
If the {update} keyword is used with the {dipole} value, then the
orientation of the dipole moment of each particle is also updated
during the time integration. This option should be used for models
where a dipole moment is assigned to finite-size particles,
e.g. spheroids via use of the "atom_style hybrid sphere
dipole"_atom_style.html command.
The default dipole orientation integrator can be changed to the
Dullweber-Leimkuhler-McLachlan integration scheme
"(Dullweber)"_#nh-Dullweber when using {update} with the value
{dipole/dlm}. This integrator is symplectic and time-reversible,
giving better energy conservation and allows slightly longer timesteps
at only a small additional computational cost.
:line
NOTE: Using a barostat coupled to tilt dimensions {xy}, {xz}, {yz} can
sometimes result in arbitrarily large values of the tilt dimensions,
i.e. a dramatically deformed simulation box. LAMMPS allows the tilt
factors to grow a small amount beyond the normal limit of half the box
length (0.6 times the box length), and then performs a box "flip" to
an equivalent periodic cell. See the discussion of the {flip} keyword
above, to allow this bound to be exceeded, if desired.
The flip operation is described in more detail in the doc page for
"fix deform"_fix_deform.html. Both the barostat dynamics and the atom
trajectories are unaffected by this operation. However, if a tilt
factor is incremented by a large amount (1.5 times the box length) on
a single timestep, LAMMPS can not accomodate this event and will
terminate the simulation with an error. This error typically indicates
that there is something badly wrong with how the simulation was
constructed, such as specifying values of {Pstart} that are too far
from the current stress value, or specifying a timestep that is too
large. Triclinic barostatting should be used with care. This also is
true for other barostat styles, although they tend to be more
forgiving of insults. In particular, it is important to recognize that
equilibrium liquids can not support a shear stress and that
equilibrium solids can not support shear stresses that exceed the
yield stress.
One exception to this rule is if the 1st dimension in the tilt factor
(x for xy) is non-periodic. In that case, the limits on the tilt
factor are not enforced, since flipping the box in that dimension does
not change the atom positions due to non-periodicity. In this mode,
if you tilt the system to extreme angles, the simulation will simply
become inefficient due to the highly skewed simulation box.
NOTE: Unlike the "fix temp/berendsen"_fix_temp_berendsen.html command
which performs thermostatting but NO time integration, these fixes
perform thermostatting/barostatting AND time integration. Thus you
should not use any other time integration fix, such as "fix
nve"_fix_nve.html on atoms to which this fix is applied. Likewise,
fix nvt and fix npt should not normally be used on atoms that also
have their temperature controlled by another fix - e.g. by "fix
langevin"_fix_nh.html or "fix temp/rescale"_fix_temp_rescale.html
commands.
See "this howto section"_Section_howto.html#howto_16 of the manual for
a discussion of different ways to compute temperature and perform
thermostatting and barostatting.
:line
These fixes compute a temperature and pressure each timestep. To do
this, the fix creates its own computes of style "temp" and "pressure",
as if one of these two sets of commands had been issued:
compute fix-ID_temp group-ID temp
compute fix-ID_press group-ID pressure fix-ID_temp :pre
compute fix-ID_temp all temp
compute fix-ID_press all pressure fix-ID_temp :pre
See the "compute temp"_compute_temp.html and "compute
pressure"_compute_pressure.html commands for details. Note that the
IDs of the new computes are the fix-ID + underscore + "temp" or fix_ID
+ underscore + "press". For fix nvt, the group for the new computes
is the same as the fix group. For fix nph and fix npt, the group for
the new computes is "all" since pressure is computed for the entire
system.
Note that these are NOT the computes used by thermodynamic output (see
the "thermo_style"_thermo_style.html command) with ID = {thermo_temp}
and {thermo_press}. This means you can change the attributes of this
fix's temperature or pressure via the
"compute_modify"_compute_modify.html command or print this temperature
or pressure during thermodynamic output via the "thermo_style
custom"_thermo_style.html command using the appropriate compute-ID.
It also means that changing attributes of {thermo_temp} or
{thermo_press} will have no effect on this fix.
Like other fixes that perform thermostatting, fix nvt and fix npt can
be used with "compute commands"_compute.html that calculate a
temperature after removing a "bias" from the atom velocities.
E.g. removing the center-of-mass velocity from a group of atoms or
only calculating temperature on the x-component of velocity or only
calculating temperature for atoms in a geometric region. This is not
done by default, but only if the "fix_modify"_fix_modify.html command
is used to assign a temperature compute to this fix that includes such
a bias term. See the doc pages for individual "compute
commands"_compute.html to determine which ones include a bias. In
this case, the thermostat works in the following manner: the current
temperature is calculated taking the bias into account, bias is
removed from each atom, thermostatting is performed on the remaining
thermal degrees of freedom, and the bias is added back in.
:line
These fixes can be used with either the {verlet} or {respa}
"integrators"_run_style.html. When using one of the barostat fixes
with {respa}, LAMMPS uses an integrator constructed
according to the following factorization of the Liouville propagator
(for two rRESPA levels):
:c,image(Eqs/fix_nh1.jpg)
This factorization differs somewhat from that of Tuckerman et al, in
that the barostat is only updated at the outermost rRESPA level,
whereas Tuckerman's factorization requires splitting the pressure into
pieces corresponding to the forces computed at each rRESPA level. In
theory, the latter method will exhibit better numerical stability. In
practice, because Pdamp is normally chosen to be a large multiple of
the outermost rRESPA timestep, the barostat dynamics are not the
limiting factor for numerical stability. Both factorizations are
time-reversible and can be shown to preserve the phase space measure
of the underlying non-Hamiltonian equations of motion.
NOTE: This implementation has been shown to conserve linear momentum
up to machine precision under NVT dynamics. Under NPT dynamics,
for a system with zero initial total linear momentum, the total
momentum fluctuates close to zero. It may occasionally undergo brief
excursions to non-negligible values, before returning close to zero.
Over long simulations, this has the effect of causing the center-of-mass
to undergo a slow random walk. This can be mitigated by resetting
the momentum at infrequent intervals using the
"fix momentum"_fix_momentum.html command.
:line
The fix npt and fix nph commands can be used with rigid bodies or
mixtures of rigid bodies and non-rigid particles (e.g. solvent). But
there are also "fix rigid/npt"_fix_rigid.html and "fix
rigid/nph"_fix_rigid.html commands, which are typically a more natural
choice. See the doc page for those commands for more discussion of
the various ways to do this.
:line
Styles with a {gpu}, {intel}, {kk}, {omp}, or {opt} suffix are
functionally the same as the corresponding style without the suffix.
They have been optimized to run faster, depending on your available
hardware, as discussed in "Section 5"_Section_accelerate.html
of the manual. The accelerated styles take the same arguments and
should produce the same results, except for round-off and precision
issues.
These accelerated styles are part of the GPU, USER-INTEL, KOKKOS,
USER-OMP and OPT packages, respectively. They are only enabled if
LAMMPS was built with those packages. See the "Making
LAMMPS"_Section_start.html#start_3 section for more info.
You can specify the accelerated styles explicitly in your input script
by including their suffix, or you can use the "-suffix command-line
switch"_Section_start.html#start_6 when you invoke LAMMPS, or you can
use the "suffix"_suffix.html command in your input script.
See "Section 5"_Section_accelerate.html of the manual for
more instructions on how to use the accelerated styles effectively.
:line
[Restart, fix_modify, output, run start/stop, minimize info:]
These fixes writes the state of all the thermostat and barostat
variables to "binary restart files"_restart.html. See the
"read_restart"_read_restart.html command for info on how to re-specify
a fix in an input script that reads a restart file, so that the
operation of the fix continues in an uninterrupted fashion.
The "fix_modify"_fix_modify.html {temp} and {press} options are
supported by these fixes. You can use them to assign a
"compute"_compute.html you have defined to this fix which will be used
in its thermostatting or barostatting procedure, as described above.
If you do this, note that the kinetic energy derived from the compute
temperature should be consistent with the virial term computed using
all atoms for the pressure. LAMMPS will warn you if you choose to
compute temperature on a subset of atoms.
NOTE: If both the {temp} and {press} keywords are used in a single
thermo_modify command (or in two separate commands), then the order in
which the keywords are specified is important. Note that a "pressure
compute"_compute_pressure.html defines its own temperature compute as
an argument when it is specified. The {temp} keyword will override
this (for the pressure compute being used by fix npt), but only if the
{temp} keyword comes after the {press} keyword. If the {temp} keyword
comes before the {press} keyword, then the new pressure compute
specified by the {press} keyword will be unaffected by the {temp}
setting.
The "fix_modify"_fix_modify.html {energy} option is supported by these
fixes to add the energy change induced by Nose/Hoover thermostatting
and barostatting to the system's potential energy as part of
"thermodynamic output"_thermo_style.html.
These fixes compute a global scalar and a global vector of quantities,
which can be accessed by various "output
commands"_Section_howto.html#howto_15. The scalar value calculated by
these fixes is "extensive"; the vector values are "intensive".
The scalar is the cumulative energy change due to the fix.
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.
The order of values in the global vector and their meaning is as
follows. The notation means there are tchain values for eta, followed
by tchain for eta_dot, followed by ndof for omega, etc:
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\[1\] = scalar strain energy (energy units) :ul
These fixes can ramp their external temperature and pressure over
multiple runs, using the {start} and {stop} keywords of the
"run"_run.html command. See the "run"_run.html command for details of
how to do this.
These fixes are not invoked during "energy
minimization"_minimize.html.
:line
[Restrictions:]
{X}, {y}, {z} cannot be barostatted if the associated dimension is not
periodic. {Xy}, {xz}, and {yz} can only be barostatted if the
simulation domain is triclinic and the 2nd dimension in the keyword
({y} dimension in {xy}) is periodic. {Z}, {xz}, and {yz}, cannot be
barostatted for 2D simulations. The "create_box"_create_box.html,
"read data"_read_data.html, and "read_restart"_read_restart.html
commands specify whether the simulation box is orthogonal or
non-orthogonal (triclinic) and explain the meaning of the xy,xz,yz
tilt factors.
For the {temp} keyword, the final Tstop cannot be 0.0 since it would
make the external T = 0.0 at some timestep during the simulation which
is not allowed in the Nose/Hoover formulation.
The {scaleyz yes} and {scalexz yes} keyword/value pairs can not be used
for 2D simulations. {scaleyz yes}, {scalexz yes}, and {scalexy yes} options
can only be used if the 2nd dimension in the keyword is periodic,
and if the tilt factor is not coupled to the barostat via keywords
{tri}, {yz}, {xz}, and {xy}.
These fixes can be used with dynamic groups as defined by the
"group"_group.html command. Likewise they can be used with groups to
which atoms are added or deleted over time, e.g. a deposition
simulation. However, the conservation properties of the thermostat
and barostat are defined for systems with a static set of atoms. You
may observe odd behavior if the atoms in a group vary dramatically
over time or the atom count becomes very small.
[Related commands:]
"fix nve"_fix_nve.html, "fix_modify"_fix_modify.html,
"run_style"_run_style.html
[Default:]
The keyword defaults are tchain = 3, pchain = 3, mtk = yes, tloop =
ploop = 1, nreset = 0, drag = 0.0, dilate = all, couple = none,
scaleyz = scalexz = scalexy = yes if periodic in 2nd dimension and
not coupled to barostat, otherwise no.
:line
:link(nh-Martyna)
[(Martyna)] Martyna, Tobias and Klein, J Chem Phys, 101, 4177 (1994).
:link(nh-Parrinello)
[(Parrinello)] Parrinello and Rahman, J Appl Phys, 52, 7182 (1981).
:link(nh-Tuckerman)
[(Tuckerman)] Tuckerman, Alejandre, Lopez-Rendon, Jochim, and
Martyna, J Phys A: Math Gen, 39, 5629 (2006).
:link(nh-Shinoda)
[(Shinoda)] Shinoda, Shiga, and Mikami, Phys Rev B, 69, 134103 (2004).
:link(nh-Dullweber)
[(Dullweber)] Dullweber, Leimkuhler and McLachlan, J Chem Phys, 107,
5840 (1997).

19
examples/USER/uef/README Normal file
View File

@ -0,0 +1,19 @@
This directory contains two short example scripts for the USER-UEF
package.
nvt_uniaxial:
A simulation of a WCA fluid under constant volume uniaxial strain
with stretching in the z direction, compression in the x and y
directions.The xx, yy and zz components of the pressure tensor are
written to the log file. The simulation conditions are the same
used in the paper by Thomas Hunt [http://arxiv.org/abs/1310.3905]
and should yield an zz pressure near 5 and xx/yy pressures near 10.
npt_biaxial:
A simulation of a WCA fluid under stress-controlled biaxial strain
with stretching in the x and y directions, compression in the z
direction. The zz stress is controlled using the ext keyword in fix
npt/uef. The xx yy and zz components of the pressure tensor are
written to the log file. The simulations conditions should yield
xx/yy pressures near 5 and zz pressure near 10

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,31 @@
# biaxial NPT deformation of WCA fluid
units lj
atom_style atomic
pair_style lj/cut 1.122562
read_data data.wca
pair_coeff 1 1 1.0 1.0
pair_modify shift yes
neighbor 0.5 bin
neigh_modify delay 0
change_box all triclinic
# these commads show the different methods that may be used to impose
# a constant stress through isotropic or anisotropic coupling
fix 1 all npt/uef temp 0.722 0.722 0.5 iso 10 10 5 erate 0.5 0.5 ext z
#fix 1 all npt/uef temp 0.722 0.722 0.5 z 10 10 5 erate 0.5 0.5 ext xyz
fix 2 all momentum 100 linear 1 1 1
#dump 1 all atom 25 dump.lammpstrj
#dump 2 all cfg/uef 25 dump.*.cfg mass type xs ys zs
thermo_style custom step c_1_press[1] c_1_press[2] c_1_press[3]
thermo 50
run 10000

View File

@ -0,0 +1,276 @@
LAMMPS (30 Jul 2016)
# biaxial NPT deformation of WCA fluid
units lj
atom_style atomic
pair_style lj/cut 1.122562
read_data data.wca
orthogonal box = (0 0 0) to (8.39798 8.39798 8.39798)
1 by 1 by 1 MPI processor grid
reading atoms ...
500 atoms
reading velocities ...
500 velocities
pair_coeff 1 1 1.0 1.0
pair_modify shift yes
neighbor 0.5 bin
neigh_modify delay 0
change_box all triclinic
triclinic box = (0 0 0) to (8.39798 8.39798 8.39798) with tilt (0 0 0)
# these commads show the different methods that may be used to impose
# a constant stress through isotropic or anisotropic coupling
fix 1 all npt/uef temp 0.722 0.722 0.5 iso 10 10 5 erate 0.5 0.5 ext z
#fix 1 all npt/uef temp 0.722 0.722 0.5 z 10 10 5 erate 0.5 0.5 ext xyz
fix 2 all momentum 100 linear 1 1 1
#dump 1 all atom 25 dump.lammpstrj
#dump 2 all cfg/uef 25 dump.*.cfg mass type xs ys zs
thermo_style custom step c_1_press[1] c_1_press[2] c_1_press[3]
thermo 50
run 10000
Neighbor list info ...
1 neighbor list requests
update every 1 steps, delay 0 steps, check yes
max neighbors/atom: 2000, page size: 100000
master list distance cutoff = 1.62256
ghost atom cutoff = 1.62256
binsize = 0.811281 -> bins = 11 11 11
Memory usage per processor = 2.40217 Mbytes
Step 1_press[ 1_press[ 1_press[
0 6.3937851 7.0436438 6.4461087
50 7.9020345 7.303289 14.733929
100 8.3214325 8.385843 13.166247
150 5.7168419 5.6083988 9.7224198
200 3.8875348 4.0840705 7.9912973
250 4.2933724 4.2410519 7.7200953
300 4.5452314 4.2434949 8.6709832
350 5.446489 5.6166962 11.300536
400 6.0682558 5.7787878 12.106852
450 5.3884296 5.5066688 9.9100012
500 4.8046418 4.7115986 9.9769201
550 4.9043933 4.6240966 9.319336
600 4.6843238 4.9571246 9.5325487
650 5.1952989 5.195648 9.6187047
700 5.4163364 5.2938289 10.136655
750 5.6723178 5.0670261 11.415221
800 5.9379901 5.6402916 10.815209
850 5.0695389 5.3021432 10.742859
900 4.6498962 4.7111912 9.8453523
950 4.4811641 5.170132 9.421765
1000 4.7501483 4.2420772 9.3510803
1050 4.5973379 5.2046799 9.8632975
1100 4.7879562 4.9051316 9.8658626
1150 5.0528771 5.5048545 10.110913
1200 4.9926563 5.2482081 9.9610863
1250 4.8476232 4.8498859 9.5752989
1300 5.2932038 5.0594534 10.869545
1350 5.4720421 5.0830442 10.69386
1400 4.8175566 4.9863651 10.041898
1450 4.6307145 4.5615459 9.231299
1500 5.0296259 4.5433558 8.7180513
1550 4.8708444 5.1601014 10.256791
1600 5.5098593 5.316773 10.224386
1650 5.5055907 5.0516814 10.272037
1700 4.6965552 5.2436628 9.8272905
1750 5.0212307 4.740601 8.9738802
1800 4.7756351 5.199734 9.9929449
1850 4.7107092 5.177203 10.580427
1900 5.0935608 4.5286844 9.3036832
1950 4.8035855 4.894359 9.4423987
2000 4.5643937 4.7480477 9.4384251
2050 4.9314701 4.990414 10.151815
2100 5.9828824 5.8188026 12.262691
2150 5.5337303 5.4598468 10.136112
2200 4.892172 4.8699674 9.1629905
2250 4.5680591 4.5740533 9.5633545
2300 5.0023535 4.3948659 8.9645774
2350 5.2533056 4.9803884 10.255653
2400 5.3330196 5.3888322 10.021617
2450 5.2095527 4.8765336 10.135381
2500 5.221153 5.2974568 10.2493
2550 5.385331 5.0801192 10.490479
2600 5.3274988 5.0253548 10.147587
2650 4.718677 5.2710337 9.7549521
2700 4.5811521 4.6083971 8.1923164
2750 4.4743752 4.3319737 8.8690805
2800 5.0215013 5.2262961 9.8627954
2850 6.1005107 5.5994942 11.170661
2900 5.9673524 5.362124 10.401699
2950 5.5400849 5.7523993 10.292536
3000 4.9202636 5.1210431 10.125839
3050 4.5286487 5.3586164 9.8634322
3100 4.5719961 5.1615414 9.8027972
3150 5.4091919 4.8581943 9.96938
3200 5.522125 5.3564838 9.7638407
3250 4.9019062 5.2514758 9.2993079
3300 5.2375918 5.1439012 9.4313575
3350 4.750235 4.8692016 10.54193
3400 5.5793211 5.4184157 11.021389
3450 4.9022614 5.3166498 9.4629659
3500 4.6348617 4.4650979 9.0665548
3550 4.7922405 4.8961269 10.255446
3600 4.8914457 5.1158894 9.4736084
3650 5.062771 4.6725475 10.263484
3700 5.4842823 5.7793971 10.342915
3750 5.3136012 5.063065 10.398307
3800 4.9372149 4.9270414 9.5304748
3850 5.2144752 5.1716455 9.7575725
3900 5.0892665 5.1697057 9.918052
3950 5.1124507 5.354702 9.791366
4000 5.1255084 5.1143653 10.913101
4050 5.1891698 4.9913681 9.6871728
4100 4.7663368 4.2435014 8.3815668
4150 4.8060033 4.3415868 9.6553386
4200 4.8548303 4.8006768 9.5995801
4250 5.0976366 5.2683175 10.386444
4300 5.8921937 5.5134696 10.788143
4350 5.8323871 5.5255869 11.199128
4400 5.2464655 5.0005905 10.311055
4450 4.9264849 5.2499854 10.26702
4500 4.4431895 4.536981 8.7489096
4550 4.5180914 4.2080277 8.6525529
4600 5.1782188 5.1224059 10.683341
4650 5.4156233 4.8714464 10.473939
4700 5.3107669 5.224614 10.569391
4750 4.9538022 5.2509475 10.288918
4800 4.6976945 4.8107142 9.8299772
4850 5.1227936 5.0737571 10.440452
4900 4.7580514 4.6375995 9.1971008
4950 5.0647601 4.6470735 9.583131
5000 5.196231 5.7531491 10.409807
5050 5.6691323 5.7163652 12.335701
5100 5.3603738 5.4887106 10.961712
5150 4.455028 4.6494465 9.8096968
5200 4.7596912 4.4804896 9.3762885
5250 5.3144927 5.0113772 9.553101
5300 5.3445266 4.8262035 9.1220802
5350 5.1540657 5.5982676 10.765178
5400 5.1773418 5.2684381 10.452351
5450 4.8946859 5.3283747 9.8015564
5500 5.2009608 4.7183522 9.4558009
5550 5.4158589 5.5005458 10.539505
5600 4.7196831 5.4181991 9.6439249
5650 4.8333571 4.8601728 8.9350189
5700 5.4395698 4.9730096 10.669681
5750 5.2947443 5.6973259 10.020539
5800 5.4391993 5.5255143 10.264969
5850 4.9921388 5.2643827 10.217028
5900 5.0048643 4.7952641 8.9718929
5950 5.1843818 4.5987295 9.6858944
6000 5.0343993 4.946933 9.7436708
6050 4.6202714 5.3502658 10.752915
6100 5.6914422 5.3621964 10.281827
6150 5.1928763 5.9652686 10.923881
6200 5.0030409 5.2013891 10.056308
6250 4.9699876 5.2363753 9.9964211
6300 4.9129606 4.4558458 9.0419952
6350 4.6623958 4.4078264 8.528649
6400 4.9811441 5.1183207 10.261751
6450 5.3644017 5.5153937 10.401295
6500 5.6674981 5.7427566 11.928777
6550 5.1622364 5.3212928 10.067198
6600 4.5954278 5.1645397 10.16724
6650 4.9192712 5.0413326 9.95656
6700 4.6179845 4.5656214 9.3798952
6750 4.7287495 4.5071148 8.7890116
6800 4.8600442 4.8083512 10.245595
6850 5.0515531 5.1609272 10.553855
6900 5.1159742 5.1359869 10.594699
6950 4.8908884 5.0592418 9.5698704
7000 4.7654136 4.7530776 8.9439321
7050 4.779293 4.7534957 9.7244349
7100 5.2265831 5.6869073 10.32717
7150 5.4019177 5.15174 10.457567
7200 4.9817102 5.0596098 10.337574
7250 5.1836654 5.6065238 10.723108
7300 4.2916569 4.457143 8.5419099
7350 4.3906104 4.5439294 9.0805415
7400 4.998572 5.3386063 10.491418
7450 5.1109022 5.0506801 10.636116
7500 5.0248381 5.019932 10.217023
7550 5.0109265 5.1438717 9.9032426
7600 4.6628614 4.6204146 8.9459669
7650 4.8930717 5.0650009 10.049331
7700 4.9373454 5.6265835 10.210644
7750 5.5001067 5.3133253 10.667995
7800 5.0816102 5.0125753 10.591986
7850 4.9638046 5.1969015 9.9728333
7900 4.8438207 4.9217213 8.9978809
7950 4.7318805 4.6248537 8.6806596
8000 5.2808543 5.2892613 10.932535
8050 5.9609722 5.87087 10.47602
8100 5.2190231 5.6693244 11.244536
8150 5.3481127 5.2849903 10.222845
8200 4.7833053 4.7404657 9.2034474
8250 4.5461994 4.510467 10.294452
8300 4.6025175 4.8332817 8.7967546
8350 5.0389897 5.6642908 10.243402
8400 4.8414338 4.8925143 9.3653631
8450 5.5087429 4.7830361 10.831666
8500 5.2678146 5.1697789 9.9105782
8550 5.1211843 4.9097801 9.4165956
8600 5.8239149 5.0821022 10.803261
8650 5.3620154 5.5831747 11.16202
8700 5.1625813 4.8791404 10.537681
8750 4.5622461 5.0157549 10.013227
8800 4.4051517 5.0224553 9.6364273
8850 4.1711629 4.635617 8.5470244
8900 4.7049907 5.2458435 10.100728
8950 4.8568883 5.2360772 9.2306469
9000 5.0091899 5.2203574 10.718541
9050 5.1037824 4.9022451 10.24271
9100 5.0789015 4.9331454 9.173614
9150 5.3865455 5.3427553 11.40199
9200 5.5089482 5.9423232 10.976063
9250 5.1353552 5.0650262 10.040607
9300 4.6761948 4.9155175 9.6413722
9350 4.4780834 4.3934708 8.7049819
9400 4.2561799 4.7906324 9.046134
9450 5.6162819 5.2881846 9.9040868
9500 5.7554547 5.6111262 10.23849
9550 5.4230462 5.5656045 10.908006
9600 5.5045685 4.9818892 9.8929535
9650 5.0541481 5.0183351 9.5226021
9700 4.9712829 5.2395398 9.9996693
9750 5.0960017 5.4419775 10.914719
9800 5.0790688 5.6378474 10.00789
9850 4.9661747 5.114502 9.4585052
9900 5.0133498 4.7456254 9.4572653
9950 5.3318846 4.6643122 10.096292
10000 5.2227687 4.8924305 9.5894615
Loop time of 4.42114 on 1 procs for 10000 steps with 500 atoms
Performance: 977122.661 tau/day, 2261.858 timesteps/s
99.9% CPU use with 1 MPI tasks x no OpenMP threads
MPI task timing breakdown:
Section | min time | avg time | max time |%varavg| %total
---------------------------------------------------------------
Pair | 0.72321 | 0.72321 | 0.72321 | 0.0 | 16.36
Neigh | 2.6161 | 2.6161 | 2.6161 | 0.0 | 59.17
Comm | 0.30217 | 0.30217 | 0.30217 | 0.0 | 6.83
Output | 0.0034378 | 0.0034378 | 0.0034378 | 0.0 | 0.08
Modify | 0.67004 | 0.67004 | 0.67004 | 0.0 | 15.16
Other | | 0.1062 | | | 2.40
Nlocal: 500 ave 500 max 500 min
Histogram: 1 0 0 0 0 0 0 0 0 0
Nghost: 905 ave 905 max 905 min
Histogram: 1 0 0 0 0 0 0 0 0 0
Neighs: 3340 ave 3340 max 3340 min
Histogram: 1 0 0 0 0 0 0 0 0 0
Total # of neighbors = 3340
Ave neighs/atom = 6.68
Neighbor list builds = 4580
Dangerous builds = 0
Total wall time: 0:00:04

View File

@ -0,0 +1,276 @@
LAMMPS (30 Jul 2016)
# biaxial NPT deformation of WCA fluid
units lj
atom_style atomic
pair_style lj/cut 1.122562
read_data data.wca
orthogonal box = (0 0 0) to (8.39798 8.39798 8.39798)
1 by 2 by 2 MPI processor grid
reading atoms ...
500 atoms
reading velocities ...
500 velocities
pair_coeff 1 1 1.0 1.0
pair_modify shift yes
neighbor 0.5 bin
neigh_modify delay 0
change_box all triclinic
triclinic box = (0 0 0) to (8.39798 8.39798 8.39798) with tilt (0 0 0)
# these commads show the different methods that may be used to impose
# a constant stress through isotropic or anisotropic coupling
fix 1 all npt/uef temp 0.722 0.722 0.5 iso 10 10 5 erate 0.5 0.5 ext z
#fix 1 all npt/uef temp 0.722 0.722 0.5 z 10 10 5 erate 0.5 0.5 ext xyz
fix 2 all momentum 100 linear 1 1 1
#dump 1 all atom 25 dump.lammpstrj
#dump 2 all cfg/uef 25 dump.*.cfg mass type xs ys zs
thermo_style custom step c_1_press[1] c_1_press[2] c_1_press[3]
thermo 50
run 10000
Neighbor list info ...
1 neighbor list requests
update every 1 steps, delay 0 steps, check yes
max neighbors/atom: 2000, page size: 100000
master list distance cutoff = 1.62256
ghost atom cutoff = 1.62256
binsize = 0.811281 -> bins = 11 11 11
Memory usage per processor = 2.38201 Mbytes
Step 1_press[ 1_press[ 1_press[
0 6.3937851 7.0436438 6.4461087
50 7.9020345 7.303289 14.733929
100 8.3214325 8.385843 13.166247
150 5.7168419 5.6083988 9.7224198
200 3.8875348 4.0840705 7.9912973
250 4.2933724 4.2410519 7.7200953
300 4.5452314 4.2434949 8.6709832
350 5.446489 5.6166962 11.300536
400 6.0682558 5.7787878 12.106852
450 5.3884296 5.5066688 9.9100012
500 4.8046418 4.7115986 9.9769201
550 4.9043933 4.6240966 9.319336
600 4.6843238 4.9571246 9.5325487
650 5.1952989 5.195648 9.6187047
700 5.4163364 5.2938289 10.136655
750 5.6723178 5.0670261 11.415221
800 5.9379901 5.6402916 10.815209
850 5.0695389 5.3021432 10.742859
900 4.6498961 4.7111912 9.8453525
950 4.4811637 5.170132 9.4217644
1000 4.7501491 4.2420769 9.3510789
1050 4.5973375 5.2046786 9.8633021
1100 4.7879517 4.905134 9.8658575
1150 5.0528775 5.5048673 10.110907
1200 4.9926837 5.2482072 9.961051
1250 4.8475661 4.8499052 9.5753719
1300 5.2929874 5.0593404 10.869345
1350 5.4722108 5.083063 10.693408
1400 4.816304 4.9851244 10.041255
1450 4.6280905 4.5646059 9.2298768
1500 5.01985 4.5471327 8.721625
1550 4.8741077 5.1549887 10.256565
1600 5.4916921 5.3197646 10.281538
1650 5.4772243 5.1837045 9.9982297
1700 4.9419503 5.2869766 9.5825456
1750 5.0000465 4.6358961 8.8873809
1800 5.0008968 4.9755404 10.274347
1850 5.3911106 5.0602442 10.252838
1900 5.6306791 5.5982927 11.287727
1950 5.0117663 4.9037147 9.9079668
2000 4.9080829 4.8206128 9.2645313
2050 4.7794302 4.5942332 9.22621
2100 5.1197536 4.884078 9.9557557
2150 5.5674448 4.9602998 10.825168
2200 5.9993278 5.484917 11.201052
2250 5.619781 5.2475017 10.382149
2300 4.7213112 4.5460993 10.254176
2350 4.4310098 4.6363048 8.2696199
2400 4.2798177 4.1485611 8.2037599
2450 5.0414399 5.2572888 10.126969
2500 5.2807077 5.4633007 10.424033
2550 5.4538601 5.3268172 10.06153
2600 4.9750473 5.2268468 10.433373
2650 4.8397032 5.2258654 9.8686538
2700 4.8943282 4.7637421 9.8715146
2750 4.8870682 4.7334316 9.2096451
2800 4.7611053 4.9820018 9.0797655
2850 4.826047 5.2478652 10.549013
2900 5.5999506 5.0160442 9.6169413
2950 5.6210454 5.1519961 10.23173
3000 5.2132243 5.1449194 9.9778889
3050 5.651798 5.5919186 10.772823
3100 4.8453492 4.6559497 9.175617
3150 4.359467 4.9901271 8.512659
3200 4.5724772 4.8788065 9.2580198
3250 5.3195893 5.6518901 10.562311
3300 5.4571458 5.9778537 11.804991
3350 5.1322763 5.280149 10.894715
3400 4.9393514 4.9051844 9.3048468
3450 4.6741698 4.6317669 9.4965959
3500 4.8634066 4.9618835 8.926419
3550 4.7096981 4.4196734 9.5607265
3600 5.1871839 5.3427606 9.9467134
3650 5.7619975 5.2486309 10.359674
3700 5.2563068 5.4591612 10.360825
3750 5.2492743 5.4861677 9.7648858
3800 5.0335744 5.2240642 9.6668438
3850 5.1003253 5.0865548 11.111281
3900 5.2978019 5.2126205 10.581896
3950 5.0067291 5.2645911 10.750446
4000 4.6513682 4.7407991 9.3959165
4050 4.1903728 4.4021987 8.8451881
4100 5.0089655 4.4961608 9.7363416
4150 5.1557684 5.6110293 10.804015
4200 5.2607824 5.3663361 10.663617
4250 5.0134036 5.1164765 9.3320261
4300 4.2919496 4.6118896 9.2176556
4350 4.9118467 4.9766595 9.8989104
4400 5.7694762 5.2410849 10.660891
4450 5.3793656 5.4714178 10.784611
4500 5.187077 5.0952514 9.6404449
4550 4.9522826 4.5959954 10.30975
4600 4.9512246 5.0305627 10.295169
4650 5.8017637 5.3485687 10.411051
4700 5.2499784 4.8217382 10.077816
4750 4.9961796 4.9148313 9.4660475
4800 4.8958835 4.6546838 9.1730325
4850 4.7408482 5.1862514 9.9399226
4900 4.999383 4.9513486 9.5506941
4950 5.0375134 4.63474 10.325618
5000 5.0274884 5.391675 9.592851
5050 5.3817822 5.5141892 11.43286
5100 5.533224 5.1489534 10.56325
5150 4.4884587 4.8979144 9.7439562
5200 4.7352575 4.2854079 8.8328248
5250 4.6347427 4.7579757 9.5316726
5300 4.9765192 5.1378784 9.7376039
5350 5.1899675 4.9469798 10.699202
5400 5.0178189 5.47536 9.707559
5450 4.9537295 5.1651951 9.7430567
5500 4.8448459 4.6800231 9.297621
5550 5.1703386 4.865903 10.090954
5600 5.6293349 5.4332687 10.047955
5650 5.2729245 6.180173 10.259202
5700 5.1034054 5.2082315 10.031079
5750 5.0982009 5.0158875 10.3517
5800 4.8139573 4.8454398 10.001093
5850 5.3237843 4.9860148 10.493724
5900 4.421652 4.7147453 10.30137
5950 5.3475173 4.8489279 9.7495241
6000 5.013939 4.796874 9.7433063
6050 5.1111778 5.2773346 10.245638
6100 5.1484609 5.2230939 9.9800589
6150 5.0101213 5.0702323 9.7021038
6200 4.5881964 5.2635287 9.3903355
6250 5.5340791 5.5956851 10.809705
6300 5.3121762 5.3679934 9.4683653
6350 5.072589 5.0111289 10.494452
6400 5.3134876 5.3779245 11.439347
6450 4.9930408 5.3215491 10.287925
6500 4.6925854 4.4527123 9.3141266
6550 4.5127115 4.5276223 9.2970101
6600 4.6857945 5.0039986 9.8782575
6650 5.4210348 4.6775837 10.404812
6700 5.416291 5.1705872 10.935776
6750 5.2396825 5.0306589 10.14922
6800 5.3579349 4.9442072 10.510841
6850 4.8287972 4.4930847 9.4697502
6900 4.9688784 4.5977364 10.004321
6950 4.7853293 4.5578984 9.0727469
7000 5.0589506 4.9662362 11.04237
7050 5.2657677 5.3989373 10.712811
7100 5.5373555 5.6700228 10.099215
7150 4.7085526 4.4207863 9.417028
7200 4.7480934 4.8575585 9.970864
7250 5.2732588 5.211703 9.8573725
7300 5.0152654 5.5514349 11.104278
7350 4.9255785 5.3533123 10.69476
7400 5.1041241 5.0597338 9.5918592
7450 4.7333067 4.584844 10.820426
7500 4.9157751 5.0274623 10.706391
7550 4.8231717 5.2251684 9.7721097
7600 4.5115685 4.6809903 9.1230191
7650 4.76928 5.0869557 9.2881957
7700 5.1014383 5.4733369 9.9024386
7750 5.7812792 5.6404429 10.895814
7800 5.451651 5.4137204 10.471661
7850 4.7982757 5.2043999 10.046712
7900 4.4490306 4.546108 8.3934233
7950 4.3147055 4.489834 8.8833017
8000 5.0558378 5.1022203 11.21385
8050 6.0715673 5.9289687 12.007167
8100 5.4463621 5.8686057 9.7475724
8150 4.6295786 4.5658519 8.9353979
8200 4.4109788 4.4122705 8.8574801
8250 4.9903375 5.2807872 10.024069
8300 5.2930602 5.7480682 10.33242
8350 5.6166755 5.3279586 10.761278
8400 5.2344331 5.3991078 10.261601
8450 4.9395736 4.8421048 10.544976
8500 4.8692729 4.4538669 10.38133
8550 4.7746965 4.5959252 10.413873
8600 4.4344376 4.9176179 9.0368016
8650 5.0230802 4.7795825 8.5121429
8700 4.9279145 4.8844196 10.145405
8750 5.343116 5.7462499 11.191805
8800 5.4073851 5.1952022 9.6534892
8850 5.6085471 5.1332845 10.28282
8900 4.9077946 5.1446696 9.236557
8950 4.9416647 5.2071136 10.106251
9000 5.4201564 5.3733264 11.081109
9050 5.9648951 5.5501112 12.621681
9100 4.8947991 5.2187898 10.470022
9150 4.48197 4.1036268 8.4201904
9200 4.3946543 4.3973715 8.5340163
9250 5.3021965 5.2717867 9.2560849
9300 5.1768568 5.8272523 10.232503
9350 5.7291082 5.7641611 11.622836
9400 5.5971415 6.0957826 11.948662
9450 4.6317008 4.8550521 9.7699372
9500 4.3364192 4.4197985 8.8085022
9550 4.4961662 4.5930997 9.6064493
9600 4.901858 5.3789866 10.044551
9650 5.2916208 4.9071387 9.9083075
9700 4.8995154 4.78658 9.3871144
9750 5.5045136 5.3070515 10.969147
9800 5.2729372 6.0714054 11.027892
9850 4.8794625 5.2788176 10.100819
9900 4.6173961 4.6918339 9.2090718
9950 4.7478539 4.6911854 8.6831286
10000 4.9331146 5.3771408 11.489778
Loop time of 2.62782 on 4 procs for 10000 steps with 500 atoms
Performance: 1643945.149 tau/day, 3805.429 timesteps/s
99.9% CPU use with 4 MPI tasks x no OpenMP threads
MPI task timing breakdown:
Section | min time | avg time | max time |%varavg| %total
---------------------------------------------------------------
Pair | 0.29968 | 0.30667 | 0.31341 | 1.2 | 11.67
Neigh | 1.0173 | 1.0395 | 1.0668 | 2.1 | 39.56
Comm | 0.55804 | 0.59161 | 0.62132 | 3.5 | 22.51
Output | 0.0028653 | 0.0035743 | 0.0056112 | 2.0 | 0.14
Modify | 0.5692 | 0.5732 | 0.57625 | 0.4 | 21.81
Other | | 0.1132 | | | 4.31
Nlocal: 125 ave 130 max 121 min
Histogram: 1 1 0 0 0 0 1 0 0 1
Nghost: 452.25 ave 455 max 449 min
Histogram: 1 0 0 0 0 1 1 0 0 1
Neighs: 837 ave 882 max 804 min
Histogram: 2 0 0 0 0 0 1 0 0 1
Total # of neighbors = 3348
Ave neighs/atom = 6.696
Neighbor list builds = 4598
Dangerous builds = 0
Total wall time: 0:00:02

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,28 @@
# uniaxial NVT deformation of WCA fluid
units lj
atom_style atomic
pair_style lj/cut 1.122562
read_data data.wca
pair_coeff 1 1 1.0 1.0
pair_modify shift yes
neighbor 0.5 bin
neigh_modify delay 0
change_box all triclinic
fix 1 all nvt/uef temp 0.722 0.722 0.5 erate -0.5 -0.5
fix 2 all momentum 100 linear 1 1 1
#dump 1 all atom 25 dump.lammpstrj
#dump 2 all cfg/uef 25 dump.*.cfg mass type xs ys zs
thermo_style custom step c_1_press[1] c_1_press[2] c_1_press[3]
thermo 50
run 10000

View File

@ -0,0 +1,273 @@
LAMMPS (30 Jul 2016)
# uniaxial NVT deformation of WCA fluid
units lj
atom_style atomic
pair_style lj/cut 1.122562
read_data data.wca
orthogonal box = (0 0 0) to (8.39798 8.39798 8.39798)
1 by 1 by 1 MPI processor grid
reading atoms ...
500 atoms
reading velocities ...
500 velocities
pair_coeff 1 1 1.0 1.0
pair_modify shift yes
neighbor 0.5 bin
neigh_modify delay 0
change_box all triclinic
triclinic box = (0 0 0) to (8.39798 8.39798 8.39798) with tilt (0 0 0)
fix 1 all nvt/uef temp 0.722 0.722 0.5 erate -0.5 -0.5
fix 2 all momentum 100 linear 1 1 1
#dump 1 all atom 25 dump.lammpstrj
#dump 2 all cfg/uef 25 dump.*.cfg mass type xs ys zs
thermo_style custom step c_1_press[1] c_1_press[2] c_1_press[3]
thermo 50
run 10000
Neighbor list info ...
1 neighbor list requests
update every 1 steps, delay 0 steps, check yes
max neighbors/atom: 2000, page size: 100000
master list distance cutoff = 1.62256
ghost atom cutoff = 1.62256
binsize = 0.811281 -> bins = 11 11 11
Memory usage per processor = 2.40217 Mbytes
Step 1_press[ 1_press[ 1_press[
0 6.3937851 7.0436438 6.4461087
50 10.369902 10.999889 6.5437384
100 12.411384 13.145871 7.8892802
150 12.88182 12.114068 7.5155182
200 10.375571 10.979773 6.5624056
250 10.158901 10.251273 5.4525068
300 10.011314 9.8371382 5.4031393
350 9.4890008 9.7992108 5.054963
400 9.1715116 9.2647886 4.9600208
450 9.8495961 9.3353483 4.986786
500 9.5903809 8.576173 4.8252116
550 8.8057509 9.7152078 4.9089022
600 8.9743682 10.031277 4.8924072
650 10.233852 9.3059527 5.1977058
700 9.2361906 9.6439971 5.0923763
750 10.449751 9.5911465 5.2548714
800 9.8366857 9.9873885 4.9456956
850 10.266351 9.9620134 5.0602713
900 9.6325813 9.3910946 5.1466624
950 9.1911919 9.1519006 4.8275345
1000 9.2871712 9.8508501 5.2674099
1050 9.7052035 10.291793 5.160359
1100 9.9425552 10.361827 5.5520484
1150 10.377563 10.26588 5.5997436
1200 9.6368269 10.354413 5.4137873
1250 9.2071055 9.1706334 4.9800411
1300 9.7140516 8.7257777 4.8536943
1350 10.145983 9.8247797 4.8921813
1400 9.1998975 9.6935675 5.2269871
1450 9.4838136 8.9035726 4.6867121
1500 9.066389 9.811658 4.8875316
1550 10.007083 9.8946118 5.204609
1600 9.722137 9.9291588 5.326712
1650 9.7424614 9.6995966 5.3577819
1700 9.7185135 9.5922931 5.385856
1750 9.6368481 8.1414594 5.0046079
1800 9.8065782 9.6798036 4.92473
1850 9.0463737 10.024205 5.6495695
1900 9.0774484 10.527582 5.0363426
1950 9.1691461 10.049703 4.8517514
2000 9.7619602 10.049532 5.2088038
2050 9.9203348 9.8056395 5.7699852
2100 9.1455665 9.5864018 5.1410542
2150 8.8501135 9.7917307 5.141824
2200 9.1433685 9.8168548 5.1742441
2250 9.3248968 10.454532 5.5456356
2300 10.210505 9.361499 5.0935226
2350 9.5041186 9.598986 5.2451005
2400 8.968896 9.2811921 4.7799868
2450 9.8201159 10.133892 4.9981817
2500 9.4421084 9.7875766 5.4124809
2550 9.6410643 9.9148309 5.0603288
2600 9.3810676 9.5346849 5.3233836
2650 9.2340337 8.7233538 5.0361302
2700 9.405597 9.7848488 4.7537042
2750 9.9447412 9.2366502 4.9736459
2800 10.189443 9.452684 5.624362
2850 9.6680124 9.0941543 5.0101469
2900 8.4350889 9.1595018 4.7706866
2950 9.0056117 9.3498593 4.7655963
3000 9.4795416 9.7400747 5.4705868
3050 9.6605264 9.4558374 5.1240166
3100 9.681451 9.7966554 5.3174458
3150 9.7887528 9.7371194 4.9349103
3200 9.9720054 9.5592538 5.2306417
3250 10.185023 9.9436037 5.4127312
3300 9.9670676 9.6069307 5.026261
3350 9.0090411 9.5975249 4.8881019
3400 9.6535707 9.748683 4.9933873
3450 9.7774977 9.7570511 4.8512619
3500 9.7250053 10.36386 5.4057249
3550 9.567788 9.773413 5.3936671
3600 9.2094148 9.0211247 5.2328675
3650 9.3512098 9.73407 4.576624
3700 9.159074 9.2611591 5.2996448
3750 9.4772798 8.9792211 5.1007079
3800 9.3898357 9.1150609 5.2126508
3850 9.2466312 9.1460651 4.867472
3900 9.9316993 9.3061137 5.1219265
3950 9.2550913 9.780254 5.371885
4000 10.005356 9.7328972 5.2535791
4050 9.5228242 9.5134113 5.4181393
4100 9.576808 10.082425 5.1272491
4150 10.20265 9.6667058 5.529118
4200 9.9443671 10.09427 5.6163734
4250 9.4956875 9.9462818 5.0820085
4300 10.350144 10.003702 5.1621505
4350 10.119486 9.8691507 5.4913457
4400 9.4991604 10.516185 5.2512264
4450 9.0812854 9.2835603 5.1695714
4500 9.7538478 8.5298834 4.5954607
4550 9.8920394 9.3581299 5.202587
4600 9.2694921 9.3338291 5.201958
4650 10.925818 9.5062049 4.8694531
4700 11.020014 10.130224 5.582409
4750 9.5005142 9.3571561 5.456739
4800 9.6670147 9.6628702 5.0451252
4850 9.134147 9.1308788 4.7950594
4900 9.7466206 8.6171443 4.8716275
4950 9.0397505 9.1996036 5.2010502
5000 9.6898652 9.8914655 5.3959279
5050 10.06771 9.7523891 5.3690408
5100 10.000963 9.6279379 5.4077384
5150 9.8686159 10.179702 5.0686824
5200 9.8866247 9.725152 5.4350049
5250 9.2068346 10.214424 5.3187713
5300 9.713992 9.8069045 5.496359
5350 9.423852 9.364085 5.2144606
5400 9.4350241 9.5584633 5.0339001
5450 10.555124 10.784922 5.1938072
5500 9.4147344 10.33187 5.4360602
5550 9.8514653 9.6575827 5.4959779
5600 9.3138107 9.6592624 4.941387
5650 9.1224809 8.7112257 5.0435936
5700 8.8289158 10.749686 4.8916132
5750 9.7200279 10.030606 5.2033161
5800 9.8439873 9.6289015 5.5131934
5850 9.6257294 9.4128988 4.9196038
5900 9.7490214 9.5776313 5.0301815
5950 9.1430855 10.108944 5.1406243
6000 9.3358644 9.5633737 4.9787073
6050 9.4432774 8.9464304 5.1466052
6100 8.8878373 9.5048946 4.9190238
6150 9.6451898 9.2419823 5.0159841
6200 9.5042173 8.9414307 5.2634247
6250 9.0896505 9.7230651 5.3340322
6300 8.8100599 8.8781352 5.4117914
6350 9.3104601 9.0233294 5.3136432
6400 9.368101 9.6387362 4.7833216
6450 10.334343 9.8384149 5.3606204
6500 9.8824036 10.022627 6.0857086
6550 9.7034443 10.026765 5.17604
6600 9.3757845 9.899268 5.2301359
6650 10.540821 10.4343 5.5287065
6700 9.6317649 9.8923579 5.6045768
6750 9.5982772 10.07897 5.1221451
6800 10.239883 10.189967 5.3167447
6850 10.017271 9.7680902 5.229621
6900 9.6200416 10.129301 5.1998759
6950 9.0361417 8.923798 5.1652612
7000 9.3153521 9.063054 4.6860773
7050 8.6434091 9.0363436 4.7811975
7100 9.4955395 9.3830541 5.022538
7150 9.3392402 9.1847119 5.1544622
7200 9.4676321 9.8370036 4.8854442
7250 9.5115882 10.350324 4.9780525
7300 9.6025583 9.6247917 5.473794
7350 9.8919524 10.049446 4.9816931
7400 9.6814319 9.9410894 5.265078
7450 9.4130955 10.191436 5.2531256
7500 9.8114668 8.8461635 5.0562894
7550 10.321567 9.4730124 5.2043655
7600 9.5059024 9.8330367 5.0749721
7650 10.067084 10.606423 5.5598818
7700 10.896159 10.084281 5.5159718
7750 9.754306 10.162301 5.2475876
7800 9.7278145 9.801009 5.0685504
7850 9.8639905 10.323104 5.2458864
7900 9.7246799 9.1377357 5.1841319
7950 10.381792 9.6977533 5.0977386
8000 9.7265224 9.2999829 4.7925571
8050 9.5203288 9.3144956 4.7539211
8100 9.6900973 9.6614063 5.304712
8150 9.713677 9.9154149 4.8178575
8200 9.4733597 9.8948632 5.036112
8250 9.7783036 9.9554334 5.3355682
8300 9.4034783 9.9156801 5.5539279
8350 9.2984025 9.2013949 5.0753991
8400 9.9299078 9.6166801 5.115776
8450 9.526737 9.3312125 4.7800587
8500 9.581956 10.065906 4.9756092
8550 9.2767953 9.326006 5.3024978
8600 9.799968 8.4660845 5.0199109
8650 9.8985354 10.127852 4.9098064
8700 8.7952691 10.521133 5.6840528
8750 9.8299997 9.5588553 5.3085734
8800 9.0811776 9.5704532 5.1684993
8850 9.8303571 9.7618932 5.1251259
8900 9.9238794 9.9654863 5.2999683
8950 10.851304 9.9682289 5.4133763
9000 9.5523794 9.1890766 5.1469144
9050 9.7461948 8.9611236 4.9490826
9100 10.138917 9.6757567 5.0473544
9150 9.4869835 9.4786575 5.0142464
9200 10.263518 10.079135 5.1493398
9250 9.8691684 9.0908275 5.3221203
9300 9.8586707 9.4177643 5.1525265
9350 9.3375816 9.9167208 5.4846207
9400 9.5603903 9.4813199 4.6237495
9450 10.30892 9.5217736 5.6163214
9500 9.327949 9.9831649 4.8923915
9550 9.8421656 9.3202702 5.3352046
9600 8.8543704 9.4556702 4.6430041
9650 10.103399 9.2161072 4.8658062
9700 9.507811 9.9647378 5.227369
9750 9.4988096 8.9942893 5.2491418
9800 9.8007958 9.234452 5.1740203
9850 9.6029685 10.076042 5.023107
9900 9.4035691 10.13782 5.2775777
9950 9.6517135 10.355994 5.3035779
10000 9.9157616 9.7741952 5.5269431
Loop time of 4.303 on 1 procs for 10000 steps with 500 atoms
Performance: 1003950.961 tau/day, 2323.961 timesteps/s
99.7% CPU use with 1 MPI tasks x no OpenMP threads
MPI task timing breakdown:
Section | min time | avg time | max time |%varavg| %total
---------------------------------------------------------------
Pair | 0.69667 | 0.69667 | 0.69667 | 0.0 | 16.19
Neigh | 2.699 | 2.699 | 2.699 | 0.0 | 62.72
Comm | 0.30701 | 0.30701 | 0.30701 | 0.0 | 7.13
Output | 0.003968 | 0.003968 | 0.003968 | 0.0 | 0.09
Modify | 0.49374 | 0.49374 | 0.49374 | 0.0 | 11.47
Other | | 0.1026 | | | 2.38
Nlocal: 500 ave 500 max 500 min
Histogram: 1 0 0 0 0 0 0 0 0 0
Nghost: 908 ave 908 max 908 min
Histogram: 1 0 0 0 0 0 0 0 0 0
Neighs: 3489 ave 3489 max 3489 min
Histogram: 1 0 0 0 0 0 0 0 0 0
Total # of neighbors = 3489
Ave neighs/atom = 6.978
Neighbor list builds = 4567
Dangerous builds = 0
Total wall time: 0:00:04

View File

@ -0,0 +1,273 @@
LAMMPS (30 Jul 2016)
# uniaxial NVT deformation of WCA fluid
units lj
atom_style atomic
pair_style lj/cut 1.122562
read_data data.wca
orthogonal box = (0 0 0) to (8.39798 8.39798 8.39798)
1 by 2 by 2 MPI processor grid
reading atoms ...
500 atoms
reading velocities ...
500 velocities
pair_coeff 1 1 1.0 1.0
pair_modify shift yes
neighbor 0.5 bin
neigh_modify delay 0
change_box all triclinic
triclinic box = (0 0 0) to (8.39798 8.39798 8.39798) with tilt (0 0 0)
fix 1 all nvt/uef temp 0.722 0.722 0.5 erate -0.5 -0.5
fix 2 all momentum 100 linear 1 1 1
#dump 1 all atom 25 dump.lammpstrj
#dump 2 all cfg/uef 25 dump.*.cfg mass type xs ys zs
thermo_style custom step c_1_press[1] c_1_press[2] c_1_press[3]
thermo 50
run 10000
Neighbor list info ...
1 neighbor list requests
update every 1 steps, delay 0 steps, check yes
max neighbors/atom: 2000, page size: 100000
master list distance cutoff = 1.62256
ghost atom cutoff = 1.62256
binsize = 0.811281 -> bins = 11 11 11
Memory usage per processor = 2.38201 Mbytes
Step 1_press[ 1_press[ 1_press[
0 6.3937851 7.0436438 6.4461087
50 10.369902 10.999889 6.5437384
100 12.411384 13.145871 7.8892802
150 12.88182 12.114068 7.5155182
200 10.375571 10.979773 6.5624056
250 10.158901 10.251273 5.4525068
300 10.011314 9.8371382 5.4031393
350 9.4890008 9.7992108 5.054963
400 9.1715116 9.2647886 4.9600208
450 9.8495961 9.3353483 4.986786
500 9.5903809 8.576173 4.8252116
550 8.8057509 9.7152078 4.9089022
600 8.9743682 10.031277 4.8924072
650 10.233852 9.3059527 5.1977058
700 9.2361906 9.6439971 5.0923762
750 10.449751 9.5911465 5.2548714
800 9.8366858 9.9873885 4.9456956
850 10.266351 9.9620134 5.0602713
900 9.6325811 9.3910947 5.1466627
950 9.1911905 9.1518997 4.8275335
1000 9.2871725 9.8508561 5.2674079
1050 9.7052018 10.291782 5.1603606
1100 9.942582 10.361849 5.5520591
1150 10.37757 10.265893 5.5997259
1200 9.6367107 10.354442 5.4138733
1250 9.2075329 9.1705 4.9806587
1300 9.7125232 8.724748 4.852827
1350 10.146185 9.8320894 4.8958299
1400 9.1958247 9.7053023 5.2334931
1450 9.4656613 8.9011194 4.7069541
1500 9.0964228 9.8379154 4.8889701
1550 10.074953 9.8121208 5.1614034
1600 10.14322 9.7113028 5.0901612
1650 9.9377801 9.8831912 5.2226793
1700 9.4144883 8.5248477 4.9447402
1750 9.0729219 9.612432 5.1999941
1800 10.067363 9.8211216 5.1464764
1850 9.3044429 8.9752352 5.0515339
1900 9.4123739 9.1810527 5.3356061
1950 9.3009721 10.013851 4.9527398
2000 9.7741829 10.11286 5.3818321
2050 9.6991106 9.7815812 5.1979016
2100 9.2977435 9.4310005 5.0893893
2150 10.325992 10.388415 4.9253076
2200 10.193251 10.389764 5.4164579
2250 9.9386988 9.63934 5.1685251
2300 9.3128664 10.496199 5.423297
2350 8.692096 9.761347 5.1356802
2400 9.4532892 9.2946894 5.3127538
2450 9.026436 8.8042728 4.9305279
2500 8.9458518 9.6338731 5.1530972
2550 8.9457961 9.7730997 5.1588
2600 9.4313048 9.0489105 4.9937356
2650 9.1625701 10.03039 4.9384831
2700 10.135274 9.9106295 5.1582637
2750 9.7419819 9.7329998 5.4813308
2800 9.6793568 10.137218 4.9126985
2850 9.8286116 9.8283148 5.2372177
2900 9.2766894 9.5302835 5.1206658
2950 9.6537203 9.8713609 5.2640351
3000 9.704446 10.360629 5.2470236
3050 9.289114 10.210593 4.9955164
3100 9.5854695 9.0377602 5.0387963
3150 9.4489179 9.0145734 4.9089788
3200 8.9221328 8.8805863 4.7910012
3250 8.9268792 8.6855592 4.7798689
3300 9.5280088 9.6859376 5.1021255
3350 9.7469167 9.7039449 5.3654161
3400 10.163823 10.247303 5.3206912
3450 10.328168 9.2596091 5.3903402
3500 10.280033 10.087996 5.3980267
3550 9.5278822 10.057563 4.9949376
3600 9.3705739 9.9639827 5.1315405
3650 10.003355 9.0323131 5.288539
3700 9.5814093 9.742063 4.9937322
3750 9.1121545 9.9600773 5.2621763
3800 8.4753486 9.2930472 4.8939508
3850 9.309286 9.0227214 4.9323125
3900 9.0283302 10.048011 5.0801404
3950 10.193343 10.279252 5.4390015
4000 9.5170246 9.8575174 5.3284718
4050 9.0306235 9.4210217 4.7042159
4100 9.7801264 10.267131 4.8946632
4150 10.161985 10.327002 5.3719225
4200 10.242291 9.5148633 5.2938589
4250 9.67955 10.025696 5.517063
4300 9.0818798 9.655456 5.0976568
4350 9.3181275 8.8534154 4.9252792
4400 9.4111133 8.9481402 4.8338338
4450 10.219905 10.0317 5.3278766
4500 9.9718967 9.9808168 5.2294123
4550 9.7194794 9.7613441 5.3369724
4600 9.4826038 9.5426517 5.1951956
4650 9.5794203 8.4729044 4.9375856
4700 9.6409231 10.059765 4.9659309
4750 9.0853564 9.6062246 5.1560466
4800 9.5805015 10.26319 5.1395845
4850 8.8662041 9.4757304 5.1729905
4900 9.6230855 10.239009 5.1382048
4950 10.401327 9.5494971 5.2688637
5000 10.433047 9.9017863 5.4626886
5050 10.318188 9.2998964 5.4707543
5100 9.6958274 9.206341 5.0269859
5150 9.5477552 10.099142 5.3760873
5200 9.4904189 9.4403777 5.1638292
5250 9.8421539 8.7828543 4.8612713
5300 9.7354196 9.357113 4.9059656
5350 9.9183987 9.4337973 5.2986167
5400 10.045743 9.8399757 5.0930923
5450 9.6414177 10.169944 5.3868716
5500 10.035214 9.5316451 4.912222
5550 9.16334 9.3853532 5.2319683
5600 9.5075535 9.2548959 5.4425531
5650 9.3854437 9.0700172 4.9845383
5700 9.1868937 9.3061525 4.9155762
5750 9.4785528 9.8271693 4.9974045
5800 9.7809419 10.070618 5.3699816
5850 10.791132 10.572676 5.3816834
5900 10.091884 10.036391 5.7604455
5950 9.4492785 8.9938163 4.9812227
6000 9.2296463 10.334517 5.6374553
6050 9.9339781 9.1097471 4.6847041
6100 10.369857 9.261491 5.3354256
6150 9.9444024 9.5330721 5.2413981
6200 9.1507255 9.2108005 4.7010871
6250 9.6093995 9.2275894 4.8659261
6300 9.0300283 9.149341 4.9305141
6350 9.6718904 9.5721387 4.9560051
6400 9.615362 10.030978 4.8786582
6450 10.343763 10.184481 5.2027613
6500 9.3452563 9.7249417 5.2318842
6550 9.9489414 10.373436 4.9258407
6600 10.083741 10.87974 5.3665699
6650 9.431476 9.7944015 5.4214407
6700 9.3430129 10.032417 4.8538936
6750 10.253341 9.5667637 5.3838115
6800 8.9695591 9.888476 4.7973343
6850 9.6952765 9.3339082 4.8432603
6900 9.1038139 9.6295207 4.8572214
6950 9.5374663 9.0498856 5.2316356
7000 8.6844415 9.1416318 4.9513449
7050 9.6271147 8.8341922 5.135948
7100 9.3889214 9.6771129 5.1106028
7150 9.4697432 9.9959141 4.8762717
7200 9.9545962 9.5556848 5.2760968
7250 10.153728 10.396722 5.4066282
7300 9.5633599 9.8262997 5.5238788
7350 10.476059 9.8526241 4.9928222
7400 9.5848947 9.389115 5.1177333
7450 9.3917853 9.8395056 5.5201002
7500 9.2406374 9.4598141 4.9336365
7550 9.1325284 9.0585 5.007436
7600 9.5045307 9.5164648 4.8310378
7650 9.5165952 9.5154581 5.3199138
7700 9.1167042 9.3283907 4.9548988
7750 9.5408306 10.191558 5.1889476
7800 9.2362359 9.5066276 5.4139251
7850 9.9533215 9.3418618 5.0073354
7900 9.063471 9.2389687 5.1529568
7950 9.6887619 9.3363144 5.0264365
8000 10.244559 10.352116 5.3898068
8050 10.522656 9.7844249 5.648648
8100 10.456047 10.108097 5.234203
8150 9.0497599 10.3333 5.5526068
8200 9.1341912 9.7046196 4.7491692
8250 9.3297032 9.2513325 4.9471519
8300 9.9385635 9.8432553 4.9102209
8350 9.506086 9.3628428 5.4489526
8400 9.7575572 9.6628477 4.7835143
8450 9.4234184 9.6901535 5.2506704
8500 9.1019018 9.4713605 4.9996292
8550 8.9668254 9.2297952 4.9015639
8600 10.000082 9.852912 5.1235791
8650 9.6677771 9.8825377 5.0888713
8700 9.5220305 9.6140025 5.2621374
8750 9.769165 9.1639605 4.942283
8800 10.214712 9.0544214 5.0977658
8850 10.050644 8.9450446 4.876467
8900 9.7066878 9.8028705 5.1098917
8950 9.8322209 9.5247394 5.1258681
9000 10.116755 9.9220422 5.2801505
9050 9.671068 9.448618 5.1789641
9100 8.6872235 9.8346401 4.8940421
9150 9.8181714 9.652061 4.9136383
9200 9.5400873 9.9027439 5.3147415
9250 9.2344784 9.9272383 5.397571
9300 9.0207063 9.2498921 5.0643988
9350 10.648665 9.0509298 5.0354353
9400 9.7266263 9.5319347 5.4323366
9450 9.5044169 9.7968623 5.2079039
9500 9.0459316 9.6916313 5.1584987
9550 9.1265901 10.045493 4.9476229
9600 9.896449 9.509792 5.5305989
9650 9.2957435 9.4288068 5.1885785
9700 9.6000499 8.7187335 5.0900953
9750 9.5997652 9.4810899 4.8707106
9800 9.2198937 9.7067006 5.4461186
9850 9.8794169 10.051937 5.0361319
9900 9.9783069 9.9785092 5.2066807
9950 9.0880268 9.5659803 5.3678011
10000 9.6972182 9.9076171 5.1538951
Loop time of 2.23728 on 4 procs for 10000 steps with 500 atoms
Performance: 1930919.704 tau/day, 4469.722 timesteps/s
99.8% CPU use with 4 MPI tasks x no OpenMP threads
MPI task timing breakdown:
Section | min time | avg time | max time |%varavg| %total
---------------------------------------------------------------
Pair | 0.26111 | 0.26444 | 0.26854 | 0.5 | 11.82
Neigh | 1.0268 | 1.037 | 1.0467 | 0.7 | 46.35
Comm | 0.5321 | 0.55022 | 0.56515 | 1.6 | 24.59
Output | 0.003746 | 0.0045477 | 0.006809 | 1.9 | 0.20
Modify | 0.26509 | 0.26827 | 0.27182 | 0.5 | 11.99
Other | | 0.1128 | | | 5.04
Nlocal: 125 ave 128 max 123 min
Histogram: 2 0 0 0 0 0 1 0 0 1
Nghost: 468.25 ave 470 max 467 min
Histogram: 2 0 0 0 0 0 1 0 0 1
Neighs: 869.75 ave 895 max 843 min
Histogram: 1 0 0 0 1 0 1 0 0 1
Total # of neighbors = 3479
Ave neighs/atom = 6.958
Neighbor list builds = 4555
Dangerous builds = 0
Total wall time: 0:00:02

View File

@ -63,7 +63,7 @@ PACKUSER = user-atc user-awpmd user-cgdna user-cgsdk user-colvars \
user-mgpt user-misc user-molfile \
user-netcdf user-omp user-phonon user-qmmm user-qtb \
user-quip user-reaxc user-smd user-smtbq user-sph user-tally \
user-vtk
user-uef user-vtk
PACKLIB = compress gpu kim kokkos latte meam mpiio mscg poems \
python reax voronoi \

View File

@ -0,0 +1,198 @@
/* ----------------------------------------------------------------------
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
http://lammps.sandia.gov, Sandia National Laboratories
Steve Plimpton, sjplimp@sandia.gov
Copyright (2003) Sandia Corporation. Under the terms of Contract
DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains
certain rights in this software. This software is distributed under
the GNU General Public License.
See the README file in the top-level LAMMPS directory.
Contributing author: David Nicholson (MIT)
------------------------------------------------------------------------- */
#include "mpi.h"
#include "string.h"
#include "stdlib.h"
#include "compute_pressure_uef.h"
#include "fix_nh_uef.h"
#include "update.h"
#include "domain.h"
#include "modify.h"
#include "fix.h"
#include "force.h"
#include "pair.h"
#include "bond.h"
#include "angle.h"
#include "dihedral.h"
#include "improper.h"
#include "kspace.h"
#include "error.h"
using namespace LAMMPS_NS;
/* ----------------------------------------------------------------------
* Default values for the ext flags
* ----------------------------------------------------------------------*/
ComputePressureUef::ComputePressureUef(LAMMPS *lmp, int narg, char **arg) :
ComputePressure(lmp, narg, arg)
{
ext_flags[0] = true;
ext_flags[1] = true;
ext_flags[2] = true;
in_fix=false;
}
/* ----------------------------------------------------------------------
* Check for the uef fix
* ----------------------------------------------------------------------*/
void ComputePressureUef::init()
{
ComputePressure::init();
// check to make sure the other uef fix is on
// borrowed from Pieter's nvt/sllod code
int i=0;
for (i=0; i<modify->nfix; i++)
{
if (strcmp(modify->fix[i]->style,"nvt/uef")==0)
break;
if (strcmp(modify->fix[i]->style,"npt/uef")==0)
break;
}
if (i==modify->nfix)
error->all(FLERR,"Can't use compute pressure/uef without defining a fix nvt/npt/uef");
ifix_uef=i;
((FixNHUef*) modify->fix[ifix_uef])->get_ext_flags(ext_flags);
if (strcmp(temperature->style,"temp/uef") != 0)
error->warning(FLERR,"The temperature used in compute pressure/ued is not of style temp/uef");
}
/* ----------------------------------------------------------------------
* Compute pressure in the directions i corresponding to ext_flag[i]=true
* ----------------------------------------------------------------------*/
double ComputePressureUef::compute_scalar()
{
temperature->compute_scalar();
// if all pressures are external the scalar is found as normal
if (ext_flags[0] && ext_flags[1] && ext_flags[2])
return ComputePressure::compute_scalar();
// otherwise compute the full tensor and average desired components
compute_vector();
addstep(update->ntimestep+1);
int k =0;
scalar = 0;
if (ext_flags[0])
{
scalar += vector[0];
k++;
}
if (ext_flags[1])
{
scalar += vector[1];
k++;
}
if (ext_flags[2])
{
scalar += vector[2];
k++;
}
scalar /= k;
return scalar;
}
/* ----------------------------------------------------------------------
Compute the pressure tensor in the rotated coordinate system
------------------------------------------------------------------------- */
void ComputePressureUef::compute_vector()
{
invoked_vector = update->ntimestep;
if (update->vflag_global != invoked_vector)
error->all(FLERR,"Virial was not tallied on needed timestep");
if (force->kspace && kspace_virial && force->kspace->scalar_pressure_flag)
error->all(FLERR,"Must use 'kspace_modify pressure/scalar no' for "
"tensor components with kspace_style msm");
// invoke temperature if it hasn't been already
double *ke_tensor;
if (keflag) {
if (temperature->invoked_vector != update->ntimestep)
temperature->compute_vector();
ke_tensor = temperature->vector;
}
if (dimension == 3) {
inv_volume = 1.0 / (domain->xprd * domain->yprd * domain->zprd);
virial_compute(6,3);
if (in_fix)
virial_rot(virial,rot);
else
{
double r[3][3];
( (FixNHUef*) modify->fix[ifix_uef])->get_rot(r);
virial_rot(virial,r);
}
if (keflag) {
for (int i = 0; i < 6; i++)
vector[i] = (ke_tensor[i] + virial[i]) * inv_volume * nktv2p;
} else
for (int i = 0; i < 6; i++)
vector[i] = virial[i] * inv_volume * nktv2p;
} else {
inv_volume = 1.0 / (domain->xprd * domain->yprd);
virial_compute(4,2);
if (keflag) {
vector[0] = (ke_tensor[0] + virial[0]) * inv_volume * nktv2p;
vector[1] = (ke_tensor[1] + virial[1]) * inv_volume * nktv2p;
vector[3] = (ke_tensor[3] + virial[3]) * inv_volume * nktv2p;
vector[2] = vector[4] = vector[5] = 0.0;
} else {
vector[0] = virial[0] * inv_volume * nktv2p;
vector[1] = virial[1] * inv_volume * nktv2p;
vector[3] = virial[3] * inv_volume * nktv2p;
vector[2] = vector[4] = vector[5] = 0.0;
}
}
}
/* ----------------------------------------------------------------------
* get the current rotation matrix and store it
------------------------------------------------------------------------- */
void ComputePressureUef::update_rot()
{
( (FixNHUef*) modify->fix[ifix_uef])->get_rot(rot);
}
/* ----------------------------------------------------------------------
Transform the pressure tensor to the rotated coordinate system
[P]rot = Q.[P].Q^t
------------------------------------------------------------------------- */
void ComputePressureUef::virial_rot(double *x, const double r[3][3])
{
double t[3][3];
// [00 10 20 ] [ 0 3 4 ] [00 01 02 ]
// [01 11 21 ] [ 3 1 5 ] [10 11 12 ]
// [02 12 22 ] [ 4 5 2 ] [20 21 22 ]
for (int k = 0; k<3; ++k)
{
t[0][k] = x[0]*r[0][k] + x[3]*r[1][k] + x[4]*r[2][k];
t[1][k] = x[3]*r[0][k] + x[1]*r[1][k] + x[5]*r[2][k];
t[2][k] = x[4]*r[0][k] + x[5]*r[1][k] + x[2]*r[2][k];
}
x[0] = r[0][0]*t[0][0] + r[1][0]*t[1][0] + r[2][0]*t[2][0];
x[3] = r[0][0]*t[0][1] + r[1][0]*t[1][1] + r[2][0]*t[2][1];
x[4] = r[0][0]*t[0][2] + r[1][0]*t[1][2] + r[2][0]*t[2][2];
x[1] = r[0][1]*t[0][1] + r[1][1]*t[1][1] + r[2][1]*t[2][1];
x[5] = r[0][1]*t[0][2] + r[1][1]*t[1][2] + r[2][1]*t[2][2];
x[2] = r[0][2]*t[0][2] + r[1][2]*t[1][2] + r[2][2]*t[2][2];
}

View File

@ -0,0 +1,66 @@
/* ----------------------------------------------------------------------
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
http://lammps.sandia.gov, Sandia National Laboratories
Steve Plimpton, sjplimp@sandia.gov
Copyright (2003) Sandia Corporation. Under the terms of Contract
DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains
certain rights in this software. This software is distributed under
the GNU General Public License.
See the README file in the top-level LAMMPS directory.
Contributing author: David Nicholson (MIT)
------------------------------------------------------------------------- */
#ifdef COMPUTE_CLASS
ComputeStyle(pressure/uef,ComputePressureUef)
#else
#ifndef LMP_COMPUTE_PRESSURE_UEF_H
#define LMP_COMPUTE_PRESSURE_UEF_H
#include "compute_pressure.h"
namespace LAMMPS_NS {
class ComputePressureUef : public ComputePressure {
public:
ComputePressureUef(class LAMMPS *, int, char **);
virtual ~ComputePressureUef(){}
virtual void init();
virtual void compute_vector();
virtual double compute_scalar();
void update_rot();
bool in_fix; //true if this compute is used in fix/nvt/npt
protected:
bool ext_flags[3]; // true if used in average output pressure
void virial_rot(double*,const double[3][3]);
int ifix_uef;
double rot[3][3];
};
}
#endif
#endif
/* ERROR/WARNING messages:
This class inherits most of the warnings from ComputePressure. The
only additions are:
E: Can't use compute pressure/uef without defining a fix nvt/npt/uef
Self-explanatory.
W: The temperature used in compute pressure/uef is not of style temp/uef
Self-explanatory.
*/

View File

@ -0,0 +1,110 @@
/* ----------------------------------------------------------------------
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
http://lammps.sandia.gov, Sandia National Laboratories
Steve Plimpton, sjplimp@sandia.gov
Copyright (2003) Sandia Corporation. Under the terms of Contract
DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains
certain rights in this software. This software is distributed under
the GNU General Public License.
See the README file in the top-level LAMMPS directory.
Contributing author: David Nicholson (MIT)
------------------------------------------------------------------------- */
#include "string.h"
#include "stdlib.h"
#include "compute_temp_uef.h"
#include "fix_nh_uef.h"
#include "update.h"
#include "modify.h"
#include "fix.h"
#include "error.h"
using namespace LAMMPS_NS;
/* ----------------------------------------------------------------------
* Base constructor initialized to use rotation matrix
* ----------------------------------------------------------------------*/
ComputeTempUef::ComputeTempUef(LAMMPS *lmp, int narg, char **arg) :
ComputeTemp(lmp, narg, arg)
{
rot_flag=true;
}
/* ----------------------------------------------------------------------
* Check for the uef fix
* ----------------------------------------------------------------------*/
void ComputeTempUef::init()
{
ComputeTemp::init();
// check to make sure the other uef fix is on
// borrowed from Pieter's nvt/sllod code
int i=0;
for (i=0; i<modify->nfix; i++)
{
if (strcmp(modify->fix[i]->style,"nvt/uef")==0)
break;
if (strcmp(modify->fix[i]->style,"npt/uef")==0)
break;
}
if (i==modify->nfix)
error->all(FLERR,"Can't use compute temp/uef without defining a fix nvt/npt/uef");
ifix_uef=i;
}
/* ----------------------------------------------------------------------
Compute the ke tensor in the proper coordinate system
------------------------------------------------------------------------- */
void ComputeTempUef::compute_vector()
{
ComputeTemp::compute_vector();
if (rot_flag)
{
double rot[3][3];
( (FixNHUef*) modify->fix[ifix_uef])->get_rot(rot);
virial_rot(vector,rot);
}
}
/* ----------------------------------------------------------------------
* turn the rotation matrix on or off to properly account for the
* coordinate system of the velocities
------------------------------------------------------------------------- */
void ComputeTempUef::yes_rot()
{
rot_flag =true;
}
void ComputeTempUef::no_rot()
{
rot_flag =false;
}
/* ----------------------------------------------------------------------
Transform the pressure tensor to the rotated coordinate system
[P]rot = Q.[P].Q^t
------------------------------------------------------------------------- */
void ComputeTempUef::virial_rot(double *x, const double r[3][3])
{
double t[3][3];
// [00 10 20 ] [ 0 3 4 ] [00 01 02 ]
// [01 11 21 ] [ 3 1 5 ] [10 11 12 ]
// [02 12 22 ] [ 4 5 2 ] [20 21 22 ]
for (int k = 0; k<3; ++k)
{
t[0][k] = x[0]*r[0][k] + x[3]*r[1][k] + x[4]*r[2][k];
t[1][k] = x[3]*r[0][k] + x[1]*r[1][k] + x[5]*r[2][k];
t[2][k] = x[4]*r[0][k] + x[5]*r[1][k] + x[2]*r[2][k];
}
x[0] = r[0][0]*t[0][0] + r[1][0]*t[1][0] + r[2][0]*t[2][0];
x[3] = r[0][0]*t[0][1] + r[1][0]*t[1][1] + r[2][0]*t[2][1];
x[4] = r[0][0]*t[0][2] + r[1][0]*t[1][2] + r[2][0]*t[2][2];
x[1] = r[0][1]*t[0][1] + r[1][1]*t[1][1] + r[2][1]*t[2][1];
x[5] = r[0][1]*t[0][2] + r[1][1]*t[1][2] + r[2][1]*t[2][2];
x[2] = r[0][2]*t[0][2] + r[1][2]*t[1][2] + r[2][2]*t[2][2];
}

View File

@ -0,0 +1,60 @@
/* ----------------------------------------------------------------------
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
http://lammps.sandia.gov, Sandia National Laboratories
Steve Plimpton, sjplimp@sandia.gov
Copyright (2003) Sandia Corporation. Under the terms of Contract
DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains
certain rights in this software. This software is distributed under
the GNU General Public License.
See the README file in the top-level LAMMPS directory.
Contributing author: David Nicholson (MIT)
------------------------------------------------------------------------- */
#ifdef COMPUTE_CLASS
ComputeStyle(temp/uef,ComputeTempUef)
#else
#ifndef LMP_COMPUTE_TEMP_UEF_H
#define LMP_COMPUTE_TEMP_UEF_H
#include "compute_temp.h"
namespace LAMMPS_NS {
class ComputeTempUef : public ComputeTemp {
public:
ComputeTempUef(class LAMMPS *, int, char **);
virtual ~ComputeTempUef(){}
virtual void init();
virtual void compute_vector();
void yes_rot();
void no_rot();
protected:
bool rot_flag;
void virial_rot(double*,const double[3][3]);
int ifix_uef;
};
}
#endif
#endif
/* ERROR/WARNING messages:
This class inherits most of the warnings from ComputePressure. The
only addition is:
E: Can't use compute temp/uef without defining a fix nvt/npt/uef
Self-explanatory.
*/

View File

@ -0,0 +1,113 @@
/* ----------------------------------------------------------------------
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
http://lammps.sandia.gov, Sandia National Laboratories
Steve Plimpton, sjplimp@sandia.gov
Copyright (2003) Sandia Corporation. Under the terms of Contract
DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains
certain rights in this software. This software is distributed under
the GNU General Public License.
See the README file in the top-level LAMMPS directory.
Contributing Author: David Nicholson (MIT)
------------------------------------------------------------------------- */
#include <math.h>
#include <stdlib.h>
#include <string.h>
#include "dump_cfg.h"
#include "atom.h"
#include "domain.h"
#include "modify.h"
#include "compute.h"
#include "fix.h"
#include "error.h"
#include "dump_cfg_uef.h"
#include "fix_nh_uef.h"
using namespace LAMMPS_NS;
enum{INT,DOUBLE,STRING,BIGINT}; // same as in DumpCustom
#define UNWRAPEXPAND 10.0
#define ONEFIELD 32
#define DELTA 1048576
/* ----------------------------------------------------------------------
* base method is mostly fine, just need to find the FixNHUef
* ----------------------------------------------------------------------*/
void DumpCFGUef::init_style()
{
DumpCFG::init_style();
// check to make sure the other uef fix is on
// borrowed from Pieter's nvt/sllod code
int i=0;
for (i=0; i<modify->nfix; i++)
{
if (strcmp(modify->fix[i]->style,"nvt/uef")==0)
break;
if (strcmp(modify->fix[i]->style,"npt/uef")==0)
break;
}
if (i==modify->nfix)
error->all(FLERR,"Can't use dump cfg/uef without defining a fix nvt/npt/uef");
ifix_uef=i;
}
/* ----------------------------------------------------------------------
* this is really the only difference between the base class and this one.
* since the output is in scaled coordinates, changing the simulation box
* edges to the flow frame will put coordinates in the flow frame too.
* ----------------------------------------------------------------------*/
void DumpCFGUef::write_header(bigint n)
{
// set scale factor used by AtomEye for CFG viz
// default = 1.0
// for peridynamics, set to pre-computed PD scale factor
// so PD particles mimic C atoms
// for unwrapped coords, set to UNWRAPEXPAND (10.0)
// so molecules are not split across periodic box boundaries
double box[3][3],rot[3][3];
((FixNHUef*) modify->fix[ifix_uef])->get_box(box);
((FixNHUef*) modify->fix[ifix_uef])->get_rot(rot);
// rot goes from "lab frame" to "upper triangular frame"
// it's transpose takes the simulation box to the flow frame
for (int i=0;i<3;i++)
for(int j=i+1;j<3;j++)
{
double t=rot[i][j];
rot[i][j]=rot[j][i];
rot[j][i]=t;
}
mul_m2(rot,box);
double scale = 1.0;
if (atom->peri_flag) scale = atom->pdscale;
else if (unwrapflag == 1) scale = UNWRAPEXPAND;
char str[64];
sprintf(str,"Number of particles = %s\n",BIGINT_FORMAT);
fprintf(fp,str,n);
fprintf(fp,"A = %g Angstrom (basic length-scale)\n",scale);
// in box[][] columns are cell edges
// in H0, rows are cell edges
fprintf(fp,"H0(1,1) = %g A\n",box[0][0]);
fprintf(fp,"H0(1,2) = %g A\n",box[1][0]);
fprintf(fp,"H0(1,3) = %g A\n",box[2][0]);
fprintf(fp,"H0(2,1) = %g A\n",box[0][1]);
fprintf(fp,"H0(2,2) = %g A\n",box[1][1]);
fprintf(fp,"H0(2,3) = %g A\n",box[2][1]);
fprintf(fp,"H0(3,1) = %g A\n",box[0][2]);
fprintf(fp,"H0(3,2) = %g A\n",box[1][2]);
fprintf(fp,"H0(3,3) = %g A\n",box[2][2]);
fprintf(fp,".NO_VELOCITY.\n");
fprintf(fp,"entry_count = %d\n",nfield-2);
for (int i = 0; i < nfield-5; i++)
fprintf(fp,"auxiliary[%d] = %s\n",i,auxname[i]);
}

View File

@ -0,0 +1,51 @@
/* -*- c++ -*- ----------------------------------------------------------
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
http://lammps.sandia.gov, Sandia National Laboratories
Steve Plimpton, sjplimp@sandia.gov
Copyright (2003) Sandia Corporation. Under the terms of Contract
DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains
certain rights in this software. This software is distributed under
the GNU General Public License.
See the README file in the top-level LAMMPS directory.
Contributing Author: David Nicholson (MIT)
------------------------------------------------------------------------- */
#ifdef DUMP_CLASS
DumpStyle(cfg/uef,DumpCFGUef)
#else
#ifndef LMP_DUMP_CFG_UEF_H
#define LMP_DUMP_CFG_UEF_H
#include "dump_cfg.h"
namespace LAMMPS_NS {
class DumpCFGUef : public DumpCFG {
public:
DumpCFGUef(LAMMPS *lmp, int narg, char **arg) :
DumpCFG(lmp, narg, arg){}
void init_style();
void write_header(bigint);
protected:
int ifix_uef;
};
}
#endif
#endif
/* ERROR/WARNING messages:
E: Can't use dump cfg/uef without defining a fix nvt/npt/uef
Self-explanatory.
*/

846
src/USER-UEF/fix_nh_uef.cpp Normal file
View File

@ -0,0 +1,846 @@
/* ----------------------------------------------------------------------
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
www.cs.sandia.gov/~sjplimp/lammps.html
Steve Plimpton, sjplimp@sandia.gov, Sandia National Laboratories
Copyright (2003) Sandia Corporation. Under the terms of Contract
DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains
certain rights in this software. This software is distributed under
the GNU General Public License.
See the README file in the top-level LAMMPS directory.
Contributing author: David Nicholson (MIT)
------------------------------------------------------------------------- */
#include "string.h"
#include "stdlib.h"
#include "math.h"
#include "fix_nh_uef.h"
#include "atom.h"
#include "force.h"
#include "group.h"
#include "comm.h"
#include "irregular.h"
#include "modify.h"
#include "compute.h"
#include "kspace.h"
#include "update.h"
#include "domain.h"
#include "error.h"
#include "output.h"
#include "timer.h"
#include "neighbor.h"
#include "compute_pressure_uef.h"
#include "compute_temp_uef.h"
using namespace LAMMPS_NS;
using namespace FixConst;
enum{ISO,ANISO,TRICLINIC};
/* ----------------------------------------------------------------------
Put all of the uef-only keywords at the back of arg and make narg smaller
so FixNH::FixNH() only sees the keywords it knows. Save the numer of
remaining keywords in rem.
---------------------------------------------------------------------- */
char ** FixNHUef::arg_kludge(int &narg, char **arg, int &rem)
{
int iarg = 3;
bool flags[3]= {false,false,false};
rem=0;
char *tmp[3];
while (iarg < narg)
{
if (strcmp(arg[iarg],"erate" ) == 0 && !flags[0])
{
tmp[0] = arg[iarg];
tmp[1] = arg[iarg+1];
tmp[2] = arg[iarg+2];
for (int k=iarg+3; k<narg; k++)
arg[k-3] = arg[k];
arg[narg-1] = tmp[2];
arg[narg-2] = tmp[1];
arg[narg-3] = tmp[0];
rem += 3;
flags[0] = true;
}
else if (strcmp(arg[iarg],"strain" ) == 0 && !flags[1])
{
tmp[0] = arg[iarg];
tmp[1] = arg[iarg+1];
tmp[2] = arg[iarg+2];
for (int k=iarg+3; k<narg; k++)
arg[k-3] = arg[k];
arg[narg-1] = tmp[2];
arg[narg-2] = tmp[1];
arg[narg-3] = tmp[0];
rem += 3;
flags[1] = true;
}
else if(strcmp(arg[iarg],"ext") == 0 && !flags[2])
{
tmp[0] = arg[iarg];
tmp[1] = arg[iarg+1];
for (int k=iarg+2; k<narg; k++)
arg[k-2] = arg[k];
arg[narg-1] = tmp[1];
arg[narg-2] = tmp[0];
rem += 2;
flags[2] = true;
}
else
iarg++;
}
narg -= rem;
return arg;
}
/* ----------------------------------------------------------------------
* Parse the remaing keywords, do some error checking, and initalize
* temp/pressure fixes
---------------------------------------------------------------------- */
FixNHUef::FixNHUef(LAMMPS *lmp, int narg, char **arg) :
FixNH(lmp, narg, arg_kludge(narg,arg,rem))
{
//initialization
erate[0] = erate[1] = 0;
//default values
strain[0]=strain[1]= 0;
ext_flags[0]=ext_flags[1]=ext_flags[2] = true;
// need to initialize these
omega_dot[0]=omega_dot[1]=omega_dot[2]=0;
// parse remaining input
bool erate_flag = false;
int iarg = narg;
narg += rem;
while (iarg <narg)
{
if (strcmp(arg[iarg],"erate")==0) {
if (iarg+3 > narg) error->all(FLERR,"Illegal fix nvt/npt/uef command");
erate[0] = force->numeric(FLERR,arg[iarg+1]);
erate[1] = force->numeric(FLERR,arg[iarg+2]);
erate_flag = true;
iarg += 3;
}
else if (strcmp(arg[iarg],"strain")==0) {
if (iarg+3 > narg) error->all(FLERR,"Illegal fix nvt/npt/uef command");
strain[0] = force->numeric(FLERR,arg[iarg+1]);
strain[1] = force->numeric(FLERR,arg[iarg+2]);
iarg += 3;
}
else if (strcmp(arg[iarg],"ext")==0) {
if (iarg+2 > narg) error->all(FLERR,"Illegal fix nvt/npt/uef command");
if (strcmp(arg[iarg+1],"x")==0)
ext_flags[1] = ext_flags[2] = false;
else if (strcmp(arg[iarg+1],"y")==0)
ext_flags[0] = ext_flags[2] = false;
else if (strcmp(arg[iarg+1],"z")==0)
ext_flags[0] = ext_flags[1] = false;
else if (strcmp(arg[iarg+1],"xy")==0)
ext_flags[2] = false;
else if (strcmp(arg[iarg+1],"xz")==0)
ext_flags[1] = false;
else if (strcmp(arg[iarg+1],"yz")==0)
ext_flags[0] = false;
else if (strcmp(arg[iarg+1],"xyz")!=0)
error->all(FLERR,"Illegal fix nvt/npt/uef command");
iarg += 2;
}
else
error->all(FLERR,"Illegal fix nvt/npt/uef command");
}
if (!erate_flag)
error->all(FLERR,"Keyword erate must be set for fix npt/npt/uef command");
if (mtchain_default_flag) mtchain=1;
if (!domain->triclinic)
error->all(FLERR,"Simulation box must be triclinic for fix/nvt/npt/uef");
//check for conditions that impose a deviatoric stress
if (pstyle == TRICLINIC)
error->all(FLERR,"Only normal stresses can be controlled with fix/nvt/npt/uef");
double erate_tmp[3];
erate_tmp[0]=erate[0];
erate_tmp[1]=erate[1];
erate_tmp[2]=-erate[0]-erate[1];
if (pstyle == ANISO)
{
if (!(ext_flags[0] & ext_flags[1] & ext_flags[2]))
error->all(FLERR,"The ext keyword may only be used with iso pressure control");
for (int k=0;k<3;k++)
for (int j=0;j<3;j++)
if (p_flag[k] && p_flag[j])
{
double tol = 1e-6;
if ( !nearly_equal(p_start[k],p_start[j],tol) || !nearly_equal(p_stop[k],p_stop[j],tol))
error->all(FLERR,"All controlled stresses must have the same value in fix/nvt/npt/uef");
if ( !nearly_equal(erate_tmp[k],erate_tmp[j],tol) || !nearly_equal(erate_tmp[k],erate_tmp[j],tol))
error->all(FLERR,"Dimensions with controlled stresses must have same strain rate in fix/nvt/npt/uef");
}
}
// conditions that produce a deviatoric stress have already
// been eliminated.
deviatoric_flag=0;
// need pre_exchange and irregular migration
pre_exchange_flag = 1;
irregular = new Irregular(lmp);
// flag that I change the box here (in case of nvt)
box_change_shape = 1;
// initialize the UEFBox class which computes the box at each step
uefbox = new UEF_utils::UEFBox();
uefbox->set_strain(strain[0],strain[1]);
// reset fixedpoint to the stagnation point. I don't allow fixedpoint
// to be set by the user.
fixedpoint[0] = domain->boxlo[0];
fixedpoint[1] = domain->boxlo[1];
fixedpoint[2] = domain->boxlo[2];
// Create temp and pressure computes for uef
int n = strlen(id) + 6;
id_temp = new char[n];
strcpy(id_temp,id);
strcat(id_temp,"_temp");
char **newarg = new char*[3];
newarg[0] = id_temp;
newarg[1] = (char *) "all";
newarg[2] = (char *) "temp/uef";
modify->add_compute(3,newarg);
delete [] newarg;
tcomputeflag = 1;
n = strlen(id) + 7;
id_press = new char[n];
strcpy(id_press,id);
strcat(id_press,"_press");
newarg = new char*[4];
newarg[0] = id_press;
newarg[1] = (char *) "all";
newarg[2] = (char *) "pressure/uef";
newarg[3] = id_temp;
modify->add_compute(4,newarg);
delete [] newarg;
pcomputeflag = 1;
nevery = 1;
}
/* ----------------------------------------------------------------------
* Erase the UEFBox object and get rid of the pressure compute if the nvt
* version is being used. Everything else will be done in base destructor
* ---------------------------------------------------------------------- */
FixNHUef::~FixNHUef()
{
delete uefbox;
if (pcomputeflag && !pstat_flag)
{
modify->delete_compute(id_press);
delete [] id_press;
}
}
/* ----------------------------------------------------------------------
* Make the end_of_step() routine callable
* ---------------------------------------------------------------------- */
int FixNHUef::setmask()
{
int mask = FixNH::setmask();
mask |= END_OF_STEP;
return mask;
}
/* ----------------------------------------------------------------------
* Run FixNH::init() and do more error checking. Set the pressure
* pointer in the case that the nvt version is used
* ---------------------------------------------------------------------- */
void FixNHUef::init()
{
FixNH::init();
// find conflict with fix/deform or other box chaging fixes
for (int i=0; i < modify->nfix; i++)
{
if (strcmp(modify->fix[i]->id,id) != 0)
if (modify->fix[i]->box_change_shape != 0)
error->all(FLERR,"Can't use another fix which changes box shape with fix/nvt/npt/uef");
}
// this will make the pressure compute for nvt
if (!pstat_flag)
if (pcomputeflag)
{
int icomp = modify->find_compute(id_press);
if (icomp<0)
error->all(FLERR,"Pressure ID for fix/nvt/uef doesn't exist");
pressure = modify->compute[icomp];
}
if (strcmp(pressure->style,"pressure/uef") != 0)
error->all(FLERR,"Using fix nvt/npt/uef without a compute pressure/uef");
if (strcmp(temperature->style,"temp/uef") != 0)
error->all(FLERR,"Using fix nvt/npt/uef without a compute temp/uef");
}
/* ----------------------------------------------------------------------
* Run FixNH::setup() make sure the box is OK and set the rotation matrix
* for the first step
* ---------------------------------------------------------------------- */
void FixNHUef::setup(int j)
{
double box[3][3];
double vol = domain->xprd * domain->yprd * domain->zprd;
uefbox->get_box(box,vol);
double tol = 1e-4;
// ensure the box is ok for uef
bool isok = true;
isok &= nearly_equal(domain->h[0],box[0][0],tol);
isok &= nearly_equal(domain->h[1],box[1][1],tol);
isok &= nearly_equal(domain->h[2],box[2][2],tol);
isok &= nearly_equal(domain->xy,box[0][1],tol);
isok &= nearly_equal(domain->yz,box[1][2],tol);
isok &= nearly_equal(domain->xz,box[0][2],tol);
if (!isok)
error->all(FLERR,"Initial box is not close enough to the expected uef box");
uefbox->get_rot(rot);
((ComputeTempUef*) temperature)->yes_rot();
((ComputePressureUef*) pressure)->in_fix = true;
((ComputePressureUef*) pressure)->update_rot();
FixNH::setup(j);
}
/* ----------------------------------------------------------------------
* rotate -> initial integration step -> rotate back
* ---------------------------------------------------------------------- */
void FixNHUef::initial_integrate(int vflag)
{
inv_rotate_x(rot);
inv_rotate_v(rot);
inv_rotate_f(rot);
((ComputeTempUef*) temperature)->no_rot();
FixNH::initial_integrate(vflag);
rotate_x(rot);
rotate_v(rot);
rotate_f(rot);
((ComputeTempUef*) temperature)->yes_rot();
}
/* ----------------------------------------------------------------------
* rotate -> initial integration step -> rotate back (RESPA)
* ---------------------------------------------------------------------- */
void FixNHUef::initial_integrate_respa(int vflag, int ilevel, int iloop)
{
inv_rotate_x(rot);
inv_rotate_v(rot);
inv_rotate_f(rot);
((ComputeTempUef*) temperature)->no_rot();
FixNH::initial_integrate_respa(vflag,ilevel,iloop);
rotate_x(rot);
rotate_v(rot);
rotate_f(rot);
((ComputeTempUef*) temperature)->yes_rot();
}
/* ----------------------------------------------------------------------
* rotate -> final integration step -> rotate back
* ---------------------------------------------------------------------- */
void FixNHUef::final_integrate()
{
// update rot here since it must directly follow the virial calculation
((ComputePressureUef*) pressure)->update_rot();
inv_rotate_v(rot);
inv_rotate_f(rot);
((ComputeTempUef*) temperature)->no_rot();
FixNH::final_integrate();
rotate_v(rot);
rotate_f(rot);
((ComputeTempUef*) temperature)->yes_rot();
}
/* ----------------------------------------------------------------------
* at outer level: call this->final_integrate()
* at other levels: rotate -> 2nd verlet step -> rotate back
* ---------------------------------------------------------------------- */
void FixNHUef::final_integrate_respa(int ilevel, int iloop)
{
// set timesteps by level
dtf = 0.5 * step_respa[ilevel] * force->ftm2v;
dthalf = 0.5 * step_respa[ilevel];
// outermost level - update eta_dot and omega_dot, apply via final_integrate
// all other levels - NVE update of v
if (ilevel == nlevels_respa-1) final_integrate();
else
{
inv_rotate_v(rot);
inv_rotate_f(rot);
nve_v();
rotate_v(rot);
rotate_f(rot);
}
}
/* ----------------------------------------------------------------------
SLLOD velocity update in time-reversible (i think) increments
v -> exp(-edot*dt/2)*v
v -> v +f/m*dt
v -> exp(-edot*dt/2)*v
-----------------------------------------------------------------------*/
void FixNHUef::nve_v()
{
double dtfm;
double **v = atom->v;
double **f = atom->f;
double *rmass = atom->rmass;
double *mass = atom->mass;
int *type = atom->type;
int *mask = atom->mask;
int nlocal = atom->nlocal;
double ex = erate[0]*dtf/2;
double ey = erate[1]*dtf/2;
double ez = -ex-ey;
double e0 = exp(-ex);
double e1 = exp(-ey);
double e2 = exp(-ez);
if (igroup == atom->firstgroup) nlocal = atom->nfirst;
if (rmass) {
for (int i = 0; i < nlocal; i++) {
if (mask[i] & groupbit) {
dtfm = dtf / rmass[i];
v[i][0] *= e0;
v[i][1] *= e1;
v[i][2] *= e2;
v[i][0] += dtfm*f[i][0];
v[i][1] += dtfm*f[i][1];
v[i][2] += dtfm*f[i][2];
v[i][0] *= e0;
v[i][1] *= e1;
v[i][2] *= e2;
}
}
} else {
for (int i = 0; i < nlocal; i++) {
if (mask[i] & groupbit) {
dtfm = dtf / mass[type[i]];
v[i][0] *= e0;
v[i][1] *= e1;
v[i][2] *= e2;
v[i][0] += dtfm*f[i][0];
v[i][1] += dtfm*f[i][1];
v[i][2] += dtfm*f[i][2];
v[i][0] *= e0;
v[i][1] *= e1;
v[i][2] *= e2;
}
}
}
}
/* ----------------------------------------------------------------------
Don't actually move atoms in remap(), just change the box
-----------------------------------------------------------------------*/
void FixNHUef::remap()
{
double vol = domain->xprd * domain->yprd * domain->zprd;
double domega = dto*(omega_dot[0]+omega_dot[1]+omega_dot[2])/3.;
// constant volume strain associated with barostat
// box scaling
double ex = dto*omega_dot[0]-domega;
double ey = dto*omega_dot[1]-domega;
uefbox->step_deform(ex,ey);
strain[0] += ex;
strain[1] += ey;
// volume change
vol = vol*exp(3*domega);
double box[3][3];
uefbox->get_box(box,vol);
domain->boxhi[0] = domain->boxlo[0]+box[0][0];
domain->boxhi[1] = domain->boxlo[1]+box[1][1];
domain->boxhi[2] = domain->boxlo[2]+box[2][2];
domain->xy = box[0][1];
domain->xz = box[0][2];
domain->yz = box[1][2];
domain->set_global_box();
domain->set_local_box();
uefbox->get_rot(rot);
}
/* ----------------------------------------------------------------------
SLLOD position update in time-reversible (i think) increments
x -> exp(edot*dt/2)*x
x -> x + v*dt
x -> exp(edot*dt/2)*x
-----------------------------------------------------------------------*/
void FixNHUef::nve_x()
{
double **x = atom->x;
double **v = atom->v;
int *mask = atom->mask;
int nlocal = atom->nlocal;
double ex = erate[0]*dtv;
strain[0] += ex;
double e0 = exp((ex+omega_dot[0]*dtv)/2);
double ey = erate[1]*dtv;
strain[1] += ey;
double e1 = exp((ey+omega_dot[1]*dtv)/2.);
double ez = -ex -ey;
double e2 = exp((ez+omega_dot[2]*dtv)/2.);
if (igroup == atom->firstgroup) nlocal = atom->nfirst;
// x update by full step only for atoms in group
for (int i = 0; i < nlocal; i++) {
if (mask[i] & groupbit) {
x[i][0] *= e0;
x[i][1] *= e1;
x[i][2] *= e2;
x[i][0] += dtv * v[i][0];
x[i][1] += dtv * v[i][1];
x[i][2] += dtv * v[i][2];
x[i][0] *= e0;
x[i][1] *= e1;
x[i][2] *= e2;
}
}
uefbox->step_deform(ex,ey);
double box[3][3];
double vol = domain->xprd * domain->yprd * domain->zprd;
uefbox->get_box(box,vol);
domain->boxhi[0] = domain->boxlo[0]+box[0][0];
domain->boxhi[1] = domain->boxlo[1]+box[1][1];
domain->boxhi[2] = domain->boxlo[2]+box[2][2];
domain->xy = box[0][1];
domain->xz = box[0][2];
domain->yz = box[1][2];
domain->set_global_box();
domain->set_local_box();
uefbox->get_rot(rot);
}
/* ----------------------------------------------------------------------
* Do the lattice reduction if necessary.
-----------------------------------------------------------------------*/
void FixNHUef::pre_exchange()
{
// only need to reset things if the lattice needs to be reduced
if (uefbox->reduce())
{
// go to lab frame
inv_rotate_x(rot);
inv_rotate_v(rot);
inv_rotate_f(rot);
// get & set the new box and rotation matrix
double vol = domain->xprd * domain->yprd * domain->zprd;
double box[3][3];
uefbox->get_box(box,vol);
domain->boxhi[0] = domain->boxlo[0]+box[0][0];
domain->boxhi[1] = domain->boxlo[1]+box[1][1];
domain->boxhi[2] = domain->boxlo[2]+box[2][2];
domain->xy = box[0][1];
domain->xz = box[0][2];
domain->yz = box[1][2];
domain->set_global_box();
domain->set_local_box();
uefbox->get_rot(rot);
// rotate to the new upper triangular frame
rotate_v(rot);
rotate_x(rot);
rotate_f(rot);
// put all atoms in the new box
double **x = atom->x;
imageint *image = atom->image;
int nlocal = atom->nlocal;
for (int i=0; i<nlocal; i++) domain->remap(x[i],image[i]);
// move atoms to the right processors
domain->x2lamda(atom->nlocal);
irregular->migrate_atoms();
domain->lamda2x(atom->nlocal);
}
}
/* ----------------------------------------------------------------------
* The following are routines to rotate between the lab and upper triangular
* (UT) frames. For most of the time the simulation is in the UT frame.
* To get to the lab frame, apply the inv_rotate_[..](rot) and to
* get back to the UT frame apply rotate_[..](rot).
*
* Note: the rotate_x() functions also apply a shift to/from the fixedpoint
* to make the integration a little simpler.
* ---------------------------------------------------------------------- */
void FixNHUef::rotate_x(double r[3][3])
{
double **x = atom->x;
int *mask = atom->mask;
int nlocal = atom->nlocal;
if (igroup == atom->firstgroup) nlocal = atom->nfirst;
double xn[3];
for (int i=0;i<nlocal;i++)
{
if (mask[i] & groupbit)
{
xn[0]=r[0][0]*x[i][0]+r[0][1]*x[i][1]+r[0][2]*x[i][2];
xn[1]=r[1][0]*x[i][0]+r[1][1]*x[i][1]+r[1][2]*x[i][2];
xn[2]=r[2][0]*x[i][0]+r[2][1]*x[i][1]+r[2][2]*x[i][2];
x[i][0]=xn[0]+domain->boxlo[0];
x[i][1]=xn[1]+domain->boxlo[1];
x[i][2]=xn[2]+domain->boxlo[2];
}
}
}
void FixNHUef::inv_rotate_x(double r[3][3])
{
double **x = atom->x;
int *mask = atom->mask;
int nlocal = atom->nlocal;
if (igroup == atom->firstgroup) nlocal = atom->nfirst;
double xn[3];
for (int i=0;i<nlocal;i++)
{
if (mask[i] & groupbit)
{
x[i][0] -= domain->boxlo[0];
x[i][1] -= domain->boxlo[1];
x[i][2] -= domain->boxlo[2];
xn[0]=r[0][0]*x[i][0]+r[1][0]*x[i][1]+r[2][0]*x[i][2];
xn[1]=r[0][1]*x[i][0]+r[1][1]*x[i][1]+r[2][1]*x[i][2];
xn[2]=r[0][2]*x[i][0]+r[1][2]*x[i][1]+r[2][2]*x[i][2];
x[i][0]=xn[0];
x[i][1]=xn[1];
x[i][2]=xn[2];
}
}
}
void FixNHUef::rotate_v(double r[3][3])
{
double **v = atom->v;
int *mask = atom->mask;
int nlocal = atom->nlocal;
if (igroup == atom->firstgroup) nlocal = atom->nfirst;
double vn[3];
for (int i=0;i<nlocal;i++)
{
if (mask[i] & groupbit)
{
vn[0]=r[0][0]*v[i][0]+r[0][1]*v[i][1]+r[0][2]*v[i][2];
vn[1]=r[1][0]*v[i][0]+r[1][1]*v[i][1]+r[1][2]*v[i][2];
vn[2]=r[2][0]*v[i][0]+r[2][1]*v[i][1]+r[2][2]*v[i][2];
v[i][0]=vn[0]; v[i][1]=vn[1]; v[i][2]=vn[2];
}
}
}
void FixNHUef::inv_rotate_v(double r[3][3])
{
double **v = atom->v;
int *mask = atom->mask;
int nlocal = atom->nlocal;
if (igroup == atom->firstgroup) nlocal = atom->nfirst;
double vn[3];
for (int i=0;i<nlocal;i++)
{
if (mask[i] & groupbit)
{
vn[0]=r[0][0]*v[i][0]+r[1][0]*v[i][1]+r[2][0]*v[i][2];
vn[1]=r[0][1]*v[i][0]+r[1][1]*v[i][1]+r[2][1]*v[i][2];
vn[2]=r[0][2]*v[i][0]+r[1][2]*v[i][1]+r[2][2]*v[i][2];
v[i][0]=vn[0]; v[i][1]=vn[1]; v[i][2]=vn[2];
}
}
}
void FixNHUef::rotate_f(double r[3][3])
{
double **f = atom->f;
int *mask = atom->mask;
int nlocal = atom->nlocal;
if (igroup == atom->firstgroup) nlocal = atom->nfirst;
double fn[3];
for (int i=0;i<nlocal;i++)
{
if (mask[i] & groupbit)
{
fn[0]=r[0][0]*f[i][0]+r[0][1]*f[i][1]+r[0][2]*f[i][2];
fn[1]=r[1][0]*f[i][0]+r[1][1]*f[i][1]+r[1][2]*f[i][2];
fn[2]=r[2][0]*f[i][0]+r[2][1]*f[i][1]+r[2][2]*f[i][2];
f[i][0]=fn[0]; f[i][1]=fn[1]; f[i][2]=fn[2];
}
}
}
void FixNHUef::inv_rotate_f(double r[3][3])
{
double **f = atom->f;
int *mask = atom->mask;
int nlocal = atom->nlocal;
if (igroup == atom->firstgroup) nlocal = atom->nfirst;
double fn[3];
for (int i=0;i<nlocal;i++)
{
if (mask[i] & groupbit)
{
fn[0]=r[0][0]*f[i][0]+r[1][0]*f[i][1]+r[2][0]*f[i][2];
fn[1]=r[0][1]*f[i][0]+r[1][1]*f[i][1]+r[2][1]*f[i][2];
fn[2]=r[0][2]*f[i][0]+r[1][2]*f[i][1]+r[2][2]*f[i][2];
f[i][0]=fn[0]; f[i][1]=fn[1]; f[i][2]=fn[2];
}
}
}
/* ----------------------------------------------------------------------
* Increase the size of the restart list to add in the strains
* ---------------------------------------------------------------------- */
int FixNHUef::size_restart_global()
{
return FixNH::size_restart_global() +2;
}
/* ----------------------------------------------------------------------
* Pack the strains after packing the default FixNH values
* ---------------------------------------------------------------------- */
int FixNHUef::pack_restart_data(double *list)
{
int n = FixNH::pack_restart_data(list);
list[n++] = strain[0];
list[n++] = strain[1];
return n;
}
/* ----------------------------------------------------------------------
* read and set the strains after the default FixNH values
* ---------------------------------------------------------------------- */
void FixNHUef::restart(char *buf)
{
int n = size_restart_global();
FixNH::restart(buf);
double *list = (double *) buf;
strain[0] = list[n-2];
strain[1] = list[n-1];
uefbox->set_strain(strain[0],strain[1]);
}
/* ----------------------------------------------------------------------
* If the step writes a restart, reduce the box beforehand. This makes sure
* the unique box shape can be found once the restart is read and that
* all of the atoms lie within the box.
* This may only be necessary for RESPA runs, but I'm leaving it in anyway.
* ---------------------------------------------------------------------- */
void FixNHUef::end_of_step()
{
if (update->ntimestep==output->next_restart)
{
pre_exchange();
domain->x2lamda(atom->nlocal);
domain->pbc();
timer->stamp();
comm->exchange();
comm->borders();
domain->lamda2x(atom->nlocal+atom->nghost);
timer->stamp(Timer::COMM);
neighbor->build();
timer->stamp(Timer::NEIGH);
}
}
/* ----------------------------------------------------------------------
* reduce the simulation box after a run is complete. otherwise it won't
* be possible to resume from a write_restart since the initialization of
* the simulation box requires reduced simulation box
* ---------------------------------------------------------------------- */
void FixNHUef::post_run()
{
pre_exchange();
domain->x2lamda(atom->nlocal);
domain->pbc();
timer->stamp();
comm->exchange();
comm->borders();
domain->lamda2x(atom->nlocal+atom->nghost);
timer->stamp(Timer::COMM);
neighbor->build();
timer->stamp(Timer::NEIGH);
}
/* ----------------------------------------------------------------------
* public read for rotation matrix
* ---------------------------------------------------------------------- */
void FixNHUef::get_rot(double r[3][3])
{
r[0][0] = rot[0][0];
r[0][1] = rot[0][1];
r[0][2] = rot[0][2];
r[1][0] = rot[1][0];
r[1][1] = rot[1][1];
r[1][2] = rot[1][2];
r[2][0] = rot[2][0];
r[2][1] = rot[2][1];
r[2][2] = rot[2][2];
}
/* ----------------------------------------------------------------------
* public read for ext flags
* ---------------------------------------------------------------------- */
void FixNHUef::get_ext_flags(bool* e)
{
e[0] = ext_flags[0];
e[1] = ext_flags[1];
e[2] = ext_flags[2];
}
/* ----------------------------------------------------------------------
* public read for simulation box
* ---------------------------------------------------------------------- */
void FixNHUef::get_box(double b[3][3])
{
double box[3][3];
double vol = domain->xprd * domain->yprd * domain->zprd;
uefbox->get_box(box,vol);
b[0][0] = box[0][0];
b[0][1] = box[0][1];
b[0][2] = box[0][2];
b[1][0] = box[1][0];
b[1][1] = box[1][1];
b[1][2] = box[1][2];
b[2][0] = box[2][0];
b[2][1] = box[2][1];
b[2][2] = box[2][2];
}
/* ----------------------------------------------------------------------
* comparing floats
* it's imperfect, but should work provided no infinities
* ---------------------------------------------------------------------- */
bool FixNHUef::nearly_equal(double a, double b, double epsilon)
{
double absa = fabs(a);
double absb = fabs(b);
double diff = fabs(a-b);
if (a == b) return true;
else if ( (absa+absb) < epsilon)
return diff < epsilon*epsilon;
else
return diff/(absa+absb) < epsilon;
}

125
src/USER-UEF/fix_nh_uef.h Normal file
View File

@ -0,0 +1,125 @@
/* ----------------------------------------------------------------------
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
www.cs.sandia.gov/~sjplimp/lammps.html
Steve Plimpton, sjplimp@sandia.gov, Sandia National Laboratories
Copyright (2003) Sandia Corporation. Under the terms of Contract
DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains
certain rights in this software. This software is distributed under
the GNU General Public License.
See the README file in the top-level LAMMPS directory.
Contributing Author: David Nicholson (MIT)
------------------------------------------------------------------------- */
#ifndef LMP_FIX_NH_UEF_H
#define LMP_FIX_NH_UEF_H
#include "uef_utils.h"
#include "fix_nh.h"
namespace LAMMPS_NS {
class FixNHUef : public FixNH {
public:
FixNHUef(class LAMMPS *, int, char **);
virtual ~FixNHUef();
virtual int setmask();
virtual void init();
virtual void setup(int);
virtual void pre_exchange();
virtual int pack_restart_data(double*);
virtual void restart(char *);
virtual void end_of_step();
virtual void initial_integrate(int);
virtual void final_integrate();
virtual void initial_integrate_respa(int, int, int);
virtual void final_integrate_respa(int, int);
virtual void post_run();
void get_rot(double[3][3]);
void get_ext_flags(bool*);
void get_box(double[3][3]);
protected:
virtual void remap();
virtual int size_restart_global();
virtual void nve_x();
virtual void nve_v();
char **arg_kludge(int&, char**, int&);
void rotate_x(double [3][3]);
void inv_rotate_x(double[3][3]);
void rotate_v(double[3][3]);
void inv_rotate_v(double[3][3]);
void rotate_f(double[3][3]);
void inv_rotate_f(double[3][3]);
double strain[2],erate[2]; // strain/strain rate : [e_x, e_y]
// always assume traceless e_z = -e_x-e_y
int rem; //this is for the narg kluge
UEF_utils::UEFBox *uefbox; // interface for the special simulation box
double rot[3][3]; // rotation matrix
bool ext_flags[3]; // flags for external "free surfaces"
bool nearly_equal(double,double,double);
//bool rotate_output; // experimental feature. Too many issues for now
};
}
#endif
/* ERROR/WARNING messages:
This is a base class for FixNH so it will inherit most of its error/warning messages along with the following:
E: Illegal fix nvt/npt/uef command
Self-explanatory
E: Keyword erate must be set for fix nvt/npt/uef command
Self-explanatory.
E: Simulation box must be triclinic for fix/nvt/npt/uef
Self-explanatory.
E: Only normal stresses can be controlled with fix/nvt/npt/uef
The keywords xy xz and yz cannot be used for pressure control
E: The ext keyword may only be used with iso pressure control
Self-explanatory
E: All controlled stresses must have the same value in fix/nvt/npt/uef
Stress control is only possible when the stress specified for each dimension is the same
E: Dimensions with controlled stresses must have same strain rate in fix/nvt/npt/uef
Stress-controlled dimensions with the same strain rate must have the same target stress.
E: Can't use another fix which changes box shape with fix/nvt/npt/uef
The fix npt/nvt/uef command must have full control over the box shape. You cannot use a simultaneous fix deform command, for example.
E: Pressure ID for fix/nvt/uef doesn't exist
The compute pressure introduced via fix_modify does not exist
E: Using fix nvt/npt/uef without a compute pressure/uef
Self-explanatory.
E: Using fix nvt/npt/uef without a compute temp/uef
Self-explanatory.
E: Initial box is not close enough to the expected uef box
The initial box does not correspond to the shape required by the value of the strain keyword. If the default strain value of zero was used, the initial box is not cubic.
*/

View File

@ -0,0 +1,33 @@
/* ----------------------------------------------------------------------
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
http://lammps.sandia.gov, Sandia National Laboratories
Steve Plimpton, sjplimp@sandia.gov
Copyright (2003) Sandia Corporation. Under the terms of Contract
DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains
certain rights in this software. This software is distributed under
the GNU General Public License.
See the README file in the top-level LAMMPS directory.
Contributing author: David Nicholson (MIT)
------------------------------------------------------------------------- */
#include "string.h"
#include "fix_npt_uef.h"
#include "modify.h"
#include "error.h"
using namespace LAMMPS_NS;
using namespace FixConst;
FixNPTUef::FixNPTUef(LAMMPS *lmp, int narg, char **arg) :
FixNHUef(lmp, narg, arg)
{
if (!tstat_flag)
error->all(FLERR,"Temperature control must be used with fix npt/uef");
if (!pstat_flag)
error->all(FLERR,"Pressure control must be used with fix npt/uef");
}

View File

@ -0,0 +1,50 @@
/* ----------------------------------------------------------------------
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
http://lammps.sandia.gov, Sandia National Laboratories
Steve Plimpton, sjplimp@sandia.gov
Copyright (2003) Sandia Corporation. Under the terms of Contract
DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains
certain rights in this software. This software is distributed under
the GNU General Public License.
See the README file in the top-level LAMMPS directory.
Contributing author: David Nicholson (MIT)
------------------------------------------------------------------------- */
#ifdef FIX_CLASS
FixStyle(npt/uef,FixNPTUef)
#else
#ifndef LMP_FIX_NPT_UEF_H
#define LMP_FIX_NPT_UEF_H
#include "fix_nh_uef.h"
namespace LAMMPS_NS {
class FixNPTUef : public FixNHUef {
public:
FixNPTUef(class LAMMPS *, int, char **);
~FixNPTUef() {}
};
}
#endif
#endif
/* ERROR/WARNING messages:
E: Temperature control must be used with fix npt uef
Self-explanatory.
E: Pressure control must be used with fix npt uef
Self-explanatory.
*/

View File

@ -0,0 +1,35 @@
/* ----------------------------------------------------------------------
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
http://lammps.sandia.gov, Sandia National Laboratories
Steve Plimpton, sjplimp@sandia.gov
Copyright (2003) Sandia Corporation. Under the terms of Contract
DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains
certain rights in this software. This software is distributed under
the GNU General Public License.
See the README file in the top-level LAMMPS directory.
Contributing author: David Nicholson (MIT)
------------------------------------------------------------------------- */
#include "string.h"
#include "fix_nvt_uef.h"
#include "modify.h"
#include "error.h"
using namespace LAMMPS_NS;
using namespace FixConst;
FixNVTUef::FixNVTUef(LAMMPS *lmp, int narg, char **arg) :
FixNHUef(lmp, narg, arg)
{
if (!tstat_flag)
error->all(FLERR,"Temperature control must be used with fix nvt/uef");
if (pstat_flag)
error->all(FLERR,"Pressure control can't be used with fix nvt/uef");
}

View File

@ -0,0 +1,50 @@
/* ----------------------------------------------------------------------
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
http://lammps.sandia.gov, Sandia National Laboratories
Steve Plimpton, sjplimp@sandia.gov
Copyright (2003) Sandia Corporation. Under the terms of Contract
DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains
certain rights in this software. This software is distributed under
the GNU General Public License.
See the README file in the top-level LAMMPS directory.
Contributing author: David Nicholson (MIT)
------------------------------------------------------------------------- */
#ifdef FIX_CLASS
FixStyle(nvt/uef,FixNVTUef)
#else
#ifndef LMP_FIX_NVT_UEF_H
#define LMP_FIX_NVT_UEF_H
#include "fix_nh_uef.h"
namespace LAMMPS_NS {
class FixNVTUef : public FixNHUef {
public:
FixNVTUef(class LAMMPS *, int, char **);
~FixNVTUef(){}
};
}
#endif
#endif
/* ERROR/WARNING messages:
E: Temperature control must be used with fix npt uef
Self-explanatory.
E: Pressure control must be used with fix npt uef
Self-explanatory.
*/

365
src/USER-UEF/uef_utils.cpp Normal file
View File

@ -0,0 +1,365 @@
/* ----------------------------------------------------------------------
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
http://lammps.sandia.gov, Sandia National Laboratories
Steve Plimpton, sjplimp@sandia.gov
Copyright (2003) Sandia Corporation. Under the terms of Contract
DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains
certain rights in this software. This software is distributed under
the GNU General Public License.
See the README file in the top-level LAMMPS directory.
Contributing author: David Nicholson (MIT)
-------------------------------------------------------------------------
This class contains functions to calculate the evolution of the periodic
simulation box under elongational flow as described by Matthew Dobson
in the arXiv preprint at http://arxiv.org/abs/1408.7078
Additionally, there are methods to do a lattice reduction to further
reduce the simulation box using the method of Igor Semaev at
http://link.springer.com/chapter/10.1007%2F3-540-44670-2_13
*/
#include <math.h>
#include "uef_utils.h"
using namespace LAMMPS_NS;
using namespace UEF_utils;
UEFBox::UEFBox()
{
// initial box (also an inverse eigenvector matrix of automorphisms)
double x = 0.327985277605681;
double y = 0.591009048506103;
double z = 0.736976229099578;
l0[0][0]= z; l0[0][1]= y; l0[0][2]= x;
l0[1][0]=-x; l0[1][1]= z; l0[1][2]=-y;
l0[2][0]=-y; l0[2][1]= x; l0[2][2]= z;
// spectra of the two automorpisms (log of eigenvalues)
w1[0]=-1.177725211523360;
w1[1]=-0.441448620566067;
w1[2]= 1.619173832089425;
w2[0]= w1[1];
w2[1]= w1[2];
w2[2]= w1[0];
// initialize theta
// strain = w1 * theta1 + w2 * theta2
theta[0]=theta[1]=0;
//set up the initial box l and change of basis matrix r
for (int k=0;k<3;k++)
for (int j=0;j<3;j++)
{
l[k][j] = l0[k][j];
r[j][k]=(j==k);
}
// get the initial rotation and upper triangular matrix
rotation_matrix(rot, lrot ,l);
// this is just a way to calculate the automorphisms
// themselves, which play a minor role in the calculations
// it's overkill, but only called once
double t1[3][3];
double t1i[3][3];
double t2[3][3];
double t2i[3][3];
double l0t[3][3];
for (int k=0; k<3; ++k)
for (int j=0; j<3; ++j)
{
t1[k][j] = exp(w1[k])*l0[k][j];
t1i[k][j] = exp(-w1[k])*l0[k][j];
t2[k][j] = exp(w2[k])*l0[k][j];
t2i[k][j] = exp(-w2[k])*l0[k][j];
l0t[k][j] = l0[j][k];
}
mul_m2(l0t,t1);
mul_m2(l0t,t1i);
mul_m2(l0t,t2);
mul_m2(l0t,t2i);
for (int k=0; k<3; ++k)
for (int j=0; j<3; ++j)
{
a1[k][j] = round(t1[k][j]);
a1i[k][j] = round(t1i[k][j]);
a2[k][j] = round(t2[k][j]);
a2i[k][j] = round(t2i[k][j]);
}
// winv used to transform between
// strain increments and theta increments
winv[0][0] = w2[1];
winv[0][1] = -w2[0];
winv[1][0] = -w1[1];
winv[1][1] = w1[0];
double d = w1[0]*w2[1] - w2[0]*w1[1];
for (int k=0;k<2;k++)
for (int j=0;j<2;j++)
winv[k][j] /= d;
}
// get volume-correct r basis in: basis*cbrt(vol) = q*r
void UEFBox::get_box(double x[3][3], double v)
{
v = cbrtf(v);
for (int k=0;k<3;k++)
for (int j=0;j<3;j++)
x[k][j] = lrot[k][j]*v;
}
// get rotation matrix q in: basis = q*r
void UEFBox::get_rot(double x[3][3])
{
for (int k=0;k<3;k++)
for (int j=0;j<3;j++)
x[k][j]=rot[k][j];
}
// diagonal, incompressible deformation
void UEFBox::step_deform(const double ex, const double ey)
{
// increment theta values used in the reduction
theta[0] +=winv[0][0]*ex + winv[0][1]*ey;
theta[1] +=winv[1][0]*ex + winv[1][1]*ey;
// deformation of the box. reduce() needs to
// be called regularly or calculation will become
// unstable
double eps[3];
eps[0]=ex; eps[1] = ey; eps[2] = -ex-ey;
for (int k=0;k<3;k++)
{
eps[k] = exp(eps[k]);
l[k][0] = eps[k]*l[k][0];
l[k][1] = eps[k]*l[k][1];
l[k][2] = eps[k]*l[k][2];
}
rotation_matrix(rot,lrot, l);
}
// reuduce the current basis
bool UEFBox::reduce()
{
// determine how many times to apply the automorphisms
// and find new theta values
int f1 = round(theta[0]);
int f2 = round(theta[1]);
theta[0] -= f1;
theta[1] -= f2;
// store old change or basis matrix to determine if it
// changes
int r0[3][3];
for (int k=0;k<3;k++)
for (int j=0;j<3;j++)
r0[k][j]=r[k][j];
// this modifies the old change basis matrix to
// handle the case where the automorphism transforms
// the box but the reduced basis doesn't change
// (r0 should still equal r at the end)
if (f1 > 0) for (int k=0;k<f1;k++) mul_m2 (a1,r0);
if (f1 < 0) for (int k=0;k<-f1;k++) mul_m2 (a1i,r0);
if (f2 > 0) for (int k=0;k<f2;k++) mul_m2 (a2,r0);
if (f2 < 0) for (int k=0;k<-f2;k++) mul_m2 (a2i,r0);
// robust reduction to the box defined by Dobson
for (int k=0;k<3;k++)
{
double eps = exp(theta[0]*w1[k]+theta[1]*w2[k]);
l[k][0] = eps*l0[k][0];
l[k][1] = eps*l0[k][1];
l[k][2] = eps*l0[k][2];
}
// further reduce the box using greedy reduction and check
// if it changed from the last step using the change of basis
// matrices r and r0
greedy(l,r);
rotation_matrix(rot,lrot, l);
return !mat_same(r,r0);
}
void UEFBox::set_strain(const double ex, const double ey)
{
theta[0] =winv[0][0]*ex + winv[0][1]*ey;
theta[1] =winv[1][0]*ex + winv[1][1]*ey;
theta[0] -= round(theta[0]);
theta[1] -= round(theta[1]);
for (int k=0;k<3;k++)
{
double eps = exp(theta[0]*w1[k]+theta[1]*w2[k]);
l[k][0] = eps*l0[k][0];
l[k][1] = eps*l0[k][1];
l[k][2] = eps*l0[k][2];
}
greedy(l,r);
rotation_matrix(rot,lrot, l);
}
// this is just qr reduction using householder reflections
// m is input matrix, q is a rotation, r is upper triangular
// q*m = r
void rotation_matrix(double q[3][3], double r[3][3], const double m[3][3])
{
for (int k=0;k<3;k++)
for (int j=0;j<3;j++)
r[k][j] = m[k][j];
double a = -sqrt(col_prod(r,0,0))*r[0][0]/fabs(r[0][0]);
double v[3];
v[0] = r[0][0]-a;
v[1] = r[1][0];
v[2] = r[2][0];
a = sqrt(v[0]*v[0]+v[1]*v[1]+v[2]*v[2]);
v[0] /= a; v[1] /= a; v[2] /= a;
double qt[3][3];
for (int k=0;k<3;k++)
for (int j=0;j<3;j++)
{
qt[k][j] = (k==j) - 2*v[k]*v[j];
q[k][j]= qt[k][j];
}
mul_m2(qt,r);
a = -sqrt(r[1][1]*r[1][1] + r[2][1]*r[2][1])*r[1][1]/fabs(r[1][1]);
v[0] = 0;
v[1] = r[1][1] - a;
v[2] = r[2][1];
a = sqrt(v[1]*v[1]+v[2]*v[2]);
v[1] /= a;
v[2] /= a;
for (int k=0;k<3;k++)
for (int j=0;j<3;j++)
qt[k][j] = (k==j) - 2*v[k]*v[j];
mul_m2(qt,r);
mul_m2(qt,q);
// this makes r have positive diagonals
// q*m = r <==> (-q)*m = (-r) will hold row-wise
if (r[0][0] < 0){ neg_row(q,0); neg_row(r,0); }
if (r[1][1] < 0){ neg_row(q,1); neg_row(r,1); }
if (r[2][2] < 0){ neg_row(q,2); neg_row(r,2); }
}
//sort columns in order of increasing length
void col_sort(double b[3][3],int r[3][3])
{
if (col_prod(b,0,0)>col_prod(b,1,1))
{
col_swap(b,0,1);
col_swap(r,0,1);
}
if (col_prod(b,0,0)>col_prod(b,2,2))
{
col_swap(b,0,2);
col_swap(r,0,2);
}
if (col_prod(b,1,1)>col_prod(b,2,2))
{
col_swap(b,1,2);
col_swap(r,1,2);
}
}
// 1-2 reduction (Graham-Schmidt)
void red12(double b[3][3],int r[3][3])
{
int y = round(col_prod(b,0,1)/col_prod(b,0,0));
b[0][1] -= y*b[0][0];
b[1][1] -= y*b[1][0];
b[2][1] -= y*b[2][0];
r[0][1] -= y*r[0][0];
r[1][1] -= y*r[1][0];
r[2][1] -= y*r[2][0];
if (col_prod(b,1,1) < col_prod(b,0,0))
{
col_swap(b,0,1);
col_swap(r,0,1);
red12(b,r);
}
}
// The Semaev condition for a 3-reduced basis
void red3(double b[3][3], int r[3][3])
{
double b11 = col_prod(b,0,0);
double b22 = col_prod(b,1,1);
double b12 = col_prod(b,0,1);
double b13 = col_prod(b,0,2);
double b23 = col_prod(b,1,2);
double y2 =-(b23/b22-b12/b22*b13/b11)/(1-b12/b11*b12/b22);
double y1 =-(b13/b11-b12/b11*b23/b22)/(1-b12/b11*b12/b22);
int x1=0;
int x2=0;
double min = col_prod(b,2,2);
int x1v[2];
int x2v[2];
x1v[0] = floor(y1); x1v[1] = x1v[0]+1;
x2v[0] = floor(y2); x2v[1] = x2v[0]+1;
for (int k=0;k<2;k++)
for (int j=0;j<2;j++)
{
double a[3];
a[0] = b[0][2] + x1v[k]*b[0][0] + x2v[j]*b[0][1];
a[1] = b[1][2] + x1v[k]*b[1][0] + x2v[j]*b[1][1];
a[2] = b[2][2] + x1v[k]*b[2][0] + x2v[j]*b[2][1];
double val=a[0]*a[0]+a[1]*a[1]+a[2]*a[2];
if (val<min)
{
min = val;
x1 = x1v[k];
x2 = x2v[j];
}
}
if (x1 || x2)
{
b[0][2] += x1*b[0][0] + x2*b[0][1];
b[1][2] += x1*b[1][0] + x2*b[1][1];
b[2][2] += x1*b[2][0] + x2*b[2][1];
r[0][2] += x1*r[0][0] + x2*r[0][1];
r[1][2] += x1*r[1][0] + x2*r[1][1];
r[2][2] += x1*r[2][0] + x2*r[2][1];
greedy_recurse(b,r); // note the recursion step is here
}
}
// the meat of the greedy reduction algorithm
void greedy_recurse(double b[3][3], int r[3][3])
{
col_sort(b,r);
red12(b,r);
red3(b,r); // recursive caller
}
// set r (change of basis) to be identity then reduce basis and make it unique
void greedy(double b[3][3],int r[3][3])
{
r[0][1]=r[0][2]=r[1][0]=r[1][2]=r[2][0]=r[2][1]=0;
r[0][0]=r[1][1]=r[2][2]=1;
greedy_recurse(b,r);
make_unique(b,r);
}
// A reduced basis isn't unique. This procedure will make it
// "more" unique. Degenerate cases are possible, but unlikely
// with floating point math.
void make_unique(double b[3][3], int r[3][3])
{
if (fabs(b[0][0]) < fabs(b[0][1]))
{ col_swap(b,0,1); col_swap(r,0,1); }
if (fabs(b[0][0]) < fabs(b[0][2]))
{ col_swap(b,0,2); col_swap(r,0,2); }
if (fabs(b[1][1]) < fabs(b[1][2]))
{ col_swap(b,1,2); col_swap(r,1,2); }
if (b[0][0] < 0){ neg_col(b,0); neg_col(r,0); }
if (b[1][1] < 0){ neg_col(b,1); neg_col(r,1); }
if (det(b) < 0){ neg_col(b,2); neg_col(r,2); }
}

139
src/USER-UEF/uef_utils.h Normal file
View File

@ -0,0 +1,139 @@
/* ----------------------------------------------------------------------
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
http://lammps.sandia.gov, Sandia National Laboratories
Steve Plimpton, sjplimp@sandia.gov
Copyright (2003) Sandia Corporation. Under the terms of Contract
DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains
certain rights in this software. This software is distributed under
the GNU General Public License.
See the README file in the top-level LAMMPS directory.
Contributing author: David Nicholson (MIT)
-------------------------------------------------------------------------
This class contains functions to calculate the evolution of the periodic
simulation box under elongational flow as described by Matthew Dobson
in the arXiv preprint at http://arxiv.org/abs/1408.7078
Additionally, there are methods to do a lattice reduction to further
reduce the simulation box using the method of Igor Semaev at
http://link.springer.com/chapter/10.1007%2F3-540-44670-2_13
*/
namespace LAMMPS_NS {
namespace UEF_utils {
class UEFBox
{
public:
UEFBox();
void set_strain(const double, const double);
void step_deform(const double,const double);
bool reduce();
void get_box(double[3][3], double);
void get_rot(double[3][3]);
private:
double l0[3][3]; // initial basis
double w1[3],w2[3], winv[3][3]; // omega1 and omega2 (spectra of automorphisms)
//double edot[3], delta[2];
double theta[2];
double l[3][3], rot[3][3], lrot[3][3];
int r[3][3],a1[3][3],a2[3][3],a1i[3][3],a2i[3][3];
};
// lattice reduction routines
void greedy(double[3][3],int[3][3]);
void col_sort(double[3][3],int[3][3]);
void red12(double[3][3],int[3][3]);
void greedy_recurse(double[3][3],int[3][3]);
void red3(double [3][3],int r[3][3]);
void make_unique(double[3][3],int[3][3]);
void rotation_matrix(double[3][3],double[3][3],const double [3][3]);
// A few utility functions for 3x3 arrays
template<typename T>
T col_prod(T x[3][3], int c1, int c2)
{
return x[0][c1]*x[0][c2]+x[1][c1]*x[1][c2]+x[2][c1]*x[2][c2];
}
template<typename T>
void col_swap(T x[3][3], int c1, int c2)
{
for (int k=0;k<3;k++)
{
T t = x[k][c2];
x[k][c2]=x[k][c1];
x[k][c1]=t;
}
}
template<typename T>
void neg_col(T x[3][3], int c1)
{
x[0][c1] = -x[0][c1];
x[1][c1] = -x[1][c1];
x[2][c1] = -x[2][c1];
}
template<typename T>
void neg_row(T x[3][3], int c1)
{
x[c1][0] = -x[c1][0];
x[c1][1] = -x[c1][1];
x[c1][2] = -x[c1][2];
}
template<typename T>
T det(T x[3][3])
{
double val;
val = x[0][0]*(x[1][1]*x[2][2] - x[1][2]*x[2][1]);
val -= x[0][1]*(x[1][0]*x[2][2] - x[1][2]*x[2][0]);
val += x[0][2]*(x[1][0]*x[2][1] - x[1][1]*x[2][0]);
return val;
}
template<typename T>
bool mat_same(T x1[3][3], T x2[3][3])
{
bool v = true;
for (int k=0;k<3;k++)
for (int j=0;j<3;j++)
v &= (x1[k][j]==x2[k][j]);
return v;
}
template<typename T>
void mul_m1(T m1[3][3], const T m2[3][3])
{
T t[3][3];
for (int k=0;k<3;k++)
for (int j=0;j<3;j++)
t[k][j]=m1[k][j];
for (int k=0;k<3;k++)
for (int j=0;j<3;j++)
m1[k][j] = t[k][0]*m2[0][j] + t[k][1]*m2[1][j] + t[k][2]*m2[2][j];
}
template<typename T>
void mul_m2(const T m1[3][3], T m2[3][3])
{
T t[3][3];
for (int k=0;k<3;k++)
for (int j=0;j<3;j++)
t[k][j]=m2[k][j];
for (int k=0;k<3;k++)
for (int j=0;j<3;j++)
m2[k][j] = m1[k][0]*t[0][j] + m1[k][1]*t[1][j] + m1[k][2]*t[2][j];
}
}
}