lammps/doc/fix_atom_swap.html

194 lines
8.8 KiB
HTML

<HTML>
<CENTER><A HREF = "http://lammps.sandia.gov">LAMMPS WWW Site</A> - <A HREF = "Manual.html">LAMMPS Documentation</A> - <A HREF = "Section_commands.html#comm">LAMMPS Commands</A>
</CENTER>
<HR>
<H3>fix atom_swap command
</H3>
<P><B>Syntax:</B>
</P>
<PRE>fix ID group-ID atom_swap N X seed T keyword values ...
</PRE>
<UL><LI>ID, group-ID are documented in <A HREF = "fix.html">fix</A> command
<LI>atom_swap = style name of this fix command
<LI>N = invoke this fix every N steps
<LI>X = number of swaps to attempt every N steps
<LI>seed = random # seed (positive integer)
<LI>T = scaling temperature of the MC swaps (temperature units)
<LI>one or more keyword/value pairs may be appended to args
<LI>keyword = <I>types</I> or <I>delta_mu</I> or <I>ke</I> or <I>semi-grand</I> or <I>region</I>
<PRE> <I>types</I> values = two or more atom types
<I>delta_mu</I> values = number_of_types-1 relative chemical potentials (energy units)
<I>ke</I> value = <I>no</I> or <I>yes</I>
<I>no</I> = no conservation of kinetic energy after atom swaps
<I>yes</I> = kinetic energy is conserved after atom swaps
<I>semi-grand</I> value = <I>no</I> or <I>yes</I>
<I>no</I> = particle type counts and fractions conserved
<I>yes</I> = semi-grand canonical ensemble, particle fractions not conserved
<I>region</I> value = region-ID
region-ID = ID of region to use as an exchange/move volume
</PRE>
</UL>
<P><B>Examples:</B>
</P>
<PRE>fix 2 all atom/swap 1 1 29494 300.0 ke no types 1 2
fix atom_swap_fix all atom/swap 100 1 12345 298.0 region my_swap_region types 5 6
fix SGMC all atom/swap 1 100 345 1.0 semi-grand yes types 1 2 3 delta_mu 4.3 -5.0
</PRE>
<P><B>Description:</B>
</P>
<P>This fix performs Monte Carlo swaps of atoms of one given atom type with atoms
of the other given atom types. The specified T is used in the Metropolis criterion
dictating swap probabilities.
</P>
<P>Perform X swaps of atoms of one type with atoms of another type according to a
Monte Carlo probability. Swap candidates must be in the fix group, must be in
the region (if specified), and must be of one of the listed types. Swaps are
attempted between candidates that are chosen randomly with equal probability
among the candidate atoms. Swaps are not attempted between atoms of the same
type since nothing would happen.
</P>
<P>All atoms in the simulation domain can be moved using regular time
integration displacements, e.g. via <A HREF = "fix_nvt.html">fix_nvt</A>, resulting
in a hybrid MC+MD simulation. A smaller-than-usual timestep size
may be needed when running such a hybrid simulation, especially if
the swapped atoms are not well equilibrated.
</P>
<P>The <I>types</I> keyword is required. At least two atom types must be specified.
</P>
<P>The <I>ke</I> keyword can be set to <I>no</I> to turn off kinetic energy conservation
for swaps. The default is <I>yes</I>, which means that swapped atoms have their
velocities scaled by the ratio of the masses of the swapped atom types. This
ensures that the kinetic energy of each atom is the same after the swap as it
was before the swap, even though the atom masses have changed.
</P>
<P>The <I>semi-grand</I> keyword can be set to <I>yes</I> to switch to the semi-grand
canonical ensemble as discussed in <A HREF = "#Sadigh">(Sadigh)</A>. This means that the
total number of each particle type does not need to be conserved. The default
is <I>no</I>, which means that the only kind of swap allowed exchanges an atom of
one type with an atom of a different given type. In other words, the relative
mole fractions of the swapped atoms remains constant. Whereas in the
semi-grand canonical ensemble, the composition of the system can change. Note
that when using <I>semi-grand</I>, all atoms in the fix group are eligible for
attempted conversion to one of the given types, even if its current type is
not one of the given types. An attempt is made to switch the selected atom to
one of the listed <I>types</I> with equal probability. Acceptance of each attempt
depends upon the Metropolis criterion.
</P>
<P>The <I>delta_mu</I> keyword allows users to specify non-zero chemical potentials
for each of the atom types. All chemical potentials are relative to the first
atom type, so no value is given for the first atom type. These parameters are
useful for semi-grand canonical ensemble simulations where it may be
desirable to actively control the composition of the system. When given,
there must be ntypes-1 values given, where ntypes is the number of atom
types in the simulated system. Note that a value for delta_mu is required for
all atom types when using <I>semi-grand</I>, even for atom types not listed
following the <I>types</I> keyword. This is because when using <I>semi-grand</I>, it is
possible that any of the atom types in the system could be part of the fix
group and therefore are eligible for swapping to one of the listed atom types.
</P>
<P>This command may optionally use the <I>region</I> keyword to define
swap volume. The specified region must have been
previously defined with a <A HREF = "region.html">region</A> command. It must be
defined with side = <I>in</I>. Swap attempts occur only between atoms that
are both within the specified region. Swaps are not otherwise attempted.
</P>
<P>You should ensure you do not swap atoms belonging to a molecule, or
LAMMPS will soon generate an error when it tries to find those atoms.
LAMMPS will warn you if any of the atoms eligible for swapping have a
non-zero molecule ID, but does not check for this at the time of
swapping.
</P>
<P>This fix checks to ensure all atoms of the given types have the same
atomic charge. LAMMPS doesn't enforce this in general, but it is
needed for this fix to simplify the swapping procedure. Successful swaps
will swap the atom type and charge of the swapped atoms.
</P>
<P>Since this fix computes total potential energies before and after
proposed swaps, so even complicated potential energy calculations are
OK, including the following:
</P>
<UL><LI> long-range electrostatics (kspace)
<LI> many body pair styles
<LI> hybrid pair styles
<LI> eam pair styles
<LI> triclinic systems
<LI> need to include potential energy contributions from other fixes
</UL>
<P>Some fixes have an associated potential energy. Examples of such fixes
include: <A HREF = "fix_efield.html">efield</A>, <A HREF = "fix_gravity.html">gravity</A>,
<A HREF = "fix_addforce.html">addforce</A>, <A HREF = "fix_langevin.html">langevin</A>,
<A HREF = "fix_restrain.html">restrain</A>, <A HREF = "fix_temp_berendsen.html">temp/berendsen</A>,
<A HREF = "fix_temp_rescale.html">temp/rescale</A>, and <A HREF = "fix_wall.html">wall fixes</A>.
For that energy to be included in the total potential energy of the
system (the quantity used when performing GCMC moves),
you MUST enable the <A HREF = "fix_modify.html">fix_modify</A> <I>energy</I> option for
that fix. The doc pages for individual <A HREF = "fix.html">fix</A> commands
specify if this should be done.
</P>
<P><B>Restart, fix_modify, output, run start/stop, minimize info:</B>
</P>
<P>This fix writes the state of the fix to <A HREF = "restart.html">binary restart
files</A>. This includes information about the random
number generator seed, the next timestep for MC exchanges, etc. See
the <A HREF = "read_restart.html">read_restart</A> command for info on how to
re-specify a fix in an input script that reads a restart file, so that
the operation of the fix continues in an uninterrupted fashion.
</P>
<P>None of the <A HREF = "fix_modify.html">fix_modify</A> options are relevant to this
fix.
</P>
<P>This fix computes a global vector of length 2, which can be accessed
by various <A HREF = "Section_howto.html#howto_15">output commands</A>. The vector
values are the following global cumulative quantities:
</P>
<UL><LI>1 = swap attempts
<LI>2 = swap successes
</UL>
<P>The vector values calculated by this fix are "extensive".
</P>
<P>No parameter of this fix can be used with the <I>start/stop</I> keywords of
the <A HREF = "run.html">run</A> command. This fix is not invoked during <A HREF = "minimize.html">energy
minimization</A>.
</P>
<P><B>Restrictions:</B>
</P>
<P>This fix is part of the MC package. It is only enabled if LAMMPS was
built with that package. See the <A HREF = "Section_start.html#start_3">Making
LAMMPS</A> section for more info.
</P>
<P><B>Related commands:</B>
</P>
<P><A HREF = "fix_nvt.html">fix_nvt</A>, <A HREF = "neighbor.html">neighbor</A>,
<A HREF = "fix_deposit.html">fix_deposit</A>, <A HREF = "fix_evaporate.html">fix_evaporate</A>,
<A HREF = "delete_atoms.html">delete_atoms</A>, <A HREF = "fix_gcmc.html">fix_gcmc</A>
</P>
<P><B>Default:</B>
</P>
<P>The option defaults are ke = yes, semi-grand = no, delta_mu = 0.0 for
all atom types.
</P>
<HR>
<A NAME = "Sadigh"></A>
<P><B>(Sadigh)</B> B Sadigh, P Erhart, A Stukowski, A Caro, E Martinez, and
L Zepeda-Ruiz, Phys. Rev. B, 85, 184203 (2012).
</P>
</HTML>