refactoring of global and local hyper, including amended doc pages

This commit is contained in:
Steve Plimpton
2019-03-01 18:47:34 -07:00
parent eea30c5b76
commit f0ec2e3279
14 changed files with 868 additions and 634 deletions

View File

@ -54,9 +54,10 @@ local quantities have the word "local" in their style,
e.g. {bond/local}. Styles with neither "atom" or "local" in their e.g. {bond/local}. Styles with neither "atom" or "local" in their
style produce global quantities. style produce global quantities.
Note that a single compute produces either global or per-atom or local Note that a single compute can produce either global or per-atom or
quantities, but never more than one of these (with only a few local quantities, but not both global and per-atom. It can produce
exceptions, as documented by individual compute commands). local quantities in tandem with global or per-atom quantities. The
compute doc page will explain.
Global, per-atom, and local quantities each come in three kinds: a Global, per-atom, and local quantities each come in three kinds: a
single scalar value, a vector of values, or a 2d array of values. The single scalar value, a vector of values, or a 2d array of values. The

View File

@ -83,8 +83,10 @@ not in the specified fix group. Local quantities are calculated by
each processor based on the atoms it owns, but there may be zero or each processor based on the atoms it owns, but there may be zero or
more per atoms. more per atoms.
Note that a single fix may produces either global or per-atom or local Note that a single fix can produce either global or per-atom or local
quantities (or none at all), but never more than one of these. quantities (or none at all), but not both global and per-atom. It can
produce local quantities in tandem with global or per-atom quantities.
The fix doc page will explain.
Global, per-atom, and local quantities each come in three kinds: a Global, per-atom, and local quantities each come in three kinds: a
single scalar value, a vector of values, or a 2d array of values. The single scalar value, a vector of values, or a 2d array of values. The

View File

@ -35,6 +35,7 @@ keyword = {mode} or {file} or {ave} or {start} or {beyond} or {overwrite} or {ti
{mode} arg = {scalar} or {vector} {mode} arg = {scalar} or {vector}
scalar = all input values are scalars scalar = all input values are scalars
vector = all input values are vectors vector = all input values are vectors
{kind} arg = {global} or {peratom} or {local}
{file} arg = filename {file} arg = filename
filename = name of file to output histogram(s) to filename = name of file to output histogram(s) to
{ave} args = {one} or {running} or {window} {ave} args = {one} or {running} or {window}
@ -92,7 +93,8 @@ either all global, all per-atom, or all local quantities. Inputs of
different kinds (e.g. global and per-atom) cannot be mixed. Atom different kinds (e.g. global and per-atom) cannot be mixed. Atom
attributes are per-atom vector values. See the doc page for attributes are per-atom vector values. See the doc page for
individual "compute" and "fix" commands to see what kinds of individual "compute" and "fix" commands to see what kinds of
quantities they generate. quantities they generate. See the optional {kind} keyword below for
how to force the fix ave/histo command to dis-ambiguate if necessary.
Note that the output of this command is a single histogram for all Note that the output of this command is a single histogram for all
input values combined together, not one histogram per input value. input values combined together, not one histogram per input value.
@ -231,6 +233,14 @@ keyword is set to {vector}, then all input values must be global or
per-atom or local vectors, or columns of global or per-atom or local per-atom or local vectors, or columns of global or per-atom or local
arrays. arrays.
The {kind} keyword only needs to be set if a compute or fix produces
more than one kind of output (global, per-atom, local). If this is
not the case, then LAMMPS will determine what kind of input is
provided and whether all the input arguments are consistent. If a
compute or fix produces more than one kind of output, the {kind}
keyword should be used to specify which output will be used. The
remaining input arguments must still be consistent.
The {beyond} keyword determines how input values that fall outside the The {beyond} keyword determines how input values that fall outside the
{lo} to {hi} bounds are treated. Values such that {lo} <= value <= {lo} to {hi} bounds are treated. Values such that {lo} <= value <=
{hi} are assigned to one bin. Values on a bin boundary are assigned {hi} are assigned to one bin. Values on a bin boundary are assigned
@ -240,7 +250,7 @@ If {beyond} is set to {end} then values < {lo} are counted in the
first bin and values > {hi} are counted in the last bin. If {beyond} first bin and values > {hi} are counted in the last bin. If {beyond}
is set to {extend} then two extra bins are created, so that there are is set to {extend} then two extra bins are created, so that there are
Nbins+2 total bins. Values < {lo} are counted in the first bin and Nbins+2 total bins. Values < {lo} are counted in the first bin and
values > {hi} are counted in the last bin (Nbins+1). Values between values > {hi} are counted in the last bin (Nbins+2). Values between
{lo} and {hi} (inclusive) are counted in bins 2 through Nbins+1. The {lo} and {hi} (inclusive) are counted in bins 2 through Nbins+1. The
"coordinate" stored and printed for these two extra bins is {lo} and "coordinate" stored and printed for these two extra bins is {lo} and
{hi}. {hi}.
@ -354,5 +364,6 @@ ave/chunk"_fix_ave_chunk.html, "fix ave/time"_fix_ave_time.html,
[Default:] none [Default:] none
The option defaults are mode = scalar, ave = one, start = 0, no file The option defaults are mode = scalar, kind = figured out from input
output, beyond = ignore, and title 1,2,3 = strings as described above. arguments, ave = one, start = 0, no file output, beyond = ignore, and
title 1,2,3 = strings as described above.

View File

@ -102,7 +102,7 @@ Bi = exp(beta * Vij(max)) :pre
where beta = 1/kTequil, and {Tequil} is the temperature of the system where beta = 1/kTequil, and {Tequil} is the temperature of the system
and an argument to this fix. Note that Bi >= 1 at every step. and an argument to this fix. Note that Bi >= 1 at every step.
NOTE: To run GHD, the input script must also use the "fix NOTE: To run a GHD simulation, the input script must also use the "fix
langevin"_fix_langevin.html command to thermostat the atoms at the langevin"_fix_langevin.html command to thermostat the atoms at the
same {Tequil} as specified by this fix, so that the system is running same {Tequil} as specified by this fix, so that the system is running
constant-temperature (NVT) dynamics. LAMMPS does not check that this constant-temperature (NVT) dynamics. LAMMPS does not check that this
@ -166,9 +166,9 @@ correctly. There will just be fewer events because the hyper time
NOTE: If you have no physical intuition as to the smallest barrier NOTE: If you have no physical intuition as to the smallest barrier
height in your system, a reasonable strategy to determine the largest height in your system, a reasonable strategy to determine the largest
{Vmax} you can use for an LHD model, is to run a sequence of {Vmax} you can use for a GHD model, is to run a sequence of
simulations with smaller and smaller {Vmax} values, until the event simulations with smaller and smaller {Vmax} values, until the event
rate does not change. rate does not change (as a function of hyper time).
The {Tequil} argument is the temperature at which the system is The {Tequil} argument is the temperature at which the system is
simulated; see the comment above about the "fix simulated; see the comment above about the "fix
@ -177,7 +177,8 @@ beta term in the exponential factor that determines how much boost is
achieved as a function of the bias potential. achieved as a function of the bias potential.
In general, the lower the value of {Tequil} and the higher the value In general, the lower the value of {Tequil} and the higher the value
of {Vmax}, the more boost will be achievable by the GHD algorithm. of {Vmax}, the more time boost will be achievable by the GHD
algorithm.
:line :line
@ -190,41 +191,43 @@ The "fix_modify"_fix_modify.html {energy} option is supported by this
fix to add the energy of the bias potential to the the system's fix to add the energy of the bias potential to the the system's
potential energy as part of "thermodynamic output"_thermo_style.html. potential energy as part of "thermodynamic output"_thermo_style.html.
This fix computes a global scalar and global vector of length 11, which This fix computes a global scalar and global vector of length 12, which
can be accessed by various "output commands"_Howto_output.html. The can be accessed by various "output commands"_Howto_output.html. The
scalar is the magnitude of the bias potential (energy units) applied on scalar is the magnitude of the bias potential (energy units) applied on
the current timestep. The vector stores the following quantities: the current timestep. The vector stores the following quantities:
1 = boost factor on this step (unitless) 1 = boost factor on this step (unitless)
2 = max strain Eij of any bond on this step (unitless) 2 = max strain Eij of any bond on this step (absolute value, unitless)
3 = ID of first atom in the max-strain bond 3 = ID of first atom in the max-strain bond
4 = ID of second atom in the max-strain bond 4 = ID of second atom in the max-strain bond
5 = average # of bonds/atom on this step :ul 5 = average # of bonds/atom on this step :ul
6 = fraction of timesteps with bias = 0.0 during this run 6 = fraction of timesteps where the biased bond has bias = 0.0 during this run
7 = max drift distance of any atom during this run (distance units) 7 = fraction of timesteps where the biased bond has negative strain during this run
8 = max bond length during this run (distance units) :ul 8 = max drift distance of any atom during this run (distance units)
9 = max bond length during this run (distance units) :ul
9 = cumulative hyper time since fix was defined (time units) 10 = cumulative hyper time since fix was defined (time units)
10 = cumulative count of event timesteps since fix was defined 11 = cumulative count of event timesteps since fix was defined
11 = cumulative count of atoms in events since fix was defined :ul 12 = cumulative count of atoms in events since fix was defined :ul
The first 5 quantities are for the current timestep. Quantities 6-8 The first 5 quantities are for the current timestep. Quantities 6-9
are for the current hyper run. Quantities 9-11 are cumulative across are for the current hyper run. They are reset each time a new hyper
multiple runs (since the fix was defined in the input script). run is performed. Quantities 19-12 are cumulative across multiple
runs (since the point in the input script the fix was defined).
For value 7, drift is the distance an atom moves between timesteps For value 8, drift is the distance an atom moves between two quenched
when the bond list is reset, i.e. between events. Atoms involved in states when the second quench determines an event has occurred. Atoms
an event will typically move the greatest distance since others are involved in an event will typically move the greatest distance since
typically oscillating around their lattice site. others typically remain near their original quenched position.
For value 10, events are checked for by the "hyper"_hyper.html command For value 11, events are checked for by the "hyper"_hyper.html command
once every {Nevent} timesteps. This value is the count of those once every {Nevent} timesteps. This value is the count of those
timesteps on which one (or more) events was detected. It is NOT the timesteps on which one (or more) events was detected. It is NOT the
number of distinct events, since more than one event may occur in the number of distinct events, since more than one event may occur in the
same {Nevent} time window. same {Nevent} time window.
For value 11, each time the "hyper"_hyper.html command checks for an For value 12, each time the "hyper"_hyper.html command checks for an
event, it invokes a compute to flag zero or more atoms as event, it invokes a compute to flag zero or more atoms as
participating in one or more events. E.g. atoms that have displaced participating in one or more events. E.g. atoms that have displaced
more than some distance from the previous quench state. Value 11 is more than some distance from the previous quench state. Value 11 is

View File

@ -22,10 +22,9 @@ Dcut = minimum distance between boosted bonds (distance units) :l
alpha = boostostat relaxation time (time units) :l alpha = boostostat relaxation time (time units) :l
Btarget = desired time boost factor (unitless) :l Btarget = desired time boost factor (unitless) :l
zero or more keyword/value pairs may be appended :l zero or more keyword/value pairs may be appended :l
keyword = {lost} or {check/bias} or {check/coeff} keyword = {check/ghost} or {check/bias} :l
{lostbond} value = error/warn/ignore {check/ghost} values = none
{check/bias} values = Nevery error/warn/ignore {check/bias} values = Nevery error/warn/ignore :pre
{check/coeff} values = Nevery error/warn/ignore :pre
:ule :ule
[Examples:] [Examples:]
@ -65,8 +64,8 @@ To understand this description, you should first read the description
of the GHD algorithm on the "fix hyper/global"_fix_hyper_global.html of the GHD algorithm on the "fix hyper/global"_fix_hyper_global.html
doc page. This description of LHD builds on the GHD description. doc page. This description of LHD builds on the GHD description.
The definition of bonds, Eij, and Emax are the same for GHD and LHD. The definition of bonds and Eij are the same for GHD and LHD. The
The formulas for Vij(max) and Fij(max) are also the same except for a formulas for Vij(max) and Fij(max) are also the same except for a
pre-factor Cij, explained below. pre-factor Cij, explained below.
The bias energy Vij applied to a bond IJ with maximum strain is The bias energy Vij applied to a bond IJ with maximum strain is
@ -117,11 +116,11 @@ where Vkl(max) is the bias energy of the maxstrain bond KL within bond
IJ's neighborhood, beta = 1/kTequil, and {Tequil} is the temperature IJ's neighborhood, beta = 1/kTequil, and {Tequil} is the temperature
of the system and an argument to this fix. of the system and an argument to this fix.
NOTE: To run LHD, the input script must also use the "fix NOTE: To run an LHD simulation, the input script must also use the
langevin"_fix_langevin.html command to thermostat the atoms at the "fix langevin"_fix_langevin.html command to thermostat the atoms at
same {Tequil} as specified by this fix, so that the system is running the same {Tequil} as specified by this fix, so that the system is
constant-temperature (NVT) dynamics. LAMMPS does not check that this running constant-temperature (NVT) dynamics. LAMMPS does not check
is done. that this is done.
Note that if IJ = KL, then bond IJ is a biased bond on that timestep, Note that if IJ = KL, then bond IJ is a biased bond on that timestep,
otherwise it is not. But regardless, the boost factor Bij can be otherwise it is not. But regardless, the boost factor Bij can be
@ -216,20 +215,20 @@ each pair. E.g. something like 2x the cutoff of the interatomic
potential. In practice a {Dcut} value of ~10 Angstroms seems to work potential. In practice a {Dcut} value of ~10 Angstroms seems to work
well for many solid-state systems. well for many solid-state systems.
NOTE: You must also insure that ghost atom communication is performed NOTE: You should insure that ghost atom communication is performed for
for a distance of at least {Dcut} + {cutevent} where {cutevent} = the a distance of at least {Dcut} + {cutevent} = the distance one or more
distance one or more atoms move (between quenched states) to be atoms move (between quenched states) to be considered an "event". It
considered an "event". It is an argument to the "compute is an argument to the "compute event/displace" command used to detect
event/displace" command used to detect events. By default the ghost events. By default the ghost communication distance is set by the
communication distance is set by the pair_style cutoff, which will pair_style cutoff, which will typically be < {Dcut}. The "comm_modify
typically be < {Dcut}. The "comm_modify cutoff"_comm_modify.html cutoff"_comm_modify.html command should be used to override the ghost
command can be used to set the ghost cutoff explicitly, e.g. cutoff explicitly, e.g.
comm_modify cutoff 12.0 :pre comm_modify cutoff 12.0 :pre
This fix does not know the {cutevent} parameter, but uses half the Note that this fix does not know the {cutevent} parameter, but uses
bond length as an estimate to warn if the ghost cutoff is not long half the {cutbond} parameter as an estimate to warn if the ghost
enough. cutoff is not long enough.
As described above the {alpha} argument is a pre-factor in the As described above the {alpha} argument is a pre-factor in the
boostostat update equation for each bond's Cij prefactor. {Alpha} is boostostat update equation for each bond's Cij prefactor. {Alpha} is
@ -269,7 +268,30 @@ NOTE: If you have no physical intuition as to the smallest barrier
height in your system, a reasonable strategy to determine the largest height in your system, a reasonable strategy to determine the largest
{Btarget} you can use for an LHD model, is to run a sequence of {Btarget} you can use for an LHD model, is to run a sequence of
simulations with smaller and smaller {Btarget} values, until the event simulations with smaller and smaller {Btarget} values, until the event
rate does not change. rate does not change (as a function of hyper time).
:line
Here is additional information on the optional keywords for this fix.
The {check/ghost} keyword turns on extra computation each timestep to
compute statistics about ghost atoms used to determine which bonds to
bias. The output of these stats are the vector values 14 and 15,
described below. If this keyword is not enabled, the output
of the stats will be zero.
The {check/bias} keyword turns on extra computation and communcation
to check if any biased bonds are closer than {Dcut} to each other,
which should not be the case if LHD is operating correctly. Thus it
is a debugging check. The {Nevery} setting determines how often the
check is made. The {error}, {warn}, or {ignore} setting determines
what is done if the count of too-close bonds is not zero. Either the
code will exit, or issue a warning, or silently tally the count. The
count can be output as vector value 17, as described below. If this
keyword is not enabled, the output of that statistic will be 0.
Note that both of these computations are costly, hence they are only
enabled by these keywords.
:line :line
@ -282,95 +304,120 @@ The "fix_modify"_fix_modify.html {energy} option is supported by this
fix to add the energy of the bias potential to the the system's fix to add the energy of the bias potential to the the system's
potential energy as part of "thermodynamic output"_thermo_style.html. potential energy as part of "thermodynamic output"_thermo_style.html.
This fix computes a global scalar and global vector of length 23, This fix computes a global scalar and global vector of length 21,
which can be accessed by various "output which can be accessed by various "output commands"_Howto_output.html.
commands"_Howto_output.html. The scalar is the magnitude of The scalar is the magnitude of the bias potential (energy units)
the bias potential (energy units) applied on the current timestep, applied on the current timestep, summed over all biased bonds. The
summed over all biased bonds. The vector stores the following vector stores the following quantities:
quantities:
1 = # of biased bonds on this step 1 = # of biased bonds on this step
2 = max strain Eij of any bond on this step (unitless) 2 = max strain Eij of any bond on this step (absolute value, unitless)
3 = average bias potential for all biased bonds on this step (energy units) 3 = average bias coeff for all bonds on this step (unitless)
4 = average # of bonds/atom on this step 4 = average # of bonds/atom on this step
5 = average neighbor bonds/bond on this step within {Dcut} :ul 5 = average neighbor bonds/bond on this step within {Dcut} :ul
6 = fraction of steps and bonds with no bias during this run 6 = max bond length during this run (distance units)
7 = max drift distance of any atom during this run (distance units) 7 = average # of biased bonds/step during this run
8 = max bond length during this run (distance units) 8 = fraction of biased bonds with no bias during this run
9 = average # of biased bonds/step during this run 9 = fraction of biased bonds with negative strain during this run
10 = average bias potential for all biased bonds during this run (energy units) 10 = average bias coeff for all bonds during this run (unitless)
11 = max bias potential for any biased bond during this run (energy units) 11 = min bias coeff for any bond during this run (unitless)
12 = min bias potential for any biased bond during this run (energy units) 12 = max bias coeff for any bond during this run (unitless)
13 = max distance from my sub-box of any ghost atom with maxstrain < qfactor during this run (distance units)
14 = max distance outside my box of any ghost atom with any maxstrain during this run (distance units)
15 = count of ghost neighbor atoms not found on reneighbor steps during this run
16 = count of lost bond partners during this run
17 = average bias coeff for lost bond partners during this run
18 = count of bias overlaps found during this run
19 = count of non-matching bias coefficients found during this run :ul
20 = cumulative hyper time since fix created (time units) 13 = max drift distance of any bond atom during this run (distance units)
21 = cumulative count of event timesteps since fix created 14 = max distance from proc subbox of any ghost atom with maxstrain < qfactor during this run (distance units)
22 = cumulative count of atoms in events since fix created 15 = max distance outside my box of any ghost atom with any maxstrain during this run (distance units)
23 = cumulative # of new bonds since fix created :ul 16 = count of ghost atoms that could not be found on reneighbor steps during this run
17 = count of bias overlaps (< Dcut) found during this run
18 = cumulative hyper time since fix created (time units)
19 = cumulative count of event timesteps since fix created
20 = cumulative count of atoms in events since fix created
21 = cumulative # of new bonds formed since fix created :ul
The first quantities (1-5) are for the current timestep. Quantities The first quantities (1-5) are for the current timestep. Quantities
6-19 are for the current hyper run. They are reset each time a new 6-17 are for the current hyper run. They are reset each time a new
hyper run is performed. Quantities 20-23 are cumulative across hyper run is performed. Quantities 18-21 are cumulative across
multiple runs (since the fix was defined in the input script). multiple runs (since the point in the input script the fix was
defined).
For value 6, the numerator is a count of all biased bonds on every For value 8, the numerator is a count of all biased bonds on each
timestep whose bias energy = 0.0 due to Eij >= {qfactor}. The timestep whose bias energy = 0.0 due to Eij >= {qfactor}. The
denominator is the count of all biased bonds on all timesteps. denominator is the count of all biased bonds on all timesteps.
For value 7, drift is the distance an atom moves between timesteps For value 9, the numerator is a count of all biased bonds on each
when the bond list is reset, i.e. between events. Atoms involved in timestep with negative strain. The denominator is the count of all
an event will typically move the greatest distance since others are biased bonds on all timesteps.
typically oscillating around their lattice site.
For values 13 and 14, the maxstrain of a ghost atom is the maxstrain Values 13-17 are mostly useful for debugging and diagnostic purposes.
of any bond it is part of, and it is checked for ghost atoms within
the bond neighbor cutoff.
Values 15-19 are mostly useful for debugging and diagnostic purposes. For value 13, drift is the distance an atom moves between two quenched
states when the second quench determines an event has occurred. Atoms
involved in an event will typically move the greatest distance since
others typically remain near their original quenched position.
For values 15-17, it is possible that a ghost atom owned by another For values 14-16, neighbor atoms in the full neighbor list with cutoff
processor will move far enough (e.g. as part of an event-in-progress) {Dcut} may be ghost atoms outside a processor's sub-box. Before the
that it will no longer be within the communication cutoff distance for next event occurs they may move further than {Dcut} away from the
acquiring ghost atoms. Likewise it may be a ghost atom bond partner sub-box boundary. Value 14 is the furthest (from the sub-box) any
that cannot be found because it has moved too far. These values count ghost atom in the neighbor list with maxstrain < {qfactor} was
those occurrences. Because they typically involve atoms that are part accessed during the run. Value 15 is the same except that the ghost
of events, they do not usually indicate bad dynamics. Value 16 is the atom's maxstrain may be >= {qfactor}, which may mean it is about to
average bias coefficient for bonds where a partner atom was lost. participate in an event. Value 16 is a count of how many ghost atoms
could not be found on reneighbor steps, presumably because they moved
too far away due to their participation in an event (which will likely
be detected at the next quench).
For value 18, no two bonds should be biased if they are within a Typical values for 14 and 15 should be slightly larger than {Dcut},
which accounts for ghost atoms initially at a {Dcut} distance moving
thermally before the next event takes place.
Note that for values 14 and 15 to be computed, the optional keyword
{check/ghost} must be specified. Otherwise these values will be zero.
This is because computing them incurs overhead, so the values are only
computed if requested.
Value 16 should be zero or small. As explained above a small count
likely means some ghost atoms were participating in their own events
and moved a longer distance. If the value is large, it likely means
the communication cutoff for ghosts is too close to {Dcut} leading to
many not-found ghost atoms before the next event. This may lead to a
reduced number of bonds being selected for biasing, since the code
assumes those atoms are part of highly strained bonds. As explained
above, the "comm_modify cutoff"_comm_modify.html command can be used
to set a longer cutoff.
For value 17, no two bonds should be biased if they are within a
{Dcut} distance of each other. This value should be zero, indicating {Dcut} distance of each other. This value should be zero, indicating
that no pair of bonds "overlap", meaning they are closer than {Dcut} that no pair of biased bonds are closer than {Dcut} from each other.
from each other.
For value 19, the same bias coefficient is stored by both atoms in an Note that for values 17 to be computed, the optional keyword
IJ bond. This value should be zero, indicating that for all bonds, {check/bias} must be specified and it determines how often this check
each atom in the bond stores the a bias coefficient with the same is performed. This is because performing the check incurs overhead,
value. so if only computed as often as requested.
Value 20 is simply the specified {boost} factor times the number of The result at the end of the run is the cumulative total from every
timestep times the timestep size. timestep the check was made. Note that the value is a count of atoms
in bonds which found other atoms in bonds too close, so it is almost
always an over-count of the number of too-close bonds.
For value 21, events are checked for by the "hyper"_hyper.html command Value 18 is simply the specified {boost} factor times the number of
timesteps times the timestep size.
For value 19, events are checked for by the "hyper"_hyper.html command
once every {Nevent} timesteps. This value is the count of those once every {Nevent} timesteps. This value is the count of those
timesteps on which one (or more) events was detected. It is NOT the timesteps on which one (or more) events was detected. It is NOT the
number of distinct events, since more than one event may occur in the number of distinct events, since more than one event may occur in the
same {Nevent} time window. same {Nevent} time window.
For value 22, each time the "hyper"_hyper.html command checks for an For value 20, each time the "hyper"_hyper.html command checks for an
event, it invokes a compute to flag zero or more atoms as event, it invokes a compute to flag zero or more atoms as
participating in one or more events. E.g. atoms that have displaced participating in one or more events. E.g. atoms that have displaced
more than some distance from the previous quench state. Value 22 is more than some distance from the previous quench state. Value 20 is
the cumulative count of the number of atoms participating in any of the cumulative count of the number of atoms participating in any of
the events that were found. the events that were found.
Value 23 tallies the number of new bonds created by the bond reset Value 21 tallies the number of new bonds created by the bond reset
operation. Bonds between a specific I,J pair of atoms may persist for operation. Bonds between a specific I,J pair of atoms may persist for
the entire hyperdynamics simulation if neither I or J are involved in the entire hyperdynamics simulation if neither I or J are involved in
an event. an event.
@ -378,6 +425,16 @@ an event.
The scalar and vector values calculated by this fix are all The scalar and vector values calculated by this fix are all
"intensive". "intensive".
This fix also computes a local vector of length the number of bonds
currently in the system. The value for each bond is its Cij prefactor
(bias coefficient). These values can be can be accessed by various
"output commands"_Howto_output.html. A particularly useful one is the
"fix ave/histo"_fix_ave_histo.html command which can be used to
histogram the Cij values to see if they are distributed reasonably
close to 1.0, which indicates a good choice of {Vmax}.
The local values calculated by this fix are unitless.
No parameter of this fix can be used with the {start/stop} keywords of No parameter of this fix can be used with the {start/stop} keywords of
the "run"_run.html command. This fix is not invoked during "energy the "run"_run.html command. This fix is not invoked during "energy
minimization"_minimize.html. minimization"_minimize.html.
@ -392,7 +449,9 @@ doc page for more info.
"hyper"_hyper.html, "fix hyper/global"_fix_hyper_global.html "hyper"_hyper.html, "fix hyper/global"_fix_hyper_global.html
[Default:] None [Default:]
The check/ghost and check/bias keywords are not enabled by default.
:line :line

View File

@ -12,6 +12,8 @@ variable cutevent index 1.1
variable steps index 100000 variable steps index 100000
variable nevent index 1000 variable nevent index 1000
variable zoom index 1.8 variable zoom index 1.8
variable seed index 826626413
variable tol index 1.0e-15
units metal units metal
atom_style atomic atom_style atomic
@ -45,7 +47,7 @@ neighbor 0.5 bin
neigh_modify every 1 delay 5 check yes neigh_modify every 1 delay 5 check yes
fix 1 mobile nve fix 1 mobile nve
fix 2 mobile langevin ${Tequil} ${Tequil} 1.0 858872873 zero yes fix 2 mobile langevin ${Tequil} ${Tequil} 1.0 ${seed} zero yes
timestep 0.005 timestep 0.005
@ -92,4 +94,4 @@ dump_modify 1 pad 6 amap 1 3 sa 1 3 blue red green
# run # run
hyper ${steps} ${nevent} HG event min 1.0e-6 1.0e-6 100 100 dump 1 hyper ${steps} ${nevent} HG event min ${tol} ${tol} 1000 1000 dump 1

View File

@ -107,6 +107,12 @@ dump 1 all image 10000000 local.*.jpg v_acolor type size 1024 1024 &
zoom ${zoom} adiam 2.5 view 0.0 0.0 up 0 1 0 axes yes 0.9 0.01 zoom ${zoom} adiam 2.5 view 0.0 0.0 up 0 1 0 axes yes 0.9 0.01
dump_modify 1 pad 6 amap 1 3 sa 1 3 blue red green dump_modify 1 pad 6 amap 1 3 sa 1 3 blue red green
# test of histogramming and dump output of bias coeffs
#fix histo all ave/histo 10 100 1000 0.9 1.1 100 f_HL &
# mode vector kind local file tmp.histo
#dump 2 all local 1000 tmp.local f_HL
# run # run
hyper ${steps} ${nevent} HL event min ${tol} ${tol} 1000 1000 dump 1 hyper ${steps} ${nevent} HL event min ${tol} ${tol} 1000 1000 dump 1

View File

@ -37,7 +37,7 @@ using namespace FixConst;
// possible enhancements // possible enhancements
// should there be a virial contribution from boosted bond? // should there be a virial contribution from boosted bond?
// allow newton off? see Note in pre_reverse() // allow newton off?
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
@ -52,7 +52,7 @@ FixHyperGlobal::FixHyperGlobal(LAMMPS *lmp, int narg, char **arg) :
hyperflag = 1; hyperflag = 1;
scalar_flag = 1; scalar_flag = 1;
vector_flag = 1; vector_flag = 1;
size_vector = 11; size_vector = 12;
global_freq = 1; global_freq = 1;
extscalar = 0; extscalar = 0;
extvector = 0; extvector = 0;
@ -76,6 +76,7 @@ FixHyperGlobal::FixHyperGlobal(LAMMPS *lmp, int narg, char **arg) :
maxold = 0; maxold = 0;
xold = NULL; xold = NULL;
tagold = NULL; tagold = NULL;
old2now = NULL;
me = comm->me; me = comm->me;
firstflag = 1; firstflag = 1;
@ -94,6 +95,7 @@ FixHyperGlobal::~FixHyperGlobal()
memory->sfree(blist); memory->sfree(blist);
memory->destroy(xold); memory->destroy(xold);
memory->destroy(tagold); memory->destroy(tagold);
memory->destroy(old2now);
} }
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
@ -114,6 +116,7 @@ void FixHyperGlobal::init_hyper()
maxdriftsq = 0.0; maxdriftsq = 0.0;
maxbondlen = 0.0; maxbondlen = 0.0;
nobias = 0; nobias = 0;
negstrain = 0;
} }
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
@ -155,14 +158,16 @@ void FixHyperGlobal::setup_pre_neighbor()
void FixHyperGlobal::setup_pre_reverse(int eflag, int vflag) void FixHyperGlobal::setup_pre_reverse(int eflag, int vflag)
{ {
// no increment in nobias or hyper time when pre-run forces are calculated // no increment in these quantities when pre-run forces are calculated
int nobias_hold = nobias; int nobias_hold = nobias;
int negstrain_hold = negstrain;
double t_hyper_hold = t_hyper; double t_hyper_hold = t_hyper;
pre_reverse(eflag,vflag); pre_reverse(eflag,vflag);
nobias = nobias_hold; nobias = nobias_hold;
negstrain = negstrain_hold;
t_hyper = t_hyper_hold; t_hyper = t_hyper_hold;
} }
@ -171,7 +176,7 @@ void FixHyperGlobal::setup_pre_reverse(int eflag, int vflag)
void FixHyperGlobal::pre_neighbor() void FixHyperGlobal::pre_neighbor()
{ {
int i,m,iold,jold,ilocal,jlocal; int i,m,iold,jold,ilocal,jlocal;
double distsq; // double distsq;
// reset local indices for owned bond atoms, since atoms have migrated // reset local indices for owned bond atoms, since atoms have migrated
// must be done after ghost atoms are setup via comm->borders() // must be done after ghost atoms are setup via comm->borders()
@ -182,6 +187,7 @@ void FixHyperGlobal::pre_neighbor()
// closest_image() returns the ghost atom index in that case // closest_image() returns the ghost atom index in that case
// also compute max drift of any atom in a bond // also compute max drift of any atom in a bond
// drift = displacement from quenched coord while event has not yet occured // drift = displacement from quenched coord while event has not yet occured
// NOTE: drift calc is now done in bond_build(), between 2 quenched states
for (i = 0; i < nall_old; i++) old2now[i] = -1; for (i = 0; i < nall_old; i++) old2now[i] = -1;
@ -199,8 +205,8 @@ void FixHyperGlobal::pre_neighbor()
if (ilocal < 0) if (ilocal < 0)
error->one(FLERR,"Fix hyper/global bond atom not found"); error->one(FLERR,"Fix hyper/global bond atom not found");
old2now[iold] = ilocal; old2now[iold] = ilocal;
distsq = MathExtra::distsq3(x[ilocal],xold[iold]); //distsq = MathExtra::distsq3(x[ilocal],xold[iold]);
maxdriftsq = MAX(distsq,maxdriftsq); //maxdriftsq = MAX(distsq,maxdriftsq);
} }
if (jlocal < 0) { if (jlocal < 0) {
jlocal = atom->map(tagold[jold]); jlocal = atom->map(tagold[jold]);
@ -208,40 +214,13 @@ void FixHyperGlobal::pre_neighbor()
if (jlocal < 0) if (jlocal < 0)
error->one(FLERR,"Fix hyper/global bond atom not found"); error->one(FLERR,"Fix hyper/global bond atom not found");
old2now[jold] = jlocal; old2now[jold] = jlocal;
distsq = MathExtra::distsq3(x[jlocal],xold[jold]); //distsq = MathExtra::distsq3(x[jlocal],xold[jold]);
maxdriftsq = MAX(distsq,maxdriftsq); //maxdriftsq = MAX(distsq,maxdriftsq);
} }
blist[m].i = ilocal; blist[m].i = ilocal;
blist[m].j = jlocal; blist[m].j = jlocal;
} }
/* old way - nblocal loop is re-doing index-find calculation
// NOTE: drift may not include J atoms moving (if not themselves bond owners)
int flag = 0;
for (m = 0; m < nblocal; m++) {
iold = blist[m].iold;
jold = blist[m].jold;
ilocal = atom->map(tagold[iold]);
jlocal = atom->map(tagold[jold]);
ilocal = domain->closest_image(xold[iold],ilocal);
jlocal = domain->closest_image(xold[iold],jlocal);
blist[m].i = ilocal;
blist[m].j = jlocal;
if (ilocal < 0 || jlocal < 0) flag++;
else {
distsq = MathExtra::distsq3(x[ilocal],xold[iold]);
maxdriftsq = MAX(distsq,maxdriftsq);
}
}
if (flag) error->one(FLERR,"Fix hyper/global bond atom not found");
*/
} }
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
@ -254,12 +233,12 @@ void FixHyperGlobal::pre_reverse(int /* eflag */, int /* vflag */)
double ebias,vbias,fbias,fbiasr; double ebias,vbias,fbias,fbiasr;
// compute current strain of each owned bond // compute current strain of each owned bond
// eabs_max = maximum absolute value of strain of any bond I own // emax = maximum abs value of strain of any bond I own
// imax,jmax = local indices of my 2 atoms in that bond // imax,jmax = local indices of my 2 atoms in that bond
// rmax,r0max = current and relaxed lengths of that bond // rmax,r0max = current and relaxed lengths of that bond
double **x = atom->x; double **x = atom->x;
double estrain_maxabs = 0.0; double emax = 0.0;
for (m = 0; m < nblocal; m++) { for (m = 0; m < nblocal; m++) {
i = blist[m].i; i = blist[m].i;
@ -272,8 +251,8 @@ void FixHyperGlobal::pre_reverse(int /* eflag */, int /* vflag */)
r0 = blist[m].r0; r0 = blist[m].r0;
estrain = fabs(r-r0) / r0; estrain = fabs(r-r0) / r0;
if (estrain > estrain_maxabs) { if (estrain > emax) {
estrain_maxabs = estrain; emax = estrain;
rmax = r; rmax = r;
r0max = r0; r0max = r0;
imax = i; imax = i;
@ -285,7 +264,7 @@ void FixHyperGlobal::pre_reverse(int /* eflag */, int /* vflag */)
// finds max strain and what proc owns it // finds max strain and what proc owns it
// owner = proc that owns that bond // owner = proc that owns that bond
pairme.value = estrain_maxabs; pairme.value = emax;
pairme.proc = me; pairme.proc = me;
MPI_Allreduce(&pairme,&pairall,1,MPI_DOUBLE_INT,MPI_MAXLOC,world); MPI_Allreduce(&pairme,&pairall,1,MPI_DOUBLE_INT,MPI_MAXLOC,world);
owner = pairall.proc; owner = pairall.proc;
@ -311,16 +290,14 @@ void FixHyperGlobal::pre_reverse(int /* eflag */, int /* vflag */)
// Fix = x component of force on atom I // Fix = x component of force on atom I
// = Fbias dEbias/dr dr/dxi, dEbias/dr = 1/r0, dr/dxi = delx/r // = Fbias dEbias/dr dr/dxi, dEbias/dr = 1/r0, dr/dxi = delx/r
// dt_boost = time boost factor = exp(Vbias/kT) // dt_boost = time boost factor = exp(Vbias/kT)
// NOTE: logic here would need to be different for newton off
double **f = atom->f; double **f = atom->f;
vbias = fbias = 0.0; vbias = fbias = 0.0;
dt_boost = 1.0; dt_boost = 1.0;
if (estrain_maxabs < qfactor) { if (emax < qfactor) {
//ebias = (rmax-r0max) / r0max; ebias = (rmax-r0max) / r0max;
ebias = fabs(rmax-r0max) / r0max;
vbias = vmax * (1.0 - ebias*ebias*invqfactorsq); vbias = vmax * (1.0 - ebias*ebias*invqfactorsq);
fbias = 2.0 * vmax * ebias * invqfactorsq; fbias = 2.0 * vmax * ebias * invqfactorsq;
dt_boost = exp(beta*vbias); dt_boost = exp(beta*vbias);
@ -338,13 +315,15 @@ void FixHyperGlobal::pre_reverse(int /* eflag */, int /* vflag */)
f[jmax][1] -= dely*fbiasr; f[jmax][1] -= dely*fbiasr;
f[jmax][2] -= delz*fbiasr; f[jmax][2] -= delz*fbiasr;
if (ebias < 0.0) negstrain++;
} else nobias++; } else nobias++;
// output quantities // output quantities
outvec[0] = vbias; outvec[0] = vbias;
outvec[1] = dt_boost; outvec[1] = dt_boost;
outvec[2] = ebias; outvec[2] = emax;
outvec[3] = atom->tag[imax]; outvec[3] = atom->tag[imax];
outvec[4] = atom->tag[jmax]; outvec[4] = atom->tag[jmax];
@ -356,8 +335,8 @@ void FixHyperGlobal::pre_reverse(int /* eflag */, int /* vflag */)
void FixHyperGlobal::build_bond_list(int natom) void FixHyperGlobal::build_bond_list(int natom)
{ {
int i,j,ii,jj,inum,jnum; int i,j,m,ii,jj,iold,jold,ilocal,jlocal,inum,jnum;
double xtmp,ytmp,ztmp,delx,dely,delz,rsq; double xtmp,ytmp,ztmp,delx,dely,delz,rsq,distsq;
int *ilist,*jlist,*numneigh,**firstneigh; int *ilist,*jlist,*numneigh,**firstneigh;
if (natom) { if (natom) {
@ -365,6 +344,27 @@ void FixHyperGlobal::build_bond_list(int natom)
nevent_atom += natom; nevent_atom += natom;
} }
// compute max distance any bond atom has moved between 2 quenched states
// xold[iold] = last quenched coord for iold
// x[ilocal] = current quenched coord for same atom
double **x = atom->x;
int nlocal = atom->nlocal;
int nall = nlocal + atom->nghost;
for (m = 0; m < nblocal; m++) {
iold = blist[m].iold;
ilocal = atom->map(tagold[iold]);
ilocal = domain->closest_image(xold[iold],ilocal);
distsq = MathExtra::distsq3(x[ilocal],xold[iold]);
maxdriftsq = MAX(distsq,maxdriftsq);
jold = blist[m].jold;
jlocal = atom->map(tagold[jold]);
jlocal = domain->closest_image(xold[iold],jlocal);
distsq = MathExtra::distsq3(x[jlocal],xold[jold]);
maxdriftsq = MAX(distsq,maxdriftsq);
}
// trigger neighbor list build // trigger neighbor list build
neighbor->build_one(list); neighbor->build_one(list);
@ -372,7 +372,6 @@ void FixHyperGlobal::build_bond_list(int natom)
// identify bonds assigned to each owned atom // identify bonds assigned to each owned atom
// do not create a bond between two non-group atoms // do not create a bond between two non-group atoms
double **x = atom->x;
int *mask = atom->mask; int *mask = atom->mask;
inum = list->inum; inum = list->inum;
@ -415,10 +414,12 @@ void FixHyperGlobal::build_bond_list(int natom)
} }
} }
// store IDs and coords for owned+ghost atoms at time of bond creation // store per-atom quantities for owned+ghost atoms at time of bond creation
// realloc xold and tagold as needed // nall_old = value of nall at time bonds are built
if (atom->nmax > maxold) { tagint *tag = atom->tag;
if (nall > maxold) {
memory->destroy(xold); memory->destroy(xold);
memory->destroy(tagold); memory->destroy(tagold);
memory->destroy(old2now); memory->destroy(old2now);
@ -428,16 +429,11 @@ void FixHyperGlobal::build_bond_list(int natom)
memory->create(old2now,maxold,"hyper/global:old2now"); memory->create(old2now,maxold,"hyper/global:old2now");
} }
tagint *tag = atom->tag; memcpy(&xold[0][0],&x[0][0],3*nall*sizeof(double));
int nall = atom->nlocal + atom->nghost; for (i = 0; i < nall; i++) tagold[i] = tag[i];
nall_old = nall;
for (i = 0; i < nall; i++) { nlocal_old = nlocal;
xold[i][0] = x[i][0]; nall_old = nall;
xold[i][1] = x[i][1];
xold[i][2] = x[i][2];
tagold[i] = tag[i];
}
} }
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
@ -473,7 +469,7 @@ double FixHyperGlobal::compute_vector(int i)
bcastflag = 0; bcastflag = 0;
} }
// 11 vector outputs returned for i = 0-10 // 12 vector outputs returned for i = 0-11
// i = 0 = boost factor on this step // i = 0 = boost factor on this step
// i = 1 = max strain of any bond on this step (positive or negative) // i = 1 = max strain of any bond on this step (positive or negative)
@ -481,13 +477,14 @@ double FixHyperGlobal::compute_vector(int i)
// i = 3 = ID of atom J in max-strain bond on this step // i = 3 = ID of atom J in max-strain bond on this step
// i = 4 = ave bonds/atom on this step // i = 4 = ave bonds/atom on this step
// i = 5 = fraction of steps with no bias during this run // i = 5 = fraction of steps where bond has no bias during this run
// i = 6 = max drift of any atom during this run // i = 6 = fraction of steps where bond has negative strain during this run
// i = 7 = max bond length during this run // i = 7 = max drift distance of any atom during this run
// i = 8 = max bond length during this run
// i = 8 = cummulative hyper time since fix created // i = 9 = cummulative hyper time since fix created
// i = 9 = cummulative # of event timesteps since fix created // i = 10 = cummulative # of event timesteps since fix created
// i = 10 = cummulative # of atoms in events since fix created // i = 11 = cummulative # of atoms in events since fix created
if (i == 0) return outvec[1]; if (i == 0) return outvec[1];
if (i == 1) return outvec[2]; if (i == 1) return outvec[2];
@ -509,20 +506,27 @@ double FixHyperGlobal::compute_vector(int i)
} }
if (i == 6) { if (i == 6) {
if (update->ntimestep == update->firststep) return 0.0;
int allnegstrain;
MPI_Allreduce(&negstrain,&allnegstrain,1,MPI_INT,MPI_SUM,world);
return 1.0*allnegstrain / (update->ntimestep - update->firststep);
}
if (i == 7) {
double alldriftsq; double alldriftsq;
MPI_Allreduce(&maxdriftsq,&alldriftsq,1,MPI_DOUBLE,MPI_MAX,world); MPI_Allreduce(&maxdriftsq,&alldriftsq,1,MPI_DOUBLE,MPI_MAX,world);
return sqrt(alldriftsq); return sqrt(alldriftsq);
} }
if (i == 7) { if (i == 8) {
double allbondlen; double allbondlen;
MPI_Allreduce(&maxbondlen,&allbondlen,1,MPI_DOUBLE,MPI_MAX,world); MPI_Allreduce(&maxbondlen,&allbondlen,1,MPI_DOUBLE,MPI_MAX,world);
return allbondlen; return allbondlen;
} }
if (i == 8) return t_hyper; if (i == 9) return t_hyper;
if (i == 9) return (double) nevent; if (i == 10) return (double) nevent;
if (i == 10) return (double) nevent_atom; if (i == 11) return (double) nevent_atom;
return 0.0; return 0.0;
} }
@ -534,13 +538,14 @@ double FixHyperGlobal::compute_vector(int i)
double FixHyperGlobal::query(int i) double FixHyperGlobal::query(int i)
{ {
if (i == 1) return compute_vector(8); // cummulative hyper time if (i == 1) return compute_vector(9); // cummulative hyper time
if (i == 2) return compute_vector(9); // nevent if (i == 2) return compute_vector(10); // nevent
if (i == 3) return compute_vector(10); // nevent_atom if (i == 3) return compute_vector(11); // nevent_atom
if (i == 4) return compute_vector(4); // ave bonds/atom if (i == 4) return compute_vector(4); // ave bonds/atom
if (i == 5) return compute_vector(6); // maxdrift if (i == 5) return compute_vector(7); // maxdrift
if (i == 6) return compute_vector(7); // maxbondlen if (i == 6) return compute_vector(8); // maxbondlen
if (i == 7) return compute_vector(5); // fraction with zero bias if (i == 7) return compute_vector(5); // fraction with zero bias
if (i == 8) return compute_vector(6); // fraction with negative strain
error->all(FLERR,"Invalid query to fix hyper/global"); error->all(FLERR,"Invalid query to fix hyper/global");

View File

@ -56,6 +56,7 @@ class FixHyperGlobal : public FixHyper {
double maxbondlen; // max length of any bond double maxbondlen; // max length of any bond
double maxdriftsq; // max distance any atom drifts from original pos double maxdriftsq; // max distance any atom drifts from original pos
int nobias; // # of steps when bias = 0, b/c bond too long int nobias; // # of steps when bias = 0, b/c bond too long
int negstrain; // # of steps when biased bond has negative strain
class NeighList *list; class NeighList *list;
@ -70,12 +71,13 @@ class FixHyperGlobal : public FixHyper {
double r0; // relaxed bond length double r0; // relaxed bond length
}; };
struct OneBond *blist; // list of owned bonds OneBond *blist; // list of owned bonds
int nblocal; // # of owned bonds int nblocal; // # of owned bonds
// coords and IDs of owned+ghost atoms when bonds were formed // coords and IDs of owned+ghost atoms when bonds were formed
// persists on a proc from one event until the next // persists on a proc from one event until the next
int nlocal_old; // nlocal for old atoms
int nall_old; // nlocal+nghost for old atoms int nall_old; // nlocal+nghost for old atoms
int maxold; // allocated size of old atoms int maxold; // allocated size of old atoms

File diff suppressed because it is too large Load Diff

View File

@ -21,6 +21,7 @@ FixStyle(hyper/local,FixHyperLocal)
#define LMP_FIX_HYPER_LOCAL_H #define LMP_FIX_HYPER_LOCAL_H
#include "fix_hyper.h" #include "fix_hyper.h"
#include "my_page.h"
namespace LAMMPS_NS { namespace LAMMPS_NS {
@ -43,6 +44,7 @@ class FixHyperLocal : public FixHyper {
int pack_forward_comm(int, int *, double *, int, int *); int pack_forward_comm(int, int *, double *, int, int *);
void unpack_forward_comm(int, int, double *); void unpack_forward_comm(int, int, double *);
int pack_reverse_comm(int, int, double *); int pack_reverse_comm(int, int, double *);
int pack_reverse_comm_size(int, int);
void unpack_reverse_comm(int, int *, double *); void unpack_reverse_comm(int, int *, double *);
double memory_usage(); double memory_usage();
@ -54,54 +56,72 @@ class FixHyperLocal : public FixHyper {
private: private:
int me; int me;
// inputs and derived quantities
double cutbond,qfactor,vmax,tequil,dcut; double cutbond,qfactor,vmax,tequil,dcut;
double alpha_user; // timescale to apply boostostat (time units) double alpha_user; // timescale to apply boostostat (time units)
double alpha; // unitless dt/alpha_user double alpha; // unitless dt/alpha_user
double boost_target; // target value of boost double boost_target; // target value of boost
int checkbias,checkbias_every,checkbias_flag,checkbias_count; int checkghost,checkbias; // flags for optional stats
double cutbondsq,dcutsq;
double beta,invqfactorsq;
// flags
int setupflag; // 1 during setup, 0 during run int setupflag; // 1 during setup, 0 during run
int firstflag; // set for first time bond_build takes place int firstflag; // set for first time bond_build takes place
int nostrainyet; // 1 until maxstrain is first computed int nostrainyet; // 1 until maxstrain is first compute
bigint starttime; // timestep when this fix was invoked
int nbias_running,nobias_running;
int nbondbuild;
double time_bondbuild;
bigint starttime;
double sumbiascoeff; // sum of aveboost at every timestep
bigint allbonds; // sum of bond count on this step
double allbias; // sum of biascoeff on all bonds on this step
int nnewbond; // running tally of number of new bonds created
int maxbondperatom; // max # of bonds any atom ever has
int commflag; // flag for communication mode int commflag; // flag for communication mode
// stats
int nbondbuild; // # of rebuilds of bond list
double time_bondbuild; // CPU time for bond builds
bigint allbonds; // current total # of bonds
int nnewbond; // running tally of # of new bonds created
int maxbondperatom; // max # of bonds any atom ever has
int nevent; // # of events that trigger bond rebuild int nevent; // # of events that trigger bond rebuild
int nevent_atom; // # of atoms that experienced an event int nevent_atom; // # of atoms that experienced an event
double cutbondsq,dcutsq;
double beta,invqfactorsq; int nbias_running; // running count of biased bonds
double mybias; int nobias_running; // ditto for bonds with bias = 0, b/c too long
int negstrain_running; // ditto for bonds with negative strain
double mybias; // sum of bias potentials for biased bonds
double maxbondlen; // cummulative max length of any bond double maxbondlen; // cummulative max length of any bond
double maxdriftsq; // max distance any atom drifts from original pos double maxdriftsq; // max distance any bond atom drifts from quenched x
double maxbiascoeff; // cummulative max bias coeff for any bond
double sumbiascoeff; // sum of all bond bias coeffs at each timestep
double avebiascoeff; // cummulative sumbiascoeff/allbonds across steps
double minbiascoeff; // cummulative min bias coeff for any bond double minbiascoeff; // cummulative min bias coeff for any bond
double maxbiascoeff; // cummulative max bias coeff for any bond
double rmaxever,rmaxeverbig; double rmaxever,rmaxeverbig;
int ghost_toofar; int ghost_toofar; // # of ghost atoms not found in Dcut neigh list
int checkbias_every,checkbias_flag,checkbias_count;
// 2 neighbor lists
class NeighList *listfull; // full neigh list up to Dcut distance class NeighList *listfull; // full neigh list up to Dcut distance
class NeighList *listhalf; // half neigh list up to pair distance class NeighList *listhalf; // half neigh list up to pair distance
// both created only when bonds are rebuilt // both created only when bonds are rebuilt
// list of my owned bonds // list of my owned bonds and bias coeffs
// persists on a proc from one event until the next // persists on a proc from one event until the next
struct OneBond { // single IJ bond, atom I is owner struct OneBond { // single IJ bond, atom I is owner
int i,j; // current local indices of 2 bond atoms int i,j; // current local indices of 2 bond atoms
int iold,jold; // local indices when bonds were formed int iold,jold; // local indices when bonds were formed
double r0; // relaxed bond length double r0; // relaxed bond length
double biascoeff; // biasing coefficient = prefactor Cij
}; };
struct OneBond *blist; // list of owned bonds OneBond *blist; // list of owned bonds
double *biascoeff; // biasing coefficient Cij for each bond
int nblocal; // # of owned bonds int nblocal; // # of owned bonds
int maxbond; // allocated size of blist int maxbond; // allocated size of blist
@ -137,24 +157,24 @@ class FixHyperLocal : public FixHyper {
tagint *biasflag; // atoms in biased bonds marked with bond partner tagint *biasflag; // atoms in biased bonds marked with bond partner
// for owned and ghost atoms // for owned and ghost atoms
// data struct used to persist biascoeffs when bond list is re-created
struct OneCoeff {
double biascoeff;
tagint jtag;
};
struct OneCoeff **clist; // list of bond coeffs for each atom's bonds
int *numcoeff; // # of coeffs per atom
int maxcoeff; // allocate size of clist
int maxcoeffperatom; // allocated # of columns in clist
// list of biased bonds this proc owns // list of biased bonds this proc owns
int maxbias; // allocated size of bias list int maxbias; // allocated size of bias list
int nbias; // # of biased bonds I own int nbias; // # of biased bonds I own
int *bias; // index of biased bonds in my bond list int *bias; // index of biased bonds in my bond list
// data structs for persisting bias coeffs when bond list is reformed
struct OneCoeff {
double biascoeff;
tagint tag;
};
MyPage<OneCoeff> *cpage; // pages of OneCoeff datums for clist
OneCoeff **clist; // ptrs to vectors of bias coeffs for each atom
int *numcoeff; // # of bias coeffs per atom (one per bond)
int maxcoeff; // allocate sized of clist and numcoeff
// extra timers // extra timers
//double timefirst,timesecond,timethird,timefourth; //double timefirst,timesecond,timethird,timefourth;
@ -163,7 +183,6 @@ class FixHyperLocal : public FixHyper {
// private methods // private methods
void grow_bond(); void grow_bond();
void grow_coeff();
}; };
} }

View File

@ -40,9 +40,7 @@ enum{NOHYPER,GLOBAL,LOCAL};
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
Hyper::Hyper(LAMMPS *lmp) : Hyper::Hyper(LAMMPS *lmp) : Pointers(lmp), dumplist(NULL) {}
Pointers(lmp), dumplist(NULL)
{}
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
perform hyperdynamics simulation perform hyperdynamics simulation
@ -260,11 +258,12 @@ void Hyper::command(int narg, char **arg)
double maxdrift = 0.0; double maxdrift = 0.0;
double maxbondlen = 0.0; double maxbondlen = 0.0;
double fraczero = 1.0; double fraczero = 1.0;
double fracneg = 1.0;
double nnewbond,avenboost,aveboostcoeff,maxboostcoeff,minboostcoeff; double nnewbond,avenbias,avebiascoeff,minbiascoeff,maxbiascoeff;
double maxbondperatom,neighbondperbond,aveboostnow; double maxbondperatom,neighbondperbond,avebiasnow;
double tbondbuild,rmaxever,rmaxeverbig,allghost_toofar; double tbondbuild,rmaxever,rmaxeverbig,allghost_toofar;
double lostbond,lostbondcoeff,biasoverlap,nonmatchbiascoeff; double lostbond,lostbondcoeff,biasoverlap;
if (hyperenable) { if (hyperenable) {
t_hyper = fix_hyper->query(1); t_hyper = fix_hyper->query(1);
@ -274,115 +273,70 @@ void Hyper::command(int narg, char **arg)
maxdrift = fix_hyper->query(5); maxdrift = fix_hyper->query(5);
maxbondlen = fix_hyper->query(6); maxbondlen = fix_hyper->query(6);
fraczero = fix_hyper->query(7); fraczero = fix_hyper->query(7);
fracneg = fix_hyper->query(8);
if (hyperstyle == LOCAL) { if (hyperstyle == LOCAL) {
nnewbond = fix_hyper->query(8); nnewbond = fix_hyper->query(9);
maxbondperatom = fix_hyper->query(9); maxbondperatom = fix_hyper->query(10);
avenboost = fix_hyper->query(10); avenbias = fix_hyper->query(11);
aveboostcoeff = fix_hyper->query(11); avebiascoeff = fix_hyper->query(12);
maxboostcoeff = fix_hyper->query(12); minbiascoeff = fix_hyper->query(13);
minboostcoeff = fix_hyper->query(13); maxbiascoeff = fix_hyper->query(14);
neighbondperbond = fix_hyper->query(14); neighbondperbond = fix_hyper->query(15);
aveboostnow = fix_hyper->query(15); avebiasnow = fix_hyper->query(16);
tbondbuild = fix_hyper->query(16); tbondbuild = fix_hyper->query(17);
rmaxever = fix_hyper->query(17); rmaxever = fix_hyper->query(18);
rmaxeverbig = fix_hyper->query(18); rmaxeverbig = fix_hyper->query(19);
allghost_toofar = fix_hyper->query(19); allghost_toofar = fix_hyper->query(20);
lostbond = fix_hyper->query(20); biasoverlap = fix_hyper->query(21);
lostbondcoeff = fix_hyper->query(21);
biasoverlap = fix_hyper->query(22);
nonmatchbiascoeff = fix_hyper->query(23);
} }
} }
if (me == 0) { if (me == 0) {
if (screen) { FILE *out;
fprintf(screen,"Cummulative quantities for fix hyper:\n"); for (int iout = 0; iout < 2; iout++) {
fprintf(screen," hyper time = %g\n",t_hyper); if (iout == 0) out = screen;
fprintf(screen," time boost factor = %g\n",t_hyper/(nsteps*update->dt)); if (iout == 1) out = logfile;
fprintf(screen," event timesteps = %d\n",nevent_running); if (!out) continue;
fprintf(screen," # of atoms in events = %d\n",nevent_atoms_running); fprintf(out,"Cummulative quantities for fix hyper:\n");
fprintf(screen,"Quantities for this hyper run:\n"); fprintf(out," hyper time = %g\n",t_hyper);
fprintf(screen," event timesteps = %d\n",nevent); fprintf(out," time boost factor = %g\n",t_hyper/(nsteps*update->dt));
fprintf(screen," # of atoms in events = %d\n",nevent_atoms); fprintf(out," event timesteps = %d\n",nevent_running);
fprintf(screen," max length of any bond = %g\n",maxbondlen); fprintf(out," # of atoms in events = %d\n",nevent_atoms_running);
fprintf(screen," max drift distance of any atom = %g\n",maxdrift); fprintf(out,"Quantities for this hyper run:\n");
fprintf(screen," fraction of steps & bonds with zero bias = %g\n", fprintf(out," event timesteps = %d\n",nevent);
fraczero); fprintf(out," # of atoms in events = %d\n",nevent_atoms);
fprintf(screen,"Current quantities:\n"); fprintf(out," max length of any bond = %g\n",maxbondlen);
fprintf(screen," ave bonds/atom = %g\n",avebonds); fprintf(out," max drift distance of any atom = %g\n",maxdrift);
fprintf(out," fraction of biased bonds with zero bias = %g\n",fraczero);
fprintf(out," fraction of biased bonds with negative strain = %g\n",
fracneg);
fprintf(out,"Current quantities:\n");
fprintf(out," ave bonds/atom = %g\n",avebonds);
if (hyperstyle == LOCAL) { if (hyperstyle == LOCAL) {
fprintf(screen,"Cummulative quantities specific to fix hyper/local:\n"); fprintf(out,"Cummulative quantities specific to fix hyper/local:\n");
fprintf(screen," # of new bonds formed = %g\n",nnewbond); fprintf(out," # of new bonds formed = %g\n",nnewbond);
fprintf(screen," max bonds/atom = %g\n",maxbondperatom); fprintf(out," max bonds/atom = %g\n",maxbondperatom);
fprintf(screen,"Quantities for this hyper run specific to " fprintf(out,"Quantities for this hyper run specific to "
"fix hyper/local:\n"); "fix hyper/local:\n");
fprintf(screen," ave boosted bonds/step = %g\n",avenboost); fprintf(out," ave biased bonds/step = %g\n",avenbias);
fprintf(screen," ave boost coeff of all bonds = %g\n",aveboostcoeff); fprintf(out," ave bias coeff of all bonds = %g\n",avebiascoeff);
fprintf(screen," max boost coeff of any bond = %g\n",maxboostcoeff); fprintf(out," min bias coeff of any bond = %g\n",minbiascoeff);
fprintf(screen," min boost coeff of any bond = %g\n",minboostcoeff); fprintf(out," max bias coeff of any bond = %g\n",maxbiascoeff);
fprintf(screen," max dist from my box of any " fprintf(out," max dist from my subbox of any "
"non-maxstrain bond ghost atom = %g\n",rmaxever); "non-maxstrain bond ghost atom = %g\n",rmaxever);
fprintf(screen," max dist from my box of any bond ghost atom = %g\n", fprintf(out," max dist from my box of any bond ghost atom = %g\n",
rmaxeverbig); rmaxeverbig);
fprintf(screen," count of bond ghost neighbors " fprintf(out," count of bond ghost neighbors "
"not found on reneighbor steps = %g\n",allghost_toofar); "not found on reneighbor steps = %g\n",allghost_toofar);
fprintf(screen," lost bond partners = %g\n",lostbond); fprintf(out," bias overlaps = %g\n",biasoverlap);
fprintf(screen," ave bias coeff for lost bond partners = %g\n", fprintf(out," CPU time for bond builds = %g\n",tbondbuild);
lostbondcoeff); fprintf(out,"Current quantities specific to fix hyper/local:\n");
fprintf(screen," bias overlaps = %g\n",biasoverlap); fprintf(out," neighbor bonds/bond = %g\n",neighbondperbond);
fprintf(screen," non-matching bias coeffs = %g\n",nonmatchbiascoeff); fprintf(out," ave boost coeff for all bonds = %g\n",avebiasnow);
fprintf(screen," CPU time for bond builds = %g\n",tbondbuild);
fprintf(screen,"Current quantities specific to fix hyper/local:\n");
fprintf(screen," neighbor bonds/bond = %g\n",neighbondperbond);
fprintf(screen," ave boost coeff for all bonds = %g\n",aveboostnow);
} }
fprintf(screen,"\n"); fprintf(out,"\n");
}
if (logfile) {
fprintf(logfile,"Cummulative quantities for fix hyper:\n");
fprintf(logfile," hyper time = %g\n",t_hyper);
fprintf(logfile," event timesteps = %d\n",nevent_running);
fprintf(logfile," # of atoms in events = %d\n",nevent_atoms_running);
fprintf(logfile,"Quantities for this hyper run:\n");
fprintf(logfile," event timesteps = %d\n",nevent);
fprintf(logfile," # of atoms in events = %d\n",nevent_atoms);
fprintf(logfile," max length of any bond = %g\n",maxbondlen);
fprintf(logfile," max drift distance of any atom = %g\n",maxdrift);
fprintf(logfile," fraction of steps & bonds with zero bias = %g\n",
fraczero);
fprintf(logfile,"Current quantities:\n");
fprintf(logfile," ave bonds/atom = %g\n",avebonds);
if (hyperstyle == LOCAL) {
fprintf(logfile,"Cummulative quantities specific tofix hyper/local:\n");
fprintf(logfile," # of new bonds formed = %g\n",nnewbond);
fprintf(logfile," max bonds/atom = %g\n",maxbondperatom);
fprintf(logfile,"Quantities for this hyper run specific to "
"fix hyper/local:\n");
fprintf(logfile," ave boosted bonds/step = %g\n",avenboost);
fprintf(logfile," ave boost coeff of all bonds = %g\n",aveboostcoeff);
fprintf(logfile," max boost coeff of any bond = %g\n",maxboostcoeff);
fprintf(logfile," min boost coeff of any bond = %g\n",minboostcoeff);
fprintf(logfile," max dist from my box of any "
"non-maxstrain bond ghost atom = %g\n",rmaxever);
fprintf(logfile," max dist from my box of any bond ghost atom = %g\n",
rmaxeverbig);
fprintf(logfile," count of ghost bond neighbors "
"not found on reneighbor steps = %g\n",allghost_toofar);
fprintf(logfile," lost bond partners = %g\n",lostbond);
fprintf(logfile," ave bias coeff for lost bond partners = %g\n",
lostbondcoeff);
fprintf(logfile," bias overlaps = %g\n",biasoverlap);
fprintf(logfile," non-matching bias coeffs = %g\n",nonmatchbiascoeff);
fprintf(logfile," CPU time for bond builds = %g\n",tbondbuild);
fprintf(logfile,"Current quantities specific to fix hyper/local:\n");
fprintf(logfile," neighbor bonds/bond = %g\n",neighbondperbond);
fprintf(logfile," ave boost coeff for all bonds = %g\n",aveboostnow);
}
fprintf(logfile,"\n");
} }
} }

View File

@ -32,7 +32,7 @@ using namespace FixConst;
enum{X,V,F,COMPUTE,FIX,VARIABLE}; enum{X,V,F,COMPUTE,FIX,VARIABLE};
enum{ONE,RUNNING}; enum{ONE,RUNNING};
enum{SCALAR,VECTOR,WINDOW}; enum{SCALAR,VECTOR,WINDOW};
enum{GLOBAL,PERATOM,LOCAL}; enum{DEFAULT,GLOBAL,PERATOM,LOCAL};
enum{IGNORE,END,EXTRA}; enum{IGNORE,END,EXTRA};
#define INVOKED_SCALAR 1 #define INVOKED_SCALAR 1
@ -46,8 +46,10 @@ enum{IGNORE,END,EXTRA};
FixAveHisto::FixAveHisto(LAMMPS *lmp, int narg, char **arg) : FixAveHisto::FixAveHisto(LAMMPS *lmp, int narg, char **arg) :
Fix(lmp, narg, arg), Fix(lmp, narg, arg),
nvalues(0), which(NULL), argindex(NULL), value2index(NULL), ids(NULL), fp(NULL), stats_list(NULL), nvalues(0), which(NULL), argindex(NULL), value2index(NULL),
bin(NULL), bin_total(NULL), bin_all(NULL), bin_list(NULL), coord(NULL), vector(NULL) ids(NULL), fp(NULL), stats_list(NULL),
bin(NULL), bin_total(NULL), bin_all(NULL), bin_list(NULL),
coord(NULL), vector(NULL)
{ {
if (narg < 10) error->all(FLERR,"Illegal fix ave/histo command"); if (narg < 10) error->all(FLERR,"Illegal fix ave/histo command");
@ -188,9 +190,8 @@ FixAveHisto::FixAveHisto(LAMMPS *lmp, int narg, char **arg) :
memory->sfree(earg); memory->sfree(earg);
} }
// setup and error check // check input args for kind consistency
// kind = inputs are all global, or all per-atom, or all local // all inputs must all be global, per-atom, or local
// for fix inputs, check that fix frequency is acceptable
if (nevery <= 0 || nrepeat <= 0 || nfreq <= 0) if (nevery <= 0 || nrepeat <= 0 || nfreq <= 0)
error->all(FLERR,"Illegal fix ave/histo command"); error->all(FLERR,"Illegal fix ave/histo command");
@ -201,40 +202,65 @@ FixAveHisto::FixAveHisto(LAMMPS *lmp, int narg, char **arg) :
if (ave != RUNNING && overwrite) if (ave != RUNNING && overwrite)
error->all(FLERR,"Illegal fix ave/histo command"); error->all(FLERR,"Illegal fix ave/histo command");
int kindflag; int kindglobal,kindperatom,kindlocal;
for (int i = 0; i < nvalues; i++) { for (int i = 0; i < nvalues; i++) {
if (which[i] == X || which[i] == V || which[i] == F) kindflag = PERATOM; kindglobal = kindperatom = kindlocal = 0;
else if (which[i] == COMPUTE) {
if (which[i] == X || which[i] == V || which[i] == F) {
kindperatom = 1;
} else if (which[i] == COMPUTE) {
int c_id = modify->find_compute(ids[i]); int c_id = modify->find_compute(ids[i]);
if (c_id < 0) error->all(FLERR,"Fix ave/histo input is invalid compute"); if (c_id < 0) error->all(FLERR,"Fix ave/histo input is invalid compute");
Compute *compute = modify->compute[c_id]; Compute *compute = modify->compute[c_id];
// computes can produce multiple kinds of output
if (compute->scalar_flag || compute->vector_flag || compute->array_flag) if (compute->scalar_flag || compute->vector_flag || compute->array_flag)
kindflag = GLOBAL; kindglobal = 1;
else if (compute->peratom_flag) kindflag = PERATOM; if (compute->peratom_flag) kindperatom = 1;
else if (compute->local_flag) kindflag = LOCAL; if (compute->local_flag) kindlocal = 1;
else error->all(FLERR,"Fix ave/histo input is invalid compute");
} else if (which[i] == FIX) { } else if (which[i] == FIX) {
int f_id = modify->find_fix(ids[i]); int f_id = modify->find_fix(ids[i]);
if (f_id < 0) error->all(FLERR,"Fix ave/histo input is invalid fix"); if (f_id < 0) error->all(FLERR,"Fix ave/histo input is invalid fix");
Fix *fix = modify->fix[f_id]; Fix *fix = modify->fix[f_id];
// fixes can produce multiple kinds of output
if (fix->scalar_flag || fix->vector_flag || fix->array_flag) if (fix->scalar_flag || fix->vector_flag || fix->array_flag)
kindflag = GLOBAL; kindglobal = 1;
else if (fix->peratom_flag) kindflag = PERATOM; if (fix->peratom_flag) kindperatom = 1;
else if (fix->local_flag) kindflag = LOCAL; if (fix->local_flag) kindlocal = 1;
else error->all(FLERR,"Fix ave/histo input is invalid fix");
} else if (which[i] == VARIABLE) { } else if (which[i] == VARIABLE) {
int ivariable = input->variable->find(ids[i]); int ivariable = input->variable->find(ids[i]);
if (ivariable < 0) error->all(FLERR,"Fix ave/histo input is invalid variable"); if (ivariable < 0)
if (input->variable->equalstyle(ivariable)) kindflag = GLOBAL; error->all(FLERR,"Fix ave/histo input is invalid variable");
else if (input->variable->atomstyle(ivariable)) kindflag = PERATOM; // variables only produce one kind of output
else error->all(FLERR,"Fix ave/histo input is invalid variable"); if (input->variable->equalstyle(ivariable)) kindglobal = 1;
else if (input->variable->atomstyle(ivariable)) kindperatom = 1;
else error->all(FLERR,"Fix ave/histo input is invalid kind of variable");
}
if (kind == DEFAULT) {
if (kindglobal + kindperatom + kindlocal > 1)
error->all(FLERR,"Fix ave/histo input kind is ambiguous");
if (kindglobal) kind = GLOBAL;
if (kindperatom) kind = PERATOM;
if (kindlocal) kind = LOCAL;
} else if (kind == GLOBAL) {
if (!kindglobal)
error->all(FLERR,"Fix ave/histo input kind is invalid");
} else if (kind == PERATOM) {
if (!kindperatom)
error->all(FLERR,"Fix ave/histo input kind is invalid");
} else if (kind == LOCAL) {
if (!kindlocal)
error->all(FLERR,"Fix ave/histo input kind is invalid");
} }
if (i == 0) kind = kindflag;
else if (kindflag != kind)
error->all(FLERR,
"Fix ave/histo inputs are not all global, peratom, or local");
} }
// more error checks
// for fix inputs, check that fix frequency is acceptable
if (kind == PERATOM && mode == SCALAR) if (kind == PERATOM && mode == SCALAR)
error->all(FLERR, error->all(FLERR,
"Fix ave/histo cannot input per-atom values in scalar mode"); "Fix ave/histo cannot input per-atom values in scalar mode");
@ -919,6 +945,7 @@ void FixAveHisto::options(int iarg, int narg, char **arg)
// option defaults // option defaults
fp = NULL; fp = NULL;
kind = DEFAULT;
ave = ONE; ave = ONE;
startstep = 0; startstep = 0;
mode = SCALAR; mode = SCALAR;
@ -942,6 +969,13 @@ void FixAveHisto::options(int iarg, int narg, char **arg)
} }
} }
iarg += 2; iarg += 2;
} else if (strcmp(arg[iarg],"kind") == 0) {
if (iarg+2 > narg) error->all(FLERR,"Illegal fix ave/histo command");
if (strcmp(arg[iarg+1],"global") == 0) kind = GLOBAL;
else if (strcmp(arg[iarg+1],"peratom") == 0) kind = PERATOM;
else if (strcmp(arg[iarg+1],"local") == 0) kind = LOCAL;
else error->all(FLERR,"Illegal fix ave/histo command");
iarg += 2;
} else if (strcmp(arg[iarg],"ave") == 0) { } else if (strcmp(arg[iarg],"ave") == 0) {
if (iarg+2 > narg) error->all(FLERR,"Illegal fix ave/histo command"); if (iarg+2 > narg) error->all(FLERR,"Illegal fix ave/histo command");
if (strcmp(arg[iarg+1],"one") == 0) ave = ONE; if (strcmp(arg[iarg+1],"one") == 0) ave = ONE;

View File

@ -380,9 +380,8 @@ void Thermo::compute(int flag)
loc += sprintf(&line[loc],format[ifield],dvalue); loc += sprintf(&line[loc],format[ifield],dvalue);
else if (vtype[ifield] == INT) else if (vtype[ifield] == INT)
loc += sprintf(&line[loc],format[ifield],ivalue); loc += sprintf(&line[loc],format[ifield],ivalue);
else if (vtype[ifield] == BIGINT) { else if (vtype[ifield] == BIGINT)
loc += sprintf(&line[loc],format[ifield],bivalue); loc += sprintf(&line[loc],format[ifield],bivalue);
}
} }
// print line to screen and logfile // print line to screen and logfile