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

Collected small changes and fixes for the next patch
This commit is contained in:
Axel Kohlmeyer
2019-06-24 23:55:50 -04:00
committed by GitHub
36 changed files with 235 additions and 125 deletions

View File

@ -303,6 +303,7 @@ include(Packages/USER-QUIP)
include(Packages/USER-QMMM)
include(Packages/USER-VTK)
include(Packages/KIM)
include(Packages/LATTE)
include(Packages/MESSAGE)
include(Packages/MSCG)
include(Packages/COMPRESS)

View File

@ -50,11 +50,11 @@ An alphabetic list of all general LAMMPS commands.
"dump"_dump.html,
"dump adios"_dump_adios.html,
"dump image"_dump_image.html,
"dump_modify"_dump_modify.html,
"dump movie"_dump_image.html,
"dump netcdf"_dump_netcdf.html,
"dump netcdf/mpiio"_dump_netcdf.html,
"dump vtk"_dump_vtk.html,
"dump_modify"_dump_modify.html,
"dynamical_matrix"_dynamical_matrix.html,
"echo"_echo.html,
"fix"_fix.html,

View File

@ -222,6 +222,8 @@ OPT.
"sph/rhosum"_pair_sph_rhosum.html,
"sph/taitwater"_pair_sph_taitwater.html,
"sph/taitwater/morris"_pair_sph_taitwater_morris.html,
"spin/dipole/cut"_pair_spin_dipole.html,
"spin/dipole/long"_pair_spin_dipole.html,
"spin/dmi"_pair_spin_dmi.html,
"spin/exchange"_pair_spin_exchange.html,
"spin/magelec"_pair_spin_magelec.html,

View File

@ -0,0 +1,15 @@
\documentclass[12pt]{article}
\pagestyle{empty}
\begin{document}
$$
E_{a} = K_2\left(\theta - \theta_0\right)^2 + K_3\left(\theta - \theta_0\right)^3 + K_4\left(\theta - \theta_0\right)^4 + K_5\left(\theta - \theta_0\right)^5 + K_6\left(\theta - \theta_0\right)^6
$$
\end{document}
%%% Local Variables:
%%% mode: latex
%%% TeX-master: t
%%% End:

View File

@ -0,0 +1,15 @@
\documentclass[12pt]{article}
\pagestyle{empty}
\begin{document}
$$
E = K \left[ 1 + \cos(n\theta - \theta_0)\right]
$$
\end{document}
%%% Local Variables:
%%% mode: latex
%%% TeX-master: t
%%% End:

View File

@ -0,0 +1,15 @@
\documentclass[12pt]{article}
\pagestyle{empty}
\begin{document}
$$
E = K \left(\theta - \theta_0\right)^2
$$
\end{document}
%%% Local Variables:
%%% mode: latex
%%% TeX-master: t
%%% End:

18
doc/src/Eqs/pair_agni.tex Normal file
View File

@ -0,0 +1,18 @@
\documentclass[12pt]{article}
\pagestyle{empty}
\begin{document}
\begin{eqnarray*}
F_i^u & = & \sum_t^{N_t}\alpha_t \cdot \exp\left[-\frac{\left(d_{i,t}^u\right)^2}{2l^2}\right] \\
d_{i,t}^u & = & \left|\left| V_i^u(\eta) - V_t^u(\eta) \right|\right| \\
V_i^u(\eta) & = & \sum_{j \neq i}\frac{r^u_{ij}}{r_{ij}} \cdot e^{-\left(\frac{r_{ij}}{\eta} \right)^2} \cdot f_d\left(r_{ij}\right) \\
f_d\left(r_{ij}\right) & = & \frac{1}{2} \left[\cos\left(\frac{\pi r_{ij}}{R_c}\right) + 1 \right]
\end{eqnarray*}
\end{document}
%%% Local Variables:
%%% mode: latex
%%% TeX-master: t
%%% End:

View File

@ -1,6 +1,7 @@
\documentclass[12pt]{article}
\begin{document}
\pagestyle{empty}
\begin{eqnarray*}
E = A e^{-\kappa r} - \frac{C}{r^6} \cdot \frac{1}{1 + D r^{14}} \qquad r < r_c \\

View File

@ -0,0 +1,15 @@
\documentclass[12pt]{article}
\pagestyle{empty}
\begin{document}
$$
E = \frac{C_{q_i q_j}}{\epsilon r_{ij}}\,\, \textrm{erf}\left(\alpha_{ij} r_{ij}\right)\quad\quad\quad r < r_c
$$
\end{document}
%%% Local Variables:
%%% mode: latex
%%% TeX-master: t
%%% End:

View File

@ -911,6 +911,8 @@ the usual manner via MD. Various pair, fix, and compute styles.
src/SPIN: filenames -> commands
"Howto spins"_Howto_spins.html
"pair_style spin/dipole/cut"_pair_spin_dipole.html
"pair_style spin/dipole/long"_pair_spin_dipole.html
"pair_style spin/dmi"_pair_spin_dmi.html
"pair_style spin/exchange"_pair_spin_exchange.html
"pair_style spin/magelec"_pair_spin_magelec.html

View File

@ -647,6 +647,7 @@ pair_sph_lj.html
pair_sph_rhosum.html
pair_sph_taitwater.html
pair_sph_taitwater_morris.html
pair_spin_dipole.html
pair_spin_dmi.html
pair_spin_exchange.html
pair_spin_magelec.html

View File

@ -13,7 +13,8 @@ pair_modify command :h3
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
keyword = {pair} or {shift} or {mix} or {table} or {table/disp} or {tabinner}
or {tabinner/disp} or {tail} or {compute} or {nofdotr} :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
@ -33,7 +34,8 @@ keyword = {pair} or {shift} or {mix} or {table} or {table/disp} or {tabinner} or
{tabinner/disp} value = cutoff
cutoff = inner cutoff at which to begin table (distance units)
{tail} value = {yes} or {no}
{compute} value = {yes} or {no} :pre
{compute} value = {yes} or {no}
{nofdotr} :pre
:ule
[Examples:]
@ -212,6 +214,10 @@ a pair style will not work, because the
"kspace_style"_kspace_style.html command requires a Kspace-compatible
pair style be defined.
The {nofdotr} keyword allows to disable an optimization that computes
the global stress tensor from the total forces and atom positions rather
than from summing forces between individual pairs of atoms.
:line
The {special} keyword allows to override the 1-2, 1-3, and 1-4

View File

@ -284,6 +284,8 @@ accelerated styles exist.
"sph/rhosum"_pair_sph_rhosum.html -
"sph/taitwater"_pair_sph_taitwater.html -
"sph/taitwater/morris"_pair_sph_taitwater_morris.html -
"spin/dipole/cut"_pair_spin_dipole.html -
"spin/dipole/long"_pair_spin_dipole.html -
"spin/dmi"_pair_spin_dmi.html -
"spin/exchange"_pair_spin_exchange.html -
"spin/magelec"_pair_spin_magelec.html -

View File

@ -105,6 +105,7 @@ Pair Styles :h1
pair_sph_rhosum
pair_sph_taitwater
pair_sph_taitwater_morris
pair_spin_dipole
pair_spin_dmi
pair_spin_exchange
pair_spin_magelec

View File

@ -473,9 +473,8 @@ double PairLJClass2CoulCut::single(int i, int j, int itype, int jtype,
void *PairLJClass2CoulCut::extract(const char *str, int &dim)
{
dim = 0;
if (strcmp(str,"cut_coul") == 0) return (void *) &cut_coul;
dim = 2;
if (strcmp(str,"cut_coul") == 0) return (void *) &cut_coul;
if (strcmp(str,"epsilon") == 0) return (void *) epsilon;
if (strcmp(str,"sigma") == 0) return (void *) sigma;
return NULL;

View File

@ -115,25 +115,25 @@ FixOrientBCC::FixOrientBCC(LAMMPS *lmp, int narg, char **arg) :
char *result;
int count;
FILE *infile = fopen(xifilename,"r");
if (infile == NULL) error->one(FLERR,"Fix orient/bcc file open failed");
FILE *inpfile = fopen(xifilename,"r");
if (inpfile == NULL) error->one(FLERR,"Fix orient/bcc file open failed");
for (int i = 0; i < 4; i++) {
result = fgets(line,IMGMAX,infile);
result = fgets(line,IMGMAX,inpfile);
if (!result) error->one(FLERR,"Fix orient/bcc file read failed");
count = sscanf(line,"%lg %lg %lg",&Rxi[i][0],&Rxi[i][1],&Rxi[i][2]);
if (count != 3) error->one(FLERR,"Fix orient/bcc file read failed");
}
fclose(infile);
fclose(inpfile);
infile = fopen(chifilename,"r");
if (infile == NULL) error->one(FLERR,"Fix orient/bcc file open failed");
inpfile = fopen(chifilename,"r");
if (inpfile == NULL) error->one(FLERR,"Fix orient/bcc file open failed");
for (int i = 0; i < 4; i++) {
result = fgets(line,IMGMAX,infile);
result = fgets(line,IMGMAX,inpfile);
if (!result) error->one(FLERR,"Fix orient/bcc file read failed");
count = sscanf(line,"%lg %lg %lg",&Rchi[i][0],&Rchi[i][1],&Rchi[i][2]);
if (count != 3) error->one(FLERR,"Fix orient/bcc file read failed");
}
fclose(infile);
fclose(inpfile);
}
MPI_Bcast(&Rxi[0][0],18,MPI_DOUBLE,0,world);

View File

@ -113,25 +113,25 @@ FixOrientFCC::FixOrientFCC(LAMMPS *lmp, int narg, char **arg) :
char *result;
int count;
FILE *infile = fopen(xifilename,"r");
if (infile == NULL) error->one(FLERR,"Fix orient/fcc file open failed");
FILE *inpfile = fopen(xifilename,"r");
if (inpfile == NULL) error->one(FLERR,"Fix orient/fcc file open failed");
for (int i = 0; i < 6; i++) {
result = fgets(line,IMGMAX,infile);
result = fgets(line,IMGMAX,inpfile);
if (!result) error->one(FLERR,"Fix orient/fcc file read failed");
count = sscanf(line,"%lg %lg %lg",&Rxi[i][0],&Rxi[i][1],&Rxi[i][2]);
if (count != 3) error->one(FLERR,"Fix orient/fcc file read failed");
}
fclose(infile);
fclose(inpfile);
infile = fopen(chifilename,"r");
if (infile == NULL) error->one(FLERR,"Fix orient/fcc file open failed");
inpfile = fopen(chifilename,"r");
if (inpfile == NULL) error->one(FLERR,"Fix orient/fcc file open failed");
for (int i = 0; i < 6; i++) {
result = fgets(line,IMGMAX,infile);
result = fgets(line,IMGMAX,inpfile);
if (!result) error->one(FLERR,"Fix orient/fcc file read failed");
count = sscanf(line,"%lg %lg %lg",&Rchi[i][0],&Rchi[i][1],&Rchi[i][2]);
if (count != 3) error->one(FLERR,"Fix orient/fcc file read failed");
}
fclose(infile);
fclose(inpfile);
}
MPI_Bcast(&Rxi[0][0],18,MPI_DOUBLE,0,world);

View File

@ -487,9 +487,8 @@ double PairNMCutCoulCut::single(int i, int j, int itype, int jtype,
void *PairNMCutCoulCut::extract(const char *str, int &dim)
{
dim = 0;
if (strcmp(str,"cut_coul") == 0) return (void *) &cut_coul;
dim = 2;
if (strcmp(str,"cut_coul") == 0) return (void *) &cut_coul;
if (strcmp(str,"e0") == 0) return (void *) e0;
if (strcmp(str,"r0") == 0) return (void *) r0;
if (strcmp(str,"nn") == 0) return (void *) nn;

View File

@ -146,12 +146,12 @@ void NEB::command(int narg, char **arg)
if (strcmp(arg[5],"final") == 0) {
if (narg != 7 && narg !=8) error->universe_all(FLERR,"Illegal NEB command");
infile = arg[6];
readfile(infile,0);
inpfile = arg[6];
readfile(inpfile,0);
} else if (strcmp(arg[5],"each") == 0) {
if (narg != 7 && narg !=8) error->universe_all(FLERR,"Illegal NEB command");
infile = arg[6];
readfile(infile,1);
inpfile = arg[6];
readfile(inpfile,1);
} else if (strcmp(arg[5],"none") == 0) {
if (narg != 6 && narg !=7) error->universe_all(FLERR,"Illegal NEB command");
} else error->universe_all(FLERR,"Illegal NEB command");

View File

@ -47,7 +47,7 @@ class NEB : protected Pointers {
double ftol; // force tolerance convergence criterion
int n1steps, n2steps; // number of steps in stage 1 and 2
int nevery; // output interval
char *infile; // name of file containing final state
char *inpfile; // name of file containing final state
class FixNEB *fneb;
int numall; // per-replica dimension of array all

View File

@ -59,7 +59,7 @@ enum{ISO,ANISO,TRICLINIC};
FixRigid::FixRigid(LAMMPS *lmp, int narg, char **arg) :
Fix(lmp, narg, arg), step_respa(NULL),
infile(NULL), nrigid(NULL), mol2body(NULL), body2mol(NULL),
inpfile(NULL), nrigid(NULL), mol2body(NULL), body2mol(NULL),
body(NULL), displace(NULL), masstotal(NULL), xcm(NULL),
vcm(NULL), fcm(NULL), inertia(NULL), ex_space(NULL),
ey_space(NULL), ez_space(NULL), angmom(NULL), omega(NULL),
@ -327,7 +327,7 @@ FixRigid::FixRigid(LAMMPS *lmp, int narg, char **arg) :
t_iter = 1;
t_order = 3;
p_chain = 10;
infile = NULL;
inpfile = NULL;
pcouple = NONE;
pstyle = ANISO;
@ -546,12 +546,12 @@ FixRigid::FixRigid(LAMMPS *lmp, int narg, char **arg) :
p_chain = force->inumeric(FLERR,arg[iarg+1]);
iarg += 2;
} else if (strcmp(arg[iarg],"infile") == 0) {
} else if (strcmp(arg[iarg],"inpfile") == 0) {
if (iarg+2 > narg) error->all(FLERR,"Illegal fix rigid command");
delete [] infile;
delete [] inpfile;
int n = strlen(arg[iarg+1]) + 1;
infile = new char[n];
strcpy(infile,arg[iarg+1]);
inpfile = new char[n];
strcpy(inpfile,arg[iarg+1]);
restart_file = 1;
reinitflag = 0;
iarg += 2;
@ -649,7 +649,7 @@ FixRigid::~FixRigid()
atom->delete_callback(id,0);
delete random;
delete [] infile;
delete [] inpfile;
memory->destroy(mol2body);
memory->destroy(body2mol);
@ -760,14 +760,14 @@ void FixRigid::init()
// setup rigid bodies, using current atom info. if reinitflag is not set,
// do the initialization only once, b/c properties may not be re-computable
// especially if overlapping particles.
// do not do dynamic init if read body properties from infile.
// this is b/c the infile defines the static and dynamic properties and may
// do not do dynamic init if read body properties from inpfile.
// this is b/c the inpfile defines the static and dynamic properties and may
// not be computable if contain overlapping particles.
// setup_bodies_static() reads infile itself
// setup_bodies_static() reads inpfile itself
if (reinitflag || !setupflag) {
setup_bodies_static();
if (!infile) setup_bodies_dynamic();
if (!inpfile) setup_bodies_dynamic();
setupflag = 1;
}
@ -1640,7 +1640,7 @@ void FixRigid::set_v()
sets extended flags, masstotal, center-of-mass
sets Cartesian and diagonalized inertia tensor
sets body image flags
may read some properties from infile
may read some properties from inpfile
------------------------------------------------------------------------- */
void FixRigid::setup_bodies_static()
@ -1791,7 +1791,7 @@ void FixRigid::setup_bodies_static()
xcm[ibody][2] = all[ibody][2]/masstotal[ibody];
}
// set vcm, angmom = 0.0 in case infile is used
// set vcm, angmom = 0.0 in case inpfile is used
// and doesn't overwrite all body's values
// since setup_bodies_dynamic() will not be called
@ -1810,7 +1810,7 @@ void FixRigid::setup_bodies_static()
// inbody[i] = 0/1 if Ith rigid body is initialized by file
int *inbody;
if (infile) {
if (inpfile) {
memory->create(inbody,nbody,"rigid:inbody");
for (ibody = 0; ibody < nbody; ibody++) inbody[ibody] = 0;
readfile(0,masstotal,xcm,vcm,angmom,imagebody,inbody);
@ -1918,7 +1918,7 @@ void FixRigid::setup_bodies_static()
// overwrite Cartesian inertia tensor with file values
if (infile) readfile(1,NULL,all,NULL,NULL,NULL,inbody);
if (inpfile) readfile(1,NULL,all,NULL,NULL,NULL,inbody);
// diagonalize inertia tensor for each body via Jacobi rotations
// inertia = 3 eigenvalues = principal moments of inertia
@ -2116,11 +2116,11 @@ void FixRigid::setup_bodies_static()
MPI_Allreduce(sum[0],all[0],6*nbody,MPI_DOUBLE,MPI_SUM,world);
// error check that re-computed moments of inertia match diagonalized ones
// do not do test for bodies with params read from infile
// do not do test for bodies with params read from inpfile
double norm;
for (ibody = 0; ibody < nbody; ibody++) {
if (infile && inbody[ibody]) continue;
if (inpfile && inbody[ibody]) continue;
if (inertia[ibody][0] == 0.0) {
if (fabs(all[ibody][0]) > TOLERANCE)
error->all(FLERR,"Fix rigid: Bad principal moments");
@ -2149,7 +2149,7 @@ void FixRigid::setup_bodies_static()
error->all(FLERR,"Fix rigid: Bad principal moments");
}
if (infile) memory->destroy(inbody);
if (inpfile) memory->destroy(inbody);
}
/* ----------------------------------------------------------------------
@ -2268,10 +2268,10 @@ void FixRigid::readfile(int which, double *vec,
char line[MAXLINE];
if (me == 0) {
fp = fopen(infile,"r");
fp = fopen(inpfile,"r");
if (fp == NULL) {
char str[128];
snprintf(str,128,"Cannot open fix rigid infile %s",infile);
snprintf(str,128,"Cannot open fix rigid inpfile %s",inpfile);
error->one(FLERR,str);
}
@ -2371,7 +2371,7 @@ void FixRigid::readfile(int which, double *vec,
/* ----------------------------------------------------------------------
write out restart info for mass, COM, inertia tensor, image flags to file
identical format to infile option, so info can be read in when restarting
identical format to inpfile option, so info can be read in when restarting
only proc 0 writes list of global bodies to file
------------------------------------------------------------------------- */

View File

@ -67,7 +67,7 @@ class FixRigid : public Fix {
int triclinic;
double MINUSPI,TWOPI;
char *infile; // file to read rigid body attributes from
char *inpfile; // file to read rigid body attributes from
int rstyle; // SINGLE,MOLECULE,GROUP
int setupflag; // 1 if body properties are setup, else 0
int earlyflag; // 1 if forces/torques computed at post_force()
@ -261,7 +261,7 @@ E: Fix rigid: Bad principal moments
The principal moments of inertia computed for a rigid body
are not within the required tolerances.
E: Cannot open fix rigid infile %s
E: Cannot open fix rigid inpfile %s
The specified file cannot be opened. Check that the path and name are
correct.

View File

@ -70,7 +70,7 @@ enum{FULL_BODY,INITIAL,FINAL,FORCE_TORQUE,VCM_ANGMOM,XCM_MASS,ITENSOR,DOF};
FixRigidSmall::FixRigidSmall(LAMMPS *lmp, int narg, char **arg) :
Fix(lmp, narg, arg), step_respa(NULL),
infile(NULL), body(NULL), bodyown(NULL), bodytag(NULL), atom2body(NULL),
inpfile(NULL), body(NULL), bodyown(NULL), bodytag(NULL), atom2body(NULL),
xcmimage(NULL), displace(NULL), eflags(NULL), orient(NULL), dorient(NULL),
avec_ellipsoid(NULL), avec_line(NULL), avec_tri(NULL), counts(NULL),
itensor(NULL), mass_body(NULL), langextra(NULL), random(NULL),
@ -191,7 +191,7 @@ FixRigidSmall::FixRigidSmall(LAMMPS *lmp, int narg, char **arg) :
int seed;
langflag = 0;
infile = NULL;
inpfile = NULL;
onemols = NULL;
reinitflag = 1;
@ -232,12 +232,12 @@ FixRigidSmall::FixRigidSmall(LAMMPS *lmp, int narg, char **arg) :
if (seed <= 0) error->all(FLERR,"Illegal fix rigid/small command");
iarg += 5;
} else if (strcmp(arg[iarg],"infile") == 0) {
} else if (strcmp(arg[iarg],"inpfile") == 0) {
if (iarg+2 > narg) error->all(FLERR,"Illegal fix rigid/small command");
delete [] infile;
delete [] inpfile;
int n = strlen(arg[iarg+1]) + 1;
infile = new char[n];
strcpy(infile,arg[iarg+1]);
inpfile = new char[n];
strcpy(inpfile,arg[iarg+1]);
restart_file = 1;
reinitflag = 0;
iarg += 2;
@ -546,7 +546,7 @@ FixRigidSmall::~FixRigidSmall()
memory->destroy(dorient);
delete random;
delete [] infile;
delete [] inpfile;
memory->destroy(langextra);
memory->destroy(mass_body);
@ -622,10 +622,10 @@ void FixRigidSmall::init()
if reinitflag is not set, do the initialization only once, b/c properties
may not be re-computable especially if overlapping particles or bodies
are inserted from mol template.
do not do dynamic init if read body properties from infile. this
is b/c the infile defines the static and dynamic properties and may not
do not do dynamic init if read body properties from inpfile. this
is b/c the inpfile defines the static and dynamic properties and may not
be computable if contain overlapping particles setup_bodies_static()
reads infile itself.
reads inpfile itself.
cannot do this until now, b/c requires comm->setup() to have setup stencil
invoke pre_neighbor() to insure body xcmimage flags are reset
needed if Verlet::setup::pbc() has remapped/migrated atoms for 2nd run
@ -638,7 +638,7 @@ void FixRigidSmall::setup_pre_neighbor()
setup_bodies_static();
else pre_neighbor();
if ((reinitflag || !setupflag) && !infile)
if ((reinitflag || !setupflag) && !inpfile)
setup_bodies_dynamic();
setupflag = 1;
@ -1775,7 +1775,7 @@ int FixRigidSmall::rendezvous_body(int n, char *inbuf,
sets extended flags, masstotal, center-of-mass
sets Cartesian and diagonalized inertia tensor
sets body image flags
may read some properties from infile
may read some properties from inpfile
------------------------------------------------------------------------- */
void FixRigidSmall::setup_bodies_static()
@ -1932,7 +1932,7 @@ void FixRigidSmall::setup_bodies_static()
xcm[2] /= body[ibody].mass;
}
// set vcm, angmom = 0.0 in case infile is used
// set vcm, angmom = 0.0 in case inpfile is used
// and doesn't overwrite all body's values
// since setup_bodies_dynamic() will not be called
@ -1955,7 +1955,7 @@ void FixRigidSmall::setup_bodies_static()
// inbody[i] = 0/1 if Ith rigid body is initialized by file
int *inbody;
if (infile) {
if (inpfile) {
memory->create(inbody,nlocal_body,"rigid/small:inbody");
for (ibody = 0; ibody < nlocal_body; ibody++) inbody[ibody] = 0;
readfile(0,NULL,inbody);
@ -2058,7 +2058,7 @@ void FixRigidSmall::setup_bodies_static()
// overwrite Cartesian inertia tensor with file values
if (infile) readfile(1,itensor,inbody);
if (inpfile) readfile(1,itensor,inbody);
// diagonalize inertia tensor for each body via Jacobi rotations
// inertia = 3 eigenvalues = principal moments of inertia
@ -2257,11 +2257,11 @@ void FixRigidSmall::setup_bodies_static()
comm->reverse_comm_fix(this,6);
// error check that re-computed moments of inertia match diagonalized ones
// do not do test for bodies with params read from infile
// do not do test for bodies with params read from inpfile
double norm;
for (ibody = 0; ibody < nlocal_body; ibody++) {
if (infile && inbody[ibody]) continue;
if (inpfile && inbody[ibody]) continue;
inertia = body[ibody].inertia;
if (inertia[0] == 0.0) {
@ -2295,7 +2295,7 @@ void FixRigidSmall::setup_bodies_static()
// clean up
memory->destroy(itensor);
if (infile) memory->destroy(inbody);
if (inpfile) memory->destroy(inbody);
}
/* ----------------------------------------------------------------------
@ -2437,10 +2437,10 @@ void FixRigidSmall::readfile(int which, double **array, int *inbody)
// open file and read header
if (me == 0) {
fp = fopen(infile,"r");
fp = fopen(inpfile,"r");
if (fp == NULL) {
char str[128];
snprintf(str,128,"Cannot open fix rigid/small infile %s",infile);
snprintf(str,128,"Cannot open fix rigid/small inpfile %s",inpfile);
error->one(FLERR,str);
}
@ -2538,7 +2538,7 @@ void FixRigidSmall::readfile(int which, double **array, int *inbody)
/* ----------------------------------------------------------------------
write out restart info for mass, COM, inertia tensor to file
identical format to infile option, so info can be read in when restarting
identical format to inpfile option, so info can be read in when restarting
each proc contributes info for rigid bodies it owns
------------------------------------------------------------------------- */

View File

@ -74,7 +74,7 @@ class FixRigidSmall : public Fix {
int triclinic;
double MINUSPI,TWOPI;
char *infile; // file to read rigid body attributes from
char *inpfile; // file to read rigid body attributes from
int setupflag; // 1 if body properties are setup, else 0
int earlyflag; // 1 if forces/torques are computed at post_force()
int commflag; // various modes of forward/reverse comm
@ -318,7 +318,7 @@ E: Fix rigid: Bad principal moments
The principal moments of inertia computed for a rigid body
are not within the required tolerances.
E: Cannot open fix rigid/small infile %s
E: Cannot open fix rigid/small inpfile %s
The specified file cannot be opened. Check that the path and name are
correct.

View File

@ -139,12 +139,12 @@ void NEBSpin::command(int narg, char **arg)
if (strcmp(arg[5],"final") == 0) {
if (narg != 7 && narg !=8) error->universe_all(FLERR,"Illegal NEBSpin command");
infile = arg[6];
readfile(infile,0);
inpfile = arg[6];
readfile(inpfile,0);
} else if (strcmp(arg[5],"each") == 0) {
if (narg != 7 && narg !=8) error->universe_all(FLERR,"Illegal NEBSpin command");
infile = arg[6];
readfile(infile,1);
inpfile = arg[6];
readfile(inpfile,1);
} else if (strcmp(arg[5],"none") == 0) {
if (narg != 6 && narg !=7) error->universe_all(FLERR,"Illegal NEBSpin command");
} else error->universe_all(FLERR,"Illegal NEBSpin command");

View File

@ -46,7 +46,7 @@ class NEBSpin : protected Pointers {
double ttol; // torque tolerance convergence criterion
int n1steps, n2steps; // number of steps in stage 1 and 2
int nevery; // output interval
char *infile; // name of file containing final state
char *inpfile; // name of file containing final state
class FixNEBSpin *fneb;
int numall; // per-replica dimension of array all

View File

@ -455,8 +455,8 @@ void Atom::create_avec(const char *style, int narg, char **arg, int trysuffix)
if (sflag) {
char estyle[256];
if (sflag == 1) sprintf(estyle,"%s/%s",style,lmp->suffix);
else sprintf(estyle,"%s/%s",style,lmp->suffix2);
if (sflag == 1) snprintf(estyle,256,"%s/%s",style,lmp->suffix);
else snprintf(estyle,256,"%s/%s",style,lmp->suffix2);
int n = strlen(estyle) + 1;
atom_style = new char[n];
strcpy(atom_style,estyle);
@ -487,7 +487,7 @@ AtomVec *Atom::new_avec(const char *style, int trysuffix, int &sflag)
if (lmp->suffix) {
sflag = 1;
char estyle[256];
sprintf(estyle,"%s/%s",style,lmp->suffix);
snprintf(estyle,256,"%s/%s",style,lmp->suffix);
if (avec_map->find(estyle) != avec_map->end()) {
AtomVecCreator avec_creator = (*avec_map)[estyle];
return avec_creator(lmp);
@ -497,7 +497,7 @@ AtomVec *Atom::new_avec(const char *style, int trysuffix, int &sflag)
if (lmp->suffix2) {
sflag = 2;
char estyle[256];
sprintf(estyle,"%s/%s",style,lmp->suffix2);
snprintf(estyle,256,"%s/%s",style,lmp->suffix2);
if (avec_map->find(estyle) != avec_map->end()) {
AtomVecCreator avec_creator = (*avec_map)[estyle];
return avec_creator(lmp);

View File

@ -1734,7 +1734,7 @@ void Domain::add_region(int narg, char **arg)
if (lmp->suffix_enable) {
if (lmp->suffix) {
char estyle[256];
sprintf(estyle,"%s/%s",arg[1],lmp->suffix);
snprintf(estyle,256,"%s/%s",arg[1],lmp->suffix);
if (region_map->find(estyle) != region_map->end()) {
RegionCreator region_creator = (*region_map)[estyle];
regions[nregion] = region_creator(lmp, narg, arg);
@ -1746,7 +1746,7 @@ void Domain::add_region(int narg, char **arg)
if (lmp->suffix2) {
char estyle[256];
sprintf(estyle,"%s/%s",arg[1],lmp->suffix2);
snprintf(estyle,256,"%s/%s",arg[1],lmp->suffix2);
if (region_map->find(estyle) != region_map->end()) {
RegionCreator region_creator = (*region_map)[estyle];
regions[nregion] = region_creator(lmp, narg, arg);

View File

@ -238,7 +238,7 @@ Pair *Force::new_pair(const char *style, int trysuffix, int &sflag)
if (lmp->suffix) {
sflag = 1;
char estyle[256];
sprintf(estyle,"%s/%s",style,lmp->suffix);
snprintf(estyle,256,"%s/%s",style,lmp->suffix);
if (pair_map->find(estyle) != pair_map->end()) {
PairCreator pair_creator = (*pair_map)[estyle];
return pair_creator(lmp);
@ -247,7 +247,7 @@ Pair *Force::new_pair(const char *style, int trysuffix, int &sflag)
if (lmp->suffix2) {
sflag = 2;
char estyle[256];
sprintf(estyle,"%s/%s",style,lmp->suffix2);
snprintf(estyle,256,"%s/%s",style,lmp->suffix2);
if (pair_map->find(estyle) != pair_map->end()) {
PairCreator pair_creator = (*pair_map)[estyle];
return pair_creator(lmp);
@ -350,7 +350,7 @@ Bond *Force::new_bond(const char *style, int trysuffix, int &sflag)
if (lmp->suffix) {
sflag = 1;
char estyle[256];
sprintf(estyle,"%s/%s",style,lmp->suffix);
snprintf(estyle,256,"%s/%s",style,lmp->suffix);
if (bond_map->find(estyle) != bond_map->end()) {
BondCreator bond_creator = (*bond_map)[estyle];
return bond_creator(lmp);
@ -360,7 +360,7 @@ Bond *Force::new_bond(const char *style, int trysuffix, int &sflag)
if (lmp->suffix2) {
sflag = 2;
char estyle[256];
sprintf(estyle,"%s/%s",style,lmp->suffix2);
snprintf(estyle,256,"%s/%s",style,lmp->suffix2);
if (bond_map->find(estyle) != bond_map->end()) {
BondCreator bond_creator = (*bond_map)[estyle];
return bond_creator(lmp);
@ -429,7 +429,7 @@ Angle *Force::new_angle(const char *style, int trysuffix, int &sflag)
if (lmp->suffix) {
sflag = 1;
char estyle[256];
sprintf(estyle,"%s/%s",style,lmp->suffix);
snprintf(estyle,256,"%s/%s",style,lmp->suffix);
if (angle_map->find(estyle) != angle_map->end()) {
AngleCreator angle_creator = (*angle_map)[estyle];
return angle_creator(lmp);
@ -439,7 +439,7 @@ Angle *Force::new_angle(const char *style, int trysuffix, int &sflag)
if (lmp->suffix2) {
sflag = 2;
char estyle[256];
sprintf(estyle,"%s/%s",style,lmp->suffix);
snprintf(estyle,256,"%s/%s",style,lmp->suffix);
if (angle_map->find(estyle) != angle_map->end()) {
AngleCreator angle_creator = (*angle_map)[estyle];
return angle_creator(lmp);
@ -509,7 +509,7 @@ Dihedral *Force::new_dihedral(const char *style, int trysuffix, int &sflag)
if (lmp->suffix) {
sflag = 1;
char estyle[256];
sprintf(estyle,"%s/%s",style,lmp->suffix);
snprintf(estyle,256,"%s/%s",style,lmp->suffix);
if (dihedral_map->find(estyle) != dihedral_map->end()) {
DihedralCreator dihedral_creator = (*dihedral_map)[estyle];
return dihedral_creator(lmp);
@ -519,7 +519,7 @@ Dihedral *Force::new_dihedral(const char *style, int trysuffix, int &sflag)
if (lmp->suffix2) {
sflag = 2;
char estyle[256];
sprintf(estyle,"%s/%s",style,lmp->suffix2);
snprintf(estyle,256,"%s/%s",style,lmp->suffix2);
if (dihedral_map->find(estyle) != dihedral_map->end()) {
DihedralCreator dihedral_creator = (*dihedral_map)[estyle];
return dihedral_creator(lmp);
@ -588,7 +588,7 @@ Improper *Force::new_improper(const char *style, int trysuffix, int &sflag)
if (lmp->suffix) {
sflag = 1;
char estyle[256];
sprintf(estyle,"%s/%s",style,lmp->suffix);
snprintf(estyle,256,"%s/%s",style,lmp->suffix);
if (improper_map->find(estyle) != improper_map->end()) {
ImproperCreator improper_creator = (*improper_map)[estyle];
return improper_creator(lmp);
@ -598,7 +598,7 @@ Improper *Force::new_improper(const char *style, int trysuffix, int &sflag)
if (lmp->suffix2) {
sflag = 2;
char estyle[256];
sprintf(estyle,"%s/%s",style,lmp->suffix2);
snprintf(estyle,256,"%s/%s",style,lmp->suffix2);
if (improper_map->find(estyle) != improper_map->end()) {
ImproperCreator improper_creator = (*improper_map)[estyle];
return improper_creator(lmp);
@ -671,7 +671,7 @@ KSpace *Force::new_kspace(const char *style, int trysuffix, int &sflag)
if (lmp->suffix) {
sflag = 1;
char estyle[256];
sprintf(estyle,"%s/%s",style,lmp->suffix);
snprintf(estyle,256,"%s/%s",style,lmp->suffix);
if (kspace_map->find(estyle) != kspace_map->end()) {
KSpaceCreator kspace_creator = (*kspace_map)[estyle];
return kspace_creator(lmp);
@ -681,7 +681,7 @@ KSpace *Force::new_kspace(const char *style, int trysuffix, int &sflag)
if (lmp->suffix2) {
sflag = 1;
char estyle[256];
sprintf(estyle,"%s/%s",style,lmp->suffix2);
snprintf(estyle,256,"%s/%s",style,lmp->suffix2);
if (kspace_map->find(estyle) != kspace_map->end()) {
KSpaceCreator kspace_creator = (*kspace_map)[estyle];
return kspace_creator(lmp);
@ -735,8 +735,8 @@ void Force::store_style(char *&str, const char *style, int sflag)
{
if (sflag) {
char estyle[256];
if (sflag == 1) sprintf(estyle,"%s/%s",style,lmp->suffix);
else sprintf(estyle,"%s/%s",style,lmp->suffix2);
if (sflag == 1) snprintf(estyle,256,"%s/%s",style,lmp->suffix);
else snprintf(estyle,256,"%s/%s",style,lmp->suffix2);
int n = strlen(estyle) + 1;
str = new char[n];
strcpy(str,estyle);

View File

@ -1818,11 +1818,11 @@ void Input::pair_style()
if (!match && lmp->suffix_enable) {
char estyle[256];
if (lmp->suffix) {
sprintf(estyle,"%s/%s",arg[0],lmp->suffix);
snprintf(estyle,256,"%s/%s",arg[0],lmp->suffix);
if (strcmp(estyle,force->pair_style) == 0) match = 1;
}
if (lmp->suffix2) {
sprintf(estyle,"%s/%s",arg[0],lmp->suffix2);
snprintf(estyle,256,"%s/%s",arg[0],lmp->suffix2);
if (strcmp(estyle,force->pair_style) == 0) match = 1;
}
}

View File

@ -186,6 +186,10 @@ void Pair::modify_params(int narg, char **arg)
else if (strcmp(arg[iarg+1],"no") == 0) compute_flag = 0;
else error->all(FLERR,"Illegal pair_modify command");
iarg += 2;
} else if (strcmp(arg[iarg],"nofdotr") == 0) {
if (iarg+2 > narg) error->all(FLERR,"Illegal pair_modify command");
no_virial_fdotr_compute = 1;
++iarg;
} else error->all(FLERR,"Illegal pair_modify command");
}
}

View File

@ -303,6 +303,7 @@ double PairCoulCut::single(int i, int j, int /*itype*/, int /*jtype*/,
void *PairCoulCut::extract(const char *str, int &dim)
{
dim = 2;
if (strcmp(str,"cut_coul") == 0) return (void *) &cut;
if (strcmp(str,"scale") == 0) return (void *) scale;
return NULL;
}

View File

@ -254,6 +254,7 @@ void PairHybrid::settings(int narg, char **arg)
delete[] multiple;
delete[] special_lj;
delete[] special_coul;
delete[] compute_tally;
}
if (allocated) {
@ -273,7 +274,6 @@ 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
@ -649,6 +649,8 @@ void PairHybrid::write_restart(FILE *fp)
// each sub-style writes its settings, but no coeff info
fwrite(compute_tally,sizeof(int),nstyles,fp);
int n;
for (int m = 0; m < nstyles; m++) {
n = strlen(keywords[m]) + 1;
@ -682,6 +684,7 @@ void PairHybrid::read_restart(FILE *fp)
delete[] multiple;
delete[] special_lj;
delete[] special_coul;
delete[] compute_tally;
styles = new Pair*[nstyles];
keywords = new char*[nstyles];
@ -689,10 +692,14 @@ void PairHybrid::read_restart(FILE *fp)
special_lj = new double*[nstyles];
special_coul = new double*[nstyles];
compute_tally = new int[nstyles];
// each sub-style is created via new_pair()
// each reads its settings, but no coeff info
if (me == 0) fread(compute_tally,sizeof(int),nstyles,fp);
MPI_Bcast(compute_tally,nstyles,MPI_INT,0,world);
int n,dummy;
for (int m = 0; m < nstyles; m++) {
if (me == 0) fread(&n,sizeof(int),1,fp);
@ -938,17 +945,24 @@ void *PairHybrid::extract(const char *str, int &dim)
void *cutptr = NULL;
void *ptr;
double cutvalue = 0.0;
int couldim = -1;
for (int m = 0; m < nstyles; m++) {
ptr = styles[m]->extract(str,dim);
if (ptr && strcmp(str,"cut_coul") == 0) {
if (cutptr && dim != couldim)
error->all(FLERR,
"Coulomb styles of pair hybrid sub-styles do not match");
double *p_newvalue = (double *) ptr;
double newvalue = *p_newvalue;
if (cutptr && newvalue != cutvalue)
if (cutptr && (newvalue != cutvalue))
error->all(FLERR,
"Coulomb cutoffs of pair hybrid sub-styles do not match");
cutptr = ptr;
cutvalue = newvalue;
if (dim == 0) {
cutptr = ptr;
cutvalue = newvalue;
}
couldim = dim;
} else if (ptr) return ptr;
}

View File

@ -461,9 +461,8 @@ double PairLJCutCoulCut::single(int i, int j, int itype, int jtype,
void *PairLJCutCoulCut::extract(const char *str, int &dim)
{
dim = 0;
if (strcmp(str,"cut_coul") == 0) return (void *) &cut_coul;
dim = 2;
if (strcmp(str,"cut_coul") == 0) return (void *) &cut_coul;
if (strcmp(str,"epsilon") == 0) return (void *) epsilon;
if (strcmp(str,"sigma") == 0) return (void *) sigma;
return NULL;

View File

@ -580,32 +580,32 @@ void ReadRestart::command(int narg, char **arg)
}
/* ----------------------------------------------------------------------
infile contains a "*"
search for all files which match the infile pattern
inpfile contains a "*"
search for all files which match the inpfile pattern
replace "*" with latest timestep value to create outfile name
search dir referenced by initial pathname of file
if infile also contains "%", use "base" when searching directory
if inpfile also contains "%", use "base" when searching directory
only called by proc 0
------------------------------------------------------------------------- */
void ReadRestart::file_search(char *infile, char *outfile)
void ReadRestart::file_search(char *inpfile, char *outfile)
{
char *ptr;
// separate infile into dir + filename
// separate inpfile into dir + filename
char *dirname = new char[strlen(infile) + 1];
char *filename = new char[strlen(infile) + 1];
char *dirname = new char[strlen(inpfile) + 1];
char *filename = new char[strlen(inpfile) + 1];
if (strchr(infile,'/')) {
ptr = strrchr(infile,'/');
if (strchr(inpfile,'/')) {
ptr = strrchr(inpfile,'/');
*ptr = '\0';
strcpy(dirname,infile);
strcpy(dirname,inpfile);
strcpy(filename,ptr+1);
*ptr = '/';
} else {
strcpy(dirname,"./");
strcpy(filename,infile);
strcpy(filename,inpfile);
}
// if filename contains "%" replace "%" with "base"
@ -651,11 +651,11 @@ void ReadRestart::file_search(char *infile, char *outfile)
if (maxnum < 0) error->one(FLERR,"Found no restart file matching pattern");
// create outfile with maxint substituted for "*"
// use original infile, not pattern, since need to retain "%" in filename
// use original inpfile, not pattern, since need to retain "%" in filename
ptr = strchr(infile,'*');
ptr = strchr(inpfile,'*');
*ptr = '\0';
sprintf(outfile,"%s" BIGINT_FORMAT "%s",infile,maxnum,ptr+1);
sprintf(outfile,"%s" BIGINT_FORMAT "%s",inpfile,maxnum,ptr+1);
*ptr = '*';
// clean up

View File

@ -316,8 +316,8 @@ void Update::create_integrate(int narg, char **arg, int trysuffix)
if (sflag) {
char estyle[256];
if (sflag == 1) sprintf(estyle,"%s/%s",arg[0],lmp->suffix);
else sprintf(estyle,"%s/%s",arg[0],lmp->suffix2);
if (sflag == 1) snprintf(estyle,256,"%s/%s",arg[0],lmp->suffix);
else snprintf(estyle,256,"%s/%s",arg[0],lmp->suffix2);
int n = strlen(estyle) + 1;
integrate_style = new char[n];
strcpy(integrate_style,estyle);
@ -339,7 +339,7 @@ void Update::new_integrate(char *style, int narg, char **arg,
if (lmp->suffix) {
sflag = 1;
char estyle[256];
sprintf(estyle,"%s/%s",style,lmp->suffix);
snprintf(estyle,256,"%s/%s",style,lmp->suffix);
if (integrate_map->find(estyle) != integrate_map->end()) {
IntegrateCreator integrate_creator = (*integrate_map)[estyle];
integrate = integrate_creator(lmp, narg, arg);
@ -350,7 +350,7 @@ void Update::new_integrate(char *style, int narg, char **arg,
if (lmp->suffix2) {
sflag = 2;
char estyle[256];
sprintf(estyle,"%s/%s",style,lmp->suffix2);
snprintf(estyle,256,"%s/%s",style,lmp->suffix2);
if (integrate_map->find(estyle) != integrate_map->end()) {
IntegrateCreator integrate_creator = (*integrate_map)[estyle];
integrate = integrate_creator(lmp, narg, arg);