Compare commits

...

18 Commits

Author SHA1 Message Date
fb3f597f41 30Nov16 patch 2016-11-30 14:04:41 -07:00
d14814ae2e Merge pull request #289 from akohlmey/collected-updates-and-bugfixes
Collected updates and bugfixes
2016-11-30 14:02:41 -07:00
beb5a30f67 new compute global/atom command, also bug fix for descending dump sorts 2016-11-30 14:01:27 -07:00
7ddb6670c0 fix typo 2016-11-30 00:12:35 -05:00
789e62388f simplify code 2016-11-29 09:03:53 -05:00
7d098bff90 update format
(cherry picked from commit 2597185afb)
2016-11-29 09:01:36 -05:00
1d970d3cdf dihedral_nharmonic: added writing coefficient by write_data
(cherry picked from commit 618f5c6aa5)
2016-11-29 09:01:36 -05:00
42d430168b fix typo in compute cluster/atom docs
this closes #292
2016-11-29 07:24:09 -05:00
5ff5bc2a6c avoid issues detected by coverity scan 2016-11-28 21:34:35 -05:00
02ae2d218a correct broken link to USER-SMD docs PDF 2016-11-28 11:34:22 -05:00
470908fc93 explicitly disallow dynamic groups with compute rdf 2016-11-24 05:46:15 -05:00
6759630c16 bug fix for dump sort in descending order 2016-11-23 17:08:36 -07:00
87781771ba fix typo and USER-OMP support omission 2016-11-23 09:02:32 -05:00
df46b9aa38 rename compute pressure/grem to compute PRESSURE/GREM 2016-11-22 15:25:59 -05:00
647c6f00ce Merge branch 'grem-feature' of https://github.com/dstelter92/lammps into collected-updates-and-bugfixes 2016-11-22 14:51:19 -05:00
237307eda2 small typo and changes 2016-11-22 12:16:00 -05:00
d58dd4f159 bugfix when parsing mpirun 2016-11-22 12:13:20 -05:00
ae70f1090f added readme for grem examples 2016-11-22 12:05:14 -05:00
53 changed files with 1076 additions and 59 deletions

View File

@ -1,7 +1,7 @@
<!-- HTML_ONLY -->
<HEAD>
<TITLE>LAMMPS Users Manual</TITLE>
<META NAME="docnumber" CONTENT="22 Nov 2016 version">
<META NAME="docnumber" CONTENT="30 Nov 2016 version">
<META NAME="author" CONTENT="http://lammps.sandia.gov - Sandia National Laboratories">
<META NAME="copyright" CONTENT="Copyright (2003) Sandia Corporation. This software and manual is distributed under the GNU General Public License.">
</HEAD>
@ -21,7 +21,7 @@
<H1></H1>
LAMMPS Documentation :c,h3
22 Nov 2016 version :c,h4
30 Nov 2016 version :c,h4
Version info: :h4

View File

@ -632,11 +632,11 @@ USER-INTEL, k = KOKKOS, o = USER-OMP, t = OPT.
"rigid/npt (o)"_fix_rigid.html,
"rigid/nve (o)"_fix_rigid.html,
"rigid/nvt (o)"_fix_rigid.html,
<"rigid/small (o)"_fix_rigid.html,
"rigid/small/nph"_fix_rigid.html,
"rigid/small/npt"_fix_rigid.html,
"rigid/small/nve"_fix_rigid.html,
"rigid/small/nvt"_fix_rigid.html,
"rigid/small (o)"_fix_rigid.html,
"rigid/small/nph (o)"_fix_rigid.html,
"rigid/small/npt (o)"_fix_rigid.html,
"rigid/small/nve (o)"_fix_rigid.html,
"rigid/small/nvt (o)"_fix_rigid.html,
"setforce (k)"_fix_setforce.html,
"shake"_fix_shake.html,
"spring"_fix_spring.html,
@ -767,6 +767,7 @@ KOKKOS, o = USER-OMP, t = OPT.
"erotate/sphere"_compute_erotate_sphere.html,
"erotate/sphere/atom"_compute_erotate_sphere_atom.html,
"event/displace"_compute_event_displace.html,
"global/atom"_compute_global_atom.html,
"group/group"_compute_group_group.html,
"gyration"_compute_gyration.html,
"gyration/chunk"_compute_gyration_chunk.html,

View File

@ -641,7 +641,8 @@ the restarted simulation begins.
[Related commands:]
"fix ave/chunk"_fix_ave_chunk.html
"fix ave/chunk"_fix_ave_chunk.html,
"compute global/atom"_compute_global_atom.html
[Default:]

View File

@ -37,7 +37,7 @@ The neighbor list needed to compute this quantity is constructed each
time the calculation is performed (i.e. each time a snapshot of atoms
is dumped). Thus it can be inefficient to compute/dump this quantity
too frequently or to have multiple compute/dump commands, each of a
{clsuter/atom} style.
{cluster/atom} style.
NOTE: If you have a bonded system, then the settings of
"special_bonds"_special_bonds.html command can remove pairwise

View File

@ -0,0 +1,220 @@
"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 global/atom command :h3
[Syntax:]
compute ID group-ID style index input1 input2 ... :pre
ID, group-ID are documented in "compute"_compute.html command :ulb,l
global/atom = style name of this compute command :l
index = c_ID, c_ID\[N\], f_ID, f_ID\[N\], v_name :l
c_ID = per-atom vector calculated by a compute with ID
c_ID\[I\] = Ith column of per-atom array calculated by a compute with ID
f_ID = per-atom vector calculated by a fix with ID
f_ID\[I\] = Ith column of per-atom array calculated by a fix with ID
v_name = per-atom vector calculated by an atom-style variable with name :pre
one or more inputs can be listed :l
input = c_ID, c_ID\[N\], f_ID, f_ID\[N\], v_name :l
c_ID = global vector calculated by a compute with ID
c_ID\[I\] = Ith column of global array calculated by a compute with ID, I can include wildcard (see below)
f_ID = global vector calculated by a fix with ID
f_ID\[I\] = Ith column of global array calculated by a fix with ID, I can include wildcard (see below)
v_name = global vector calculated by a vector-style variable with name :pre
:ule
[Examples:]
compute 1 all global/atom c_chunk c_com\[1\\] c_com\[2\\] c_com\[3\\]
compute 1 all global/atom c_chunk c_com\[*\\] :pre
[Description:]
Define a calculation that assigns global values to each atom from
vectors or arrays of global values. The specified {index} parameter
is used to determine which global value is assigned to each atom.
The {index} parameter must reference a per-atom vector or array from a
"compute"_compute.html or "fix"_fix.html or the evaluation of an
atom-style "variable"_variable.html. Each {input} value must
reference a global vector or array from a "compute"_compute.html or
"fix"_fix.html or the evaluation of an vector-style
"variable"_variable.html. Details are given below.
The {index} value for an atom is used as a index I (from 1 to N) into
the vector associated with each of the input values. The Ith value
from the input vector becomes one output value for that atom. If the
atom is not in the specified group, or the index I < 1 or I > M, where
M is the actual length of the input vector, then an output value of
0.0 is assigned to the atom.
An example of how this command is useful, is in the context of
"chunks" which are static or dyanmic subsets of atoms. The "compute
chunk/atom"_compute_chunk_atom.html command assigns unique chunk IDs
to each atom. It's output can be used as the {index} parameter for
this command. Various other computes with "chunk" in their style
name, such as "compute com/chunk"_compute_com_chunk.html or "compute
msd/chunk"_compute_msd_chunk.html, calculate properties for each
chunk. The output of these commands are global vectors or arrays,
with one or more values per chunk, and can be used as input values for
this command. This command will then assign the global chunk value to
each atom in the chunk, producing a per-atom vector or per-atom array
as output. The per-atom values can then be output to a dump file or
used by any command that uses per-atom values from a compute as input,
as discussed in "Section 6.15"_Section_howto.html#howto_15.
As a concrete example, these commands will calculate the displacement
of each atom from the center-of-mass of the molecule it is in, and
dump those values to a dump file. In this case, each molecule is a
chunk.
compute cc1 all chunk/atom molecule
compute myChunk all com/chunk cc1
compute prop all property/atom xu yu zu
compute glob all global/atom c_cc1 c_myChunk\[*\]
variable dx atom c_prop\[1\]-c_glob\[1\]
variable dy atom c_prop\[2\]-c_glob\[2\]
variable dz atom c_prop\[3\]-c_glob\[3\]
variable dist atom sqrt(v_dx*v_dx+v_dy*v_dy+v_dz*v_dz)
dump 1 all custom 100 tmp.dump id xu yu zu c_glob\[1\] c_glob\[2\] c_glob\[3\] &
v_dx v_dy v_dz v_dist
dump_modify 1 sort id :pre
You can add these commands to the bench/in.chain script to see how
they work.
:line
Note that for input values from a compute or fix, the bracketed index
I can be specified using a wildcard asterisk with the index to
effectively specify multiple values. This takes the form "*" or "*n"
or "n*" or "m*n". If N = the size of the vector (for {mode} = scalar)
or the number of columns in the array (for {mode} = vector), then an
asterisk with no numeric values means all indices from 1 to N. A
leading asterisk means all indices from 1 to n (inclusive). A
trailing asterisk means all indices from n to N (inclusive). A middle
asterisk means all indices from m to n (inclusive).
Using a wildcard is the same as if the individual columns of the array
had been listed one by one. E.g. these 2 compute global/atom commands
are equivalent, since the "compute com/chunk"_compute_com_chunk.html
command creates a global array with 3 columns:
compute cc1 all chunk/atom molecule
compute com all com/chunk cc1
compute 1 all global/atom c_cc1 c_com\[1\] c_com\[2\] c_com\[3\]
compute 1 all global/atom c_cc1 c_com\[*\] :pre
:line
This section explains the {index} parameter. Note that it must
reference per-atom values, as contrasted with the {input} values which
must reference global values.
Note that all of these options generate floating point values. When
they are used as an index into the specified input vectors, they
simple rounded down to convert the value to integer indices. The
final values should range from 1 to N (inclusive), since they are used
to access values from N-length vectors.
If {index} begins with "c_", a compute ID must follow which has been
previously defined in the input script. The compute must generate
per-atom quantities. See the individual "compute"_compute.html doc
page for details. If no bracketed integer is appended, the per-atom
vector calculated by the compute is used. If a bracketed integer is
appended, the Ith column of the per-atom array calculated by the
compute is used. Users can also write code for their own compute
styles and "add them to LAMMPS"_Section_modify.html. See the
discussion above for how I can be specified with a wildcard asterisk
to effectively specify multiple values.
If {index} begins with "f_", a fix ID must follow which has been
previously defined in the input script. The Fix must generate
per-atom quantities. See the individual "fix"_fix.html doc page for
details. Note that some fixes only produce their values on certain
timesteps, which must be compatible with when compute global/atom
references the values, else an error results. If no bracketed integer
is appended, the per-atom vector calculated by the fix is used. If a
bracketed integer is appended, the Ith column of the per-atom array
calculated by the fix is used. Users can also write code for their
own fix style and "add them to LAMMPS"_Section_modify.html. See the
discussion above for how I can be specified with a wildcard asterisk
to effectively specify multiple values.
If {index} begins with "v_", a variable name must follow which has
been previously defined in the input script. It must be an
"atom-style variable"_variable.html. Atom-style variables can
reference thermodynamic keywords and various per-atom attributes, or
invoke other computes, fixes, or variables when they are evaluated, so
this is a very general means of generating per-atom quantities to use
as {index}.
:line
This section explains the kinds of {input} values that can be used.
Note that inputs reference global values, as contrasted with the
{index} parameter which must reference per-atom values.
If a value begins with "c_", a compute ID must follow which has been
previously defined in the input script. The compute must generate a
global vector or array. See the individual "compute"_compute.html doc
page for details. If no bracketed integer is appended, the vector
calculated by the compute is used. If a bracketed integer is
appended, the Ith column of the array calculated by the compute is
used. Users can also write code for their own compute styles and "add
them to LAMMPS"_Section_modify.html. See the discussion above for how
I can be specified with a wildcard asterisk to effectively specify
multiple values.
If a value begins with "f_", a fix ID must follow which has been
previously defined in the input script. The fix must generate a
global vector or array. See the individual "fix"_fix.html doc page
for details. Note that some fixes only produce their values on
certain timesteps, which must be compatible with when compute
global/atom references the values, else an error results. If no
bracketed integer is appended, the vector calculated by the fix is
used. If a bracketed integer is appended, the Ith column of the array
calculated by the fix is used. Users can also write code for their
own fix style and "add them to LAMMPS"_Section_modify.html. See the
discussion above for how I can be specified with a wildcard asterisk
to effectively specify multiple values.
If a value begins with "v_", a variable name must follow which has
been previously defined in the input script. It must be a
"vector-style variable"_variable.html. Vector-style variables can
reference thermodynamic keywords and various other attributes of
atoms, or invoke other computes, fixes, or variables when they are
evaluated, so this is a very general means of generating a vector of
global quantities which the {index} parameter will reference for
assignement of global values to atoms.
:line
[Output info:]
If a single input is specified this compute produces a per-atom
vector. If multiple inputs are specified, this compute produces a
per-atom array values, where the number of columns is equal to the
number of inputs specified. These values can be used by any command
that uses per-atom vector or array values from a compute as input.
See "Section 6.15"_Section_howto.html#howto_15 for an overview of
LAMMPS output options.
The per-atom vector or array values will be in whatever units the
corresponsing input values are in.
[Restrictions:] none
[Related commands:]
"compute"_compute.html, "fix"_fix.html, "variable"_variable.html,
"compute chunk/atom"_compute_chunk_atom.html, "compute
reduce"_compute_reduce.html
[Default:] none

View File

@ -27,7 +27,7 @@ contact radius is used only to prevent particles belonging to
different physical bodies from penetrating each other. It is used by
the contact pair styles, e.g., smd/hertz and smd/tri_surface.
See "this PDF guide"_USER/smd/SMD_LAMMPS_userguide.pdf to using Smooth
See "this PDF guide"_PDF/SMD_LAMMPS_userguide.pdf to using Smooth
Mach Dynamics in LAMMPS.
The value of the contact radius will be 0.0 for particles not in the

View File

@ -24,7 +24,7 @@ compute 1 all smd/damage :pre
Define a computation that calculates the damage status of SPH particles
according to the damage model which is defined via the SMD SPH pair styles, e.g., the maximum plastic strain failure criterion.
See "this PDF guide"_USER/smd/SMD_LAMMPS_userguide.pdf to use Smooth Mach Dynamics in LAMMPS.
See "this PDF guide"_PDF/SMD_LAMMPS_userguide.pdf to use Smooth Mach Dynamics in LAMMPS.
[Output Info:]

View File

@ -32,7 +32,7 @@ configuration. This compute is only really useful for debugging the
hourglass control mechanim which is part of the Total-Lagrangian SPH
pair style.
See "this PDF guide"_USER/smd/SMD_LAMMPS_userguide.pdf to use Smooth
See "this PDF guide"_PDF/SMD_LAMMPS_userguide.pdf to use Smooth
Mach Dynamics in LAMMPS.
[Output Info:]

View File

@ -24,7 +24,7 @@ compute 1 all smd/internal/energy :pre
Define a computation which outputs the per-particle enthalpy, i.e.,
the sum of potential energy and heat.
See "this PDF guide"_USER/smd/SMD_LAMMPS_userguide.pdf to use Smooth
See "this PDF guide"_PDF/SMD_LAMMPS_userguide.pdf to use Smooth
Mach Dynamics in LAMMPS.
[Output Info:]

View File

@ -25,7 +25,7 @@ Define a computation that outputs the equivalent plastic strain per
particle. This command is only meaningful if a material model with
plasticity is defined.
See "this PDF guide"_USER/smd/SMD_LAMMPS_userguide.pdf to use Smooth
See "this PDF guide"_PDF/SMD_LAMMPS_userguide.pdf to use Smooth
Mach Dynamics in LAMMPS.
[Output Info:]

View File

@ -25,7 +25,7 @@ Define a computation that outputs the time rate of the equivalent
plastic strain. This command is only meaningful if a material model
with plasticity is defined.
See "this PDF guide"_USER/smd/SMD_LAMMPS_userguide.pdf to use Smooth
See "this PDF guide"_PDF/SMD_LAMMPS_userguide.pdf to use Smooth
Mach Dynamics in LAMMPS.
[Output Info:]

View File

@ -26,7 +26,7 @@ The mass density is the mass of a particle which is constant during
the course of a simulation, divided by its volume, which can change
due to mechanical deformation.
See "this PDF guide"_USER/smd/SMD_LAMMPS_userguide.pdf to use Smooth
See "this PDF guide"_PDF/SMD_LAMMPS_userguide.pdf to use Smooth
Mach Dynamics in LAMMPS.
[Output info:]

View File

@ -25,7 +25,7 @@ Define a computation that calculates the deformation gradient. It is
only meaningful for particles which interact according to the
Total-Lagrangian SPH pair style.
See "this PDF guide"_USER/smd/SMD_LAMMPS_userguide.pdf to use Smooth
See "this PDF guide"_PDF/SMD_LAMMPS_userguide.pdf to use Smooth
Mach Dynamics in LAMMPS.
[Output info:]

View File

@ -30,7 +30,7 @@ time step. This calculation is performed automatically in the
relevant SPH pair styles and this compute only serves to make the
stable time increment accessible for output purposes.
See "this PDF guide"_USER/smd/SMD_LAMMPS_userguide.pdf to using Smooth
See "this PDF guide"_PDF/SMD_LAMMPS_userguide.pdf to using Smooth
Mach Dynamics in LAMMPS.
[Output info:]

View File

@ -25,7 +25,7 @@ Define a computation that calculates the number of particles inside of
the smoothing kernel radius for particles interacting via the
Total-Lagrangian SPH pair style.
See "this PDF guide"_USER/smd/SMD_LAMMPS_userguide.pdf to using Smooth
See "this PDF guide"_PDF/SMD_LAMMPS_userguide.pdf to using Smooth
Mach Dynamics in LAMMPS.
[Output info:]

View File

@ -26,7 +26,7 @@ associated with a particle as a rotated ellipsoid. It is only
meaningful for particles which interact according to the
Total-Lagrangian SPH pair style.
See "this PDF guide"_USER/smd/SMD_LAMMPS_userguide.pdf to use Smooth
See "this PDF guide"_PDF/SMD_LAMMPS_userguide.pdf to use Smooth
Mach Dynamics in LAMMPS.
[Output info:]

View File

@ -24,7 +24,7 @@ compute 1 all smd/tlsph/strain :pre
Define a computation that calculates the Green-Lagrange strain tensor
for particles interacting via the Total-Lagrangian SPH pair style.
See "this PDF guide"_USER/smd/SMD_LAMMPS_userguide.pdf to using Smooth
See "this PDF guide"_PDF/SMD_LAMMPS_userguide.pdf to using Smooth
Mach Dynamics in LAMMPS.
[Output info:]

View File

@ -24,7 +24,7 @@ compute 1 all smd/tlsph/strain/rate :pre
Define a computation that calculates the rate of the strain tensor for
particles interacting via the Total-Lagrangian SPH pair style.
See "this PDF guide"_USER/smd/SMD_LAMMPS_userguide.pdf to using Smooth
See "this PDF guide"_PDF/SMD_LAMMPS_userguide.pdf to using Smooth
Mach Dynamics in LAMMPS.
[Output info:]

View File

@ -24,7 +24,7 @@ compute 1 all smd/tlsph/stress :pre
Define a computation that outputs the Cauchy stress tensor for
particles interacting via the Total-Lagrangian SPH pair style.
See "this PDF guide"_USER/smd/SMD_LAMMPS_userguide.pdf to using Smooth
See "this PDF guide"_PDF/SMD_LAMMPS_userguide.pdf to using Smooth
Mach Dynamics in LAMMPS.
[Output info:]

View File

@ -25,7 +25,7 @@ Define a computation that returns the coordinates of the vertices
corresponding to the triangle-elements of a mesh created by the "fix
smd/wall_surface"_fix_smd_wall_surface.html.
See "this PDF guide"_USER/smd/SMD_LAMMPS_userguide.pdf to using Smooth
See "this PDF guide"_PDF/SMD_LAMMPS_userguide.pdf to using Smooth
Mach Dynamics in LAMMPS.
[Output info:]

View File

@ -25,7 +25,7 @@ Define a computation that returns the number of neighbor particles
inside of the smoothing kernel radius for particles interacting via
the updated Lagrangian SPH pair style.
See "this PDF guide"_USER/smd/SMD_LAMMPS_userguide.pdf to using Smooth
See "this PDF guide"_PDF/SMD_LAMMPS_userguide.pdf to using Smooth
Mach Dynamics in LAMMPS.
[Output info:]

View File

@ -24,7 +24,7 @@ compute 1 all smd/ulsph/strain :pre
Define a computation that outputs the logarithmic strain tensor. for
particles interacting via the updated Lagrangian SPH pair style.
See "this PDF guide"_USER/smd/SMD_LAMMPS_userguide.pdf to using Smooth
See "this PDF guide"_PDF/SMD_LAMMPS_userguide.pdf to using Smooth
Mach Dynamics in LAMMPS.
[Output info:]

View File

@ -25,7 +25,7 @@ Define a computation that outputs the rate of the logarithmic strain
tensor for particles interacting via the updated Lagrangian SPH pair
style.
See "this PDF guide"_USER/smd/SMD_LAMMPS_userguide.pdf to using Smooth
See "this PDF guide"_PDF/SMD_LAMMPS_userguide.pdf to using Smooth
Mach Dynamics in LAMMPS.
[Output info:]

View File

@ -23,7 +23,7 @@ compute 1 all smd/ulsph/stress :pre
Define a computation that outputs the Cauchy stress tensor.
See "this PDF guide"_USER/smd/SMD_LAMMPS_userguide.pdf to using Smooth
See "this PDF guide"_PDF/SMD_LAMMPS_userguide.pdf to using Smooth
Mach Dynamics in LAMMPS.
[Output info:]

View File

@ -24,7 +24,7 @@ compute 1 all smd/vol :pre
Define a computation that provides the per-particle volume and the sum
of the per-particle volumes of the group for which the fix is defined.
See "this PDF guide"_USER/smd/SMD_LAMMPS_userguide.pdf to using Smooth
See "this PDF guide"_PDF/SMD_LAMMPS_userguide.pdf to using Smooth
Mach Dynamics in LAMMPS.
[Output info:]

View File

@ -36,7 +36,7 @@ stable maximum time step.
This fix inquires the minimum stable time increment across all particles contained in the group for which this
fix is defined. An additional safety factor {s_fact} is applied to the time increment.
See "this PDF guide"_USER/smd/SMD_LAMMPS_userguide.pdf to use Smooth Mach Dynamics in LAMMPS.
See "this PDF guide"_PDF/SMD_LAMMPS_userguide.pdf to use Smooth Mach Dynamics in LAMMPS.
[Restart, fix_modify, output, run start/stop, minimize info:]

View File

@ -32,7 +32,7 @@ fix 1 all smd/integrate_tlsph limit_velocity 1000 :pre
The fix performs explicit time integration for particles which interact according with the Total-Lagrangian SPH pair style.
See "this PDF guide"_USER/smd/SMD_LAMMPS_userguide.pdf to using Smooth Mach Dynamics in LAMMPS.
See "this PDF guide"_PDF/SMD_LAMMPS_userguide.pdf to using Smooth Mach Dynamics in LAMMPS.
The {limit_velocity} keyword will control the velocity, scaling the norm of
the velocity vector to max_vel in case it exceeds this velocity limit.

View File

@ -34,7 +34,7 @@ fix 1 all smd/integrate_ulsph limit_velocity 1000 :pre
[Description:]
The fix performs explicit time integration for particles which interact with the updated Lagrangian SPH pair style.
See "this PDF guide"_USER/smd/SMD_LAMMPS_userguide.pdf to using Smooth Mach Dynamics in LAMMPS.
See "this PDF guide"_PDF/SMD_LAMMPS_userguide.pdf to using Smooth Mach Dynamics in LAMMPS.
The {adjust_radius} keyword activates dynamic adjustment of the per-particle SPH smoothing kernel radius such that the number of neighbors per particles remains
within the interval {min_nn} to {max_nn}. The parameter {adjust_radius_factor} determines the amount of adjustment per timestep. Typical values are

View File

@ -55,7 +55,7 @@ specified. This style also sets the velocity of each particle to (omega cross
Rperp) where omega is its angular velocity around the rotation axis and
Rperp is a perpendicular vector from the rotation axis to the particle.
See "this PDF guide"_USER/smd/SMD_LAMMPS_userguide.pdf to using Smooth Mach Dynamics in LAMMPS.
See "this PDF guide"_PDF/SMD_LAMMPS_userguide.pdf to using Smooth Mach Dynamics in LAMMPS.
[Restart, fix_modify, output, run start/stop, minimize info:]

View File

@ -37,7 +37,7 @@ It is possible to move the triangulated surface via the "smd/move_tri_surf"_fix_
Immediately after a .STL file has been read, the simulation needs to be run for 0 timesteps in order to properly register the new particles
in the system. See the "funnel_flow" example in the USER-SMD examples directory.
See "this PDF guide"_USER/smd/SMD_LAMMPS_userguide.pdf to use Smooth Mach Dynamics in LAMMPS.
See "this PDF guide"_PDF/SMD_LAMMPS_userguide.pdf to use Smooth Mach Dynamics in LAMMPS.
[Restart, fix_modify, output, run start/stop, minimize info:]

View File

@ -311,6 +311,7 @@ compute_erotate_sphere.html
compute_erotate_sphere_atom.html
compute_event_displace.html
compute_fep.html
compute_global_atom.html
compute_group_group.html
compute_gyration.html
compute_gyration_chunk.html

View File

@ -39,7 +39,7 @@ invocation of the {tlsph} for a solid body would consist of an equation of state
the pressure (the diagonal components of the stress tensor), and a material model to compute shear
stresses (the off-diagonal components of the stress tensor). Damage and failure models can also be added.
Please see the "SMD user guide"_USER/smd/SMD_LAMMPS_userguide.pdf for a complete listing of the possible keywords and material models.
Please see the "SMD user guide"_PDF/SMD_LAMMPS_userguide.pdf for a complete listing of the possible keywords and material models.
:line

View File

@ -43,7 +43,7 @@ stresses (the off-diagonal components of the stress tensor).
Note that the use of *GRADIENT_CORRECTION can lead to severe numerical instabilities. For a general fluid simulation, *NO_GRADIENT_CORRECTION is recommended.
Please see the "SMD user guide"_USER/smd/SMD_LAMMPS_userguide.pdf for a complete listing of the possible keywords and material models.
Please see the "SMD user guide"_PDF/SMD_LAMMPS_userguide.pdf for a complete listing of the possible keywords and material models.
:line

View File

@ -0,0 +1,81 @@
Generalized Replica Exchange Method (gREM) examples
===================================================
Examples:
---------------------------------------------------
lj-single:
This example is the simplest case scenario utilizing the generalized
ensemble defined by fix_grem. It utilizes only 1 replica and requires
the LAMMPS executable to be run as usual:
mpirun -np 4 lmp_mpi -in in.gREM-npt
./lmp_serial -in in.gREM-nvt
While this does not obtain any information about Ts(H), it is most similar to
a microcanonical simulation and "single-replica gREM" can be useful for
studying non-equilibrium processes as well.
lj-6rep:
This example utilizes an external python script to handle swaps between
replicas. Included is run.sh, which requires the path to your LAMMPS
executable. The python script is fragile as it relies on parsing output files
from the LAMMPS run and moving LAMMPS data files between directories. Use
caution if modifying this example further. If complied with mpi, multiple
processors can be used as:
./run.sh $NUM_PROCS
a serial run is completed simply as
./run.sh 1
where the executable provided must be serial if "1" is provided as the number
of procs. While this external replica exchange module is quite slow and
inefficient, it allows for many replicas to be used on a single processor.
While here there are only 6 replicas, this example could be extended to >100
replicas while still using a serial compilation. This is also beneficial for
running on high performance nodes with few cores to complete a full-scale gREM
simulation with a large number of replicas.
A quick note on efficiency: frequent exchanges slow down this script
substantially because LAMMPS is restarted every exchange attempt. The script
works best for large systems with infrequent exchanges.
lj-temper:
This is an example using the internal replica exchange module. While fast
in comparison to the python version, it requires substantial resources
(at least 1 proc per replica). Instead of stopping LAMMPS every exchange
attempt, all replicas are run concurrently, and exchanges take place
internally. This requires use of LAMMPS partition mode, via the command
line using the -p flag. Input files require world type variables defining
the parameters of each replica. The included example with 4 replicas must
run on at least 4 procs, in that case LAMMPS could be initiated as:
mpirun -np 4 lmp_mpi -p 4x1 -in in.gREM-temper
spawning 4 partitions with 1 replica each. Multiple procs per replica could
be used. In the case of a 16 system with 4 replicas, the
following logic could be used:
mpirun -np 16 lmp_mpi -p 4x4 -in in.gREM-temper
Once started, a universe log file will be created as well as log files for
each replica. The universe (log.lammps) contains exchange information, while
the replicas (*/log.lammps.*) contains the thermo_output as usual. In this
example, in.gREM-temper moves the log files to their respective folders.
Closing Notes:
---------------------------------------------------
Of significant difference between lj-6rep and lj-temper is the format of data.
In lj-6rep, data is stored as 'replicas' meaning discontinuous trajectories, as
files are moved between directories labeled by the 'lambda' of the replica. In
lj-temper, data is stored as 'walkers' with continuous trajectories, but
discontinuous parameters. The later is significantly more efficient, but
requires post-processing to obtain per-replica information.
Any problems/questions should be directed to <dstelter@bu.edu>.

View File

@ -51,7 +51,7 @@ for exchange in arange(starting_ex,max_exchange):
os.chdir(path+"/%s" % lambdas[l])
#os.system("cp restart_file restart_file%d" % exchange)
if (nproc > 1):
os.system("mpirun -np %d " + lmp + " -in ../" + inp + " -var lambda %g -var eta %g -var enthalpy %g > output" % (nproc, lambdas[l], eta, H))
os.system("mpirun -np %d " % (nproc) + lmp + " -in ../" + inp + " -var lambda %g -var eta %g -var enthalpy %g > output" % (lambdas[l], eta, H))
if (nproc == 1):
os.system(lmp + " -in ../" + inp + " -var lambda %g -var eta %g -var enthalpy %g > output" % (lambdas[l], eta, H))
os.system("grep -v '[a-zA-Z]' output | awk '{if(NF==6 && NR>19)print $0}' | awk '{print $3}' >ent")
@ -60,7 +60,6 @@ for exchange in arange(starting_ex,max_exchange):
aver_enthalpy[l] = mean(ee[-1])
# os.system("mv dump.dcd dump%d.dcd" % exchange)
os.system("mv log.lammps log%d.lammps" % exchange)
# os.system("rm output")
os.system("mv final_restart_file final_restart_file%d" % exchange)
os.system("mv ent ent%d" % exchange)
os.system("bzip2 log%d.lammps ent%d" % (exchange,exchange))

View File

@ -84,6 +84,8 @@ void Temper::command(int narg, char **arg)
my_set_temp = universe->iworld;
if (narg == 7) my_set_temp = force->inumeric(FLERR,arg[6]);
if ((my_set_temp < 0) || (my_set_temp >= universe->nworlds))
error->universe_one(FLERR,"Illegal temperature index");
// swap frequency must evenly divide total # of timesteps

View File

@ -29,7 +29,7 @@ bond_style harmonic/shift/cut, Carsten Svaneborg, science at zqex.dk, 8 Aug 11
compute ackland/atom, Gerolf Ziegenhain, gerolf at ziegenhain.com, 4 Oct 2007
compute basal/atom, Christopher Barrett, cdb333 at cavs.msstate.edu, 3 Mar 2013
compute temp/rotate, Laurent Joly (U Lyon), ljoly.ulyon at gmail.com, 8 Aug 11
compute pressure/grem, David Stelter, dstelter@bu.edu, 22 Nov 16
compute PRESSURE/GREM, David Stelter, dstelter@bu.edu, 22 Nov 16
dihedral_style cosine/shift/exp, Carsten Svaneborg, science at zqex.dk, 8 Aug 11
dihedral_style fourier, Loukas Peristeras, loukas.peristeras at scienomics.com, 27 Oct 12
dihedral_style nharmonic, Loukas Peristeras, loukas.peristeras at scienomics.com, 27 Oct 12

View File

@ -54,7 +54,7 @@ void ComputePressureGrem::init()
// Initialize hook to gREM fix
int ifix = modify->find_fix(fix_grem);
if (ifix < 0)
error->all(FLERR,"Fix grem ID for compute pressure/grem does not exist");
error->all(FLERR,"Fix grem ID for compute PRESSURE/GREM does not exist");
int dim;
scale_grem = (double *)modify->fix[ifix]->extract("scale_grem",dim);

View File

@ -13,7 +13,7 @@
#ifdef COMPUTE_CLASS
ComputeStyle(pressure/grem,ComputePressureGrem)
ComputeStyle(PRESSURE/GREM,ComputePressureGrem)
#else
@ -80,12 +80,12 @@ E: Must use 'kspace_modify pressure/scalar no' for tensor components with kspace
Otherwise MSM will compute only a scalar pressure. See the kspace_modify
command for details on this setting.
E: Fix grem ID for compute pressure/grem does not exist
E: Fix grem ID for compute PRESSURE/GREM does not exist
Compute pressure/grem was passed an invalid fix id
Compute PRESSURE/GREM was passed an invalid fix id
E: Cannot extract gREM scale factor from fix grem
The fix id passed to compute pressure/grem refers to an incompatible fix
The fix id passed to compute PRESSURE/GREM refers to an incompatible fix
*/

View File

@ -35,7 +35,9 @@ using namespace LAMMPS_NS;
/* ---------------------------------------------------------------------- */
DihedralNHarmonic::DihedralNHarmonic(LAMMPS *lmp) : Dihedral(lmp) {}
DihedralNHarmonic::DihedralNHarmonic(LAMMPS *lmp) : Dihedral(lmp) {
writedata = 1;
}
/* ---------------------------------------------------------------------- */
@ -334,3 +336,18 @@ void DihedralNHarmonic::read_restart(FILE *fp)
for (int i = 1; i <= atom->ndihedraltypes; i++) setflag[i] = 1;
}
/* ----------------------------------------------------------------------
proc 0 writes to data file
------------------------------------------------------------------------- */
void DihedralNHarmonic::write_data(FILE *fp)
{
for (int i = 1; i <= atom->ndihedraltypes; i++) {
fprintf(fp, "%d %d", i, nterms[i]);
for (int j = 0; j < nterms[i]; j++ )
fprintf(fp, " %g", a[i][j]);
fprintf(fp, "\n");
}
}

View File

@ -33,6 +33,7 @@ class DihedralNHarmonic : public Dihedral {
void coeff(int, char **);
void write_restart(FILE *);
void read_restart(FILE *);
void write_data(FILE *);
protected:
int *nterms;

View File

@ -97,7 +97,7 @@ FixGrem::FixGrem(LAMMPS *lmp, int narg, char **arg) :
newarg = new char*[5];
newarg[0] = id_press;
newarg[1] = (char *) "all";
newarg[2] = (char *) "pressure/grem";
newarg[2] = (char *) "PRESSURE/GREM";
newarg[3] = id_temp;
newarg[4] = id;
modify->add_compute(5,newarg);

View File

@ -85,6 +85,7 @@ PairAGNI::PairAGNI(LAMMPS *lmp) : Pair(lmp)
nparams = 0;
params = NULL;
map = NULL;
cutmax = 0.0;
}
/* ----------------------------------------------------------------------

View File

@ -113,6 +113,8 @@ void TemperGrem::command(int narg, char **arg)
my_set_lambda = universe->iworld;
if (narg == 8) my_set_lambda = force->inumeric(FLERR,arg[7]);
if ((my_set_lambda < 0) || (my_set_lambda >= universe->nworlds))
error->universe_one(FLERR,"Illegal temperature index");
// swap frequency must evenly divide total # of timesteps
@ -271,12 +273,6 @@ void TemperGrem::command(int narg, char **arg)
partner = world2root[partner_world];
}
// compute weights
volume = domain->xprd * domain->yprd * domain->zprd;
enth = pe + (pressref * volume);
weight = log(set_lambda[my_set_lambda] + (eta*(enth + h0)));
weight_cross = log(set_lambda[partner_set_lambda] + (eta*(enth + h0)));
// swap with a partner, only root procs in each world participate
// hi proc sends PE to low proc
// lo proc make Boltzmann decision on whether to swap
@ -284,6 +280,12 @@ void TemperGrem::command(int narg, char **arg)
swap = 0;
if (partner != -1) {
// compute weights
volume = domain->xprd * domain->yprd * domain->zprd;
enth = pe + (pressref * volume);
weight = log(set_lambda[my_set_lambda] + (eta*(enth + h0)));
weight_cross = log(set_lambda[partner_set_lambda] + (eta*(enth + h0)));
if (me_universe > partner) {
MPI_Send(&weight,1,MPI_DOUBLE,partner,0,universe->uworld);
MPI_Send(&weight_cross,1,MPI_DOUBLE,partner,0,universe->uworld);

View File

@ -40,7 +40,8 @@ int Compute::instance_total = 0;
Compute::Compute(LAMMPS *lmp, int narg, char **arg) : Pointers(lmp),
id(NULL), style(NULL),
vector(NULL), array(NULL), vector_atom(NULL), array_atom(NULL), vector_local(NULL), array_local(NULL),
vector(NULL), array(NULL), vector_atom(NULL),
array_atom(NULL), vector_local(NULL), array_local(NULL),
tlist(NULL), vbiasall(NULL)
{
instance_me = instance_total++;

View File

@ -70,7 +70,7 @@ ComputeBondLocal::ComputeBondLocal(LAMMPS *lmp, int narg, char **arg) :
// set velflag if compute any quantities based on velocities
singleflag = 0;
ghostvelflag = 0;
velflag = 0;
for (int i = 0; i < nvalues; i++) {
if (bstyle[i] == ENGPOT || bstyle[i] == FORCE) singleflag = 1;
if (bstyle[i] == VELVIB || bstyle[i] == OMEGA || bstyle[i] == ENGTRANS ||

540
src/compute_global_atom.cpp Normal file
View File

@ -0,0 +1,540 @@
/* ----------------------------------------------------------------------
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.
------------------------------------------------------------------------- */
#include <string.h>
#include <stdlib.h>
#include "compute_global_atom.h"
#include "atom.h"
#include "update.h"
#include "domain.h"
#include "modify.h"
#include "fix.h"
#include "force.h"
#include "comm.h"
#include "group.h"
#include "input.h"
#include "variable.h"
#include "memory.h"
#include "error.h"
using namespace LAMMPS_NS;
enum{COMPUTE,FIX,VARIABLE};
enum{VECTOR,ARRAY};
#define INVOKED_VECTOR 2
#define INVOKED_ARRAY 4
#define INVOKED_PERATOM 8
#define BIG 1.0e20
/* ---------------------------------------------------------------------- */
ComputeGlobalAtom::ComputeGlobalAtom(LAMMPS *lmp, int narg, char **arg) :
Compute(lmp, narg, arg),
idref(NULL), which(NULL), argindex(NULL), value2index(NULL), ids(NULL),
indices(NULL), varatom(NULL), vecglobal(NULL)
{
if (narg < 5) error->all(FLERR,"Illegal compute global/atom command");
peratom_flag = 1;
// process index arg
int iarg = 3;
if (strncmp(arg[iarg],"c_",2) == 0 ||
strncmp(arg[iarg],"f_",2) == 0 ||
strncmp(arg[iarg],"v_",2) == 0) {
if (arg[iarg][0] == 'c') whichref = COMPUTE;
else if (arg[iarg][0] == 'f') whichref = FIX;
else if (arg[iarg][0] == 'v') whichref = VARIABLE;
int n = strlen(arg[iarg]);
char *suffix = new char[n];
strcpy(suffix,&arg[iarg][2]);
char *ptr = strchr(suffix,'[');
if (ptr) {
if (suffix[strlen(suffix)-1] != ']')
error->all(FLERR,"Illegal compute global/atom command");
indexref = atoi(ptr+1);
*ptr = '\0';
} else indexref = 0;
n = strlen(suffix) + 1;
idref = new char[n];
strcpy(idref,suffix);
delete [] suffix;
} else error->all(FLERR,"Illegal compute global/atom command");
iarg++;
// expand args if any have wildcard character "*"
int expand = 0;
char **earg;
int nargnew = input->expand_args(narg-iarg,&arg[iarg],1,earg);
if (earg != &arg[iarg]) expand = 1;
arg = earg;
// parse values until one isn't recognized
which = new int[nargnew];
argindex = new int[nargnew];
ids = new char*[nargnew];
value2index = new int[nargnew];
nvalues = 0;
iarg = 0;
while (iarg < nargnew) {
ids[nvalues] = NULL;
if (strncmp(arg[iarg],"c_",2) == 0 ||
strncmp(arg[iarg],"f_",2) == 0 ||
strncmp(arg[iarg],"v_",2) == 0) {
if (arg[iarg][0] == 'c') which[nvalues] = COMPUTE;
else if (arg[iarg][0] == 'f') which[nvalues] = FIX;
else if (arg[iarg][0] == 'v') which[nvalues] = VARIABLE;
int n = strlen(arg[iarg]);
char *suffix = new char[n];
strcpy(suffix,&arg[iarg][2]);
char *ptr = strchr(suffix,'[');
if (ptr) {
if (suffix[strlen(suffix)-1] != ']')
error->all(FLERR,"Illegal compute global/atom command");
argindex[nvalues] = atoi(ptr+1);
*ptr = '\0';
} else argindex[nvalues] = 0;
n = strlen(suffix) + 1;
ids[nvalues] = new char[n];
strcpy(ids[nvalues],suffix);
nvalues++;
delete [] suffix;
} else error->all(FLERR,"Illegal compute global/atom command");
iarg++;
}
// if wildcard expansion occurred, free earg memory from expand_args()
if (expand) {
for (int i = 0; i < nargnew; i++) delete [] earg[i];
memory->sfree(earg);
}
// setup and error check both index arg and values
if (whichref == COMPUTE) {
int icompute = modify->find_compute(idref);
if (icompute < 0)
error->all(FLERR,"Compute ID for compute global/atom does not exist");
if (!modify->compute[icompute]->peratom_flag)
error->all(FLERR,"Compute global/atom compute does not "
"calculate a per-atom vector or array");
if (indexref == 0 &&
modify->compute[icompute]->size_peratom_cols != 0)
error->all(FLERR,"Compute global/atom compute does not "
"calculate a per-atom vector");
if (indexref && modify->compute[icompute]->size_peratom_cols == 0)
error->all(FLERR,"Compute global/atom compute does not "
"calculate a per-atom array");
if (indexref && indexref > modify->compute[icompute]->size_peratom_cols)
error->all(FLERR,
"Compute global/atom compute array is accessed out-of-range");
} else if (whichref == FIX) {
int ifix = modify->find_fix(idref);
if (ifix < 0)
error->all(FLERR,"Fix ID for compute global/atom does not exist");
if (!modify->fix[ifix]->peratom_flag)
error->all(FLERR,"Compute global/atom fix does not "
"calculate a per-atom vector or array");
if (indexref == 0 &&
modify->fix[ifix]->size_peratom_cols != 0)
error->all(FLERR,"Compute global/atom fix does not "
"calculate a per-atom vector");
if (indexref && modify->fix[ifix]->size_peratom_cols == 0)
error->all(FLERR,"Compute global/atom fix does not "
"calculate a per-atom array");
if (indexref && indexref > modify->fix[ifix]->size_peratom_cols)
error->all(FLERR,
"Compute global/atom fix array is accessed out-of-range");
} else if (whichref == VARIABLE) {
int ivariable = input->variable->find(idref);
if (ivariable < 0)
error->all(FLERR,"Variable name for compute global/atom does not exist");
if (input->variable->atomstyle(ivariable) == 0)
error->all(FLERR,"Compute global/atom variable is not "
"atom-style variable");
}
for (int i = 0; i < nvalues; i++) {
if (which[i] == COMPUTE) {
int icompute = modify->find_compute(ids[i]);
if (icompute < 0)
error->all(FLERR,"Compute ID for compute global/atom does not exist");
if (argindex[i] == 0) {
if (!modify->compute[icompute]->vector_flag)
error->all(FLERR,"Compute global/atom compute does not "
"calculate a global vector");
} else {
if (!modify->compute[icompute]->array_flag)
error->all(FLERR,"Compute global/atom compute does not "
"calculate a global array");
if (argindex[i] > modify->compute[icompute]->size_array_cols)
error->all(FLERR,"Compute global/atom compute array is "
"accessed out-of-range");
}
} else if (which[i] == FIX) {
int ifix = modify->find_fix(ids[i]);
if (ifix < 0)
error->all(FLERR,"Fix ID for compute global/atom does not exist");
if (argindex[i] == 0) {
if (!modify->fix[ifix]->vector_flag)
error->all(FLERR,"Compute global/atom fix does not "
"calculate a global vector");
} else {
if (!modify->fix[ifix]->array_flag)
error->all(FLERR,"Compute global/atom fix does not "
"calculate a global array");
if (argindex[i] > modify->fix[ifix]->size_array_cols)
error->all(FLERR,"Compute global/atom fix array is "
"accessed out-of-range");
}
} else if (which[i] == VARIABLE) {
int ivariable = input->variable->find(ids[i]);
if (ivariable < 0)
error->all(FLERR,"Variable name for compute global/atom "
"does not exist");
if (input->variable->vectorstyle(ivariable) == 0)
error->all(FLERR,"Compute global/atom variable is not "
"vector-style variable");
}
}
// this compute produces either a peratom vector or array
if (nvalues == 1) size_peratom_cols = 0;
else size_peratom_cols = nvalues;
nmax = maxvector = 0;
indices = NULL;
varatom = NULL;
vecglobal = NULL;
vector_atom = NULL;
array_atom = NULL;
}
/* ---------------------------------------------------------------------- */
ComputeGlobalAtom::~ComputeGlobalAtom()
{
delete [] idref;
delete [] which;
delete [] argindex;
for (int m = 0; m < nvalues; m++) delete [] ids[m];
delete [] ids;
delete [] value2index;
memory->destroy(indices);
memory->destroy(varatom);
memory->destroy(vecglobal);
memory->destroy(vector_atom);
memory->destroy(array_atom);
}
/* ---------------------------------------------------------------------- */
void ComputeGlobalAtom::init()
{
// set indices of all computes,fixes,variables
if (whichref == COMPUTE) {
int icompute = modify->find_compute(idref);
if (icompute < 0)
error->all(FLERR,"Compute ID for compute global/atom does not exist");
ref2index = icompute;
} else if (whichref == FIX) {
int ifix = modify->find_fix(idref);
if (ifix < 0)
error->all(FLERR,"Fix ID for compute global/atom does not exist");
ref2index = ifix;
} else if (whichref == VARIABLE) {
int ivariable = input->variable->find(idref);
if (ivariable < 0)
error->all(FLERR,"Variable name for compute global/atom does not exist");
ref2index = ivariable;
}
for (int m = 0; m < nvalues; m++) {
if (which[m] == COMPUTE) {
int icompute = modify->find_compute(ids[m]);
if (icompute < 0)
error->all(FLERR,"Compute ID for compute global/atom does not exist");
value2index[m] = icompute;
} else if (which[m] == FIX) {
int ifix = modify->find_fix(ids[m]);
if (ifix < 0)
error->all(FLERR,"Fix ID for compute global/atom does not exist");
value2index[m] = ifix;
} else if (which[m] == VARIABLE) {
int ivariable = input->variable->find(ids[m]);
if (ivariable < 0)
error->all(FLERR,"Variable name for compute global/atom "
"does not exist");
value2index[m] = ivariable;
}
}
}
/* ---------------------------------------------------------------------- */
void ComputeGlobalAtom::compute_peratom()
{
int i,j;
invoked_peratom = update->ntimestep;
// grow indices and output vector or array if necessary
if (atom->nmax > nmax) {
nmax = atom->nmax;
memory->destroy(indices);
memory->create(indices,nmax,"global/atom:indices");
if (nvalues == 1) {
memory->destroy(vector_atom);
memory->create(vector_atom,nmax,"global/atom:vector_atom");
} else {
memory->destroy(array_atom);
memory->create(array_atom,nmax,nvalues,"global/atom:array_atom");
}
}
// setup current peratom indices
// integer indices are rounded down from double values
// indices are decremented from 1 to N -> 0 to N-1
int *mask = atom->mask;
int nlocal = atom->nlocal;
if (whichref == COMPUTE) {
Compute *compute = modify->compute[ref2index];
if (!(compute->invoked_flag & INVOKED_PERATOM)) {
compute->compute_peratom();
compute->invoked_flag |= INVOKED_PERATOM;
}
if (indexref == 0) {
double *compute_vector = compute->vector_atom;
for (i = 0; i < nlocal; i++)
if (mask[i] & groupbit)
indices[i] = static_cast<int> (compute_vector[i]) - 1;
} else {
double **compute_array = compute->array_atom;
int im1 = indexref - 1;
for (i = 0; i < nlocal; i++)
if (mask[i] & groupbit)
indices[i] = static_cast<int> (compute_array[i][im1]) - 1;
}
} else if (whichref == FIX) {
if (update->ntimestep % modify->fix[ref2index]->peratom_freq)
error->all(FLERR,"Fix used in compute global/atom not "
"computed at compatible time");
Fix *fix = modify->fix[ref2index];
if (indexref == 0) {
double *fix_vector = fix->vector_atom;
for (i = 0; i < nlocal; i++)
if (mask[i] & groupbit)
indices[i] = static_cast<int> (fix_vector[i]) - 1;
} else {
double **fix_array = fix->array_atom;
int im1 = indexref - 1;
for (i = 0; i < nlocal; i++)
if (mask[i] & groupbit)
indices[i] = static_cast<int> (fix_array[i][im1]) - 1;
}
} else if (whichref == VARIABLE) {
if (atom->nmax > nmax) {
nmax = atom->nmax;
memory->destroy(varatom);
memory->create(varatom,nmax,"global/atom:varatom");
}
input->variable->compute_atom(ref2index,igroup,varatom,1,0);
for (i = 0; i < nlocal; i++)
if (mask[i] & groupbit)
indices[i] = static_cast<int> (varatom[i]) - 1;
}
// loop over values to fill output vector or array
for (int m = 0; m < nvalues; m++) {
// output = vector
if (argindex[m] == 0) {
int vmax;
double *source;
if (which[m] == COMPUTE) {
Compute *compute = modify->compute[value2index[m]];
if (!(compute->invoked_flag & INVOKED_VECTOR)) {
compute->compute_vector();
compute->invoked_flag |= INVOKED_VECTOR;
}
source = compute->vector;
vmax = compute->size_vector;
} else if (which[m] == FIX) {
if (update->ntimestep % modify->fix[value2index[m]]->peratom_freq)
error->all(FLERR,"Fix used in compute global/atom not "
"computed at compatible time");
Fix *fix = modify->fix[value2index[m]];
vmax = fix->size_vector;
if (vmax > maxvector) {
maxvector = vmax;
memory->destroy(vecglobal);
memory->create(vecglobal,maxvector,"global/atom:vecglobal");
}
for (i = 0; i < vmax; i++)
vecglobal[i] = fix->compute_vector(i);
source = vecglobal;
} else if (which[m] == VARIABLE) {
vmax = input->variable->compute_vector(value2index[m],&source);
}
if (nvalues == 1) {
for (i = 0; i < nlocal; i++) {
vector_atom[i] = 0.0;
if (mask[i] & groupbit) {
j = indices[i];
if (j >= 0 && j < vmax) vector_atom[i] = source[j];
}
}
} else {
for (i = 0; i < nlocal; i++) {
array_atom[i][m] = 0.0;
if (mask[i] & groupbit) {
j = indices[i];
if (j >= 0 && j < vmax) array_atom[i][m] = source[j];
}
}
}
// output = array
} else {
int vmax;
double *source;
int col = argindex[m] - 1;
if (which[m] == COMPUTE) {
Compute *compute = modify->compute[value2index[m]];
if (!(compute->invoked_flag & INVOKED_ARRAY)) {
compute->compute_array();
compute->invoked_flag |= INVOKED_ARRAY;
}
double **compute_array = compute->array;
vmax = compute->size_array_rows;
if (vmax > maxvector) {
maxvector = vmax;
memory->destroy(vecglobal);
memory->create(vecglobal,maxvector,"global/atom:vecglobal");
}
for (i = 0; i < vmax; i++)
vecglobal[i] = compute_array[i][col];
source = vecglobal;
} else if (which[m] == FIX) {
if (update->ntimestep % modify->fix[value2index[m]]->peratom_freq)
error->all(FLERR,"Fix used in compute global/atom not "
"computed at compatible time");
Fix *fix = modify->fix[value2index[m]];
vmax = fix->size_array_rows;
if (vmax > maxvector) {
maxvector = vmax;
memory->destroy(vecglobal);
memory->create(vecglobal,maxvector,"global/atom:vecglobal");
}
for (i = 0; i < vmax; i++)
vecglobal[i] = fix->compute_array(i,col);
source = vecglobal;
} else if (which[m] == VARIABLE) {
vmax = input->variable->compute_vector(value2index[m],&source);
}
if (nvalues == 1) {
for (i = 0; i < nlocal; i++) {
vector_atom[i] = 0.0;
if (mask[i] & groupbit) {
j = indices[i];
if (j >= 0 && j < vmax) vector_atom[i] = source[j];
}
}
} else {
for (i = 0; i < nlocal; i++) {
array_atom[i][m] = 0.0;
if (mask[i] & groupbit) {
j = indices[i];
if (j >= 0 && j < vmax) array_atom[i][m] = source[j];
}
}
}
}
}
}
/* ----------------------------------------------------------------------
memory usage of local atom-based array
------------------------------------------------------------------------- */
double ComputeGlobalAtom::memory_usage()
{
double bytes = nmax*nvalues * sizeof(double);
bytes += nmax * sizeof(int); // indices
if (varatom) bytes += nmax * sizeof(double); // varatom
bytes += maxvector * sizeof(double); // vecglobal
return bytes;
}

143
src/compute_global_atom.h Normal file
View File

@ -0,0 +1,143 @@
/* -*- 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.
------------------------------------------------------------------------- */
#ifdef COMPUTE_CLASS
ComputeStyle(global/atom,ComputeGlobalAtom)
#else
#ifndef LMP_COMPUTE_GLOBAL_ATOM_H
#define LMP_COMPUTE_GLOBAL_ATOM_H
#include "compute.h"
namespace LAMMPS_NS {
class ComputeGlobalAtom : public Compute {
public:
ComputeGlobalAtom(class LAMMPS *, int, char **);
virtual ~ComputeGlobalAtom();
void init();
void compute_peratom();
double memory_usage();
protected:
int whichref,indexref,ref2index;
char *idref;
int nvalues;
int *which,*argindex,*value2index;
char **ids;
int nmax,maxvector;
int *indices;
double *varatom;
double *vecglobal;
};
}
#endif
#endif
/* ERROR/WARNING messages:
E: Illegal ... command
Self-explanatory. Check the input script syntax and compare to the
documentation for the command. You can use -echo screen as a
command-line option when running LAMMPS to see the offending line.
E: Region ID for compute reduce/region does not exist
Self-explanatory.
E: Compute reduce replace requires min or max mode
Self-explanatory.
E: Invalid replace values in compute reduce
Self-explanatory.
E: Compute ID for compute reduce does not exist
Self-explanatory.
E: Compute reduce compute does not calculate a per-atom vector
Self-explanatory.
E: Compute reduce compute does not calculate a per-atom array
Self-explanatory.
E: Compute reduce compute array is accessed out-of-range
An index for the array is out of bounds.
E: Compute reduce compute does not calculate a local vector
Self-explanatory.
E: Compute reduce compute does not calculate a local array
Self-explanatory.
E: Compute reduce compute calculates global values
A compute that calculates peratom or local values is required.
E: Fix ID for compute reduce does not exist
Self-explanatory.
E: Compute reduce fix does not calculate a per-atom vector
Self-explanatory.
E: Compute reduce fix does not calculate a per-atom array
Self-explanatory.
E: Compute reduce fix array is accessed out-of-range
An index for the array is out of bounds.
E: Compute reduce fix does not calculate a local vector
Self-explanatory.
E: Compute reduce fix does not calculate a local array
Self-explanatory.
E: Compute reduce fix calculates global values
A fix that calculates peratom or local values is required.
E: Variable name for compute reduce does not exist
Self-explanatory.
E: Compute reduce variable is not atom-style variable
Self-explanatory.
E: Fix used in compute reduce not computed at compatible time
Fixes generate their values on specific timesteps. Compute reduce is
requesting a value on a non-allowed timestep.
*/

View File

@ -46,6 +46,7 @@ ComputeRDF::ComputeRDF(LAMMPS *lmp, int narg, char **arg) :
array_flag = 1;
extarray = 0;
dynamic_group_allow = 0;
nbin = force->inumeric(FLERR,arg[3]);
if (nbin < 1) error->all(FLERR,"Illegal compute rdf command");

View File

@ -256,7 +256,7 @@ void Dump::init()
if (maxall-minall+1 == isize) {
reorderflag = 1;
double range = maxall-minall + EPSILON;
idlo = static_cast<int> (range*me/nprocs + minall);
idlo = static_cast<tagint> (range*me/nprocs + minall);
tagint idhi = static_cast<tagint> (range*(me+1)/nprocs + minall);
tagint lom1 = static_cast<tagint> ((idlo-1-minall)/range * nprocs);
@ -636,9 +636,13 @@ void Dump::sort()
MPI_Allreduce(&max,&maxall,1,MPI_DOUBLE,MPI_MAX,world);
double range = maxall-minall + EPSILON*(maxall-minall);
if (range == 0.0) range = EPSILON;
// proc assignment is inverted if sortorder = DESCEND
for (i = 0; i < nme; i++) {
value = buf[i*size_one + sortcolm1];
iproc = static_cast<int> ((value-minall)/range * nprocs);
if (sortorder == DESCEND) iproc = nprocs-1 - iproc;
proclist[i] = iproc;
}
}

View File

@ -43,8 +43,10 @@ enum{SCALAR,VECTOR};
FixAveTime::FixAveTime(LAMMPS *lmp, int narg, char **arg) :
Fix(lmp, narg, arg),
nvalues(0), which(NULL), argindex(NULL), value2index(NULL), offcol(NULL), varlen(NULL), ids(NULL),
fp(NULL), offlist(NULL), format(NULL), format_user(NULL), vector(NULL), vector_total(NULL), vector_list(NULL),
nvalues(0), which(NULL), argindex(NULL), value2index(NULL),
offcol(NULL), varlen(NULL), ids(NULL),
fp(NULL), offlist(NULL), format(NULL), format_user(NULL),
vector(NULL), vector_total(NULL), vector_list(NULL),
column(NULL), array(NULL), array_total(NULL), array_list(NULL)
{
if (narg < 7) error->all(FLERR,"Illegal fix ave/time command");

View File

@ -1 +1 @@
#define LAMMPS_VERSION "22 Nov 2016"
#define LAMMPS_VERSION "30 Nov 2016"

View File

@ -5,6 +5,6 @@ for use with msi2lmp.
Note that LAMMPS does not distribute Accelrys (or old BioSym)
force field files, since they are proprietary. All the
files in this directory that are part of the LAMMPS distribution
are are openly available files that are in the public domain.
are openly available files that are in the public domain.