remove class member name clashes. Pointers contains infile so we rename other uses to inpfile
This commit is contained in:
@ -115,25 +115,25 @@ FixOrientBCC::FixOrientBCC(LAMMPS *lmp, int narg, char **arg) :
|
|||||||
char *result;
|
char *result;
|
||||||
int count;
|
int count;
|
||||||
|
|
||||||
FILE *infile = fopen(xifilename,"r");
|
FILE *inpfile = fopen(xifilename,"r");
|
||||||
if (infile == NULL) error->one(FLERR,"Fix orient/bcc file open failed");
|
if (inpfile == NULL) error->one(FLERR,"Fix orient/bcc file open failed");
|
||||||
for (int i = 0; i < 4; i++) {
|
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");
|
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]);
|
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");
|
if (count != 3) error->one(FLERR,"Fix orient/bcc file read failed");
|
||||||
}
|
}
|
||||||
fclose(infile);
|
fclose(inpfile);
|
||||||
|
|
||||||
infile = fopen(chifilename,"r");
|
inpfile = fopen(chifilename,"r");
|
||||||
if (infile == NULL) error->one(FLERR,"Fix orient/bcc file open failed");
|
if (inpfile == NULL) error->one(FLERR,"Fix orient/bcc file open failed");
|
||||||
for (int i = 0; i < 4; i++) {
|
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");
|
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]);
|
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");
|
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);
|
MPI_Bcast(&Rxi[0][0],18,MPI_DOUBLE,0,world);
|
||||||
|
|||||||
@ -113,25 +113,25 @@ FixOrientFCC::FixOrientFCC(LAMMPS *lmp, int narg, char **arg) :
|
|||||||
char *result;
|
char *result;
|
||||||
int count;
|
int count;
|
||||||
|
|
||||||
FILE *infile = fopen(xifilename,"r");
|
FILE *inpfile = fopen(xifilename,"r");
|
||||||
if (infile == NULL) error->one(FLERR,"Fix orient/fcc file open failed");
|
if (inpfile == NULL) error->one(FLERR,"Fix orient/fcc file open failed");
|
||||||
for (int i = 0; i < 6; i++) {
|
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");
|
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]);
|
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");
|
if (count != 3) error->one(FLERR,"Fix orient/fcc file read failed");
|
||||||
}
|
}
|
||||||
fclose(infile);
|
fclose(inpfile);
|
||||||
|
|
||||||
infile = fopen(chifilename,"r");
|
inpfile = fopen(chifilename,"r");
|
||||||
if (infile == NULL) error->one(FLERR,"Fix orient/fcc file open failed");
|
if (inpfile == NULL) error->one(FLERR,"Fix orient/fcc file open failed");
|
||||||
for (int i = 0; i < 6; i++) {
|
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");
|
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]);
|
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");
|
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);
|
MPI_Bcast(&Rxi[0][0],18,MPI_DOUBLE,0,world);
|
||||||
|
|||||||
@ -146,12 +146,12 @@ void NEB::command(int narg, char **arg)
|
|||||||
|
|
||||||
if (strcmp(arg[5],"final") == 0) {
|
if (strcmp(arg[5],"final") == 0) {
|
||||||
if (narg != 7 && narg !=8) error->universe_all(FLERR,"Illegal NEB command");
|
if (narg != 7 && narg !=8) error->universe_all(FLERR,"Illegal NEB command");
|
||||||
infile = arg[6];
|
inpfile = arg[6];
|
||||||
readfile(infile,0);
|
readfile(inpfile,0);
|
||||||
} else if (strcmp(arg[5],"each") == 0) {
|
} else if (strcmp(arg[5],"each") == 0) {
|
||||||
if (narg != 7 && narg !=8) error->universe_all(FLERR,"Illegal NEB command");
|
if (narg != 7 && narg !=8) error->universe_all(FLERR,"Illegal NEB command");
|
||||||
infile = arg[6];
|
inpfile = arg[6];
|
||||||
readfile(infile,1);
|
readfile(inpfile,1);
|
||||||
} else if (strcmp(arg[5],"none") == 0) {
|
} else if (strcmp(arg[5],"none") == 0) {
|
||||||
if (narg != 6 && narg !=7) error->universe_all(FLERR,"Illegal NEB command");
|
if (narg != 6 && narg !=7) error->universe_all(FLERR,"Illegal NEB command");
|
||||||
} else error->universe_all(FLERR,"Illegal NEB command");
|
} else error->universe_all(FLERR,"Illegal NEB command");
|
||||||
|
|||||||
@ -47,7 +47,7 @@ class NEB : protected Pointers {
|
|||||||
double ftol; // force tolerance convergence criterion
|
double ftol; // force tolerance convergence criterion
|
||||||
int n1steps, n2steps; // number of steps in stage 1 and 2
|
int n1steps, n2steps; // number of steps in stage 1 and 2
|
||||||
int nevery; // output interval
|
int nevery; // output interval
|
||||||
char *infile; // name of file containing final state
|
char *inpfile; // name of file containing final state
|
||||||
|
|
||||||
class FixNEB *fneb;
|
class FixNEB *fneb;
|
||||||
int numall; // per-replica dimension of array all
|
int numall; // per-replica dimension of array all
|
||||||
|
|||||||
@ -59,7 +59,7 @@ enum{ISO,ANISO,TRICLINIC};
|
|||||||
|
|
||||||
FixRigid::FixRigid(LAMMPS *lmp, int narg, char **arg) :
|
FixRigid::FixRigid(LAMMPS *lmp, int narg, char **arg) :
|
||||||
Fix(lmp, narg, arg), step_respa(NULL),
|
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),
|
body(NULL), displace(NULL), masstotal(NULL), xcm(NULL),
|
||||||
vcm(NULL), fcm(NULL), inertia(NULL), ex_space(NULL),
|
vcm(NULL), fcm(NULL), inertia(NULL), ex_space(NULL),
|
||||||
ey_space(NULL), ez_space(NULL), angmom(NULL), omega(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_iter = 1;
|
||||||
t_order = 3;
|
t_order = 3;
|
||||||
p_chain = 10;
|
p_chain = 10;
|
||||||
infile = NULL;
|
inpfile = NULL;
|
||||||
|
|
||||||
pcouple = NONE;
|
pcouple = NONE;
|
||||||
pstyle = ANISO;
|
pstyle = ANISO;
|
||||||
@ -546,12 +546,12 @@ FixRigid::FixRigid(LAMMPS *lmp, int narg, char **arg) :
|
|||||||
p_chain = force->inumeric(FLERR,arg[iarg+1]);
|
p_chain = force->inumeric(FLERR,arg[iarg+1]);
|
||||||
iarg += 2;
|
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");
|
if (iarg+2 > narg) error->all(FLERR,"Illegal fix rigid command");
|
||||||
delete [] infile;
|
delete [] inpfile;
|
||||||
int n = strlen(arg[iarg+1]) + 1;
|
int n = strlen(arg[iarg+1]) + 1;
|
||||||
infile = new char[n];
|
inpfile = new char[n];
|
||||||
strcpy(infile,arg[iarg+1]);
|
strcpy(inpfile,arg[iarg+1]);
|
||||||
restart_file = 1;
|
restart_file = 1;
|
||||||
reinitflag = 0;
|
reinitflag = 0;
|
||||||
iarg += 2;
|
iarg += 2;
|
||||||
@ -649,7 +649,7 @@ FixRigid::~FixRigid()
|
|||||||
atom->delete_callback(id,0);
|
atom->delete_callback(id,0);
|
||||||
|
|
||||||
delete random;
|
delete random;
|
||||||
delete [] infile;
|
delete [] inpfile;
|
||||||
memory->destroy(mol2body);
|
memory->destroy(mol2body);
|
||||||
memory->destroy(body2mol);
|
memory->destroy(body2mol);
|
||||||
|
|
||||||
@ -760,14 +760,14 @@ void FixRigid::init()
|
|||||||
// setup rigid bodies, using current atom info. if reinitflag is not set,
|
// 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
|
// do the initialization only once, b/c properties may not be re-computable
|
||||||
// especially if overlapping particles.
|
// especially if overlapping particles.
|
||||||
// do not do dynamic init if read body properties from infile.
|
// do not do dynamic init if read body properties from inpfile.
|
||||||
// this is b/c the infile defines the static and dynamic properties and may
|
// this is b/c the inpfile defines the static and dynamic properties and may
|
||||||
// not be computable if contain overlapping particles.
|
// not be computable if contain overlapping particles.
|
||||||
// setup_bodies_static() reads infile itself
|
// setup_bodies_static() reads inpfile itself
|
||||||
|
|
||||||
if (reinitflag || !setupflag) {
|
if (reinitflag || !setupflag) {
|
||||||
setup_bodies_static();
|
setup_bodies_static();
|
||||||
if (!infile) setup_bodies_dynamic();
|
if (!inpfile) setup_bodies_dynamic();
|
||||||
setupflag = 1;
|
setupflag = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1640,7 +1640,7 @@ void FixRigid::set_v()
|
|||||||
sets extended flags, masstotal, center-of-mass
|
sets extended flags, masstotal, center-of-mass
|
||||||
sets Cartesian and diagonalized inertia tensor
|
sets Cartesian and diagonalized inertia tensor
|
||||||
sets body image flags
|
sets body image flags
|
||||||
may read some properties from infile
|
may read some properties from inpfile
|
||||||
------------------------------------------------------------------------- */
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
void FixRigid::setup_bodies_static()
|
void FixRigid::setup_bodies_static()
|
||||||
@ -1791,7 +1791,7 @@ void FixRigid::setup_bodies_static()
|
|||||||
xcm[ibody][2] = all[ibody][2]/masstotal[ibody];
|
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
|
// and doesn't overwrite all body's values
|
||||||
// since setup_bodies_dynamic() will not be called
|
// 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
|
// inbody[i] = 0/1 if Ith rigid body is initialized by file
|
||||||
|
|
||||||
int *inbody;
|
int *inbody;
|
||||||
if (infile) {
|
if (inpfile) {
|
||||||
memory->create(inbody,nbody,"rigid:inbody");
|
memory->create(inbody,nbody,"rigid:inbody");
|
||||||
for (ibody = 0; ibody < nbody; ibody++) inbody[ibody] = 0;
|
for (ibody = 0; ibody < nbody; ibody++) inbody[ibody] = 0;
|
||||||
readfile(0,masstotal,xcm,vcm,angmom,imagebody,inbody);
|
readfile(0,masstotal,xcm,vcm,angmom,imagebody,inbody);
|
||||||
@ -1918,7 +1918,7 @@ void FixRigid::setup_bodies_static()
|
|||||||
|
|
||||||
// overwrite Cartesian inertia tensor with file values
|
// 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
|
// diagonalize inertia tensor for each body via Jacobi rotations
|
||||||
// inertia = 3 eigenvalues = principal moments of inertia
|
// 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);
|
MPI_Allreduce(sum[0],all[0],6*nbody,MPI_DOUBLE,MPI_SUM,world);
|
||||||
|
|
||||||
// error check that re-computed moments of inertia match diagonalized ones
|
// 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;
|
double norm;
|
||||||
for (ibody = 0; ibody < nbody; ibody++) {
|
for (ibody = 0; ibody < nbody; ibody++) {
|
||||||
if (infile && inbody[ibody]) continue;
|
if (inpfile && inbody[ibody]) continue;
|
||||||
if (inertia[ibody][0] == 0.0) {
|
if (inertia[ibody][0] == 0.0) {
|
||||||
if (fabs(all[ibody][0]) > TOLERANCE)
|
if (fabs(all[ibody][0]) > TOLERANCE)
|
||||||
error->all(FLERR,"Fix rigid: Bad principal moments");
|
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");
|
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];
|
char line[MAXLINE];
|
||||||
|
|
||||||
if (me == 0) {
|
if (me == 0) {
|
||||||
fp = fopen(infile,"r");
|
fp = fopen(inpfile,"r");
|
||||||
if (fp == NULL) {
|
if (fp == NULL) {
|
||||||
char str[128];
|
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);
|
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
|
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
|
only proc 0 writes list of global bodies to file
|
||||||
------------------------------------------------------------------------- */
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
|||||||
@ -67,7 +67,7 @@ class FixRigid : public Fix {
|
|||||||
int triclinic;
|
int triclinic;
|
||||||
double MINUSPI,TWOPI;
|
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 rstyle; // SINGLE,MOLECULE,GROUP
|
||||||
int setupflag; // 1 if body properties are setup, else 0
|
int setupflag; // 1 if body properties are setup, else 0
|
||||||
int earlyflag; // 1 if forces/torques computed at post_force()
|
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
|
The principal moments of inertia computed for a rigid body
|
||||||
are not within the required tolerances.
|
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
|
The specified file cannot be opened. Check that the path and name are
|
||||||
correct.
|
correct.
|
||||||
|
|||||||
@ -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) :
|
FixRigidSmall::FixRigidSmall(LAMMPS *lmp, int narg, char **arg) :
|
||||||
Fix(lmp, narg, arg), step_respa(NULL),
|
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),
|
xcmimage(NULL), displace(NULL), eflags(NULL), orient(NULL), dorient(NULL),
|
||||||
avec_ellipsoid(NULL), avec_line(NULL), avec_tri(NULL), counts(NULL),
|
avec_ellipsoid(NULL), avec_line(NULL), avec_tri(NULL), counts(NULL),
|
||||||
itensor(NULL), mass_body(NULL), langextra(NULL), random(NULL),
|
itensor(NULL), mass_body(NULL), langextra(NULL), random(NULL),
|
||||||
@ -191,7 +191,7 @@ FixRigidSmall::FixRigidSmall(LAMMPS *lmp, int narg, char **arg) :
|
|||||||
|
|
||||||
int seed;
|
int seed;
|
||||||
langflag = 0;
|
langflag = 0;
|
||||||
infile = NULL;
|
inpfile = NULL;
|
||||||
onemols = NULL;
|
onemols = NULL;
|
||||||
reinitflag = 1;
|
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");
|
if (seed <= 0) error->all(FLERR,"Illegal fix rigid/small command");
|
||||||
iarg += 5;
|
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");
|
if (iarg+2 > narg) error->all(FLERR,"Illegal fix rigid/small command");
|
||||||
delete [] infile;
|
delete [] inpfile;
|
||||||
int n = strlen(arg[iarg+1]) + 1;
|
int n = strlen(arg[iarg+1]) + 1;
|
||||||
infile = new char[n];
|
inpfile = new char[n];
|
||||||
strcpy(infile,arg[iarg+1]);
|
strcpy(inpfile,arg[iarg+1]);
|
||||||
restart_file = 1;
|
restart_file = 1;
|
||||||
reinitflag = 0;
|
reinitflag = 0;
|
||||||
iarg += 2;
|
iarg += 2;
|
||||||
@ -546,7 +546,7 @@ FixRigidSmall::~FixRigidSmall()
|
|||||||
memory->destroy(dorient);
|
memory->destroy(dorient);
|
||||||
|
|
||||||
delete random;
|
delete random;
|
||||||
delete [] infile;
|
delete [] inpfile;
|
||||||
|
|
||||||
memory->destroy(langextra);
|
memory->destroy(langextra);
|
||||||
memory->destroy(mass_body);
|
memory->destroy(mass_body);
|
||||||
@ -622,10 +622,10 @@ void FixRigidSmall::init()
|
|||||||
if reinitflag is not set, do the initialization only once, b/c properties
|
if reinitflag is not set, do the initialization only once, b/c properties
|
||||||
may not be re-computable especially if overlapping particles or bodies
|
may not be re-computable especially if overlapping particles or bodies
|
||||||
are inserted from mol template.
|
are inserted from mol template.
|
||||||
do not do dynamic init if read body properties from infile. this
|
do not do dynamic init if read body properties from inpfile. this
|
||||||
is b/c the infile defines the static and dynamic properties and may not
|
is b/c the inpfile defines the static and dynamic properties and may not
|
||||||
be computable if contain overlapping particles setup_bodies_static()
|
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
|
cannot do this until now, b/c requires comm->setup() to have setup stencil
|
||||||
invoke pre_neighbor() to insure body xcmimage flags are reset
|
invoke pre_neighbor() to insure body xcmimage flags are reset
|
||||||
needed if Verlet::setup::pbc() has remapped/migrated atoms for 2nd run
|
needed if Verlet::setup::pbc() has remapped/migrated atoms for 2nd run
|
||||||
@ -638,7 +638,7 @@ void FixRigidSmall::setup_pre_neighbor()
|
|||||||
setup_bodies_static();
|
setup_bodies_static();
|
||||||
else pre_neighbor();
|
else pre_neighbor();
|
||||||
|
|
||||||
if ((reinitflag || !setupflag) && !infile)
|
if ((reinitflag || !setupflag) && !inpfile)
|
||||||
setup_bodies_dynamic();
|
setup_bodies_dynamic();
|
||||||
|
|
||||||
setupflag = 1;
|
setupflag = 1;
|
||||||
@ -1775,7 +1775,7 @@ int FixRigidSmall::rendezvous_body(int n, char *inbuf,
|
|||||||
sets extended flags, masstotal, center-of-mass
|
sets extended flags, masstotal, center-of-mass
|
||||||
sets Cartesian and diagonalized inertia tensor
|
sets Cartesian and diagonalized inertia tensor
|
||||||
sets body image flags
|
sets body image flags
|
||||||
may read some properties from infile
|
may read some properties from inpfile
|
||||||
------------------------------------------------------------------------- */
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
void FixRigidSmall::setup_bodies_static()
|
void FixRigidSmall::setup_bodies_static()
|
||||||
@ -1932,7 +1932,7 @@ void FixRigidSmall::setup_bodies_static()
|
|||||||
xcm[2] /= body[ibody].mass;
|
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
|
// and doesn't overwrite all body's values
|
||||||
// since setup_bodies_dynamic() will not be called
|
// 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
|
// inbody[i] = 0/1 if Ith rigid body is initialized by file
|
||||||
|
|
||||||
int *inbody;
|
int *inbody;
|
||||||
if (infile) {
|
if (inpfile) {
|
||||||
memory->create(inbody,nlocal_body,"rigid/small:inbody");
|
memory->create(inbody,nlocal_body,"rigid/small:inbody");
|
||||||
for (ibody = 0; ibody < nlocal_body; ibody++) inbody[ibody] = 0;
|
for (ibody = 0; ibody < nlocal_body; ibody++) inbody[ibody] = 0;
|
||||||
readfile(0,NULL,inbody);
|
readfile(0,NULL,inbody);
|
||||||
@ -2058,7 +2058,7 @@ void FixRigidSmall::setup_bodies_static()
|
|||||||
|
|
||||||
// overwrite Cartesian inertia tensor with file values
|
// 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
|
// diagonalize inertia tensor for each body via Jacobi rotations
|
||||||
// inertia = 3 eigenvalues = principal moments of inertia
|
// inertia = 3 eigenvalues = principal moments of inertia
|
||||||
@ -2257,11 +2257,11 @@ void FixRigidSmall::setup_bodies_static()
|
|||||||
comm->reverse_comm_fix(this,6);
|
comm->reverse_comm_fix(this,6);
|
||||||
|
|
||||||
// error check that re-computed moments of inertia match diagonalized ones
|
// 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;
|
double norm;
|
||||||
for (ibody = 0; ibody < nlocal_body; ibody++) {
|
for (ibody = 0; ibody < nlocal_body; ibody++) {
|
||||||
if (infile && inbody[ibody]) continue;
|
if (inpfile && inbody[ibody]) continue;
|
||||||
inertia = body[ibody].inertia;
|
inertia = body[ibody].inertia;
|
||||||
|
|
||||||
if (inertia[0] == 0.0) {
|
if (inertia[0] == 0.0) {
|
||||||
@ -2295,7 +2295,7 @@ void FixRigidSmall::setup_bodies_static()
|
|||||||
// clean up
|
// clean up
|
||||||
|
|
||||||
memory->destroy(itensor);
|
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
|
// open file and read header
|
||||||
|
|
||||||
if (me == 0) {
|
if (me == 0) {
|
||||||
fp = fopen(infile,"r");
|
fp = fopen(inpfile,"r");
|
||||||
if (fp == NULL) {
|
if (fp == NULL) {
|
||||||
char str[128];
|
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);
|
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
|
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
|
each proc contributes info for rigid bodies it owns
|
||||||
------------------------------------------------------------------------- */
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
|||||||
@ -74,7 +74,7 @@ class FixRigidSmall : public Fix {
|
|||||||
int triclinic;
|
int triclinic;
|
||||||
double MINUSPI,TWOPI;
|
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 setupflag; // 1 if body properties are setup, else 0
|
||||||
int earlyflag; // 1 if forces/torques are computed at post_force()
|
int earlyflag; // 1 if forces/torques are computed at post_force()
|
||||||
int commflag; // various modes of forward/reverse comm
|
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
|
The principal moments of inertia computed for a rigid body
|
||||||
are not within the required tolerances.
|
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
|
The specified file cannot be opened. Check that the path and name are
|
||||||
correct.
|
correct.
|
||||||
|
|||||||
@ -139,12 +139,12 @@ void NEBSpin::command(int narg, char **arg)
|
|||||||
|
|
||||||
if (strcmp(arg[5],"final") == 0) {
|
if (strcmp(arg[5],"final") == 0) {
|
||||||
if (narg != 7 && narg !=8) error->universe_all(FLERR,"Illegal NEBSpin command");
|
if (narg != 7 && narg !=8) error->universe_all(FLERR,"Illegal NEBSpin command");
|
||||||
infile = arg[6];
|
inpfile = arg[6];
|
||||||
readfile(infile,0);
|
readfile(inpfile,0);
|
||||||
} else if (strcmp(arg[5],"each") == 0) {
|
} else if (strcmp(arg[5],"each") == 0) {
|
||||||
if (narg != 7 && narg !=8) error->universe_all(FLERR,"Illegal NEBSpin command");
|
if (narg != 7 && narg !=8) error->universe_all(FLERR,"Illegal NEBSpin command");
|
||||||
infile = arg[6];
|
inpfile = arg[6];
|
||||||
readfile(infile,1);
|
readfile(inpfile,1);
|
||||||
} else if (strcmp(arg[5],"none") == 0) {
|
} else if (strcmp(arg[5],"none") == 0) {
|
||||||
if (narg != 6 && narg !=7) error->universe_all(FLERR,"Illegal NEBSpin command");
|
if (narg != 6 && narg !=7) error->universe_all(FLERR,"Illegal NEBSpin command");
|
||||||
} else error->universe_all(FLERR,"Illegal NEBSpin command");
|
} else error->universe_all(FLERR,"Illegal NEBSpin command");
|
||||||
|
|||||||
@ -46,7 +46,7 @@ class NEBSpin : protected Pointers {
|
|||||||
double ttol; // torque tolerance convergence criterion
|
double ttol; // torque tolerance convergence criterion
|
||||||
int n1steps, n2steps; // number of steps in stage 1 and 2
|
int n1steps, n2steps; // number of steps in stage 1 and 2
|
||||||
int nevery; // output interval
|
int nevery; // output interval
|
||||||
char *infile; // name of file containing final state
|
char *inpfile; // name of file containing final state
|
||||||
|
|
||||||
class FixNEBSpin *fneb;
|
class FixNEBSpin *fneb;
|
||||||
int numall; // per-replica dimension of array all
|
int numall; // per-replica dimension of array all
|
||||||
|
|||||||
@ -580,32 +580,32 @@ void ReadRestart::command(int narg, char **arg)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* ----------------------------------------------------------------------
|
/* ----------------------------------------------------------------------
|
||||||
infile contains a "*"
|
inpfile contains a "*"
|
||||||
search for all files which match the infile pattern
|
search for all files which match the inpfile pattern
|
||||||
replace "*" with latest timestep value to create outfile name
|
replace "*" with latest timestep value to create outfile name
|
||||||
search dir referenced by initial pathname of file
|
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
|
only called by proc 0
|
||||||
------------------------------------------------------------------------- */
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
void ReadRestart::file_search(char *infile, char *outfile)
|
void ReadRestart::file_search(char *inpfile, char *outfile)
|
||||||
{
|
{
|
||||||
char *ptr;
|
char *ptr;
|
||||||
|
|
||||||
// separate infile into dir + filename
|
// separate inpfile into dir + filename
|
||||||
|
|
||||||
char *dirname = new char[strlen(infile) + 1];
|
char *dirname = new char[strlen(inpfile) + 1];
|
||||||
char *filename = new char[strlen(infile) + 1];
|
char *filename = new char[strlen(inpfile) + 1];
|
||||||
|
|
||||||
if (strchr(infile,'/')) {
|
if (strchr(inpfile,'/')) {
|
||||||
ptr = strrchr(infile,'/');
|
ptr = strrchr(inpfile,'/');
|
||||||
*ptr = '\0';
|
*ptr = '\0';
|
||||||
strcpy(dirname,infile);
|
strcpy(dirname,inpfile);
|
||||||
strcpy(filename,ptr+1);
|
strcpy(filename,ptr+1);
|
||||||
*ptr = '/';
|
*ptr = '/';
|
||||||
} else {
|
} else {
|
||||||
strcpy(dirname,"./");
|
strcpy(dirname,"./");
|
||||||
strcpy(filename,infile);
|
strcpy(filename,inpfile);
|
||||||
}
|
}
|
||||||
|
|
||||||
// if filename contains "%" replace "%" with "base"
|
// 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");
|
if (maxnum < 0) error->one(FLERR,"Found no restart file matching pattern");
|
||||||
|
|
||||||
// create outfile with maxint substituted for "*"
|
// 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';
|
*ptr = '\0';
|
||||||
sprintf(outfile,"%s" BIGINT_FORMAT "%s",infile,maxnum,ptr+1);
|
sprintf(outfile,"%s" BIGINT_FORMAT "%s",inpfile,maxnum,ptr+1);
|
||||||
*ptr = '*';
|
*ptr = '*';
|
||||||
|
|
||||||
// clean up
|
// clean up
|
||||||
|
|||||||
Reference in New Issue
Block a user