forked from lijiext/lammps
add support to pair_modify to selectively disable compute/tally callbacks in sub-styles for pair hybrid and hybrid/overlay
This commit is contained in:
parent
f0681f7e12
commit
4e411364ff
|
@ -225,6 +225,12 @@ special_bonds lj/coul 1e-20 1e-20 0.5
|
|||
pair_hybrid tersoff lj/cut/coul/long 12.0
|
||||
pair_modify pair tersoff special lj/coul 1.0 1.0 1.0 :pre
|
||||
|
||||
For use with the various "compute */tally"_compute_tally.html
|
||||
computes, the "pair_modify compute/tally"_pair_modify.html
|
||||
command can be used to selectively turn off processing of
|
||||
the compute tally styles, for example, if those pair styles
|
||||
(e.g. manybody styles) do not support this feature.
|
||||
|
||||
See the "pair_modify"_pair_modify.html doc page for details on
|
||||
the specific syntax, requirements and restrictions.
|
||||
|
||||
|
|
|
@ -15,11 +15,13 @@ pair_modify keyword values ... :pre
|
|||
one or more keyword/value pairs may be listed :ulb,l
|
||||
keyword = {pair} or {shift} or {mix} or {table} or {table/disp} or {tabinner} or {tabinner/disp} or {tail} or {compute} :l
|
||||
{pair} values = sub-style N {special} which wt1 wt2 wt3
|
||||
or sub-style N {compute/tally} flag
|
||||
sub-style = sub-style of "pair hybrid"_pair_hybrid.html
|
||||
N = which instance of sub-style (only if sub-style is used multiple times)
|
||||
{special} which wt1 wt2 wt3 = override {special_bonds} settings (optional)
|
||||
which = {lj/coul} or {lj} or {coul}
|
||||
w1,w2,w3 = 1-2, 1-3, and 1-4 weights from 0.0 to 1.0 inclusive
|
||||
{special} which wt1 wt2 wt3 = override {special_bonds} settings (optional)
|
||||
which = {lj/coul} or {lj} or {coul}
|
||||
w1,w2,w3 = 1-2, 1-3, and 1-4 weights from 0.0 to 1.0 inclusive
|
||||
{compute/tally} flag = {yes} or {no}
|
||||
{mix} value = {geometric} or {arithmetic} or {sixthpower}
|
||||
{shift} value = {yes} or {no}
|
||||
{table} value = N
|
||||
|
@ -40,6 +42,7 @@ pair_modify shift yes mix geometric
|
|||
pair_modify tail yes
|
||||
pair_modify table 12
|
||||
pair_modify pair lj/cut compute no
|
||||
pair_modify pair tersoff compute/tally no
|
||||
pair_modify pair lj/cut/coul/long 1 special lj/coul 0.0 0.0 0.0 :pre
|
||||
|
||||
[Description:]
|
||||
|
@ -60,9 +63,12 @@ keywords will be applied to. Note that if the {pair} keyword is not
|
|||
used, and the pair style is {hybrid} or {hybrid/overlay}, then all the
|
||||
specified keywords will be applied to all sub-styles.
|
||||
|
||||
The {special} keyword can only be used in conjunction with the {pair}
|
||||
keyword and must directly follow it. It allows to override the
|
||||
The {special} and {compute/tally} keywords can [only] be used in
|
||||
conjunction with the {pair} keyword and must directly follow it.
|
||||
{special} allows to override the
|
||||
"special_bonds"_special_bonds.html settings for the specified sub-style.
|
||||
{compute/tally} allows to disable or enable registering
|
||||
"compute */tally"_compute_tally.html computes for a given sub-style.
|
||||
More details are given below.
|
||||
|
||||
The {mix} keyword affects pair coefficients for interactions between
|
||||
|
@ -231,6 +237,14 @@ setting. Substituting 1.0e-10 for 0.0 and 0.9999999999 for 1.0 is
|
|||
usually a sufficient workaround in this case without causing a
|
||||
significant error.
|
||||
|
||||
The {compute/tally} keyword takes exactly 1 argument ({no} or {yes}),
|
||||
and allows to selectively disable or enable processing of the various
|
||||
"compute */tally"_compute_tally.html styles for a given
|
||||
"pair hybrid or hybrid/overlay"_pair_hybrid.html sub-style.
|
||||
|
||||
NOTE: Any "pair_modify pair compute/tally" command must be issued
|
||||
[before] the corresponding compute style is defined.
|
||||
|
||||
:line
|
||||
|
||||
[Restrictions:] none
|
||||
|
@ -240,8 +254,9 @@ conflicting options. You cannot use {tail} yes with 2d simulations.
|
|||
|
||||
[Related commands:]
|
||||
|
||||
"pair_style"_pair_style.html, "pair_coeff"_pair_coeff.html,
|
||||
"thermo_style"_thermo_style.html
|
||||
"pair_style"_pair_style.html, "pair_style hybrid"_pair_hybrid.html,
|
||||
pair_coeff"_pair_coeff.html, "thermo_style"_thermo_style.html,
|
||||
"compute */tally"_compute_tally.html
|
||||
|
||||
[Default:]
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ using namespace LAMMPS_NS;
|
|||
|
||||
PairHybrid::PairHybrid(LAMMPS *lmp) : Pair(lmp),
|
||||
styles(NULL), keywords(NULL), multiple(NULL), nmap(NULL),
|
||||
map(NULL), special_lj(NULL), special_coul(NULL)
|
||||
map(NULL), special_lj(NULL), special_coul(NULL), compute_tally(NULL)
|
||||
{
|
||||
nstyles = 0;
|
||||
|
||||
|
@ -62,6 +62,7 @@ PairHybrid::~PairHybrid()
|
|||
|
||||
delete [] special_lj;
|
||||
delete [] special_coul;
|
||||
delete [] compute_tally;
|
||||
|
||||
delete [] svector;
|
||||
|
||||
|
@ -175,7 +176,7 @@ void PairHybrid::compute(int eflag, int vflag)
|
|||
void PairHybrid::add_tally_callback(Compute *ptr)
|
||||
{
|
||||
for (int m = 0; m < nstyles; m++)
|
||||
styles[m]->add_tally_callback(ptr);
|
||||
if (compute_tally[m]) styles[m]->add_tally_callback(ptr);
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
@ -183,7 +184,7 @@ void PairHybrid::add_tally_callback(Compute *ptr)
|
|||
void PairHybrid::del_tally_callback(Compute *ptr)
|
||||
{
|
||||
for (int m = 0; m < nstyles; m++)
|
||||
styles[m]->del_tally_callback(ptr);
|
||||
if (compute_tally[m]) styles[m]->del_tally_callback(ptr);
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
@ -270,6 +271,8 @@ void PairHybrid::settings(int narg, char **arg)
|
|||
special_lj = new double*[narg];
|
||||
special_coul = new double*[narg];
|
||||
|
||||
compute_tally = new int[narg];
|
||||
|
||||
// allocate each sub-style
|
||||
// allocate uses suffix, but don't store suffix version in keywords,
|
||||
// else syntax in coeff() will not match
|
||||
|
@ -289,6 +292,7 @@ void PairHybrid::settings(int narg, char **arg)
|
|||
styles[nstyles] = force->new_pair(arg[iarg],1,dummy);
|
||||
force->store_style(keywords[nstyles],arg[iarg],0);
|
||||
special_lj[nstyles] = special_coul[nstyles] = NULL;
|
||||
compute_tally[nstyles] = 1;
|
||||
|
||||
jarg = iarg + 1;
|
||||
while (jarg < narg && !force->pair_map->count(arg[jarg])) jarg++;
|
||||
|
@ -799,6 +803,20 @@ void PairHybrid::modify_params(int narg, char **arg)
|
|||
iarg += 5;
|
||||
}
|
||||
|
||||
// if 2nd keyword (after pair) is compute/tally:
|
||||
// set flag to register USER-TALLY computes accordingly
|
||||
|
||||
if (iarg < narg && strcmp(arg[iarg],"compute/tally") == 0) {
|
||||
if (narg < iarg+2)
|
||||
error->all(FLERR,"Illegal pair_modify compute/tally command");
|
||||
if (strcmp(arg[iarg+1],"yes") == 0) {
|
||||
compute_tally[m] = 1;
|
||||
} else if (strcmp(arg[iarg+1],"no") == 0) {
|
||||
compute_tally[m] = 0;
|
||||
} else error->all(FLERR,"Illegal pair_modify compute/tally command");
|
||||
iarg += 2;
|
||||
}
|
||||
|
||||
// apply the remaining keywords to the base pair style itself and the
|
||||
// sub-style except for "pair" and "special".
|
||||
// the former is important for some keywords like "tail" or "compute"
|
||||
|
|
|
@ -72,6 +72,7 @@ class PairHybrid : public Pair {
|
|||
int ***map; // list of sub-styles itype,jtype points to
|
||||
double **special_lj; // list of per style LJ exclusion factors
|
||||
double **special_coul; // list of per style Coulomb exclusion factors
|
||||
int *compute_tally; // list of on/off flags for tally computes
|
||||
|
||||
void allocate();
|
||||
void flags();
|
||||
|
|
Loading…
Reference in New Issue