Merge remote-tracking branch 'lammps-ro/master' into lammps-icms
Resolved Conflicts: doc/Manual.html doc/Manual.txt src/atom_vec_hybrid.cpp src/verlet.cpp
This commit is contained in:
@ -20,10 +20,10 @@ summary description.
|
||||
------------------------------------------------------------------------
|
||||
|
||||
If the script has "cpu" in its name, it is meant to be run in CPU-only
|
||||
mode. For example:
|
||||
mode (without using the GPU or USER-CUDA styles). For example:
|
||||
|
||||
mpirun -np 1 ../lmp_linux_double -c off -v x 8 -v y 8 -v z 8 -v t 100 < in.lj.cpu
|
||||
mpirun -np 12 ../lmp_linux_double -c off -v x 16 -v y 16 -v z 16 -v t 100 < in.lj.cpu
|
||||
mpirun -np 1 ../lmp_linux_double -v x 8 -v y 8 -v z 8 -v t 100 < in.lj.cpu
|
||||
mpirun -np 12 ../lmp_linux_double -v x 16 -v y 16 -v z 16 -v t 100 < in.lj.cpu
|
||||
|
||||
The "xyz" settings determine the problem size. The "t" setting
|
||||
determines the number of timesteps.
|
||||
@ -33,9 +33,9 @@ determines the number of timesteps.
|
||||
If the script has "gpu" in its name, it is meant to be run using
|
||||
the GPU package. For example:
|
||||
|
||||
mpirun -np 12 ../lmp_linux_single -sf gpu -c off -v g 1 -v x 32 -v y 32 -v z 64 -v t 100 < in.lj.gpu
|
||||
mpirun -np 12 ../lmp_linux_single -sf gpu -v g 1 -v x 32 -v y 32 -v z 64 -v t 100 < in.lj.gpu
|
||||
|
||||
mpirun -np 8 ../lmp_linux_mixed -sf gpu -c off -v g 2 -v x 32 -v y 32 -v z 64 -v t 100 < in.lj.gpu
|
||||
mpirun -np 8 ../lmp_linux_mixed -sf gpu -v g 2 -v x 32 -v y 32 -v z 64 -v t 100 < in.lj.gpu
|
||||
|
||||
The "xyz" settings determine the problem size. The "t" setting
|
||||
determines the number of timesteps. The "np" setting determines how
|
||||
@ -49,9 +49,9 @@ than GPUs (both per compute node) with the GPU package.
|
||||
If the script has "cuda" in its name, it is meant to be run using
|
||||
the USER-CUDA package. For example:
|
||||
|
||||
mpirun -np 1 ../lmp_linux_single -sf cuda -v g 1 -v x 16 -v y 16 -v z 16 -v t 100 < in.lj.cuda
|
||||
mpirun -np 1 ../lmp_linux_single -c on -sf cuda -v g 1 -v x 16 -v y 16 -v z 16 -v t 100 < in.lj.cuda
|
||||
|
||||
mpirun -np 2 ../lmp_linux_double -sf cuda -v g 2 -v x 32 -v y 64 -v z 64 -v t 100 < in.eam.cuda
|
||||
mpirun -np 2 ../lmp_linux_double -c on -sf cuda -v g 2 -v x 32 -v y 64 -v z 64 -v t 100 < in.eam.cuda
|
||||
|
||||
The "xyz" settings determine the problem size. The "t" setting
|
||||
determines the number of timesteps. The "np" setting determines how
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<TITLE>LAMMPS-ICMS Users Manual</TITLE>
|
||||
<META NAME="docnumber" CONTENT="29 May 2014 version">
|
||||
<META NAME="docnumber" CONTENT="6 Jun 2014 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>
|
||||
@ -22,7 +22,7 @@
|
||||
|
||||
<CENTER><H3>LAMMPS-ICMS Documentation
|
||||
</H3></CENTER>
|
||||
<CENTER><H4>29 May 2014 version
|
||||
<CENTER><H4>6 Jun 2014 version
|
||||
</H4></CENTER>
|
||||
<H4>Version info:
|
||||
</H4>
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<HEAD>
|
||||
<TITLE>LAMMPS-ICMS Users Manual</TITLE>
|
||||
<META NAME="docnumber" CONTENT="29 May 2014 version">
|
||||
<META NAME="docnumber" CONTENT="6 Jun 2014 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>
|
||||
@ -18,7 +18,7 @@
|
||||
<H1></H1>
|
||||
|
||||
LAMMPS-ICMS Documentation :c,h3
|
||||
29 May 2014 version :c,h4
|
||||
6 Jun 2014 version :c,h4
|
||||
|
||||
Version info: :h4
|
||||
|
||||
|
||||
@ -644,7 +644,10 @@ settings appropriate to your system.
|
||||
<P>Additional input script requirements to run styles with a <I>cuda</I>
|
||||
suffix are as follows:
|
||||
</P>
|
||||
<UL><LI>To invoke specific styles from the USER-CUDA package, you can either
|
||||
<UL><LI>The <A HREF = "Section_start.html#start_7">-cuda on command-line switch</A> must be
|
||||
used when launching LAMMPS to enable the USER-CUDA package.
|
||||
|
||||
<LI>To invoke specific styles from the USER-CUDA package, you can either
|
||||
append "cuda" to the style name (e.g. pair_style lj/cut/cuda), or use
|
||||
the <A HREF = "Section_start.html#start_7">-suffix command-line switch</A>, or use
|
||||
the <A HREF = "suffix.html">suffix</A> command. One exception is that the
|
||||
@ -751,8 +754,8 @@ Details of the various options are discussed below.
|
||||
<PRE>make yes-kokkos # install the KOKKOS package
|
||||
make g++ OMP=yes # build with OpenMP, no CUDA
|
||||
</PRE>
|
||||
<PRE>mpirun -np 12 lmp_g++ -k off < in.lj # MPI-only mode with no Kokkos
|
||||
mpirun -np 12 lmp_g++ -sf kk < in.lj # MPI-only mode with Kokkos
|
||||
<PRE>mpirun -np 12 lmp_g++ < in.lj # MPI-only mode with no Kokkos
|
||||
mpirun -np 12 lmp_g++ -k on -sf kk < in.lj # MPI-only mode with Kokkos
|
||||
mpirun -np 1 lmp_g++ -k on t 12 -sf kk < in.lj # one MPI task, 12 threads
|
||||
mpirun -np 2 lmp_g++ -k on t 6 -sf kk < in.lj # two MPI tasks, 6 threads/task
|
||||
</PRE>
|
||||
@ -825,8 +828,7 @@ section</A> of the manual.
|
||||
</P>
|
||||
<P>Here are common options to use:
|
||||
</P>
|
||||
<UL><LI>-k off : runs an executable built with the KOKKOS pacakage, as
|
||||
if Kokkos were not installed.
|
||||
<UL><LI>-k on : required to run any KOKKOS-enabled style
|
||||
|
||||
<LI>-sf kk : enables automatic use of Kokkos versions of atom, pair,
|
||||
fix, compute styles if they exist. This can also be done with more
|
||||
|
||||
@ -643,12 +643,15 @@ settings appropriate to your system.
|
||||
Additional input script requirements to run styles with a {cuda}
|
||||
suffix are as follows:
|
||||
|
||||
The "-cuda on command-line switch"_Section_start.html#start_7 must be
|
||||
used when launching LAMMPS to enable the USER-CUDA package. :ulb,l
|
||||
|
||||
To invoke specific styles from the USER-CUDA package, you can either
|
||||
append "cuda" to the style name (e.g. pair_style lj/cut/cuda), or use
|
||||
the "-suffix command-line switch"_Section_start.html#start_7, or use
|
||||
the "suffix"_suffix.html command. One exception is that the
|
||||
"kspace_style pppm/cuda"_kspace_style.html command has to be requested
|
||||
explicitly. :ulb,l
|
||||
explicitly. :l
|
||||
|
||||
To use the USER-CUDA package with its default settings, no additional
|
||||
command is needed in your input script. This is because when LAMMPS
|
||||
@ -750,8 +753,8 @@ Details of the various options are discussed below.
|
||||
make yes-kokkos # install the KOKKOS package
|
||||
make g++ OMP=yes # build with OpenMP, no CUDA :pre
|
||||
|
||||
mpirun -np 12 lmp_g++ -k off < in.lj # MPI-only mode with no Kokkos
|
||||
mpirun -np 12 lmp_g++ -sf kk < in.lj # MPI-only mode with Kokkos
|
||||
mpirun -np 12 lmp_g++ < in.lj # MPI-only mode with no Kokkos
|
||||
mpirun -np 12 lmp_g++ -k on -sf kk < in.lj # MPI-only mode with Kokkos
|
||||
mpirun -np 1 lmp_g++ -k on t 12 -sf kk < in.lj # one MPI task, 12 threads
|
||||
mpirun -np 2 lmp_g++ -k on t 6 -sf kk < in.lj # two MPI tasks, 6 threads/task :pre
|
||||
|
||||
@ -824,8 +827,7 @@ section"_Section_start.html#start_7 of the manual.
|
||||
|
||||
Here are common options to use:
|
||||
|
||||
-k off : runs an executable built with the KOKKOS pacakage, as
|
||||
if Kokkos were not installed. :ulb,l
|
||||
-k on : required to run any KOKKOS-enabled style :ulb,l
|
||||
|
||||
-sf kk : enables automatic use of Kokkos versions of atom, pair,
|
||||
fix, compute styles if they exist. This can also be done with more
|
||||
|
||||
@ -4388,7 +4388,7 @@ it turns off bonds that should contribute to the energy.
|
||||
|
||||
<DT><I>Fix srd requires ghost atoms store velocity</I>
|
||||
|
||||
<DD>Use the communicate vel yes command to enable this.
|
||||
<DD>Use the comm_modify vel yes command to enable this.
|
||||
|
||||
<DT><I>Fix srd requires newton pair on</I>
|
||||
|
||||
@ -6849,7 +6849,7 @@ rRESPA cutoffs.
|
||||
|
||||
<DT><I>Pair dpd requires ghost atoms store velocity</I>
|
||||
|
||||
<DD>Use the communicate vel yes command to enable this.
|
||||
<DD>Use the comm_modify vel yes command to enable this.
|
||||
|
||||
<DT><I>Pair gayberne epsilon a,b,c coeffs are not all set</I>
|
||||
|
||||
@ -6878,7 +6878,7 @@ have these 3 coefficients set at least once.
|
||||
|
||||
<DT><I>Pair granular requires ghost atoms store velocity</I>
|
||||
|
||||
<DD>Use the communicate vel yes command to enable this.
|
||||
<DD>Use the comm_modify vel yes command to enable this.
|
||||
|
||||
<DT><I>Pair granular with shear history requires newton pair off</I>
|
||||
|
||||
@ -6918,7 +6918,7 @@ rRESPA cutoffs.
|
||||
|
||||
<DT><I>Pair lubricate requires ghost atoms store velocity</I>
|
||||
|
||||
<DD>Use the communicate vel yes command to enable this.
|
||||
<DD>Use the comm_modify vel yes command to enable this.
|
||||
|
||||
<DT><I>Pair lubricate requires monodisperse particles</I>
|
||||
|
||||
@ -6934,7 +6934,7 @@ rRESPA cutoffs.
|
||||
|
||||
<DT><I>Pair lubricate/poly requires ghost atoms store velocity</I>
|
||||
|
||||
<DD>Use the communicate vel yes command to enable this.
|
||||
<DD>Use the comm_modify vel yes command to enable this.
|
||||
|
||||
<DT><I>Pair lubricate/poly requires newton pair off</I>
|
||||
|
||||
@ -6946,7 +6946,7 @@ rRESPA cutoffs.
|
||||
|
||||
<DT><I>Pair lubricateU requires ghost atoms store velocity</I>
|
||||
|
||||
<DD>Use the communicate vel yes command to enable this.
|
||||
<DD>Use the comm_modify vel yes command to enable this.
|
||||
|
||||
<DT><I>Pair lubricateU requires monodisperse particles</I>
|
||||
|
||||
@ -6954,7 +6954,7 @@ rRESPA cutoffs.
|
||||
|
||||
<DT><I>Pair lubricateU/poly requires ghost atoms store velocity</I>
|
||||
|
||||
<DD>Use the communicate vel yes command to enable this.
|
||||
<DD>Use the comm_modify vel yes command to enable this.
|
||||
|
||||
<DT><I>Pair lubricateU/poly requires newton pair off</I>
|
||||
|
||||
|
||||
@ -4392,7 +4392,7 @@ Self-explanatory. :dd
|
||||
|
||||
{Fix srd requires ghost atoms store velocity} :dt
|
||||
|
||||
Use the communicate vel yes command to enable this. :dd
|
||||
Use the comm_modify vel yes command to enable this. :dd
|
||||
|
||||
{Fix srd requires newton pair on} :dt
|
||||
|
||||
@ -6853,7 +6853,7 @@ Two atoms are further apart than the pairwise table allows. :dd
|
||||
|
||||
{Pair dpd requires ghost atoms store velocity} :dt
|
||||
|
||||
Use the communicate vel yes command to enable this. :dd
|
||||
Use the comm_modify vel yes command to enable this. :dd
|
||||
|
||||
{Pair gayberne epsilon a,b,c coeffs are not all set} :dt
|
||||
|
||||
@ -6882,7 +6882,7 @@ Self-explanatory. :dd
|
||||
|
||||
{Pair granular requires ghost atoms store velocity} :dt
|
||||
|
||||
Use the communicate vel yes command to enable this. :dd
|
||||
Use the comm_modify vel yes command to enable this. :dd
|
||||
|
||||
{Pair granular with shear history requires newton pair off} :dt
|
||||
|
||||
@ -6922,7 +6922,7 @@ Self-explanatory. :dd
|
||||
|
||||
{Pair lubricate requires ghost atoms store velocity} :dt
|
||||
|
||||
Use the communicate vel yes command to enable this. :dd
|
||||
Use the comm_modify vel yes command to enable this. :dd
|
||||
|
||||
{Pair lubricate requires monodisperse particles} :dt
|
||||
|
||||
@ -6938,7 +6938,7 @@ One of the particles has radius 0.0. :dd
|
||||
|
||||
{Pair lubricate/poly requires ghost atoms store velocity} :dt
|
||||
|
||||
Use the communicate vel yes command to enable this. :dd
|
||||
Use the comm_modify vel yes command to enable this. :dd
|
||||
|
||||
{Pair lubricate/poly requires newton pair off} :dt
|
||||
|
||||
@ -6950,7 +6950,7 @@ Self-explanatory. :dd
|
||||
|
||||
{Pair lubricateU requires ghost atoms store velocity} :dt
|
||||
|
||||
Use the communicate vel yes command to enable this. :dd
|
||||
Use the comm_modify vel yes command to enable this. :dd
|
||||
|
||||
{Pair lubricateU requires monodisperse particles} :dt
|
||||
|
||||
@ -6958,7 +6958,7 @@ All particles must be the same finite size. :dd
|
||||
|
||||
{Pair lubricateU/poly requires ghost atoms store velocity} :dt
|
||||
|
||||
Use the communicate vel yes command to enable this. :dd
|
||||
Use the comm_modify vel yes command to enable this. :dd
|
||||
|
||||
{Pair lubricateU/poly requires newton pair off} :dt
|
||||
|
||||
|
||||
@ -1163,14 +1163,12 @@ mpirun -np 16 lmp_ibm -var f tmp.out -log my.log -screen none < in.alloy
|
||||
<PRE>-cuda on/off
|
||||
</PRE>
|
||||
<P>Explicitly enable or disable CUDA support, as provided by the
|
||||
USER-CUDA package. If LAMMPS is built with this package, as described
|
||||
above in <A HREF = "#start_3">Section 2.3</A>, then by default LAMMPS will run in
|
||||
CUDA mode. If this switch is set to "off", then it will not, even if
|
||||
it was built with the USER-CUDA package, which means you can run
|
||||
standard LAMMPS or with the GPU package for testing or benchmarking
|
||||
purposes. The only reason to set the switch to "on", is to check if
|
||||
LAMMPS was built with the USER-CUDA package, since an error will be
|
||||
generated if it was not.
|
||||
USER-CUDA package. Even if LAMMPS is built with this package, as
|
||||
described above in <A HREF = "#start_3">Section 2.3</A>, this switch must be set to
|
||||
enable running with the CUDA-enabled styles the package provides. If
|
||||
the switch is not set (the default), LAMMPS will operate as if the
|
||||
USER-CUDA package were not installed; i.e. you can run standard LAMMPS
|
||||
or with the GPU package, for testing or benchmarking purposes.
|
||||
</P>
|
||||
<PRE>-echo style
|
||||
</PRE>
|
||||
@ -1204,16 +1202,14 @@ used.
|
||||
</P>
|
||||
<PRE>-kokkos on/off keyword/value ...
|
||||
</PRE>
|
||||
<P>Explicitly enable or disable Kokkos support, as provided by the KOKKOS
|
||||
package. If LAMMPS is built with this package, as described above in
|
||||
<A HREF = "#start_3">Section 2.3</A>, then by default LAMMPS will run in Kokkos
|
||||
mode. If this switch is set to "off", then it will not, even if it
|
||||
was built with the KOKKOS package, which means you can run standard
|
||||
LAMMPS styles or use styles enhanced by other acceleration packages,
|
||||
such as the GPU or USER-CUDA or USER-OMP packages, for testing or
|
||||
benchmarking purposes. The only reason to set the switch to "on", is
|
||||
to check if LAMMPS was built with the KOKKOS package, since an error
|
||||
will be generated if it was not.
|
||||
<P>Explicitly enable or disable KOKKOS support, as provided by the KOKKOS
|
||||
package. Even if LAMMPS is built with this package, as described
|
||||
above in <A HREF = "#start_3">Section 2.3</A>, this switch must be set to enable
|
||||
running with the KOKKOS-enabled styles the package provides. If the
|
||||
switch is not set (the default), LAMMPS will operate as if the KOKKOS
|
||||
package were not installed; i.e. you can run standard LAMMPS or with
|
||||
the GPU or USER-CUDA or USER-OMP packages, for testing or benchmarking
|
||||
purposes.
|
||||
</P>
|
||||
<P>Additional optional keyword/value pairs can be specified which
|
||||
determine how Kokkos will use the underlying hardware on your
|
||||
|
||||
@ -1157,14 +1157,12 @@ Here are the details on the options:
|
||||
-cuda on/off :pre
|
||||
|
||||
Explicitly enable or disable CUDA support, as provided by the
|
||||
USER-CUDA package. If LAMMPS is built with this package, as described
|
||||
above in "Section 2.3"_#start_3, then by default LAMMPS will run in
|
||||
CUDA mode. If this switch is set to "off", then it will not, even if
|
||||
it was built with the USER-CUDA package, which means you can run
|
||||
standard LAMMPS or with the GPU package for testing or benchmarking
|
||||
purposes. The only reason to set the switch to "on", is to check if
|
||||
LAMMPS was built with the USER-CUDA package, since an error will be
|
||||
generated if it was not.
|
||||
USER-CUDA package. Even if LAMMPS is built with this package, as
|
||||
described above in "Section 2.3"_#start_3, this switch must be set to
|
||||
enable running with the CUDA-enabled styles the package provides. If
|
||||
the switch is not set (the default), LAMMPS will operate as if the
|
||||
USER-CUDA package were not installed; i.e. you can run standard LAMMPS
|
||||
or with the GPU package, for testing or benchmarking purposes.
|
||||
|
||||
-echo style :pre
|
||||
|
||||
@ -1198,16 +1196,14 @@ used.
|
||||
|
||||
-kokkos on/off keyword/value ... :pre
|
||||
|
||||
Explicitly enable or disable Kokkos support, as provided by the KOKKOS
|
||||
package. If LAMMPS is built with this package, as described above in
|
||||
"Section 2.3"_#start_3, then by default LAMMPS will run in Kokkos
|
||||
mode. If this switch is set to "off", then it will not, even if it
|
||||
was built with the KOKKOS package, which means you can run standard
|
||||
LAMMPS styles or use styles enhanced by other acceleration packages,
|
||||
such as the GPU or USER-CUDA or USER-OMP packages, for testing or
|
||||
benchmarking purposes. The only reason to set the switch to "on", is
|
||||
to check if LAMMPS was built with the KOKKOS package, since an error
|
||||
will be generated if it was not.
|
||||
Explicitly enable or disable KOKKOS support, as provided by the KOKKOS
|
||||
package. Even if LAMMPS is built with this package, as described
|
||||
above in "Section 2.3"_#start_3, this switch must be set to enable
|
||||
running with the KOKKOS-enabled styles the package provides. If the
|
||||
switch is not set (the default), LAMMPS will operate as if the KOKKOS
|
||||
package were not installed; i.e. you can run standard LAMMPS or with
|
||||
the GPU or USER-CUDA or USER-OMP packages, for testing or benchmarking
|
||||
purposes.
|
||||
|
||||
Additional optional keyword/value pairs can be specified which
|
||||
determine how Kokkos will use the underlying hardware on your
|
||||
|
||||
@ -29,12 +29,14 @@
|
||||
angmomx, angmomy, angmomz,
|
||||
shapex,shapey, shapez,
|
||||
quatw, quati, quatj, quatk, tqx, tqy, tqz,
|
||||
spin, eradius, ervel, erforce
|
||||
end1x, end1y, end1z, end2x, end2y, end2z,
|
||||
corner1x, corner1y, corner1z,
|
||||
corner2x, corner2y, corner2z,
|
||||
corner3x, corner3y, corner3z,
|
||||
nbonds,
|
||||
vfrac, s0,
|
||||
spin, eradius, ervel, erforce,
|
||||
rho, drho, e, de, cv,
|
||||
i_name, d_name
|
||||
</PRE>
|
||||
<PRE> id = atom ID
|
||||
@ -56,13 +58,28 @@
|
||||
shapex,shapey,shapez = 3 diameters of aspherical particle
|
||||
quatw,quati,quatj,quatk = quaternion components for aspherical or body particles
|
||||
tqx,tqy,tqz = torque on finite-size particles
|
||||
end12x, end12y, end12z = end points of line segment
|
||||
corner123x, corner123y, corner123z = corner points of triangle
|
||||
nbonds = number of bonds
|
||||
</PRE>
|
||||
<PRE> PERI package per-atom properties:
|
||||
vfrac = ???
|
||||
s0 = ???
|
||||
</PRE>
|
||||
<PRE> USER-EFF and USER-AWPMD package per-atom properties:
|
||||
spin = electron spin
|
||||
eradius = electron radius
|
||||
ervel = electron radial velocity
|
||||
erforce = electron radial force
|
||||
end12x, end12y, end12z = end points of line segment
|
||||
corner123x, corner123y, corner123z = corner points of triangle
|
||||
nbonds = number of bonds
|
||||
</PRE>
|
||||
<PRE> USER-SPH package per-atom properties:
|
||||
rho = ???
|
||||
drho = ???
|
||||
e = ???
|
||||
de = ???
|
||||
cv = ???
|
||||
</PRE>
|
||||
<PRE> <A HREF = "fix_property_atom.html">fix property/atom</A> per-atom properties:
|
||||
i_name = custom integer vector with name
|
||||
d_name = custom integer vector with name
|
||||
</PRE>
|
||||
|
||||
@ -23,12 +23,14 @@ input = one or more atom attributes :l
|
||||
angmomx, angmomy, angmomz,
|
||||
shapex,shapey, shapez,
|
||||
quatw, quati, quatj, quatk, tqx, tqy, tqz,
|
||||
spin, eradius, ervel, erforce
|
||||
end1x, end1y, end1z, end2x, end2y, end2z,
|
||||
corner1x, corner1y, corner1z,
|
||||
corner2x, corner2y, corner2z,
|
||||
corner3x, corner3y, corner3z,
|
||||
nbonds,
|
||||
vfrac, s0,
|
||||
spin, eradius, ervel, erforce,
|
||||
rho, drho, e, de, cv,
|
||||
i_name, d_name :pre
|
||||
id = atom ID
|
||||
mol = molecule ID
|
||||
@ -49,13 +51,28 @@ input = one or more atom attributes :l
|
||||
shapex,shapey,shapez = 3 diameters of aspherical particle
|
||||
quatw,quati,quatj,quatk = quaternion components for aspherical or body particles
|
||||
tqx,tqy,tqz = torque on finite-size particles
|
||||
end12x, end12y, end12z = end points of line segment
|
||||
corner123x, corner123y, corner123z = corner points of triangle
|
||||
nbonds = number of bonds :pre
|
||||
|
||||
PERI package per-atom properties:
|
||||
vfrac = ???
|
||||
s0 = ??? :pre
|
||||
|
||||
USER-EFF and USER-AWPMD package per-atom properties:
|
||||
spin = electron spin
|
||||
eradius = electron radius
|
||||
ervel = electron radial velocity
|
||||
erforce = electron radial force
|
||||
end12x, end12y, end12z = end points of line segment
|
||||
corner123x, corner123y, corner123z = corner points of triangle
|
||||
nbonds = number of bonds
|
||||
erforce = electron radial force :pre
|
||||
|
||||
USER-SPH package per-atom properties:
|
||||
rho = ???
|
||||
drho = ???
|
||||
e = ???
|
||||
de = ???
|
||||
cv = ??? :pre
|
||||
|
||||
"fix property/atom"_fix_property_atom.html per-atom properties:
|
||||
i_name = custom integer vector with name
|
||||
d_name = custom integer vector with name :pre
|
||||
:ule
|
||||
|
||||
@ -64,7 +64,6 @@
|
||||
q, mux, muy, muz, mu,
|
||||
radius, diameter, omegax, omegay, omegaz,
|
||||
angmomx, angmomy, angmomz, tqx, tqy, tqz,
|
||||
spin, eradius, ervel, erforce,
|
||||
c_ID, c_ID[N], f_ID, f_ID[N], v_name
|
||||
</PRE>
|
||||
<PRE> id = atom ID
|
||||
@ -86,10 +85,6 @@
|
||||
omegax,omegay,omegaz = angular velocity of spherical particle
|
||||
angmomx,angmomy,angmomz = angular momentum of aspherical particle
|
||||
tqx,tqy,tqz = torque on finite-size particles
|
||||
spin = electron spin
|
||||
eradius = electron radius
|
||||
ervel = electron radial velocity
|
||||
erforce = electron radial force
|
||||
c_ID = per-atom vector calculated by a compute with ID
|
||||
c_ID[N] = Nth column of per-atom array calculated by a compute with ID
|
||||
f_ID = per-atom vector calculated by a fix with ID
|
||||
@ -109,7 +104,6 @@ dump 4b flow custom 100 dump.%.myforce id type c_myF[3] v_ke
|
||||
dump 2 inner cfg 10 dump.snap.*.cfg mass type xs ys zs vx vy vz
|
||||
dump snap all cfg 100 dump.config.*.cfg mass type xs ys zs id type c_Stress[2]
|
||||
dump 1 all xtc 1000 file.xtc
|
||||
dump e_data all custom 100 dump.eff id type x y z spin eradius fx fy fz eforce
|
||||
</PRE>
|
||||
<P><B>Description:</B>
|
||||
</P>
|
||||
@ -523,12 +517,6 @@ the <I>ellipsoid</I> atom style defines this quantity.
|
||||
can sustain a rotational torque due to interactions with other
|
||||
particles.
|
||||
</P>
|
||||
<P>The <I>spin</I>, <I>eradius</I>, <I>ervel</I>, and <I>erforce</I> attributes are for
|
||||
particles that represent nuclei and electrons modeled with the
|
||||
electronic force field (EFF). See <A HREF = "atom_style.html">atom_style
|
||||
electron</A> and <A HREF = "pair_eff.html">pair_style eff</A> for more
|
||||
details.
|
||||
</P>
|
||||
<P>The <I>c_ID</I> and <I>c_ID[N]</I> attributes allow per-atom vectors or arrays
|
||||
calculated by a <A HREF = "compute.html">compute</A> to be output. The ID in the
|
||||
attribute should be replaced by the actual ID of the compute that has
|
||||
|
||||
14
doc/dump.txt
14
doc/dump.txt
@ -51,7 +51,6 @@ args = list of arguments for a particular style :l
|
||||
q, mux, muy, muz, mu,
|
||||
radius, diameter, omegax, omegay, omegaz,
|
||||
angmomx, angmomy, angmomz, tqx, tqy, tqz,
|
||||
spin, eradius, ervel, erforce,
|
||||
c_ID, c_ID\[N\], f_ID, f_ID\[N\], v_name :pre
|
||||
|
||||
id = atom ID
|
||||
@ -73,10 +72,6 @@ args = list of arguments for a particular style :l
|
||||
omegax,omegay,omegaz = angular velocity of spherical particle
|
||||
angmomx,angmomy,angmomz = angular momentum of aspherical particle
|
||||
tqx,tqy,tqz = torque on finite-size particles
|
||||
spin = electron spin
|
||||
eradius = electron radius
|
||||
ervel = electron radial velocity
|
||||
erforce = electron radial force
|
||||
c_ID = per-atom vector calculated by a compute with ID
|
||||
c_ID\[N\] = Nth column of per-atom array calculated by a compute with ID
|
||||
f_ID = per-atom vector calculated by a fix with ID
|
||||
@ -94,8 +89,7 @@ dump 4a all custom 100 dump.myforce.* id type x y vx fx
|
||||
dump 4b flow custom 100 dump.%.myforce id type c_myF\[3\] v_ke
|
||||
dump 2 inner cfg 10 dump.snap.*.cfg mass type xs ys zs vx vy vz
|
||||
dump snap all cfg 100 dump.config.*.cfg mass type xs ys zs id type c_Stress\[2\]
|
||||
dump 1 all xtc 1000 file.xtc
|
||||
dump e_data all custom 100 dump.eff id type x y z spin eradius fx fy fz eforce :pre
|
||||
dump 1 all xtc 1000 file.xtc :pre
|
||||
|
||||
[Description:]
|
||||
|
||||
@ -508,12 +502,6 @@ The {tqx}, {tqy}, {tqz} attributes are for finite-size particles that
|
||||
can sustain a rotational torque due to interactions with other
|
||||
particles.
|
||||
|
||||
The {spin}, {eradius}, {ervel}, and {erforce} attributes are for
|
||||
particles that represent nuclei and electrons modeled with the
|
||||
electronic force field (EFF). See "atom_style
|
||||
electron"_atom_style.html and "pair_style eff"_pair_eff.html for more
|
||||
details.
|
||||
|
||||
The {c_ID} and {c_ID\[N\]} attributes allow per-atom vectors or arrays
|
||||
calculated by a "compute"_compute.html to be output. The ID in the
|
||||
attribute should be replaced by the actual ID of the compute that has
|
||||
|
||||
@ -35,7 +35,7 @@
|
||||
</P>
|
||||
<PRE>pair_style buck/long/coul/long cut off 2.5
|
||||
pair_style buck/long/coul/long cut long 2.5 4.0
|
||||
pair_style buck/long/coul/long long long 2.5 4.0
|
||||
pair_style buck/long/coul/long long long 4.0
|
||||
pair_coeff * * 1 1
|
||||
pair_coeff 1 1 1 3 4
|
||||
</PRE>
|
||||
|
||||
@ -26,7 +26,7 @@ cutoff2 = global cutoff for Coulombic (optional) (distance units) :l,ule
|
||||
|
||||
pair_style buck/long/coul/long cut off 2.5
|
||||
pair_style buck/long/coul/long cut long 2.5 4.0
|
||||
pair_style buck/long/coul/long long long 2.5 4.0
|
||||
pair_style buck/long/coul/long long long 4.0
|
||||
pair_coeff * * 1 1
|
||||
pair_coeff 1 1 1 3 4 :pre
|
||||
|
||||
|
||||
@ -175,8 +175,8 @@ number of "dangerous" reneighborings (printed at the end of a
|
||||
simulation), you should experiment with forcing reneighboring more
|
||||
often and see if system energies/trajectories change.
|
||||
</P>
|
||||
<P>These pair styles requires you to use the <A HREF = "communicate.html">communicate vel
|
||||
yes</A> option so that velocites are stored by ghost
|
||||
<P>These pair styles requires you to use the <A HREF = "comm_modify.html">comm_modify vel
|
||||
yes</A> command so that velocites are stored by ghost
|
||||
atoms.
|
||||
</P>
|
||||
<P>These pair styles will not restart exactly when using the
|
||||
|
||||
@ -167,8 +167,8 @@ number of "dangerous" reneighborings (printed at the end of a
|
||||
simulation), you should experiment with forcing reneighboring more
|
||||
often and see if system energies/trajectories change.
|
||||
|
||||
These pair styles requires you to use the "communicate vel
|
||||
yes"_communicate.html option so that velocites are stored by ghost
|
||||
These pair styles requires you to use the "comm_modify vel
|
||||
yes"_comm_modify.html command so that velocites are stored by ghost
|
||||
atoms.
|
||||
|
||||
These pair styles will not restart exactly when using the
|
||||
|
||||
@ -296,8 +296,8 @@ such as radius, radial velocity, and radital force, as defined by the
|
||||
<A HREF = "atom_style.html">atom_style</A>. The <I>electron</I> atom style does all of
|
||||
this.
|
||||
</P>
|
||||
<P>Thes pair styles require you to use the <A HREF = "communicate.html">communicate vel
|
||||
yes</A> option so that velocites are stored by ghost
|
||||
<P>Thes pair styles require you to use the <A HREF = "comm_modify.html">comm_modify vel
|
||||
yes</A> command so that velocites are stored by ghost
|
||||
atoms.
|
||||
</P>
|
||||
<P><B>Related commands:</B>
|
||||
|
||||
@ -289,8 +289,8 @@ such as radius, radial velocity, and radital force, as defined by the
|
||||
"atom_style"_atom_style.html. The {electron} atom style does all of
|
||||
this.
|
||||
|
||||
Thes pair styles require you to use the "communicate vel
|
||||
yes"_communicate.html option so that velocites are stored by ghost
|
||||
Thes pair styles require you to use the "comm_modify vel
|
||||
yes"_comm_modify.html command so that velocites are stored by ghost
|
||||
atoms.
|
||||
|
||||
[Related commands:]
|
||||
|
||||
@ -243,8 +243,8 @@ LAMMPS</A> section for more info.
|
||||
require a per-particle radius is stored. The <I>sphere</I> atom style does
|
||||
all of this.
|
||||
</P>
|
||||
<P>This pair style requires you to use the <A HREF = "communicate.html">communicate vel
|
||||
yes</A> option so that velocites are stored by ghost
|
||||
<P>This pair style requires you to use the <A HREF = "comm_modify.html">comm_modify vel
|
||||
yes</A> command so that velocites are stored by ghost
|
||||
atoms.
|
||||
</P>
|
||||
<P>These pair styles will not restart exactly when using the
|
||||
|
||||
@ -229,8 +229,8 @@ These pair styles require that atoms store torque and angular velocity
|
||||
require a per-particle radius is stored. The {sphere} atom style does
|
||||
all of this.
|
||||
|
||||
This pair style requires you to use the "communicate vel
|
||||
yes"_communicate.html option so that velocites are stored by ghost
|
||||
This pair style requires you to use the "comm_modify vel
|
||||
yes"_comm_modify.html command so that velocites are stored by ghost
|
||||
atoms.
|
||||
|
||||
These pair styles will not restart exactly when using the
|
||||
|
||||
@ -117,7 +117,7 @@ in the pair section of <A HREF = "Section_commands.html#cmd_5">this page</A>.
|
||||
<LI><A HREF = "pair_buck.html">pair_style buck/coul/cut</A> - Buckingham with cutoff Coulomb
|
||||
<LI><A HREF = "pair_buck.html">pair_style buck/coul/long</A> - Buckingham with long-range Coulombics
|
||||
<LI><A HREF = "pair_buck.html">pair_style buck/coul/msm</A> - Buckingham long-range MSM Coulombics
|
||||
<LI><A HREF = "pair_buck.html">pair_style buck/long/coul/long</A> - long-range Buckingham with long-range Coulombics
|
||||
<LI><A HREF = "pair_buck_long.html">pair_style buck/long/coul/long</A> - long-range Buckingham with long-range Coulombics
|
||||
<LI><A HREF = "pair_colloid.html">pair_style colloid</A> - integrated colloidal potential
|
||||
<LI><A HREF = "pair_comb.html">pair_style comb</A> - charge-optimized many-body (COMB) potential
|
||||
<LI><A HREF = "pair_comb.html">pair_style comb3</A> - charge-optimized many-body (COMB3) potential
|
||||
|
||||
@ -114,7 +114,7 @@ in the pair section of "this page"_Section_commands.html#cmd_5.
|
||||
"pair_style buck/coul/cut"_pair_buck.html - Buckingham with cutoff Coulomb
|
||||
"pair_style buck/coul/long"_pair_buck.html - Buckingham with long-range Coulombics
|
||||
"pair_style buck/coul/msm"_pair_buck.html - Buckingham long-range MSM Coulombics
|
||||
"pair_style buck/long/coul/long"_pair_buck.html - long-range Buckingham with long-range Coulombics
|
||||
"pair_style buck/long/coul/long"_pair_buck_long.html - long-range Buckingham with long-range Coulombics
|
||||
"pair_style colloid"_pair_colloid.html - integrated colloidal potential
|
||||
"pair_style comb"_pair_comb.html - charge-optimized many-body (COMB) potential
|
||||
"pair_style comb3"_pair_comb.html - charge-optimized many-body (COMB3) potential
|
||||
|
||||
@ -31,7 +31,7 @@
|
||||
xy, xz, yz, xlat, ylat, zlat,
|
||||
bonds, angles, dihedrals, impropers,
|
||||
pxx, pyy, pzz, pxy, pxz, pyz,
|
||||
fmax, fnorm,
|
||||
fmax, fnorm, nbuild, ndanger,
|
||||
cella, cellb, cellc, cellalpha, cellbeta, cellgamma,
|
||||
c_ID, c_ID[I], c_ID[I][J],
|
||||
f_ID, f_ID[I], f_ID[I][J],
|
||||
@ -73,6 +73,8 @@
|
||||
pxx,pyy,pzz,pxy,pxz,pyz = 6 components of pressure tensor
|
||||
fmax = max component of force on any atom in any dimension
|
||||
fnorm = length of force vector for all atoms
|
||||
nbuild = # of neighbor list builds
|
||||
ndanger = # of dangerous neighbor list builds
|
||||
cella,cellb,cellc = periodic cell lattice constants a,b,c
|
||||
cellalpha, cellbeta, cellgamma = periodic cell angles alpha,beta,gamma
|
||||
c_ID = global scalar value calculated by a compute with ID
|
||||
@ -265,6 +267,19 @@ calculates the maximum force in any dimension on any atom in the
|
||||
system, or the infinity-norm of the force vector for the system. The
|
||||
<I>fnorm</I> keyword calculates the 2-norm or length of the force vector.
|
||||
</P>
|
||||
<P>The <I>nbuild</I> and <I>ndanger</I> keywords are useful for monitoring neighbor
|
||||
list builds during a run. Note that both these values are also
|
||||
printed with the end-of-run statistics. The <I>nbuild</I> keyword is the
|
||||
number of re-builds during the current run. The <I>ndanger</I> keyword is
|
||||
the number of re-builds that LAMMPS considered potentially
|
||||
"dangerous". If atom movement triggered neighbor list rebuilding (see
|
||||
the <A HREF = "neigh_modify.html">neigh_modify</A> command), then dangerous
|
||||
reneighborings are those that were triggered on the first timestep
|
||||
atom movement was checked for. If this count is non-zero you may wish
|
||||
to reduce the delay factor to insure no force interactions are missed
|
||||
by atoms moving beyond the neighbor skin distance before a rebuild
|
||||
takes place.
|
||||
</P>
|
||||
<P>The keywords <I>cella</I>, <I>cellb</I>, <I>cellc</I>, <I>cellalpha</I>, <I>cellbeta</I>,
|
||||
<I>cellgamma</I>, correspond to the usual crystallographic quantities that
|
||||
define the periodic unit cell of a crystal. See <A HREF = "Section_howto.html#howto_12">this
|
||||
|
||||
@ -26,7 +26,7 @@ args = list of arguments for a particular style :l
|
||||
xy, xz, yz, xlat, ylat, zlat,
|
||||
bonds, angles, dihedrals, impropers,
|
||||
pxx, pyy, pzz, pxy, pxz, pyz,
|
||||
fmax, fnorm,
|
||||
fmax, fnorm, nbuild, ndanger,
|
||||
cella, cellb, cellc, cellalpha, cellbeta, cellgamma,
|
||||
c_ID, c_ID\[I\], c_ID\[I\]\[J\],
|
||||
f_ID, f_ID\[I\], f_ID\[I\]\[J\],
|
||||
@ -68,6 +68,8 @@ args = list of arguments for a particular style :l
|
||||
pxx,pyy,pzz,pxy,pxz,pyz = 6 components of pressure tensor
|
||||
fmax = max component of force on any atom in any dimension
|
||||
fnorm = length of force vector for all atoms
|
||||
nbuild = # of neighbor list builds
|
||||
ndanger = # of dangerous neighbor list builds
|
||||
cella,cellb,cellc = periodic cell lattice constants a,b,c
|
||||
cellalpha, cellbeta, cellgamma = periodic cell angles alpha,beta,gamma
|
||||
c_ID = global scalar value calculated by a compute with ID
|
||||
@ -259,6 +261,19 @@ calculates the maximum force in any dimension on any atom in the
|
||||
system, or the infinity-norm of the force vector for the system. The
|
||||
{fnorm} keyword calculates the 2-norm or length of the force vector.
|
||||
|
||||
The {nbuild} and {ndanger} keywords are useful for monitoring neighbor
|
||||
list builds during a run. Note that both these values are also
|
||||
printed with the end-of-run statistics. The {nbuild} keyword is the
|
||||
number of re-builds during the current run. The {ndanger} keyword is
|
||||
the number of re-builds that LAMMPS considered potentially
|
||||
"dangerous". If atom movement triggered neighbor list rebuilding (see
|
||||
the "neigh_modify"_neigh_modify.html command), then dangerous
|
||||
reneighborings are those that were triggered on the first timestep
|
||||
atom movement was checked for. If this count is non-zero you may wish
|
||||
to reduce the delay factor to insure no force interactions are missed
|
||||
by atoms moving beyond the neighbor skin distance before a rebuild
|
||||
takes place.
|
||||
|
||||
The keywords {cella}, {cellb}, {cellc}, {cellalpha}, {cellbeta},
|
||||
{cellgamma}, correspond to the usual crystallographic quantities that
|
||||
define the periodic unit cell of a crystal. See "this
|
||||
|
||||
@ -67,7 +67,7 @@ reset_timestep 0
|
||||
neighbor 0.3 bin
|
||||
neigh_modify delay 0 every 1 check yes
|
||||
|
||||
communicate multi group big vel yes
|
||||
comm_modify mode multi group big vel yes
|
||||
neigh_modify include big
|
||||
|
||||
# no pairwise interactions with small particles
|
||||
|
||||
@ -67,7 +67,7 @@ reset_timestep 0
|
||||
neighbor 0.3 bin
|
||||
neigh_modify delay 0 every 1 check yes
|
||||
|
||||
communicate multi group big vel yes
|
||||
comm_modify mode multi group big vel yes
|
||||
neigh_modify include big
|
||||
|
||||
# no pairwise interactions with small particles
|
||||
|
||||
@ -64,7 +64,7 @@ reset_timestep 0
|
||||
neighbor 0.3 bin
|
||||
neigh_modify delay 0 every 1 check yes
|
||||
|
||||
communicate multi group big vel yes
|
||||
comm_modify mode multi group big vel yes
|
||||
neigh_modify include big
|
||||
|
||||
# no pairwise interactions with small particles
|
||||
|
||||
@ -64,7 +64,7 @@ reset_timestep 0
|
||||
neighbor 0.3 bin
|
||||
neigh_modify delay 0 every 1 check yes
|
||||
|
||||
communicate multi group big vel yes
|
||||
comm_modify mode multi group big vel yes
|
||||
neigh_modify include big
|
||||
|
||||
# no pairwise interactions with small particles
|
||||
|
||||
@ -75,7 +75,7 @@ reset_timestep 0
|
||||
neighbor 0.3 bin
|
||||
neigh_modify delay 0 every 1 check yes
|
||||
|
||||
communicate multi group big vel yes
|
||||
comm_modify mode multi group big vel yes
|
||||
neigh_modify include big
|
||||
|
||||
# no pairwise interactions with small particles
|
||||
|
||||
@ -75,7 +75,7 @@ reset_timestep 0
|
||||
neighbor 0.3 bin
|
||||
neigh_modify delay 0 every 1 check yes
|
||||
|
||||
communicate multi group big vel yes
|
||||
comm_modify mode multi group big vel yes
|
||||
neigh_modify include big
|
||||
|
||||
# no pairwise interactions with small particles
|
||||
|
||||
@ -38,7 +38,7 @@ neighbor 0.3 bin
|
||||
neigh_modify delay 0 every 1 check yes
|
||||
neigh_modify exclude molecule big include big
|
||||
|
||||
communicate multi group big vel yes
|
||||
comm_modify mode multi group big vel yes
|
||||
neigh_modify include big
|
||||
|
||||
# no pairwise interactions with small particles
|
||||
|
||||
@ -72,7 +72,7 @@ reset_timestep 0
|
||||
neighbor 0.3 bin
|
||||
neigh_modify delay 0 every 1 check yes
|
||||
|
||||
communicate multi group big vel yes
|
||||
comm_modify mode multi group big vel yes
|
||||
neigh_modify include big
|
||||
|
||||
# no pairwise interactions with small particles
|
||||
|
||||
@ -72,7 +72,7 @@ reset_timestep 0
|
||||
neighbor 0.3 bin
|
||||
neigh_modify delay 0 every 1 check yes
|
||||
|
||||
communicate multi group big vel yes
|
||||
comm_modify mode multi group big vel yes
|
||||
neigh_modify include big
|
||||
|
||||
# no pairwise interactions with small particles
|
||||
|
||||
@ -67,7 +67,7 @@ reset_timestep 0
|
||||
neighbor 0.3 bin
|
||||
neigh_modify delay 0 every 1 check yes
|
||||
|
||||
communicate multi group big vel yes
|
||||
comm_modify mode multi group big vel yes
|
||||
neigh_modify include big
|
||||
|
||||
# no pairwise interactions with small particles
|
||||
|
||||
@ -67,7 +67,7 @@ reset_timestep 0
|
||||
neighbor 0.3 bin
|
||||
neigh_modify delay 0 every 1 check yes
|
||||
|
||||
communicate multi group big vel yes
|
||||
comm_modify mode multi group big vel yes
|
||||
neigh_modify include big
|
||||
|
||||
# no pairwise interactions with small particles
|
||||
|
||||
@ -37,7 +37,7 @@ neighbor 0.3 bin
|
||||
neigh_modify delay 0 every 1 check yes
|
||||
neigh_modify exclude molecule big include big
|
||||
|
||||
communicate multi group big vel yes
|
||||
comm_modify mode multi group big vel yes
|
||||
neigh_modify include big
|
||||
|
||||
# no pairwise interactions with small particles
|
||||
|
||||
@ -9,6 +9,8 @@ These scripts are provided for illustration purposes. No guarantee is
|
||||
made that the systems are fully equilibrated or that the runs are long
|
||||
enough to generate good statistics and highly accurate results.
|
||||
|
||||
These scripts could easily be adapted to work with solids as well.
|
||||
|
||||
-------------
|
||||
|
||||
These are the 4 methods for computing thermal conductivity. The first
|
||||
|
||||
33
examples/MC/README
Normal file
33
examples/MC/README
Normal file
@ -0,0 +1,33 @@
|
||||
This directory has an input script that illustrates how to use LAMMPS
|
||||
as an energy-evaluation engine in a Monte Carlo (MC) relaxation loop.
|
||||
It is just an illustration of how to do this for a toy 2d problem, but
|
||||
the script is fairly sophisticated in its use of variables, looping,
|
||||
and an if-the-else statement which applies the Boltzmann factor to
|
||||
accept or reject a trial atomic-displacement move.
|
||||
|
||||
The script sets up a perfect 2d hex lattice, then perturbs all
|
||||
the atom positions to "disorder" the system. It then
|
||||
loops in the following manner:
|
||||
|
||||
pick a random atom and displace it to a random new position
|
||||
evaluate the change in energy of the system due to
|
||||
the single-atom displacement
|
||||
accept or reject the trial move
|
||||
if accepted, continue to the next iteration
|
||||
if rejected, restore the atom to its original position
|
||||
before continuing to the next iteration
|
||||
|
||||
The 6 variables at the top of the input script can be adjusted
|
||||
to play with various MC parameters.
|
||||
|
||||
When the script is finished, statistics about the MC procedure
|
||||
are printed.
|
||||
|
||||
Dump file snapshots or images or a movie of the MC relaxation can be
|
||||
produced by uncommenting the appropriate dump lines in the script.
|
||||
|
||||
At some point, we will add a Python script to the python/examples
|
||||
directory that performs the same operation as this script. It will
|
||||
invoke LAMMPS as a library and use Python to implement the MC
|
||||
accept/reject logic more cleanly than the LAMMPS input script can do
|
||||
it.
|
||||
119
examples/MC/in.mc
Normal file
119
examples/MC/in.mc
Normal file
@ -0,0 +1,119 @@
|
||||
# Monte Carlo relaxation of perturbed 2d hex lattice
|
||||
|
||||
# set these parameters
|
||||
# make sure neigh skin > 2*deltamove
|
||||
|
||||
variable iter loop 3000 # number of Monte Carlo moves
|
||||
variable deltaperturb equal 0.2 # max size of initial perturbation per dim
|
||||
variable deltamove equal 0.1 # max size of MC move in one dimension
|
||||
variable density equal 1.0 # reduced LJ density of atoms on lattice
|
||||
variable kT equal 0.05 # effective T in Boltzmann factor
|
||||
variable seed equal 582783 # RNG seed
|
||||
|
||||
# problem setup
|
||||
|
||||
units lj
|
||||
atom_style atomic
|
||||
atom_modify map array sort 0 0.0
|
||||
|
||||
dimension 2
|
||||
|
||||
lattice hex ${density}
|
||||
region box block 0 10 0 5 -0.5 0.5
|
||||
|
||||
create_box 1 box
|
||||
create_atoms 1 box
|
||||
mass 1 1.0
|
||||
|
||||
pair_style lj/cut 2.5
|
||||
pair_coeff 1 1 1.0 1.0 2.5
|
||||
pair_modify shift yes
|
||||
|
||||
neighbor 0.3 bin
|
||||
neigh_modify delay 0 every 1 check yes
|
||||
|
||||
variable e equal pe
|
||||
|
||||
# run 0 to get energy of perfect lattice
|
||||
# emin = minimum energy
|
||||
|
||||
run 0
|
||||
variable emin equal $e
|
||||
|
||||
# disorder the system
|
||||
# estart = initial energy
|
||||
|
||||
variable x atom x+v_deltaperturb*random(-1.0,1.0,${seed})
|
||||
variable y atom y+v_deltaperturb*random(-1.0,1.0,${seed})
|
||||
|
||||
set group all x v_x
|
||||
set group all y v_y
|
||||
|
||||
#dump 1 all atom 25 dump.mc
|
||||
|
||||
#dump 2 all image 25 image.*.jpg type type &
|
||||
# zoom 1.6 adiam 1.0
|
||||
#dump_modify 2 pad 5
|
||||
|
||||
#dump 3 all movie 25 movie.mpg type type &
|
||||
# zoom 1.6 adiam 1.0
|
||||
#dump_modify 3 pad 5
|
||||
|
||||
variable elast equal $e
|
||||
thermo_style custom step v_emin v_elast pe
|
||||
|
||||
run 0
|
||||
|
||||
variable estart equal $e
|
||||
variable elast equal $e
|
||||
|
||||
# loop over Monte Carlo moves
|
||||
|
||||
variable naccept equal 0
|
||||
variable increment equal v_naccept+1
|
||||
variable irandom equal floor(atoms*random(0.0,1.0,${seed})+1)
|
||||
variable rn equal random(0.0,1.0,${seed})
|
||||
variable boltzfactor equal "exp(atoms*(v_elast - v_e) / v_kT)"
|
||||
variable xnew equal x[v_i]+v_deltamove*random(-1.0,1.0,${seed})
|
||||
variable ynew equal y[v_i]+v_deltamove*random(-1.0,1.0,${seed})
|
||||
variable xi equal x[v_i]
|
||||
variable yi equal y[v_i]
|
||||
|
||||
label loop
|
||||
|
||||
variable i equal ${irandom}
|
||||
|
||||
variable x0 equal ${xi}
|
||||
variable y0 equal ${yi}
|
||||
|
||||
set atom $i x ${xnew}
|
||||
set atom $i y ${ynew}
|
||||
|
||||
run 1 pre no post no
|
||||
|
||||
if "$e <= ${elast}" then &
|
||||
"variable elast equal $e" &
|
||||
"variable naccept equal ${increment}" &
|
||||
elif "${rn} <= ${boltzfactor}" &
|
||||
"variable elast equal $e" &
|
||||
"variable naccept equal ${increment}" &
|
||||
else &
|
||||
"set atom $i x ${x0}" &
|
||||
"set atom $i y ${y0}"
|
||||
|
||||
next iter
|
||||
jump SELF loop
|
||||
|
||||
# final energy and stats
|
||||
|
||||
variable nb equal nbuild
|
||||
variable nbuild equal ${nb}
|
||||
|
||||
run 0
|
||||
|
||||
print "MC stats:"
|
||||
print " starting energy = ${estart}"
|
||||
print " final energy = $e"
|
||||
print " minimum energy of perfect lattice = ${emin}"
|
||||
print " accepted MC moves = ${naccept}"
|
||||
print " neighbor list rebuilds = ${nbuild}"
|
||||
106235
examples/MC/log.mc.6Jun14
Normal file
106235
examples/MC/log.mc.6Jun14
Normal file
File diff suppressed because it is too large
Load Diff
@ -132,12 +132,19 @@ The ELASTIC directory has an example script for computing elastic
|
||||
constants, using a zero temperature Si example. See the
|
||||
ELASTIC/in.elastic file for more info.
|
||||
|
||||
The KAPPA directory has an example scripts for computing the thermal
|
||||
The KAPPA directory has example scripts for computing the thermal
|
||||
conductivity (kappa) of a LJ liquid using 4 different methods. See
|
||||
the KAPPA/README file for more info.
|
||||
|
||||
The MC directory has an example script for using LAMMPS as an
|
||||
energy-evaluation engine in a iterative Monte Carlo energy-relaxation
|
||||
loop.
|
||||
|
||||
The USER directory contains subdirectories of user-provided example
|
||||
scripts for ser packages. See the README files in those directories
|
||||
for more info. See the doc/Section_start.html file for more info
|
||||
about installing and building user packages.
|
||||
|
||||
The VISCOSITY directory has example scripts for computing the
|
||||
viscosity of a LJ liquid using 4 different methods. See the
|
||||
VISCOSITY/README file for more info.
|
||||
|
||||
@ -12,7 +12,7 @@ read_data data.${sname}
|
||||
pair_style eff/cut 100.0
|
||||
pair_coeff * *
|
||||
|
||||
communicate single vel yes
|
||||
comm_modify vel yes
|
||||
|
||||
compute effTemp all temp/eff
|
||||
|
||||
|
||||
@ -12,7 +12,7 @@ read_data data.${sname}
|
||||
pair_style eff/cut 31.6125
|
||||
pair_coeff * *
|
||||
|
||||
communicate single vel yes
|
||||
comm_modify vel yes
|
||||
|
||||
neigh_modify one 10000 page 100000
|
||||
|
||||
|
||||
@ -12,7 +12,7 @@ read_data data.${sname}
|
||||
pair_style eff/cut 100.0
|
||||
pair_coeff * *
|
||||
|
||||
communicate single vel yes
|
||||
comm_modify vel yes
|
||||
|
||||
# Minimize
|
||||
min_style cg
|
||||
|
||||
@ -12,7 +12,7 @@ read_data data.${sname}
|
||||
pair_style eff/cut 100.0
|
||||
pair_coeff * *
|
||||
|
||||
communicate single vel yes
|
||||
comm_modify vel yes
|
||||
|
||||
compute effTemp all temp/eff
|
||||
|
||||
|
||||
@ -12,7 +12,7 @@ read_data data.${sname}
|
||||
pair_style eff/cut 5000.0 0 0
|
||||
pair_coeff * *
|
||||
|
||||
communicate single vel yes
|
||||
comm_modify vel yes
|
||||
|
||||
# minimize
|
||||
min_style cg
|
||||
|
||||
@ -12,7 +12,7 @@ read_data data.${sname}
|
||||
pair_style eff/cut 0.529177249
|
||||
pair_coeff * *
|
||||
|
||||
communicate single vel yes
|
||||
comm_modify vel yes
|
||||
|
||||
compute energies all pair eff/cut
|
||||
variable eke equal c_energies[1]
|
||||
|
||||
@ -12,7 +12,7 @@ read_data data.${sname}
|
||||
pair_style eff/cut 1.0
|
||||
pair_coeff * *
|
||||
|
||||
communicate single vel yes
|
||||
comm_modify vel yes
|
||||
|
||||
compute energies all pair eff/cut
|
||||
variable eke equal c_energies[1]
|
||||
|
||||
@ -12,7 +12,7 @@ read_data data.${sname}
|
||||
pair_style eff/cut 6.447968 pressure/evirials
|
||||
pair_coeff * *
|
||||
|
||||
communicate single vel yes
|
||||
comm_modify vel yes
|
||||
|
||||
min_style cg
|
||||
min_modify line quadratic
|
||||
|
||||
@ -14,7 +14,7 @@ pair_coeff * *
|
||||
|
||||
neigh_modify one 20000 page 200000
|
||||
|
||||
communicate single vel yes
|
||||
comm_modify vel yes
|
||||
|
||||
compute effTemp all temp/eff
|
||||
|
||||
|
||||
@ -14,7 +14,7 @@ pair_coeff * *
|
||||
|
||||
neigh_modify one 10000 page 100000
|
||||
|
||||
communicate single vel yes
|
||||
comm_modify vel yes
|
||||
|
||||
compute effTemp all temp/eff
|
||||
|
||||
|
||||
@ -14,7 +14,7 @@ pair_coeff * *
|
||||
|
||||
neigh_modify one 10000 page 100000
|
||||
|
||||
communicate single vel yes
|
||||
comm_modify vel yes
|
||||
|
||||
compute peratom all stress/atom NULL
|
||||
compute p all reduce sum c_peratom[1] c_peratom[2] c_peratom[3]
|
||||
|
||||
@ -13,7 +13,7 @@ read_restart ${sname}.min.restart2
|
||||
pair_style eff/cut 50.112
|
||||
pair_coeff * *
|
||||
|
||||
communicate single vel yes
|
||||
comm_modify vel yes
|
||||
|
||||
compute effTemp all temp/eff
|
||||
|
||||
|
||||
@ -13,7 +13,7 @@ read_data data.${sname}
|
||||
pair_style eff/cut 50.112
|
||||
pair_coeff * *
|
||||
|
||||
communicate single vel yes
|
||||
comm_modify vel yes
|
||||
|
||||
compute effTemp all temp/eff
|
||||
compute effPress all pressure effTemp
|
||||
|
||||
@ -14,7 +14,7 @@ read_data data.${sname}
|
||||
pair_style eff/cut 11.049221 limit/eradius pressure/evirials
|
||||
pair_coeff * *
|
||||
|
||||
communicate single vel yes
|
||||
comm_modify vel yes
|
||||
|
||||
neigh_modify one 2000 page 20000
|
||||
|
||||
|
||||
@ -13,7 +13,7 @@ read_data data.${sname}
|
||||
pair_style eff/cut 20.88 limit/eradius pressure/evirials
|
||||
pair_coeff * *
|
||||
|
||||
communicate single vel yes
|
||||
comm_modify vel yes
|
||||
|
||||
neigh_modify one 2000 page 20000
|
||||
|
||||
|
||||
@ -19,10 +19,10 @@ make cuda CUDA=yes -> lmp_cuda
|
||||
Then the following runs were made. The "->" means that the run
|
||||
produced log.lammps which was then copied to the named log file.
|
||||
|
||||
* MPI-only runs
|
||||
* MPI-only (non-KOKKOS) runs
|
||||
|
||||
lmp_cpu -k off < in.kokkos -> log.kokkos.date.mpionly.1
|
||||
mpirun -np 4 lmp_cpu -k off < in.kokkos -> log.kokkos.date.mpionly.4
|
||||
lmp_cpu < in.kokkos -> log.kokkos.date.mpionly.1
|
||||
mpirun -np 4 lmp_cpu < in.kokkos -> log.kokkos.date.mpionly.4
|
||||
|
||||
* OpenMP threaded runs on CPUs only
|
||||
|
||||
|
||||
@ -35,6 +35,7 @@ scripts in the examples sub-directory:
|
||||
trivial.py read/run a LAMMPS input script thru Python
|
||||
demo.py invoke various LAMMPS library interface routines
|
||||
simple.py mimic operation of couple/simple/simple.cpp in Python
|
||||
mc.py Monte Carlo energy relaxation wrapper on LAMMPS
|
||||
gui.py GUI go/stop/temperature-slider to control LAMMPS
|
||||
plot.py real-time temeperature plot with GnuPlot via Pizza.py
|
||||
viz_tool.py real-time viz via some viz package
|
||||
|
||||
22
python/examples/in.mc
Normal file
22
python/examples/in.mc
Normal file
@ -0,0 +1,22 @@
|
||||
# problem setup for Monte Carlo relaxation of perturbed 2d hex lattice
|
||||
# same as example/MC/in.mc
|
||||
|
||||
units lj
|
||||
atom_style atomic
|
||||
atom_modify map array sort 0 0.0
|
||||
|
||||
dimension 2
|
||||
|
||||
lattice hex 1.0
|
||||
region box block 0 10 0 5 -0.5 0.5
|
||||
|
||||
create_box 1 box
|
||||
create_atoms 1 box
|
||||
mass 1 1.0
|
||||
|
||||
pair_style lj/cut 2.5
|
||||
pair_coeff 1 1 1.0 1.0 2.5
|
||||
pair_modify shift yes
|
||||
|
||||
neighbor 0.3 bin
|
||||
neigh_modify delay 0 every 1 check yes
|
||||
108
python/examples/mc.py
Executable file
108
python/examples/mc.py
Executable file
@ -0,0 +1,108 @@
|
||||
#!/usr/bin/env python -i
|
||||
# preceeding line should have path for Python on your machine
|
||||
|
||||
# mc.py
|
||||
# Purpose: mimic operation of example/MC/in.mc via Python
|
||||
# Syntax: mc.py in.mc
|
||||
# in.mc = LAMMPS input script
|
||||
|
||||
import sys,random,math
|
||||
|
||||
# set these parameters
|
||||
# make sure neigh skin (in in.mc) > 2*deltamove
|
||||
|
||||
nloop = 3000
|
||||
deltaperturb = 0.2
|
||||
deltamove = 0.1
|
||||
kT = 0.05
|
||||
random.seed(27848)
|
||||
|
||||
# parse command line
|
||||
|
||||
argv = sys.argv
|
||||
if len(argv) != 2:
|
||||
print "Syntax: mc.py in.mc"
|
||||
sys.exit()
|
||||
|
||||
infile = sys.argv[1]
|
||||
|
||||
from lammps import lammps
|
||||
lmp = lammps()
|
||||
|
||||
# run infile one line at a time
|
||||
# just sets up MC problem
|
||||
|
||||
lines = open(infile,'r').readlines()
|
||||
for line in lines: lmp.command(line)
|
||||
lmp.command("variable e equal pe")
|
||||
|
||||
# run 0 to get energy of perfect lattice
|
||||
# emin = minimum energy
|
||||
|
||||
lmp.command("run 0")
|
||||
|
||||
natoms = lmp.extract_global("natoms",0)
|
||||
emin = lmp.extract_compute("thermo_pe",0,0) / natoms
|
||||
lmp.command("variable emin equal $e")
|
||||
|
||||
# disorder the system
|
||||
# estart = initial energy
|
||||
|
||||
x = lmp.extract_atom("x",3)
|
||||
|
||||
for i in xrange(natoms):
|
||||
x[i][0] += deltaperturb * (2*random.random()-1)
|
||||
x[i][1] += deltaperturb * (2*random.random()-1)
|
||||
|
||||
lmp.command("variable elast equal $e")
|
||||
lmp.command("thermo_style custom step v_emin v_elast pe")
|
||||
lmp.command("run 0")
|
||||
x = lmp.extract_atom("x",3)
|
||||
lmp.command("variable elast equal $e")
|
||||
|
||||
estart = lmp.extract_compute("thermo_pe",0,0) / natoms
|
||||
|
||||
# loop over Monte Carlo moves
|
||||
# extract x after every run, in case reneighboring changed ptr in LAMMPS
|
||||
|
||||
elast = estart
|
||||
naccept = 0
|
||||
|
||||
for i in xrange(nloop):
|
||||
iatom = random.randrange(0,natoms)
|
||||
x0 = x[iatom][0]
|
||||
y0 = x[iatom][1]
|
||||
|
||||
x[iatom][0] += deltamove * (2*random.random()-1)
|
||||
x[iatom][1] += deltamove * (2*random.random()-1)
|
||||
|
||||
lmp.command("run 1 pre no post no")
|
||||
x = lmp.extract_atom("x",3)
|
||||
e = lmp.extract_compute("thermo_pe",0,0) / natoms
|
||||
|
||||
if e <= elast:
|
||||
elast = e
|
||||
lmp.command("variable elast equal $e")
|
||||
naccept += 1
|
||||
elif random.random() <= math.exp(natoms*(elast-e)/kT):
|
||||
elast = e
|
||||
lmp.command("variable elast equal $e")
|
||||
naccept += 1
|
||||
else:
|
||||
x[iatom][0] = x0
|
||||
x[iatom][1] = y0
|
||||
|
||||
# final energy and stats
|
||||
|
||||
lmp.command("variable nbuild equal nbuild")
|
||||
nbuild = lmp.extract_variable("nbuild",None,0)
|
||||
|
||||
lmp.command("run 0")
|
||||
estop = lmp.extract_compute("thermo_pe",0,0) / natoms
|
||||
|
||||
print "MC stats:"
|
||||
print " starting energy =",estart
|
||||
print " final energy =",estop
|
||||
print " minimum energy of perfect lattice =",emin
|
||||
print " accepted MC moves =",naccept
|
||||
print " neighbor list rebuilds =",nbuild
|
||||
@ -86,7 +86,7 @@ Self-explanatory.
|
||||
|
||||
E: Pair lubricate requires ghost atoms store velocity
|
||||
|
||||
Use the communicate vel yes command to enable this.
|
||||
Use the comm_modify vel yes command to enable this.
|
||||
|
||||
E: Pair lubricate requires monodisperse particles
|
||||
|
||||
|
||||
@ -101,7 +101,7 @@ Self-explanatory.
|
||||
|
||||
E: Pair lubricateU requires ghost atoms store velocity
|
||||
|
||||
Use the communicate vel yes command to enable this.
|
||||
Use the comm_modify vel yes command to enable this.
|
||||
|
||||
E: Pair lubricateU requires monodisperse particles
|
||||
|
||||
|
||||
@ -66,7 +66,7 @@ Self-explanatory.
|
||||
|
||||
E: Pair lubricateU/poly requires ghost atoms store velocity
|
||||
|
||||
Use the communicate vel yes command to enable this.
|
||||
Use the comm_modify vel yes command to enable this.
|
||||
|
||||
E: Pair lubricate/poly requires atom style sphere
|
||||
|
||||
|
||||
@ -45,7 +45,7 @@ Self-explanatory.
|
||||
|
||||
E: Pair lubricate/poly requires ghost atoms store velocity
|
||||
|
||||
Use the communicate vel yes command to enable this.
|
||||
Use the comm_modify vel yes command to enable this.
|
||||
|
||||
E: Pair lubricate/poly requires atom style sphere
|
||||
|
||||
|
||||
@ -93,7 +93,7 @@ Self-explanatory.
|
||||
|
||||
E: Pair granular requires ghost atoms store velocity
|
||||
|
||||
Use the communicate vel yes command to enable this.
|
||||
Use the comm_modify vel yes command to enable this.
|
||||
|
||||
E: Pair granular with shear history requires newton pair off
|
||||
|
||||
|
||||
File diff suppressed because one or more lines are too long
@ -17,6 +17,7 @@
|
||||
|
||||
#include "float.h"
|
||||
#include "stdlib.h"
|
||||
#include "string.h"
|
||||
#include "atom_vec_peri.h"
|
||||
#include "atom.h"
|
||||
#include "comm.h"
|
||||
@ -894,6 +895,45 @@ int AtomVecPeri::write_data_hybrid(FILE *fp, double *buf)
|
||||
return 2;
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
assign an index to named atom property and return index
|
||||
return -1 if name is unknown to this atom style
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
int AtomVecPeri::property_atom(char *name)
|
||||
{
|
||||
if (strcmp(name,"vfrac") == 0) return 0;
|
||||
if (strcmp(name,"s0") == 0) return 1;
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
pack per-atom data into buf for ComputePropertyAtom
|
||||
index maps to data specific to this atom style
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void AtomVecPeri::pack_property_atom(int index, double *buf,
|
||||
int nvalues, int groupbit)
|
||||
{
|
||||
int *mask = atom->mask;
|
||||
int nlocal = atom->nlocal;
|
||||
int n = 0;
|
||||
|
||||
if (index == 0) {
|
||||
for (int i = 0; i < nlocal; i++) {
|
||||
if (mask[i] & groupbit) buf[n] = vfrac[i];
|
||||
else buf[n] = 0.0;
|
||||
n += nvalues;
|
||||
}
|
||||
} else if (index == 1) {
|
||||
for (int i = 0; i < nlocal; i++) {
|
||||
if (mask[i] & groupbit) buf[n] = s0[i];
|
||||
else buf[n] = 0.0;
|
||||
n += nvalues;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
return # of bytes of allocated memory
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
@ -56,6 +56,8 @@ class AtomVecPeri : public AtomVec {
|
||||
int pack_data_hybrid(int, double *);
|
||||
void write_data(FILE *, int, double **);
|
||||
int write_data_hybrid(FILE *, double *);
|
||||
int property_atom(char *);
|
||||
void pack_property_atom(int, double *, int, int);
|
||||
bigint memory_usage();
|
||||
|
||||
private:
|
||||
|
||||
@ -276,7 +276,7 @@ Self-explanatory.
|
||||
|
||||
E: Fix srd requires ghost atoms store velocity
|
||||
|
||||
Use the communicate vel yes command to enable this.
|
||||
Use the comm_modify vel yes command to enable this.
|
||||
|
||||
E: Fix SRD no-slip requires atom attribute torque
|
||||
|
||||
|
||||
@ -17,6 +17,7 @@
|
||||
|
||||
#include "math.h"
|
||||
#include "stdlib.h"
|
||||
#include "string.h"
|
||||
#include "atom_vec_wavepacket.h"
|
||||
#include "atom.h"
|
||||
#include "comm.h"
|
||||
@ -37,6 +38,7 @@ AtomVecWavepacket::AtomVecWavepacket(LAMMPS *lmp) : AtomVec(lmp)
|
||||
|
||||
mass_type = 1;
|
||||
molecular = 0;
|
||||
forceclearflag = 1;
|
||||
|
||||
size_forward = 4; // coords[3]+radius[1]
|
||||
size_reverse = 10; // force[3]+erforce[1]+ervelforce[1]+vforce[3]+csforce[2]
|
||||
@ -108,7 +110,6 @@ void AtomVecWavepacket::grow_reset()
|
||||
vforce = atom->vforce;
|
||||
ervelforce = atom->ervelforce;
|
||||
etag = atom->etag;
|
||||
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
@ -143,6 +144,13 @@ void AtomVecWavepacket::copy(int i, int j, int delflag)
|
||||
modify->fix[atom->extra_grow[iextra]]->copy_arrays(i,j,delflag);
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
void AtomVecWavepacket::force_clear(int n, size_t nbytes)
|
||||
{
|
||||
memset(&erforce[n],0,nbytes);
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
// this will be used as partial pack for unsplit Hartree packets (v, ervel not regarded as separate variables)
|
||||
|
||||
@ -1101,6 +1109,59 @@ int AtomVecWavepacket::write_vel_hybrid(FILE *fp, double *buf)
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
assign an index to named atom property and return index
|
||||
return -1 if name is unknown to this atom style
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
int AtomVecWavepacket::property_atom(char *name)
|
||||
{
|
||||
if (strcmp(name,"spin") == 0) return 0;
|
||||
if (strcmp(name,"eradius") == 0) return 1;
|
||||
if (strcmp(name,"ervel") == 0) return 2;
|
||||
if (strcmp(name,"erforce") == 0) return 3;
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
pack per-atom data into buf for ComputePropertyAtom
|
||||
index maps to data specific to this atom style
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void AtomVecWavepacket::pack_property_atom(int index, double *buf,
|
||||
int nvalues, int groupbit)
|
||||
{
|
||||
int *mask = atom->mask;
|
||||
int nlocal = atom->nlocal;
|
||||
int n = 0;
|
||||
|
||||
if (index == 0) {
|
||||
for (int i = 0; i < nlocal; i++) {
|
||||
if (mask[i] & groupbit) buf[n] = spin[i];
|
||||
else buf[n] = 0.0;
|
||||
n += nvalues;
|
||||
}
|
||||
} else if (index == 1) {
|
||||
for (int i = 0; i < nlocal; i++) {
|
||||
if (mask[i] & groupbit) buf[n] = eradius[i];
|
||||
else buf[n] = 0.0;
|
||||
n += nvalues;
|
||||
}
|
||||
} else if (index == 2) {
|
||||
for (int i = 0; i < nlocal; i++) {
|
||||
if (mask[i] & groupbit) buf[n] = ervel[i];
|
||||
else buf[n] = 0.0;
|
||||
n += nvalues;
|
||||
}
|
||||
} else if (index == 3) {
|
||||
for (int i = 0; i < nlocal; i++) {
|
||||
if (mask[i] & groupbit) buf[n] = erforce[i];
|
||||
else buf[n] = 0.0;
|
||||
n += nvalues;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
return # of bytes of allocated memory
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
@ -36,6 +36,7 @@ public:
|
||||
void grow(int);
|
||||
void grow_reset();
|
||||
void copy(int, int, int);
|
||||
void force_clear(int, size_t);
|
||||
int pack_comm(int, int *, double *, int, int *);
|
||||
int pack_comm_vel(int, int *, double *, int, int *);
|
||||
int pack_comm_hybrid(int, int *, double *);
|
||||
@ -70,6 +71,8 @@ public:
|
||||
int pack_vel_hybrid(int, double *);
|
||||
void write_vel(FILE *, int, double **);
|
||||
int write_vel_hybrid(FILE *, double *);
|
||||
int property_atom(char *);
|
||||
void pack_property_atom(int, double *, int, int);
|
||||
bigint memory_usage();
|
||||
|
||||
private:
|
||||
|
||||
@ -17,6 +17,7 @@
|
||||
|
||||
#include "math.h"
|
||||
#include "stdlib.h"
|
||||
#include "string.h"
|
||||
#include "atom_vec_electron.h"
|
||||
#include "atom.h"
|
||||
#include "comm.h"
|
||||
@ -51,6 +52,7 @@ AtomVecElectron::AtomVecElectron(LAMMPS *lmp) : AtomVec(lmp)
|
||||
|
||||
mass_type = 1;
|
||||
molecular = 0;
|
||||
forceclearflag = 1;
|
||||
|
||||
size_forward = 4;
|
||||
size_reverse = 4;
|
||||
@ -140,6 +142,13 @@ void AtomVecElectron::copy(int i, int j, int delflag)
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
void AtomVecElectron::force_clear(int n, size_t nbytes)
|
||||
{
|
||||
memset(&erforce[n],0,nbytes);
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
int AtomVecElectron::pack_comm(int n, int *list, double *buf,
|
||||
int pbc_flag, int *pbc)
|
||||
{
|
||||
@ -964,6 +973,59 @@ int AtomVecElectron::write_vel_hybrid(FILE *fp, double *buf)
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
assign an index to named atom property and return index
|
||||
return -1 if name is unknown to this atom style
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
int AtomVecElectron::property_atom(char *name)
|
||||
{
|
||||
if (strcmp(name,"spin") == 0) return 0;
|
||||
if (strcmp(name,"eradius") == 0) return 1;
|
||||
if (strcmp(name,"ervel") == 0) return 2;
|
||||
if (strcmp(name,"erforce") == 0) return 3;
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
pack per-atom data into buf for ComputePropertyAtom
|
||||
index maps to data specific to this atom style
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void AtomVecElectron::pack_property_atom(int index, double *buf,
|
||||
int nvalues, int groupbit)
|
||||
{
|
||||
int *mask = atom->mask;
|
||||
int nlocal = atom->nlocal;
|
||||
int n = 0;
|
||||
|
||||
if (index == 0) {
|
||||
for (int i = 0; i < nlocal; i++) {
|
||||
if (mask[i] & groupbit) buf[n] = spin[i];
|
||||
else buf[n] = 0.0;
|
||||
n += nvalues;
|
||||
}
|
||||
} else if (index == 1) {
|
||||
for (int i = 0; i < nlocal; i++) {
|
||||
if (mask[i] & groupbit) buf[n] = eradius[i];
|
||||
else buf[n] = 0.0;
|
||||
n += nvalues;
|
||||
}
|
||||
} else if (index == 2) {
|
||||
for (int i = 0; i < nlocal; i++) {
|
||||
if (mask[i] & groupbit) buf[n] = ervel[i];
|
||||
else buf[n] = 0.0;
|
||||
n += nvalues;
|
||||
}
|
||||
} else if (index == 3) {
|
||||
for (int i = 0; i < nlocal; i++) {
|
||||
if (mask[i] & groupbit) buf[n] = erforce[i];
|
||||
else buf[n] = 0.0;
|
||||
n += nvalues;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
return # of bytes of allocated memory
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
@ -31,6 +31,7 @@ class AtomVecElectron : public AtomVec {
|
||||
void grow(int);
|
||||
void grow_reset();
|
||||
void copy(int, int, int);
|
||||
void force_clear(int, size_t);
|
||||
int pack_comm(int, int *, double *, int, int *);
|
||||
int pack_comm_vel(int, int *, double *, int, int *);
|
||||
int pack_comm_hybrid(int, int *, double *);
|
||||
@ -65,6 +66,8 @@ class AtomVecElectron : public AtomVec {
|
||||
int pack_vel_hybrid(int, double *);
|
||||
void write_vel(FILE *, int, double **);
|
||||
int write_vel_hybrid(FILE *, double *);
|
||||
int property_atom(char *);
|
||||
void pack_property_atom(int, double *, int, int);
|
||||
bigint memory_usage();
|
||||
|
||||
private:
|
||||
|
||||
@ -11,6 +11,7 @@
|
||||
See the README file in the top-level LAMMPS directory.
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
#include "string.h"
|
||||
#include "stdlib.h"
|
||||
#include "atom_vec_meso.h"
|
||||
#include "atom.h"
|
||||
@ -29,6 +30,7 @@ AtomVecMeso::AtomVecMeso(LAMMPS *lmp) : AtomVec(lmp)
|
||||
{
|
||||
molecular = 0;
|
||||
mass_type = 1;
|
||||
forceclearflag = 1;
|
||||
|
||||
comm_x_only = 0; // we communicate not only x forward but also vest ...
|
||||
comm_f_only = 0; // we also communicate de and drho in reverse direction
|
||||
@ -131,6 +133,14 @@ void AtomVecMeso::copy(int i, int j, int delflag) {
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
void AtomVecMeso::force_clear(int n, size_t nbytes)
|
||||
{
|
||||
memset(&de[n],0,nbytes);
|
||||
memset(&drho[n],0,nbytes);
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
int AtomVecMeso::pack_comm_hybrid(int n, int *list, double *buf) {
|
||||
//printf("in AtomVecMeso::pack_comm_hybrid\n");
|
||||
int i, j, m;
|
||||
@ -933,6 +943,66 @@ int AtomVecMeso::write_data_hybrid(FILE *fp, double *buf)
|
||||
return 3;
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
assign an index to named atom property and return index
|
||||
return -1 if name is unknown to this atom style
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
int AtomVecMeso::property_atom(char *name)
|
||||
{
|
||||
if (strcmp(name,"rho") == 0) return 0;
|
||||
if (strcmp(name,"drho") == 0) return 1;
|
||||
if (strcmp(name,"e") == 0) return 2;
|
||||
if (strcmp(name,"de") == 0) return 3;
|
||||
if (strcmp(name,"cv") == 0) return 4;
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
pack per-atom data into buf for ComputePropertyAtom
|
||||
index maps to data specific to this atom style
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void AtomVecMeso::pack_property_atom(int index, double *buf,
|
||||
int nvalues, int groupbit)
|
||||
{
|
||||
int *mask = atom->mask;
|
||||
int nlocal = atom->nlocal;
|
||||
int n = 0;
|
||||
|
||||
if (index == 0) {
|
||||
for (int i = 0; i < nlocal; i++) {
|
||||
if (mask[i] & groupbit) buf[n] = rho[i];
|
||||
else buf[n] = 0.0;
|
||||
n += nvalues;
|
||||
}
|
||||
} else if (index == 1) {
|
||||
for (int i = 0; i < nlocal; i++) {
|
||||
if (mask[i] & groupbit) buf[n] = drho[i];
|
||||
else buf[n] = 0.0;
|
||||
n += nvalues;
|
||||
}
|
||||
} else if (index == 2) {
|
||||
for (int i = 0; i < nlocal; i++) {
|
||||
if (mask[i] & groupbit) buf[n] = e[i];
|
||||
else buf[n] = 0.0;
|
||||
n += nvalues;
|
||||
}
|
||||
} else if (index == 3) {
|
||||
for (int i = 0; i < nlocal; i++) {
|
||||
if (mask[i] & groupbit) buf[n] = de[i];
|
||||
else buf[n] = 0.0;
|
||||
n += nvalues;
|
||||
}
|
||||
} else if (index == 4) {
|
||||
for (int i = 0; i < nlocal; i++) {
|
||||
if (mask[i] & groupbit) buf[n] = cv[i];
|
||||
else buf[n] = 0.0;
|
||||
n += nvalues;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
return # of bytes of allocated memory
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
@ -31,6 +31,7 @@ class AtomVecMeso : public AtomVec {
|
||||
void grow(int);
|
||||
void grow_reset();
|
||||
void copy(int, int, int);
|
||||
void force_clear(int, size_t);
|
||||
int pack_comm(int, int *, double *, int, int *);
|
||||
int pack_comm_vel(int, int *, double *, int, int *);
|
||||
void unpack_comm(int, int, double *);
|
||||
@ -59,6 +60,8 @@ class AtomVecMeso : public AtomVec {
|
||||
int pack_data_hybrid(int, double *);
|
||||
void write_data(FILE *, int, double **);
|
||||
int write_data_hybrid(FILE *, double *);
|
||||
int property_atom(char *);
|
||||
void pack_property_atom(int, double *, int, int);
|
||||
bigint memory_usage();
|
||||
|
||||
private:
|
||||
|
||||
@ -54,6 +54,7 @@ int FixMeso::setmask() {
|
||||
int mask = 0;
|
||||
mask |= INITIAL_INTEGRATE;
|
||||
mask |= FINAL_INTEGRATE;
|
||||
mask |= PRE_FORCE;
|
||||
return mask;
|
||||
}
|
||||
|
||||
@ -64,6 +65,25 @@ void FixMeso::init() {
|
||||
dtf = 0.5 * update->dt * force->ftm2v;
|
||||
}
|
||||
|
||||
void FixMeso::setup_pre_force(int vflag)
|
||||
{
|
||||
// set vest equal to v
|
||||
double **v = atom->v;
|
||||
double **vest = atom->vest;
|
||||
int *mask = atom->mask;
|
||||
int nlocal = atom->nlocal;
|
||||
if (igroup == atom->firstgroup)
|
||||
nlocal = atom->nfirst;
|
||||
|
||||
for (int i = 0; i < nlocal; i++) {
|
||||
if (mask[i] & groupbit) {
|
||||
vest[i][0] = v[i][0];
|
||||
vest[i][1] = v[i][1];
|
||||
vest[i][2] = v[i][2];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
allow for both per-type and per-atom mass
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
@ -29,6 +29,7 @@ class FixMeso : public Fix {
|
||||
FixMeso(class LAMMPS *, int, char **);
|
||||
int setmask();
|
||||
virtual void init();
|
||||
virtual void setup_pre_force(int);
|
||||
virtual void initial_integrate(int);
|
||||
virtual void final_integrate();
|
||||
void reset_dt();
|
||||
|
||||
104
src/atom.cpp
104
src/atom.cpp
@ -79,16 +79,17 @@ Atom::Atom(LAMMPS *lmp) : Pointers(lmp)
|
||||
mu = NULL;
|
||||
omega = angmom = torque = NULL;
|
||||
radius = rmass = NULL;
|
||||
ellipsoid = line = tri = body = NULL;
|
||||
|
||||
vfrac = s0 = NULL;
|
||||
x0 = NULL;
|
||||
ellipsoid = line = tri = body = NULL;
|
||||
|
||||
spin = NULL;
|
||||
eradius = ervel = erforce = NULL;
|
||||
cs = csforce = vforce = ervelforce = NULL;
|
||||
etag = NULL;
|
||||
rho = drho = NULL;
|
||||
e = de = NULL;
|
||||
cv = NULL;
|
||||
|
||||
rho = drho = e = de = cv = NULL;
|
||||
vest = NULL;
|
||||
|
||||
bond_per_atom = extra_bond_per_atom = 0;
|
||||
@ -130,14 +131,19 @@ Atom::Atom(LAMMPS *lmp) : Pointers(lmp)
|
||||
// initialize atom style and array existence flags
|
||||
// customize by adding new flag
|
||||
|
||||
sphere_flag = ellipsoid_flag = line_flag = tri_flag = body_flag = 0;
|
||||
peri_flag = electron_flag = 0;
|
||||
sphere_flag = peri_flag = electron_flag = 0;
|
||||
wavepacket_flag = sph_flag = 0;
|
||||
|
||||
molecule_flag = q_flag = mu_flag = 0;
|
||||
rmass_flag = radius_flag = omega_flag = torque_flag = angmom_flag = 0;
|
||||
vfrac_flag = spin_flag = eradius_flag = ervel_flag = erforce_flag = 0;
|
||||
cs_flag = csforce_flag = vforce_flag = ervelforce_flag= etag_flag = 0;
|
||||
molecule_flag = 0;
|
||||
q_flag = mu_flag = 0;
|
||||
omega_flag = torque_flag = angmom_flag = 0;
|
||||
radius_flag = rmass_flag = 0;
|
||||
ellipsoid_flag = line_flag = tri_flag = body_flag = 0;
|
||||
|
||||
vfrac_flag = 0;
|
||||
spin_flag = eradius_flag = ervel_flag = erforce_flag = ervelforce_flag = 0;
|
||||
cs_flag = csforce_flag = vforce_flag = etag_flag = 0;
|
||||
|
||||
rho_flag = e_flag = cv_flag = vest_flag = 0;
|
||||
|
||||
// Peridynamic scale factor
|
||||
@ -200,6 +206,10 @@ Atom::~Atom()
|
||||
memory->destroy(v);
|
||||
memory->destroy(f);
|
||||
|
||||
memory->destroy(molecule);
|
||||
memory->destroy(molindex);
|
||||
memory->destroy(molatom);
|
||||
|
||||
memory->destroy(q);
|
||||
memory->destroy(mu);
|
||||
memory->destroy(omega);
|
||||
@ -207,21 +217,31 @@ Atom::~Atom()
|
||||
memory->destroy(torque);
|
||||
memory->destroy(radius);
|
||||
memory->destroy(rmass);
|
||||
memory->destroy(vfrac);
|
||||
memory->destroy(s0);
|
||||
memory->destroy(x0);
|
||||
memory->destroy(ellipsoid);
|
||||
memory->destroy(line);
|
||||
memory->destroy(tri);
|
||||
memory->destroy(body);
|
||||
|
||||
memory->destroy(vfrac);
|
||||
memory->destroy(s0);
|
||||
memory->destroy(x0);
|
||||
|
||||
memory->destroy(spin);
|
||||
memory->destroy(eradius);
|
||||
memory->destroy(ervel);
|
||||
memory->destroy(erforce);
|
||||
memory->destroy(ervelforce);
|
||||
memory->destroy(cs);
|
||||
memory->destroy(csforce);
|
||||
memory->destroy(vforce);
|
||||
memory->destroy(etag);
|
||||
|
||||
memory->destroy(molecule);
|
||||
memory->destroy(molindex);
|
||||
memory->destroy(molatom);
|
||||
memory->destroy(rho);
|
||||
memory->destroy(drho);
|
||||
memory->destroy(e);
|
||||
memory->destroy(de);
|
||||
memory->destroy(cv);
|
||||
memory->destroy(vest);
|
||||
|
||||
memory->destroy(nspecial);
|
||||
memory->destroy(special);
|
||||
@ -250,11 +270,6 @@ Atom::~Atom()
|
||||
memory->destroy(improper_atom3);
|
||||
memory->destroy(improper_atom4);
|
||||
|
||||
// delete user-defined molecules
|
||||
|
||||
for (int i = 0; i < nmolecule; i++) delete molecules[i];
|
||||
memory->sfree(molecules);
|
||||
|
||||
// delete custom atom arrays
|
||||
|
||||
for (int i = 0; i < nivector; i++) {
|
||||
@ -271,6 +286,11 @@ Atom::~Atom()
|
||||
memory->sfree(ivector);
|
||||
memory->sfree(dvector);
|
||||
|
||||
// delete user-defined molecules
|
||||
|
||||
for (int i = 0; i < nmolecule; i++) delete molecules[i];
|
||||
memory->sfree(molecules);
|
||||
|
||||
// delete per-type arrays
|
||||
|
||||
delete [] mass;
|
||||
@ -320,12 +340,20 @@ void Atom::create_avec(const char *style, int narg, char **arg, char *suffix)
|
||||
// may have been set by old avec
|
||||
// customize by adding new flag
|
||||
|
||||
sphere_flag = ellipsoid_flag = line_flag = tri_flag = 0;
|
||||
peri_flag = electron_flag = 0;
|
||||
sphere_flag = peri_flag = electron_flag = 0;
|
||||
wavepacket_flag = sph_flag = 0;
|
||||
|
||||
molecule_flag = q_flag = mu_flag = 0;
|
||||
rmass_flag = radius_flag = omega_flag = torque_flag = angmom_flag = 0;
|
||||
vfrac_flag = spin_flag = eradius_flag = ervel_flag = erforce_flag = 0;
|
||||
molecule_flag = 0;
|
||||
q_flag = mu_flag = 0;
|
||||
omega_flag = torque_flag = angmom_flag = 0;
|
||||
radius_flag = rmass_flag = 0;
|
||||
ellipsoid_flag = line_flag = tri_flag = body_flag = 0;
|
||||
|
||||
vfrac_flag = 0;
|
||||
spin_flag = eradius_flag = ervel_flag = erforce_flag = ervelforce_flag = 0;
|
||||
cs_flag = csforce_flag = vforce_flag = etag_flag = 0;
|
||||
|
||||
rho_flag = e_flag = cv_flag = vest_flag = 0;
|
||||
|
||||
// create instance of AtomVec
|
||||
// use grow() to initialize atom-based arrays to length 1
|
||||
@ -1867,12 +1895,34 @@ void *Atom::extract(char *name)
|
||||
if (strcmp(name,"q") == 0) return (void *) q;
|
||||
if (strcmp(name,"mu") == 0) return (void *) mu;
|
||||
if (strcmp(name,"omega") == 0) return (void *) omega;
|
||||
if (strcmp(name,"amgmom") == 0) return (void *) angmom;
|
||||
if (strcmp(name,"angmom") == 0) return (void *) angmom;
|
||||
if (strcmp(name,"torque") == 0) return (void *) torque;
|
||||
if (strcmp(name,"radius") == 0) return (void *) radius;
|
||||
if (strcmp(name,"rmass") == 0) return (void *) rmass;
|
||||
if (strcmp(name,"ellipsoid") == 0) return (void *) ellipsoid;
|
||||
if (strcmp(name,"line") == 0) return (void *) line;
|
||||
if (strcmp(name,"tri") == 0) return (void *) tri;
|
||||
|
||||
if (strcmp(name,"vfrac") == 0) return (void *) vfrac;
|
||||
if (strcmp(name,"s0") == 0) return (void *) s0;
|
||||
if (strcmp(name,"x0") == 0) return (void *) x0;
|
||||
|
||||
if (strcmp(name,"spin") == 0) return (void *) spin;
|
||||
if (strcmp(name,"eradius") == 0) return (void *) eradius;
|
||||
if (strcmp(name,"ervel") == 0) return (void *) ervel;
|
||||
if (strcmp(name,"erforce") == 0) return (void *) erforce;
|
||||
if (strcmp(name,"ervelforce") == 0) return (void *) ervelforce;
|
||||
if (strcmp(name,"cs") == 0) return (void *) cs;
|
||||
if (strcmp(name,"csforce") == 0) return (void *) csforce;
|
||||
if (strcmp(name,"vforce") == 0) return (void *) vforce;
|
||||
if (strcmp(name,"etag") == 0) return (void *) etag;
|
||||
|
||||
if (strcmp(name,"rho") == 0) return (void *) rho;
|
||||
if (strcmp(name,"drho") == 0) return (void *) drho;
|
||||
if (strcmp(name,"e") == 0) return (void *) e;
|
||||
if (strcmp(name,"de") == 0) return (void *) de;
|
||||
if (strcmp(name,"cv") == 0) return (void *) cv;
|
||||
if (strcmp(name,"vest") == 0) return (void *) vest;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
19
src/atom.h
19
src/atom.h
@ -53,19 +53,28 @@ class Atom : protected Pointers {
|
||||
|
||||
tagint *molecule;
|
||||
int *molindex,*molatom;
|
||||
|
||||
double *q,**mu;
|
||||
double **omega,**angmom,**torque;
|
||||
double *radius,*rmass,*vfrac,*s0;
|
||||
double **x0;
|
||||
double *radius,*rmass;
|
||||
int *ellipsoid,*line,*tri,*body;
|
||||
|
||||
// PERI package
|
||||
|
||||
double *vfrac,*s0;
|
||||
double **x0;
|
||||
|
||||
// USER-EFF and USER-AWPMD packages
|
||||
|
||||
int *spin;
|
||||
double *eradius,*ervel,*erforce,*ervelforce;
|
||||
double *cs,*csforce,*vforce;
|
||||
int *etag;
|
||||
double *rho,*drho;
|
||||
double *e,*de;
|
||||
|
||||
// USER-SPH package
|
||||
|
||||
double *rho,*drho,*e,*de,*cv;
|
||||
double **vest;
|
||||
double *cv;
|
||||
|
||||
int **nspecial; // 0,1,2 = cummulative # of 1-2,1-3,1-4 neighs
|
||||
tagint **special; // IDs of 1-2,1-3,1-4 neighs of each atom
|
||||
|
||||
@ -31,6 +31,7 @@ AtomVec::AtomVec(LAMMPS *lmp) : Pointers(lmp)
|
||||
nmax = 0;
|
||||
bonds_allow = angles_allow = dihedrals_allow = impropers_allow = 0;
|
||||
mass_type = dipole_type = 0;
|
||||
forceclearflag = 0;
|
||||
size_data_bonus = 0;
|
||||
cudable = kokkosable = 0;
|
||||
|
||||
|
||||
@ -26,6 +26,7 @@ class AtomVec : protected Pointers {
|
||||
int dihedrals_allow,impropers_allow; // 1 if dihedrals, impropers used
|
||||
int mass_type; // 1 if per-type masses
|
||||
int dipole_type; // 1 if per-type dipole moments
|
||||
int forceclearflag; // 1 if has forceclear() method
|
||||
|
||||
int comm_x_only; // 1 if only exchange x in forward comm
|
||||
int comm_f_only; // 1 if only exchange f in reverse comm
|
||||
@ -59,6 +60,7 @@ class AtomVec : protected Pointers {
|
||||
virtual void grow_reset() = 0;
|
||||
virtual void copy(int, int, int) = 0;
|
||||
virtual void clear_bonus() {}
|
||||
virtual void force_clear(int, size_t) {}
|
||||
|
||||
virtual int pack_comm(int, int *, double *, int, int *) = 0;
|
||||
virtual int pack_comm_vel(int, int *, double *, int, int *) = 0;
|
||||
@ -112,6 +114,9 @@ class AtomVec : protected Pointers {
|
||||
void pack_improper(tagint **);
|
||||
void write_improper(FILE *, int, tagint **, int);
|
||||
|
||||
virtual int property_atom(char *) {return -1;}
|
||||
virtual void pack_property_atom(int, double *, int, int) {}
|
||||
|
||||
virtual bigint memory_usage() = 0;
|
||||
|
||||
protected:
|
||||
|
||||
@ -107,6 +107,8 @@ void AtomVecHybrid::process_args(int narg, char **arg)
|
||||
impropers_allow = MAX(impropers_allow,styles[k]->impropers_allow);
|
||||
mass_type = MAX(mass_type,styles[k]->mass_type);
|
||||
dipole_type = MAX(dipole_type,styles[k]->dipole_type);
|
||||
forceclearflag = MAX(forceclearflag,styles[k]->forceclearflag);
|
||||
|
||||
if (styles[k]->molecular == 2) onemols = styles[k]->onemols;
|
||||
|
||||
comm_x_only = MIN(comm_x_only,styles[k]->comm_x_only);
|
||||
@ -203,6 +205,14 @@ void AtomVecHybrid::clear_bonus()
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
void AtomVecHybrid::force_clear(int n, size_t nbytes)
|
||||
{
|
||||
for (int k = 0; k < nstyles; k++)
|
||||
if (styles[k]->forceclearflag) styles[k]->force_clear(n,nbytes);
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
int AtomVecHybrid::pack_comm(int n, int *list, double *buf,
|
||||
int pbc_flag, int *pbc)
|
||||
{
|
||||
@ -994,6 +1004,34 @@ void AtomVecHybrid::write_vel(FILE *fp, int n, double **buf)
|
||||
}
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
assign an index to named atom property and return index
|
||||
returned value encodes which sub-style and index returned by sub-style
|
||||
return -1 if name is unknown to any sub-styles
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
int AtomVecHybrid::property_atom(char *name)
|
||||
{
|
||||
for (int k = 0; k < nstyles; k++) {
|
||||
int index = styles[k]->property_atom(name);
|
||||
if (index >= 0) return index*nstyles + k;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
pack per-atom data into buf for ComputePropertyAtom
|
||||
index maps to data specific to this atom style
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void AtomVecHybrid::pack_property_atom(int multiindex, double *buf,
|
||||
int nvalues, int groupbit)
|
||||
{
|
||||
int k = multiindex % nstyles;
|
||||
int index = multiindex/nstyles;
|
||||
styles[k]->pack_property_atom(index,buf,nvalues,groupbit);
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
allstyles = list of all atom styles in this LAMMPS executable
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
@ -39,6 +39,7 @@ class AtomVecHybrid : public AtomVec {
|
||||
void grow_reset();
|
||||
void copy(int, int, int);
|
||||
void clear_bonus();
|
||||
void force_clear(int, size_t);
|
||||
int pack_comm(int, int *, double *, int, int *);
|
||||
int pack_comm_vel(int, int *, double *, int, int *);
|
||||
void unpack_comm(int, int, double *);
|
||||
@ -62,6 +63,8 @@ class AtomVecHybrid : public AtomVec {
|
||||
void write_data(FILE *, int, double **);
|
||||
void pack_vel(double **);
|
||||
void write_vel(FILE *, int, double **);
|
||||
int property_atom(char *);
|
||||
void pack_property_atom(int, double *, int, int);
|
||||
bigint memory_usage();
|
||||
|
||||
private:
|
||||
|
||||
@ -16,6 +16,7 @@
|
||||
#include "compute_property_atom.h"
|
||||
#include "math_extra.h"
|
||||
#include "atom.h"
|
||||
#include "atom_vec.h"
|
||||
#include "atom_vec_ellipsoid.h"
|
||||
#include "atom_vec_line.h"
|
||||
#include "atom_vec_tri.h"
|
||||
@ -239,27 +240,6 @@ ComputePropertyAtom::ComputePropertyAtom(LAMMPS *lmp, int narg, char **arg) :
|
||||
"atom property that isn't allocated");
|
||||
pack_choice[i] = &ComputePropertyAtom::pack_tqz;
|
||||
|
||||
} else if (strcmp(arg[iarg],"spin") == 0) {
|
||||
if (!atom->spin_flag)
|
||||
error->all(FLERR,"Compute property/atom for "
|
||||
"atom property that isn't allocated");
|
||||
pack_choice[i] = &ComputePropertyAtom::pack_spin;
|
||||
} else if (strcmp(arg[iarg],"eradius") == 0) {
|
||||
if (!atom->eradius_flag)
|
||||
error->all(FLERR,"Compute property/atom for "
|
||||
"atom property that isn't allocated");
|
||||
pack_choice[i] = &ComputePropertyAtom::pack_eradius;
|
||||
} else if (strcmp(arg[iarg],"ervel") == 0) {
|
||||
if (!atom->ervel_flag)
|
||||
error->all(FLERR,"Compute property/atom for "
|
||||
"atom property that isn't allocated");
|
||||
pack_choice[i] = &ComputePropertyAtom::pack_ervel;
|
||||
} else if (strcmp(arg[iarg],"erforce") == 0) {
|
||||
if (!atom->erforce_flag)
|
||||
error->all(FLERR,"Compute property/atom for "
|
||||
"atom property that isn't allocated");
|
||||
pack_choice[i] = &ComputePropertyAtom::pack_erforce;
|
||||
|
||||
} else if (strcmp(arg[iarg],"end1x") == 0) {
|
||||
avec_line = (AtomVecLine *) atom->style_match("line");
|
||||
if (!avec_line) error->all(FLERR,"Compute property/atom for "
|
||||
@ -342,6 +322,7 @@ ComputePropertyAtom::ComputePropertyAtom(LAMMPS *lmp, int narg, char **arg) :
|
||||
error->all(FLERR,"Compute property/atom for "
|
||||
"atom property that isn't allocated");
|
||||
pack_choice[i] = &ComputePropertyAtom::pack_nbonds;
|
||||
|
||||
} else if (strstr(arg[iarg],"i_") == arg[iarg]) {
|
||||
int flag;
|
||||
index[i] = atom->find_custom(&arg[iarg][2],flag);
|
||||
@ -357,7 +338,14 @@ ComputePropertyAtom::ComputePropertyAtom(LAMMPS *lmp, int narg, char **arg) :
|
||||
"vector does not exist");
|
||||
pack_choice[i] = &ComputePropertyAtom::pack_dname;
|
||||
|
||||
} else error->all(FLERR,"Invalid keyword in compute property/atom command");
|
||||
// check if atom style recognizes keyword
|
||||
|
||||
} else {
|
||||
index[i] = atom->avec->property_atom(arg[iarg]);
|
||||
if (index[i] < 0)
|
||||
error->all(FLERR,"Invalid keyword in compute property/atom command");
|
||||
pack_choice[i] = &ComputePropertyAtom::pack_property_atom;
|
||||
}
|
||||
}
|
||||
|
||||
nmax = 0;
|
||||
@ -1341,66 +1329,6 @@ void ComputePropertyAtom::pack_tqz(int n)
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
void ComputePropertyAtom::pack_spin(int n)
|
||||
{
|
||||
int *spin = atom->spin;
|
||||
int *mask = atom->mask;
|
||||
int nlocal = atom->nlocal;
|
||||
|
||||
for (int i = 0; i < nlocal; i++) {
|
||||
if (mask[i] & groupbit) buf[n] = spin[i];
|
||||
else buf[n] = 0.0;
|
||||
n += nvalues;
|
||||
}
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
void ComputePropertyAtom::pack_eradius(int n)
|
||||
{
|
||||
double *eradius = atom->eradius;
|
||||
int *mask = atom->mask;
|
||||
int nlocal = atom->nlocal;
|
||||
|
||||
for (int i = 0; i < nlocal; i++) {
|
||||
if (mask[i] & groupbit) buf[n] = eradius[i];
|
||||
else buf[n] = 0.0;
|
||||
n += nvalues;
|
||||
}
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
void ComputePropertyAtom::pack_ervel(int n)
|
||||
{
|
||||
double *ervel = atom->ervel;
|
||||
int *mask = atom->mask;
|
||||
int nlocal = atom->nlocal;
|
||||
|
||||
for (int i = 0; i < nlocal; i++) {
|
||||
if (mask[i] & groupbit) buf[n] = ervel[i];
|
||||
else buf[n] = 0.0;
|
||||
n += nvalues;
|
||||
}
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
void ComputePropertyAtom::pack_erforce(int n)
|
||||
{
|
||||
double *erforce = atom->erforce;
|
||||
int *mask = atom->mask;
|
||||
int nlocal = atom->nlocal;
|
||||
|
||||
for (int i = 0; i < nlocal; i++) {
|
||||
if (mask[i] & groupbit) buf[n] = erforce[i];
|
||||
else buf[n] = 0.0;
|
||||
n += nvalues;
|
||||
}
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
void ComputePropertyAtom::pack_end1x(int n)
|
||||
{
|
||||
AtomVecLine::Bonus *bonus = avec_line->bonus;
|
||||
@ -1734,3 +1662,10 @@ void ComputePropertyAtom::pack_dname(int n)
|
||||
n += nvalues;
|
||||
}
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
void ComputePropertyAtom::pack_property_atom(int n)
|
||||
{
|
||||
atom->avec->pack_property_atom(index[n],&buf[n],nvalues,groupbit);
|
||||
}
|
||||
|
||||
@ -101,10 +101,6 @@ class ComputePropertyAtom : public Compute {
|
||||
void pack_tqx(int);
|
||||
void pack_tqy(int);
|
||||
void pack_tqz(int);
|
||||
void pack_spin(int);
|
||||
void pack_eradius(int);
|
||||
void pack_ervel(int);
|
||||
void pack_erforce(int);
|
||||
void pack_end1x(int);
|
||||
void pack_end1y(int);
|
||||
void pack_end1z(int);
|
||||
@ -125,6 +121,8 @@ class ComputePropertyAtom : public Compute {
|
||||
|
||||
void pack_iname(int);
|
||||
void pack_dname(int);
|
||||
|
||||
void pack_property_atom(int);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@ -41,7 +41,7 @@ enum{ID,MOL,TYPE,ELEMENT,MASS,
|
||||
VX,VY,VZ,FX,FY,FZ,
|
||||
Q,MUX,MUY,MUZ,MU,RADIUS,DIAMETER,
|
||||
OMEGAX,OMEGAY,OMEGAZ,ANGMOMX,ANGMOMY,ANGMOMZ,
|
||||
TQX,TQY,TQZ,SPIN,ERADIUS,ERVEL,ERFORCE,
|
||||
TQX,TQY,TQZ,
|
||||
COMPUTE,FIX,VARIABLE};
|
||||
enum{LT,LE,GT,GE,EQ,NEQ};
|
||||
enum{INT,DOUBLE,STRING,BIGINT}; // same as in DumpCFG
|
||||
@ -804,33 +804,6 @@ int DumpCustom::count()
|
||||
ptr = &atom->torque[0][2];
|
||||
nstride = 3;
|
||||
|
||||
} else if (thresh_array[ithresh] == SPIN) {
|
||||
if (!atom->spin_flag)
|
||||
error->all(FLERR,
|
||||
"Threshhold for an atom property that isn't allocated");
|
||||
int *spin = atom->spin;
|
||||
for (i = 0; i < nlocal; i++) dchoose[i] = spin[i];
|
||||
ptr = dchoose;
|
||||
nstride = 1;
|
||||
} else if (thresh_array[ithresh] == ERADIUS) {
|
||||
if (!atom->eradius_flag)
|
||||
error->all(FLERR,
|
||||
"Threshhold for an atom property that isn't allocated");
|
||||
ptr = atom->eradius;
|
||||
nstride = 1;
|
||||
} else if (thresh_array[ithresh] == ERVEL) {
|
||||
if (!atom->ervel_flag)
|
||||
error->all(FLERR,
|
||||
"Threshhold for an atom property that isn't allocated");
|
||||
ptr = atom->ervel;
|
||||
nstride = 1;
|
||||
} else if (thresh_array[ithresh] == ERFORCE) {
|
||||
if (!atom->erforce_flag)
|
||||
error->all(FLERR,
|
||||
"Threshhold for an atom property that isn't allocated");
|
||||
ptr = atom->erforce;
|
||||
nstride = 1;
|
||||
|
||||
} else if (thresh_array[ithresh] == COMPUTE) {
|
||||
i = nfield + ithresh;
|
||||
if (argindex[i] == 0) {
|
||||
@ -1171,27 +1144,6 @@ int DumpCustom::parse_fields(int narg, char **arg)
|
||||
pack_choice[i] = &DumpCustom::pack_tqz;
|
||||
vtype[i] = DOUBLE;
|
||||
|
||||
} else if (strcmp(arg[iarg],"spin") == 0) {
|
||||
if (!atom->spin_flag)
|
||||
error->all(FLERR,"Dumping an atom quantity that isn't allocated");
|
||||
pack_choice[i] = &DumpCustom::pack_spin;
|
||||
vtype[i] = INT;
|
||||
} else if (strcmp(arg[iarg],"eradius") == 0) {
|
||||
if (!atom->eradius_flag)
|
||||
error->all(FLERR,"Dumping an atom quantity that isn't allocated");
|
||||
pack_choice[i] = &DumpCustom::pack_eradius;
|
||||
vtype[i] = DOUBLE;
|
||||
} else if (strcmp(arg[iarg],"ervel") == 0) {
|
||||
if (!atom->ervel_flag)
|
||||
error->all(FLERR,"Dumping an atom quantity that isn't allocated");
|
||||
pack_choice[i] = &DumpCustom::pack_ervel;
|
||||
vtype[i] = DOUBLE;
|
||||
} else if (strcmp(arg[iarg],"erforce") == 0) {
|
||||
if (!atom->erforce_flag)
|
||||
error->all(FLERR,"Dumping an atom quantity that isn't allocated");
|
||||
pack_choice[i] = &DumpCustom::pack_erforce;
|
||||
vtype[i] = DOUBLE;
|
||||
|
||||
// compute value = c_ID
|
||||
// if no trailing [], then arg is set to 0, else arg is int between []
|
||||
|
||||
@ -1506,11 +1458,6 @@ int DumpCustom::modify_param(int narg, char **arg)
|
||||
else if (strcmp(arg[1],"tqy") == 0) thresh_array[nthresh] = TQY;
|
||||
else if (strcmp(arg[1],"tqz") == 0) thresh_array[nthresh] = TQZ;
|
||||
|
||||
else if (strcmp(arg[1],"spin") == 0) thresh_array[nthresh] = SPIN;
|
||||
else if (strcmp(arg[1],"eradius") == 0) thresh_array[nthresh] = ERADIUS;
|
||||
else if (strcmp(arg[1],"ervel") == 0) thresh_array[nthresh] = ERVEL;
|
||||
else if (strcmp(arg[1],"erforce") == 0) thresh_array[nthresh] = ERFORCE;
|
||||
|
||||
// compute value = c_ID
|
||||
// if no trailing [], then arg is set to 0, else arg is between []
|
||||
// must grow field2index and argindex arrays, since access is beyond nfield
|
||||
@ -2418,51 +2365,3 @@ void DumpCustom::pack_tqz(int n)
|
||||
n += size_one;
|
||||
}
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
void DumpCustom::pack_spin(int n)
|
||||
{
|
||||
int *spin = atom->spin;
|
||||
|
||||
for (int i = 0; i < nchoose; i++) {
|
||||
buf[n] = spin[clist[i]];
|
||||
n += size_one;
|
||||
}
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
void DumpCustom::pack_eradius(int n)
|
||||
{
|
||||
double *eradius = atom->eradius;
|
||||
|
||||
for (int i = 0; i < nchoose; i++) {
|
||||
buf[n] = eradius[clist[i]];
|
||||
n += size_one;
|
||||
}
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
void DumpCustom::pack_ervel(int n)
|
||||
{
|
||||
double *ervel = atom->ervel;
|
||||
|
||||
for (int i = 0; i < nchoose; i++) {
|
||||
buf[n] = ervel[clist[i]];
|
||||
n += size_one;
|
||||
}
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
void DumpCustom::pack_erforce(int n)
|
||||
{
|
||||
double *erforce = atom->erforce;
|
||||
|
||||
for (int i = 0; i < nchoose; i++) {
|
||||
buf[n] = erforce[clist[i]];
|
||||
n += size_one;
|
||||
}
|
||||
}
|
||||
|
||||
@ -168,10 +168,6 @@ class DumpCustom : public Dump {
|
||||
void pack_tqx(int);
|
||||
void pack_tqy(int);
|
||||
void pack_tqz(int);
|
||||
void pack_spin(int);
|
||||
void pack_eradius(int);
|
||||
void pack_ervel(int);
|
||||
void pack_erforce(int);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@ -83,8 +83,8 @@ LAMMPS::LAMMPS(int narg, char **arg, MPI_Comm communicator)
|
||||
int logflag = 0;
|
||||
int partscreenflag = 0;
|
||||
int partlogflag = 0;
|
||||
int cudaflag = -1;
|
||||
int kokkosflag = -1;
|
||||
int cudaflag = 0;
|
||||
int kokkosflag = 0;
|
||||
int restartflag = 0;
|
||||
int citeflag = 1;
|
||||
int helpflag = 0;
|
||||
@ -487,18 +487,11 @@ LAMMPS::LAMMPS(int narg, char **arg, MPI_Comm communicator)
|
||||
// create Cuda class if USER-CUDA installed, unless explicitly switched off
|
||||
// instantiation creates dummy Cuda class if USER-CUDA is not installed
|
||||
|
||||
if (cudaflag == 0) {
|
||||
cuda = NULL;
|
||||
} else if (cudaflag == 1) {
|
||||
if (cudaflag == 1) {
|
||||
cuda = new Cuda(this);
|
||||
if (!cuda->cuda_exists)
|
||||
error->all(FLERR,"Cannot use -cuda on without USER-CUDA installed");
|
||||
} else {
|
||||
cuda = new Cuda(this);
|
||||
if (!cuda->cuda_exists) {
|
||||
delete cuda;
|
||||
cuda = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
int me;
|
||||
@ -509,18 +502,11 @@ LAMMPS::LAMMPS(int narg, char **arg, MPI_Comm communicator)
|
||||
// instantiation creates dummy Kokkos class if KOKKOS is not installed
|
||||
// add args between kkfirst and kklast to Kokkos instantiation
|
||||
|
||||
if (kokkosflag == 0) {
|
||||
kokkos = NULL;
|
||||
} else if (kokkosflag == 1) {
|
||||
if (kokkosflag == 1) {
|
||||
kokkos = new KokkosLMP(this,kklast-kkfirst,&arg[kkfirst]);
|
||||
if (!kokkos->kokkos_exists)
|
||||
error->all(FLERR,"Cannot use -kokkos on without KOKKOS installed");
|
||||
} else {
|
||||
kokkos = new KokkosLMP(this,kklast-kkfirst,&arg[kkfirst]);
|
||||
if (!kokkos->kokkos_exists) {
|
||||
delete kokkos;
|
||||
kokkos = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
MPI_Comm_rank(world,&me);
|
||||
|
||||
32
src/min.cpp
32
src/min.cpp
@ -24,6 +24,7 @@
|
||||
#include "string.h"
|
||||
#include "min.h"
|
||||
#include "atom.h"
|
||||
#include "atom_vec.h"
|
||||
#include "domain.h"
|
||||
#include "comm.h"
|
||||
#include "update.h"
|
||||
@ -139,17 +140,11 @@ void Min::init()
|
||||
int ifix = modify->find_fix("package_omp");
|
||||
if (ifix >= 0) external_force_clear = 1;
|
||||
|
||||
// set flags for what arrays to clear in force_clear()
|
||||
// need to clear additionals arrays if they exist
|
||||
// set flags for arrays to clear in force_clear()
|
||||
|
||||
torqueflag = 0;
|
||||
torqueflag = extraflag = 0;
|
||||
if (atom->torque_flag) torqueflag = 1;
|
||||
erforceflag = 0;
|
||||
if (atom->erforce_flag) erforceflag = 1;
|
||||
e_flag = 0;
|
||||
if (atom->e_flag) e_flag = 1;
|
||||
rho_flag = 0;
|
||||
if (atom->rho_flag) rho_flag = 1;
|
||||
if (atom->avec->forceclearflag) extraflag = 1;
|
||||
|
||||
// allow pair and Kspace compute() to be turned off via modify flags
|
||||
|
||||
@ -552,7 +547,7 @@ double Min::energy_force(int resetflag)
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
clear force on own & ghost atoms
|
||||
setup and clear other arrays as needed
|
||||
clear other arrays as needed
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void Min::force_clear()
|
||||
@ -560,20 +555,15 @@ void Min::force_clear()
|
||||
if (external_force_clear) return;
|
||||
|
||||
// clear global force array
|
||||
// nall includes ghosts only if either newton flag is set
|
||||
// if either newton flag is set, also include ghosts
|
||||
|
||||
int nall;
|
||||
if (force->newton) nall = atom->nlocal + atom->nghost;
|
||||
else nall = atom->nlocal;
|
||||
|
||||
size_t nbytes = sizeof(double) * nall;
|
||||
size_t nbytes = sizeof(double) * atom->nlocal;
|
||||
if (force->newton) nbytes += sizeof(double) * atom->nghost;
|
||||
|
||||
if (nbytes) {
|
||||
memset(&(atom->f[0][0]),0,3*nbytes);
|
||||
if (torqueflag) memset(&(atom->torque[0][0]),0,3*nbytes);
|
||||
if (erforceflag) memset(&(atom->erforce[0]), 0, nbytes);
|
||||
if (e_flag) memset(&(atom->de[0]), 0, nbytes);
|
||||
if (rho_flag) memset(&(atom->drho[0]), 0, nbytes);
|
||||
memset(&atom->f[0][0],0,3*nbytes);
|
||||
if (torqueflag) memset(&atom->torque[0][0],0,3*nbytes);
|
||||
if (extraflag) atom->avec->force_clear(0,nbytes);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -63,8 +63,7 @@ class Min : protected Pointers {
|
||||
|
||||
int triclinic; // 0 if domain is orthog, 1 if triclinic
|
||||
int pairflag;
|
||||
int torqueflag,erforceflag;
|
||||
int e_flag,rho_flag;
|
||||
int torqueflag,extraflag;
|
||||
|
||||
int pair_compute_flag; // 0 if pair->compute is skipped
|
||||
int kspace_compute_flag; // 0 if kspace->compute is skipped
|
||||
|
||||
@ -515,7 +515,7 @@ void Output::reset_timestep(bigint ntimestep)
|
||||
next_thermo = static_cast<bigint>
|
||||
(input->variable->compute_equal(ivar_thermo));
|
||||
if (next_thermo < ntimestep)
|
||||
error->all(FLERR,"Thermo every variable returned a bad timestep");
|
||||
error->all(FLERR,"Thermo_modify every variable returned a bad timestep");
|
||||
update->ntimestep++;
|
||||
next_thermo = MIN(next_thermo,update->laststep);
|
||||
modify->addstep_compute(next_thermo);
|
||||
|
||||
@ -71,7 +71,7 @@ Self-explanatory. Check the input script or data file.
|
||||
|
||||
E: Pair dpd requires ghost atoms store velocity
|
||||
|
||||
Use the communicate vel yes command to enable this.
|
||||
Use the comm_modify vel yes command to enable this.
|
||||
|
||||
W: Pair dpd needs newton pair on for momentum conservation
|
||||
|
||||
|
||||
@ -127,7 +127,7 @@ void Rerun::command(int narg, char **arg)
|
||||
// perform the psuedo run
|
||||
// invoke lmp->init() only once
|
||||
// read all relevant snapshots
|
||||
// uset setup_minimal() since atoms are already owned by correct procs
|
||||
// use setup_minimal() since atoms are already owned by correct procs
|
||||
// addstep_compute_all() insures energy/virial computed on every snapshot
|
||||
|
||||
update->whichflag = 1;
|
||||
|
||||
@ -20,6 +20,7 @@
|
||||
#include "respa.h"
|
||||
#include "neighbor.h"
|
||||
#include "atom.h"
|
||||
#include "atom_vec.h"
|
||||
#include "domain.h"
|
||||
#include "comm.h"
|
||||
#include "force.h"
|
||||
@ -283,17 +284,11 @@ void Respa::init()
|
||||
int ifix = modify->find_fix("package_omp");
|
||||
if (ifix >= 0) external_force_clear = 1;
|
||||
|
||||
// set flags for what arrays to clear in force_clear()
|
||||
// need to clear additionals arrays if they exist
|
||||
// set flags for arrays to clear in force_clear()
|
||||
|
||||
torqueflag = 0;
|
||||
torqueflag = extraflag = 0;
|
||||
if (atom->torque_flag) torqueflag = 1;
|
||||
erforceflag = 0;
|
||||
if (atom->erforce_flag) erforceflag = 1;
|
||||
e_flag = 0;
|
||||
if (atom->e_flag) e_flag = 1;
|
||||
rho_flag = 0;
|
||||
if (atom->rho_flag) rho_flag = 1;
|
||||
if (atom->avec->forceclearflag) extraflag = 1;
|
||||
|
||||
// step[] = timestep for each level
|
||||
|
||||
@ -643,6 +638,7 @@ void Respa::recurse(int ilevel)
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
clear force on own & ghost atoms
|
||||
clear other arrays as needed
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void Respa::force_clear(int newtonflag)
|
||||
@ -650,20 +646,15 @@ void Respa::force_clear(int newtonflag)
|
||||
if (external_force_clear) return;
|
||||
|
||||
// clear global force array
|
||||
// nall includes ghosts only if newton flag is set
|
||||
// if either newton flag is set, also include ghosts
|
||||
|
||||
int nall;
|
||||
if (newtonflag) nall = atom->nlocal + atom->nghost;
|
||||
else nall = atom->nlocal;
|
||||
size_t nbytes = sizeof(double) * atom->nlocal;
|
||||
if (force->newton) nbytes += sizeof(double) * atom->nghost;
|
||||
|
||||
size_t nbytes = sizeof(double) * nall;
|
||||
|
||||
if (nbytes > 0 ) {
|
||||
memset(&(atom->f[0][0]),0,3*nbytes);
|
||||
if (torqueflag) memset(&(atom->torque[0][0]),0,3*nbytes);
|
||||
if (erforceflag) memset(&(atom->erforce[0]), 0, nbytes);
|
||||
if (e_flag) memset(&(atom->de[0]), 0, nbytes);
|
||||
if (rho_flag) memset(&(atom->drho[0]), 0, nbytes);
|
||||
if (nbytes) {
|
||||
memset(&atom->f[0][0],0,3*nbytes);
|
||||
if (torqueflag) memset(&atom->torque[0][0],0,3*nbytes);
|
||||
if (extraflag) atom->avec->force_clear(0,nbytes);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -53,8 +53,7 @@ class Respa : public Integrate {
|
||||
|
||||
protected:
|
||||
int triclinic; // 0 if domain is orthog, 1 if triclinic
|
||||
int torqueflag,erforceflag;
|
||||
int e_flag,rho_flag;
|
||||
int torqueflag,extraflag;
|
||||
|
||||
int *newton; // newton flag at each level
|
||||
class FixRespa *fix_respa; // Fix to store the force level array
|
||||
|
||||
@ -29,6 +29,7 @@
|
||||
#include "compute.h"
|
||||
#include "input.h"
|
||||
#include "variable.h"
|
||||
#include "neighbor.h"
|
||||
#include "force.h"
|
||||
#include "pair.h"
|
||||
#include "bond.h"
|
||||
@ -57,7 +58,7 @@ using namespace MathConst;
|
||||
// xlat, ylat, zlat
|
||||
// bonds, angles, dihedrals, impropers,
|
||||
// pxx, pyy, pzz, pxy, pxz, pyz
|
||||
// fmax, fnorm
|
||||
// fmax, fnorm, nbuild, ndanger,
|
||||
// cella, cellb, cellc, cellalpha, cellbeta, cellgamma
|
||||
|
||||
// customize a new thermo style by adding a DEFINE to this list
|
||||
@ -801,6 +802,11 @@ void Thermo::parse_fields(char *str)
|
||||
} else if (strcmp(word,"fnorm") == 0) {
|
||||
addfield("Fnorm",&Thermo::compute_fnorm,FLOAT);
|
||||
|
||||
} else if (strcmp(word,"nbuild") == 0) {
|
||||
addfield("Nbuild",&Thermo::compute_nbuild,BIGINT);
|
||||
} else if (strcmp(word,"ndanger") == 0) {
|
||||
addfield("Ndanger",&Thermo::compute_ndanger,BIGINT);
|
||||
|
||||
} else if (strcmp(word,"cella") == 0) {
|
||||
addfield("Cella",&Thermo::compute_cella,FLOAT);
|
||||
} else if (strcmp(word,"cellb") == 0) {
|
||||
@ -1371,10 +1377,19 @@ int Thermo::evaluate_keyword(char *word, double *answer)
|
||||
pressure->invoked_flag |= INVOKED_VECTOR;
|
||||
}
|
||||
compute_pyz();
|
||||
}
|
||||
|
||||
} else if (strcmp(word,"fmax") == 0) compute_fmax();
|
||||
else if (strcmp(word,"fmax") == 0) compute_fmax();
|
||||
else if (strcmp(word,"fnorm") == 0) compute_fnorm();
|
||||
|
||||
else if (strcmp(word,"nbuild") == 0) {
|
||||
compute_nbuild();
|
||||
dvalue = bivalue;
|
||||
} else if (strcmp(word,"ndanger") == 0) {
|
||||
compute_ndanger();
|
||||
dvalue = bivalue;
|
||||
}
|
||||
|
||||
else if (strcmp(word,"cella") == 0) compute_cella();
|
||||
else if (strcmp(word,"cellb") == 0) compute_cellb();
|
||||
else if (strcmp(word,"cellc") == 0) compute_cellc();
|
||||
@ -1975,6 +1990,20 @@ void Thermo::compute_fnorm()
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
void Thermo::compute_nbuild()
|
||||
{
|
||||
bivalue = neighbor->ncalls;
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
void Thermo::compute_ndanger()
|
||||
{
|
||||
bivalue = neighbor->ndanger;
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
void Thermo::compute_cella()
|
||||
{
|
||||
dvalue = domain->xprd;
|
||||
|
||||
@ -184,6 +184,9 @@ class Thermo : protected Pointers {
|
||||
void compute_fmax();
|
||||
void compute_fnorm();
|
||||
|
||||
void compute_nbuild();
|
||||
void compute_ndanger();
|
||||
|
||||
void compute_cella();
|
||||
void compute_cellb();
|
||||
void compute_cellc();
|
||||
|
||||
@ -139,6 +139,8 @@ void Variable::set(int narg, char **arg)
|
||||
{
|
||||
if (narg < 2) error->all(FLERR,"Illegal variable command");
|
||||
|
||||
int replaceflag = 0;
|
||||
|
||||
// DELETE
|
||||
// doesn't matter if variable no longer exists
|
||||
|
||||
@ -262,17 +264,20 @@ void Variable::set(int narg, char **arg)
|
||||
"All universe/uloop variables must have same # of values");
|
||||
|
||||
// STRING
|
||||
// remove pre-existing var if also style STRING (allows it to be reset)
|
||||
// replace pre-existing var if also style STRING (allows it to be reset)
|
||||
// num = 1, which = 1st value
|
||||
// data = 1 value, string to eval
|
||||
|
||||
} else if (strcmp(arg[1],"string") == 0) {
|
||||
if (narg != 3) error->all(FLERR,"Illegal variable command");
|
||||
if (find(arg[0]) >= 0) {
|
||||
if (style[find(arg[0])] != STRING)
|
||||
int ivar = find(arg[0]);
|
||||
if (ivar >= 0) {
|
||||
if (style[ivar] != STRING)
|
||||
error->all(FLERR,"Cannot redefine variable as a different style");
|
||||
remove(find(arg[0]));
|
||||
}
|
||||
delete [] data[ivar][0];
|
||||
copy(1,&arg[2],data[ivar]);
|
||||
replaceflag = 1;
|
||||
} else {
|
||||
if (nvar == maxvar) grow();
|
||||
style[nvar] = STRING;
|
||||
num[nvar] = 1;
|
||||
@ -280,6 +285,7 @@ void Variable::set(int narg, char **arg)
|
||||
pad[nvar] = 0;
|
||||
data[nvar] = new char*[num[nvar]];
|
||||
copy(1,&arg[2],data[nvar]);
|
||||
}
|
||||
|
||||
// GETENV
|
||||
// remove pre-existing var if also style GETENV (allows it to be reset)
|
||||
@ -357,17 +363,22 @@ void Variable::set(int narg, char **arg)
|
||||
data[nvar][2] = NULL;
|
||||
|
||||
// EQUAL
|
||||
// remove pre-existing var if also style EQUAL (allows it to be reset)
|
||||
// replace pre-existing var if also style EQUAL (allows it to be reset)
|
||||
// num = 2, which = 1st value
|
||||
// data = 2 values, 1st is string to eval, 2nd is filled on retrieval
|
||||
|
||||
} else if (strcmp(arg[1],"equal") == 0) {
|
||||
if (narg != 3) error->all(FLERR,"Illegal variable command");
|
||||
if (find(arg[0]) >= 0) {
|
||||
if (style[find(arg[0])] != EQUAL)
|
||||
int ivar = find(arg[0]);
|
||||
if (ivar >= 0) {
|
||||
if (style[ivar] != EQUAL)
|
||||
error->all(FLERR,"Cannot redefine variable as a different style");
|
||||
remove(find(arg[0]));
|
||||
}
|
||||
delete [] data[ivar][0];
|
||||
if (data[ivar][1]) delete [] data[ivar][1];
|
||||
copy(1,&arg[2],data[ivar]);
|
||||
data[ivar][1] = NULL;
|
||||
replaceflag = 1;
|
||||
} else {
|
||||
if (nvar == maxvar) grow();
|
||||
style[nvar] = EQUAL;
|
||||
num[nvar] = 2;
|
||||
@ -376,19 +387,23 @@ void Variable::set(int narg, char **arg)
|
||||
data[nvar] = new char*[num[nvar]];
|
||||
copy(1,&arg[2],data[nvar]);
|
||||
data[nvar][1] = NULL;
|
||||
}
|
||||
|
||||
// ATOM
|
||||
// remove pre-existing var if also style ATOM (allows it to be reset)
|
||||
// replace pre-existing var if also style ATOM (allows it to be reset)
|
||||
// num = 1, which = 1st value
|
||||
// data = 1 value, string to eval
|
||||
|
||||
} else if (strcmp(arg[1],"atom") == 0) {
|
||||
if (narg != 3) error->all(FLERR,"Illegal variable command");
|
||||
if (find(arg[0]) >= 0) {
|
||||
if (style[find(arg[0])] != ATOM)
|
||||
int ivar = find(arg[0]);
|
||||
if (ivar >= 0) {
|
||||
if (style[ivar] != ATOM)
|
||||
error->all(FLERR,"Cannot redefine variable as a different style");
|
||||
remove(find(arg[0]));
|
||||
}
|
||||
delete [] data[ivar][0];
|
||||
copy(1,&arg[2],data[ivar]);
|
||||
replaceflag = 1;
|
||||
} else {
|
||||
if (nvar == maxvar) grow();
|
||||
style[nvar] = ATOM;
|
||||
num[nvar] = 1;
|
||||
@ -396,13 +411,15 @@ void Variable::set(int narg, char **arg)
|
||||
pad[nvar] = 0;
|
||||
data[nvar] = new char*[num[nvar]];
|
||||
copy(1,&arg[2],data[nvar]);
|
||||
}
|
||||
|
||||
} else error->all(FLERR,"Illegal variable command");
|
||||
|
||||
// set name of variable
|
||||
// must come at end, since STRING/EQUAL/ATOM reset may have removed name
|
||||
// set name of variable, if not replacing (STRING/EQUAL/ATOM)
|
||||
// name must be all alphanumeric chars or underscores
|
||||
|
||||
if (replaceflag) return;
|
||||
|
||||
int n = strlen(arg[0]) + 1;
|
||||
names[nvar] = new char[n];
|
||||
strcpy(names[nvar],arg[0]);
|
||||
|
||||
102
src/verlet.cpp
102
src/verlet.cpp
@ -17,6 +17,7 @@
|
||||
#include "domain.h"
|
||||
#include "comm.h"
|
||||
#include "atom.h"
|
||||
#include "atom_vec.h"
|
||||
#include "force.h"
|
||||
#include "pair.h"
|
||||
#include "bond.h"
|
||||
@ -69,17 +70,11 @@ void Verlet::init()
|
||||
int ifix = modify->find_fix("package_omp");
|
||||
if (ifix >= 0) external_force_clear = 1;
|
||||
|
||||
// set flags for what arrays to clear in force_clear()
|
||||
// need to clear additionals arrays if they exist
|
||||
// set flags for arrays to clear in force_clear()
|
||||
|
||||
torqueflag = 0;
|
||||
torqueflag = extraflag = 0;
|
||||
if (atom->torque_flag) torqueflag = 1;
|
||||
erforceflag = 0;
|
||||
if (atom->erforce_flag) erforceflag = 1;
|
||||
e_flag = 0;
|
||||
if (atom->e_flag) e_flag = 1;
|
||||
rho_flag = 0;
|
||||
if (atom->rho_flag) rho_flag = 1;
|
||||
if (atom->avec->forceclearflag) extraflag = 1;
|
||||
|
||||
// orthogonal vs triclinic simulation box
|
||||
|
||||
@ -345,6 +340,7 @@ void Verlet::cleanup()
|
||||
void Verlet::force_clear()
|
||||
{
|
||||
int i;
|
||||
size_t nbytes;
|
||||
|
||||
if (external_force_clear) return;
|
||||
|
||||
@ -352,19 +348,16 @@ void Verlet::force_clear()
|
||||
// if either newton flag is set, also include ghosts
|
||||
// when using threads always clear all forces.
|
||||
|
||||
int nlocal = atom->nlocal;
|
||||
|
||||
if (neighbor->includegroup == 0) {
|
||||
int nall;
|
||||
if (force->newton) nall = atom->nlocal + atom->nghost;
|
||||
else nall = atom->nlocal;
|
||||
nbytes = sizeof(double) * nlocal;
|
||||
if (force->newton) nbytes += sizeof(double) * atom->nghost;
|
||||
|
||||
size_t nbytes = sizeof(double) * nall;
|
||||
|
||||
if (nbytes > 0) {
|
||||
memset(&(atom->f[0][0]),0,3*nbytes);
|
||||
if (torqueflag) memset(&(atom->torque[0][0]),0,3*nbytes);
|
||||
if (erforceflag) memset(&(atom->erforce[0]), 0, nbytes);
|
||||
if (e_flag) memset(&(atom->de[0]), 0, nbytes);
|
||||
if (rho_flag) memset(&(atom->drho[0]), 0, nbytes);
|
||||
if (nbytes) {
|
||||
memset(&atom->f[0][0],0,3*nbytes);
|
||||
if (torqueflag) memset(&atom->torque[0][0],0,3*nbytes);
|
||||
if (extraflag) atom->avec->force_clear(0,nbytes);
|
||||
}
|
||||
|
||||
// neighbor includegroup flag is set
|
||||
@ -372,70 +365,21 @@ void Verlet::force_clear()
|
||||
// if either newton flag is set, also include ghosts
|
||||
|
||||
} else {
|
||||
int nall = atom->nfirst;
|
||||
nbytes = sizeof(double) * atom->nfirst;
|
||||
|
||||
double **f = atom->f;
|
||||
for (i = 0; i < nall; i++) {
|
||||
f[i][0] = 0.0;
|
||||
f[i][1] = 0.0;
|
||||
f[i][2] = 0.0;
|
||||
}
|
||||
|
||||
if (torqueflag) {
|
||||
double **torque = atom->torque;
|
||||
for (i = 0; i < nall; i++) {
|
||||
torque[i][0] = 0.0;
|
||||
torque[i][1] = 0.0;
|
||||
torque[i][2] = 0.0;
|
||||
}
|
||||
}
|
||||
|
||||
if (erforceflag) {
|
||||
double *erforce = atom->erforce;
|
||||
for (i = 0; i < nall; i++) erforce[i] = 0.0;
|
||||
}
|
||||
|
||||
if (e_flag) {
|
||||
double *de = atom->de;
|
||||
for (i = 0; i < nall; i++) de[i] = 0.0;
|
||||
}
|
||||
|
||||
if (rho_flag) {
|
||||
double *drho = atom->drho;
|
||||
for (i = 0; i < nall; i++) drho[i] = 0.0;
|
||||
if (nbytes) {
|
||||
memset(&atom->f[0][0],0,3*nbytes);
|
||||
if (torqueflag) memset(&atom->torque[0][0],0,3*nbytes);
|
||||
if (extraflag) atom->avec->force_clear(0,nbytes);
|
||||
}
|
||||
|
||||
if (force->newton) {
|
||||
nall = atom->nlocal + atom->nghost;
|
||||
nbytes = sizeof(double) * atom->nghost;
|
||||
|
||||
for (i = atom->nlocal; i < nall; i++) {
|
||||
f[i][0] = 0.0;
|
||||
f[i][1] = 0.0;
|
||||
f[i][2] = 0.0;
|
||||
}
|
||||
|
||||
if (torqueflag) {
|
||||
double **torque = atom->torque;
|
||||
for (i = atom->nlocal; i < nall; i++) {
|
||||
torque[i][0] = 0.0;
|
||||
torque[i][1] = 0.0;
|
||||
torque[i][2] = 0.0;
|
||||
}
|
||||
}
|
||||
|
||||
if (erforceflag) {
|
||||
double *erforce = atom->erforce;
|
||||
for (i = atom->nlocal; i < nall; i++) erforce[i] = 0.0;
|
||||
}
|
||||
|
||||
if (e_flag) {
|
||||
double *de = atom->de;
|
||||
for (i = 0; i < nall; i++) de[i] = 0.0;
|
||||
}
|
||||
|
||||
if (rho_flag) {
|
||||
double *drho = atom->drho;
|
||||
for (i = 0; i < nall; i++) drho[i] = 0.0;
|
||||
if (nbytes) {
|
||||
memset(&atom->f[nlocal][0],0,3*nbytes);
|
||||
if (torqueflag) memset(&atom->torque[nlocal][0],0,3*nbytes);
|
||||
if (extraflag) atom->avec->force_clear(nlocal,nbytes);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user