Merge pull request #1448 from akohlmey/collected-small-changes

Collected small changes and bugfixes
This commit is contained in:
Axel Kohlmeyer
2019-05-09 12:17:19 -04:00
committed by GitHub
12 changed files with 75 additions and 93 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

After

Width:  |  Height:  |  Size: 2.5 KiB

View File

@ -1,9 +1,9 @@
\documentclass[12pt]{article}
\pagestyle{empty}
\begin{document}
$$
E(r) = \frac{A}{r^{12}} - \frac{A}{r^{6}}
E(r) = \frac{A}{r^{12}} - \frac{B}{r^{6}}
$$
\end{document}

View File

@ -30,16 +30,16 @@ args = list of arguments for a particular style :l
[Examples:]
pair_style lj/mdf 2.5 3.0
pair_coeff * * 1 1
pair_coeff 1 1 1 1.1 2.8 3.0 3.2 :pre
pair_coeff * * 1.0 1.0
pair_coeff 1 1 1.1 2.8 3.0 3.2 :pre
pair_style buck 2.5 3.0
pair_coeff * * 100.0 1.5 200.0
pair_coeff * * 100.0 1.5 200.0 3.0 3.5 :pre
pair_style lennard/mdf 2.5 3.0
pair_coeff * * 1 1
pair_coeff 1 1 1 1.1 2.8 3.0 3.2 :pre
pair_coeff * * 1.0 1.0
pair_coeff 1 1 1021760.3664 2120.317338 3.0 3.2 :pre
[Description:]
@ -69,11 +69,12 @@ standard 12-6 Lennard-Jones written in the epsilon/sigma form:
:c,image(Eqs/pair_mdf-4.jpg)
The following coefficients must be defined for each pair of atoms
types via the pair_coeff command as in the examples above, or in the
data file or restart files read by the "read_data"_read_data.html or
"read_restart commands"_read_restart.html, or by mixing as described
below:
Either the first two or all of the following coefficients must be
defined for each pair of atoms types via the pair_coeff command as
in the examples above, or in the data file read by the
"read_data"_read_data.html. The two cutoffs default to the global
values and epsilon and sigma can also be determined by mixing as
described below:
epsilon (energy units)
sigma (distance units)
@ -83,7 +84,9 @@ r_{cut} (distance units) :ul
:line
For the {buck/mdf} pair_style, the potential energy, {E(r)}, is the
standard Buckingham potential:
standard Buckingham potential with three required coefficients.
The two cutoffs can be omitted and default to the corresponding
global values:
:c,image(Eqs/pair_mdf-5.jpg)
@ -91,19 +94,20 @@ A (energy units)
\rho (distance units)
C (energy-distance^6 units)
r_m (distance units)
r_{cut}$ (distance units) :ul
r_{cut} (distance units) :ul
:line
For the {lennard/mdf} pair_style, the potential energy, {E(r)}, is the
standard 12-6 Lennard-Jones written in the $A/B$ form:
standard 12-6 Lennard-Jones written in the A/B form:
:c,image(Eqs/pair_mdf-6.jpg)
The following coefficients must be defined for each pair of atoms
types via the pair_coeff command as in the examples above, or in the
data file or restart files read by the read_data or read_restart
commands, or by mixing as described below:
data file read by the read_data commands, or by mixing as described below.
The two cutoffs default to their global values and must be either both
given or both left out:
A (energy-distance^12 units)
B (energy-distance^6 units)
@ -115,33 +119,23 @@ r_{cut} (distance units) :ul
[Mixing, shift, table, tail correction, restart, rRESPA info]:
For atom type pairs I,J and I != J, the epsilon and sigma coefficients
and cutoff distance for all of the lj/cut pair styles can be mixed.
and cutoff distances for the lj/mdf pair style can be mixed.
The default mix value is {geometric}. See the "pair_modify" command
for details.
for details. The other two pair styles buck/mdf and lennard/mdf do not
support mixing, so all I,J pairs of coefficients must be specified
explicitly.
All of the {lj/cut} pair styles support the
"pair_modify"_pair_modify.html shift option for the energy of the
Lennard-Jones portion of the pair interaction.
None of the lj/mdf, buck/mdf, or lennard/mdf pair styles supports
the "pair_modify"_pair_modify.html shift option or long-range
tail corrections to pressure and energy.
The {lj/cut/coul/long} and {lj/cut/tip4p/long} pair styles support the
"pair_modify"_pair_modify.html table option since they can tabulate
the short-range portion of the long-range Coulombic interaction.
These styles write their information to "binary restart
files"_restart.html, so pair_style and pair_coeff commands do not need
to be specified in an input script that reads a restart file.
All of the {lj/cut} pair styles support the
"pair_modify"_pair_modify.html tail option for adding a long-range
tail correction to the energy and pressure for the Lennard-Jones
portion of the pair interaction.
All of the {lj/cut} pair styles write their information to "binary
restart files"_restart.html, so pair_style and pair_coeff commands do
not need to be specified in an input script that reads a restart file.
The {lj/cut} and {lj/cut/coul/long} pair styles support the use of the
{inner}, {middle}, and {outer} keywords of the "run_style
respa"_run_style.html command, meaning the pairwise forces can be
partitioned by distance at different levels of the rRESPA hierarchy.
The other styles only support the {pair} keyword of run_style respa.
See the "run_style"_run_style.html command for details.
These styles can only be used via the {pair} keyword of the "run_style
respa"_run_style.html command. They do not support the {inner},
{middle}, {outer} keywords.
:line

View File

@ -26,11 +26,9 @@ coefficients in a way, that it can be read by LAMMPS with the
option of "write_data"_write_data.html this can be used to move
the Coeffs sections from a data file into a separate file.
NOTE: The write_coeff command is not yet fully implemented in two
respects. First, some pair styles do not yet write their coefficient
information into the coeff file. This means you will need to specify
that information in your input script that reads the data file, via
the "pair_coeff"_pair_coeff.html command.
NOTE: The write_coeff command is not yet fully implemented as
some pair styles do not output their coefficient information.
This means you will need to add/copy this information manually.
:line

View File

@ -573,7 +573,7 @@ void FixNVESpin::AdvanceSingleSpin(int i)
int *sametag = atom->sametag;
double **sp = atom->sp;
double **fm = atom->fm;
double msq,scale,fm2,energy,dts2;
double fm2,energy,dts2;
double cp[3],g[3];
cp[0] = cp[1] = cp[2] = 0.0;

View File

@ -126,7 +126,6 @@ void FixSetForceSpin::single_setforce_spin(int i, double fmi[3])
{
double **x = atom->x;
int *mask = atom->mask;
int nlocal = atom->nlocal;
// update region if necessary

View File

@ -52,7 +52,6 @@ PairBuckMDF::~PairBuckMDF()
memory->destroy(rhoinv);
memory->destroy(buck1);
memory->destroy(buck2);
memory->destroy(offset);
}
}
@ -177,7 +176,6 @@ void PairBuckMDF::allocate()
memory->create(rhoinv,n+1,n+1,"pair:rhoinv");
memory->create(buck1,n+1,n+1,"pair:buck1");
memory->create(buck2,n+1,n+1,"pair:buck2");
memory->create(offset,n+1,n+1,"pair:offset");
}
/* ----------------------------------------------------------------------
@ -207,7 +205,8 @@ void PairBuckMDF::settings(int narg, char **arg)
void PairBuckMDF::coeff(int narg, char **arg)
{
if (narg != 5 && narg != 7) error->all(FLERR,"Incorrect args for pair coefficients");
if (narg != 5 && narg != 7)
error->all(FLERR,"Incorrect args for pair coefficients");
if (!allocated) allocate();
int ilo,ihi,jlo,jhi;
@ -258,11 +257,6 @@ double PairBuckMDF::init_one(int i, int j)
buck1[i][j] = a[i][j]/rho[i][j];
buck2[i][j] = 6.0*c[i][j];
if (offset_flag && (cut[i][j] > 0.0)) {
double rexp = exp(-cut[i][j]/rho[i][j]);
offset[i][j] = a[i][j]*rexp - c[i][j]/pow(cut[i][j],6.0);
} else offset[i][j] = 0.0;
cut_inner[j][i] = cut_inner[i][j];
cut_inner_sq[i][j] = cut_inner[i][j]*cut_inner[i][j];
cut_inner_sq[j][i] = cut_inner_sq[i][j];
@ -272,36 +266,6 @@ double PairBuckMDF::init_one(int i, int j)
rhoinv[j][i] = rhoinv[i][j];
buck1[j][i] = buck1[i][j];
buck2[j][i] = buck2[i][j];
offset[j][i] = offset[i][j];
// compute I,J contribution to long-range tail correction
// count total # of atoms of type I and J via Allreduce
if (tail_flag) {
int *type = atom->type;
int nlocal = atom->nlocal;
double count[2],all[2];
count[0] = count[1] = 0.0;
for (int k = 0; k < nlocal; k++) {
if (type[k] == i) count[0] += 1.0;
if (type[k] == j) count[1] += 1.0;
}
MPI_Allreduce(count,all,2,MPI_DOUBLE,MPI_SUM,world);
double rho1 = rho[i][j];
double rho2 = rho1*rho1;
double rho3 = rho2*rho1;
double rc = cut[i][j];
double rc2 = rc*rc;
double rc3 = rc2*rc;
etail_ij = 2.0*MY_PI*all[0]*all[1]*
(a[i][j]*exp(-rc/rho1)*rho1*(rc2 + 2.0*rho1*rc + 2.0*rho2) -
c[i][j]/(3.0*rc3));
ptail_ij = (-1/3.0)*2.0*MY_PI*all[0]*all[1]*
(-a[i][j]*exp(-rc/rho1)*
(rc3 + 3.0*rho1*rc2 + 6.0*rho2*rc + 6.0*rho3) + 2.0*c[i][j]/rc3);
}
return cut[i][j];
}

View File

@ -251,13 +251,7 @@ void PairLJ_AB_MDF::coeff(int narg, char **arg)
double PairLJ_AB_MDF::init_one(int i, int j)
{
if (setflag[i][j] == 0) {
aparm[i][j] = mix_energy(aparm[i][i],aparm[j][j],
bparm[i][i],bparm[j][j]);
bparm[i][j] = mix_distance(bparm[i][i],bparm[j][j]);
cut_inner[i][j] = mix_distance(cut_inner[i][i],cut_inner[j][j]);
cut[i][j] = mix_distance(cut[i][i],cut[j][j]);
}
if (setflag[i][j] == 0) error->all(FLERR,"All pair coeffs are not set");
cut_inner_sq[i][j] = cut_inner[i][j]*cut_inner[i][j];

View File

@ -33,7 +33,9 @@ using namespace LAMMPS_NS;
/* ---------------------------------------------------------------------- */
PairLJMDF::PairLJMDF(LAMMPS *lmp) : Pair(lmp) {}
PairLJMDF::PairLJMDF(LAMMPS *lmp) : Pair(lmp) {
writedata = 1;
}
/* ---------------------------------------------------------------------- */
@ -349,6 +351,29 @@ void PairLJMDF::read_restart_settings(FILE *fp)
MPI_Bcast(&mix_flag,1,MPI_INT,0,world);
}
/* ----------------------------------------------------------------------
proc 0 writes to data file
------------------------------------------------------------------------- */
void PairLJMDF::write_data(FILE *fp)
{
for (int i = 1; i <= atom->ntypes; i++)
fprintf(fp,"%d %g %g\n",i,epsilon[i][i],sigma[i][i]);
}
/* ----------------------------------------------------------------------
proc 0 writes all pairs to data file
------------------------------------------------------------------------- */
void PairLJMDF::write_data_all(FILE *fp)
{
for (int i = 1; i <= atom->ntypes; i++)
for (int j = i; j <= atom->ntypes; j++)
fprintf(fp,"%d %d %g %g %g %g\n",
i,j,epsilon[i][j],sigma[i][j],
cut_inner[i][j],cut[i][j]);
}
/* ---------------------------------------------------------------------- */
double PairLJMDF::single(int /*i*/, int /*j*/, int itype, int jtype,

View File

@ -37,6 +37,8 @@ class PairLJMDF : public Pair {
void read_restart(FILE *);
void write_restart_settings(FILE *);
void read_restart_settings(FILE *);
void write_data(FILE *);
void write_data_all(FILE *);
double single(int, int, int, int, double, double, double, double &);
void *extract(const char *, int &);

View File

@ -57,6 +57,7 @@ Domain::Domain(LAMMPS *lmp) : Pointers(lmp)
{
box_exist = 0;
box_change = 0;
deform_flag = deform_vremap = deform_groupbit = 0;
dimension = 3;
nonperiodic = 0;

View File

@ -675,8 +675,13 @@ void Output::set_thermo(int narg, char **arg)
{
if (narg != 1) error->all(FLERR,"Illegal thermo command");
// always reset var_thermo, so it is possible to switch back from
// variable spaced thermo outputs to constant spaced ones.
delete [] var_thermo;
var_thermo = NULL;
if (strstr(arg[0],"v_") == arg[0]) {
delete [] var_thermo;
int n = strlen(&arg[0][2]) + 1;
var_thermo = new char[n];
strcpy(var_thermo,&arg[0][2]);