git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@13601 f3b2605a-c512-4ea7-a41b-209d697bcdaa

This commit is contained in:
sjplimp
2015-07-15 21:29:44 +00:00
parent 062a3575b6
commit f7bc08d83d
22 changed files with 166 additions and 88 deletions

View File

@ -1258,26 +1258,8 @@ double PairBOP::sigmaBo(int itmp, int jtmp)
i_tag=tag[i]; i_tag=tag[i];
itype = map[type[i]]+1; itype = map[type[i]]+1;
memset(bt_sg,0,sizeof(struct B_SG)*nb_sg);
for(m=0;m<nb_sg;m++) { for(m=0;m<nb_sg;m++) {
for(pp=0;pp<3;pp++) {
bt_sg[m].dAA[pp]=0.0;
bt_sg[m].dBB[pp]=0.0;
bt_sg[m].dCC[pp]=0.0;
bt_sg[m].dDD[pp]=0.0;
bt_sg[m].dEE[pp]=0.0;
bt_sg[m].dEE1[pp]=0.0;
bt_sg[m].dFF[pp]=0.0;
bt_sg[m].dAAC[pp]=0.0;
bt_sg[m].dBBC[pp]=0.0;
bt_sg[m].dCCC[pp]=0.0;
bt_sg[m].dDDC[pp]=0.0;
bt_sg[m].dEEC[pp]=0.0;
bt_sg[m].dFFC[pp]=0.0;
bt_sg[m].dGGC[pp]=0.0;
bt_sg[m].dUT[pp]=0.0;
bt_sg[m].dSigB1[pp]=0.0;
bt_sg[m].dSigB[pp]=0.0;
}
bt_sg[m].i=-1; bt_sg[m].i=-1;
bt_sg[m].j=-1; bt_sg[m].j=-1;
bt_sg[m].temp=-1; bt_sg[m].temp=-1;
@ -3821,7 +3803,6 @@ double PairBOP::sigmaBo(int itmp, int jtmp)
} }
} }
return(sigB); return(sigB);
destroy_sigma();
} }
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */

View File

@ -1419,10 +1419,15 @@ void PairComb::sm_table()
// direct 1/r energy with Slater 1S orbital overlap // direct 1/r energy with Slater 1S orbital overlap
for (i = 0; i < n; i++) { for (i = 0; i < n; i++) {
if (map[i+1] < 0) continue;
r = drin; r = drin;
itype = params[i].ielement; itype = params[map[i+1]].ielement;
iparam_i = elem2param[itype][itype][itype]; iparam_i = elem2param[itype][itype][itype];
z = params[iparam_i].esm1; z = params[iparam_i].esm1;
if (comm->me == 0 && screen)
fprintf(screen," element[%d] = %-2s, z = %g\n",i+1,elements[map[i+1]],z);
for (j = 0; j < ncoul; j++) { for (j = 0; j < ncoul; j++) {
exp2er = exp(-2.0 * z * r); exp2er = exp(-2.0 * z * r);
phin[j][i] = 1.0 - exp2er * (1.0 + 2.0 * z * r * (1.0 + z * r)); phin[j][i] = 1.0 - exp2er * (1.0 + 2.0 * z * r * (1.0 + z * r));
@ -1432,10 +1437,12 @@ void PairComb::sm_table()
} }
for (i = 0; i < n; i ++) { for (i = 0; i < n; i ++) {
if (map[i+1] < 0) continue;
for (j = 0; j < n; j ++) { for (j = 0; j < n; j ++) {
if (map[j+1] < 0) continue;
r = drin; r = drin;
if (j == i) { if (j == i) {
itype = params[i].ielement; itype = params[map[i+1]].ielement;
inty = intype[itype][itype]; inty = intype[itype][itype];
iparam_i = elem2param[itype][itype][itype]; iparam_i = elem2param[itype][itype][itype];
z = params[iparam_i].esm1; z = params[iparam_i].esm1;
@ -1460,8 +1467,8 @@ void PairComb::sm_table()
r += dra; r += dra;
} }
} else if (j != i) { } else if (j != i) {
itype = params[i].ielement; itype = params[map[i+1]].ielement;
jtype = params[j].ielement; jtype = params[map[j+1]].ielement;
inty = intype[itype][jtype]; inty = intype[itype][jtype];
iparam_ij = elem2param[itype][jtype][jtype]; iparam_ij = elem2param[itype][jtype][jtype];
ea = params[iparam_ij].esm1; ea = params[iparam_ij].esm1;

View File

@ -2441,14 +2441,18 @@ void PairComb3::tables()
// direct 1/r energy with Slater 1S orbital overlap // direct 1/r energy with Slater 1S orbital overlap
for (i = 0; i < n; i++) { for (i = 0; i < n; i++) {
if (map[i+1] < 0) continue;
r = drin - dra; r = drin - dra;
itype = i; itype = map[i+1];
iparam_i = elem2param[itype][itype][itype]; iparam_i = elem2param[itype][itype][itype];
z = params[iparam_i].esm; z = params[iparam_i].esm;
exp2ershift = exp(-2.0*z*rc); exp2ershift = exp(-2.0*z*rc);
afbshift = -exp2ershift*(z+1.0/rc); afbshift = -exp2ershift*(z+1.0/rc);
dafbshift = exp2ershift*(2.0*z*z+2.0*z/rc+1.0/(rc*rc)); dafbshift = exp2ershift*(2.0*z*z+2.0*z/rc+1.0/(rc*rc));
if (comm->me == 0 && screen)
fprintf(screen," element[%d] = %-2s, z = %g\n",i+1,elements[map[i+1]],z);
for (j = 0; j < ncoul; j++) { for (j = 0; j < ncoul; j++) {
exp2er = exp(-2.0 * z * r); exp2er = exp(-2.0 * z * r);
phin[j][i] = 1.0 - exp2er * (1.0 + 2.0 * z * r * (1.0 + z * r)); phin[j][i] = 1.0 - exp2er * (1.0 + 2.0 * z * r * (1.0 + z * r));
@ -2460,10 +2464,12 @@ void PairComb3::tables()
} }
for (i = 0; i < n; i ++) { for (i = 0; i < n; i ++) {
if (map[i+1] < 0) continue;
for (j = 0; j < n; j ++) { for (j = 0; j < n; j ++) {
if (map[j+1] < 0) continue;
r = drin - dra; r = drin - dra;
if (j == i) { if (j == i) {
itype = i; itype = map[i+1];
inty = intype[itype][itype]; inty = intype[itype][itype];
iparam_i = elem2param[itype][itype][itype]; iparam_i = elem2param[itype][itype][itype];
z = params[iparam_i].esm; z = params[iparam_i].esm;
@ -2488,8 +2494,8 @@ void PairComb3::tables()
r += dra; r += dra;
} }
} else if (j != i) { } else if (j != i) {
itype = i; itype = map[i+1];
jtype = j; jtype = map[j+1];
inty = intype[itype][jtype]; inty = intype[itype][jtype];
iparam_ij = elem2param[itype][jtype][jtype]; iparam_ij = elem2param[itype][jtype][jtype];
ea = params[iparam_ij].esm; ea = params[iparam_ij].esm;

View File

@ -304,7 +304,7 @@ void BondTable::read_table(Table *tb, char *file, char *keyword)
while (1) { while (1) {
if (fgets(line,MAXLINE,fp) == NULL) if (fgets(line,MAXLINE,fp) == NULL)
error->one(FLERR,"Did not find keyword in table file"); error->one(FLERR,"Did not find keyword in table file");
if (strspn(line," \t\n") == strlen(line)) continue; // blank line if (strspn(line," \t\n\r") == strlen(line)) continue; // blank line
if (line[0] == '#') continue; // comment if (line[0] == '#') continue; // comment
char *word = strtok(line," \t\n\r"); char *word = strtok(line," \t\n\r");
if (strcmp(word,keyword) == 0) break; // matching keyword if (strcmp(word,keyword) == 0) break; // matching keyword

View File

@ -250,6 +250,9 @@ FixRigid::FixRigid(LAMMPS *lmp, int narg, char **arg) :
if (domain->dimension == 2) fflag[i][2] = tflag[i][0] = tflag[i][1] = 0.0; if (domain->dimension == 2) fflag[i][2] = tflag[i][0] = tflag[i][1] = 0.0;
} }
// number of linear rigid bodies is counted later
nlinear = 0;
// parse optional args // parse optional args
int seed; int seed;
@ -687,6 +690,7 @@ void FixRigid::init()
ndof += fflag[ibody][0] + fflag[ibody][1] + fflag[ibody][2]; ndof += fflag[ibody][0] + fflag[ibody][1] + fflag[ibody][2];
ndof += tflag[ibody][0] + tflag[ibody][1] + tflag[ibody][2]; ndof += tflag[ibody][0] + tflag[ibody][1] + tflag[ibody][2];
} }
ndof -= nlinear;
if (ndof > 0.0) tfactor = force->mvv2e / (ndof * force->boltz); if (ndof > 0.0) tfactor = force->mvv2e / (ndof * force->boltz);
else tfactor = 0.0; else tfactor = 0.0;
} }
@ -1140,12 +1144,16 @@ int FixRigid::dof(int tgroup)
// 2d body with any finite-size M should have 3 dof, remove (2N+3M) - 3 // 2d body with any finite-size M should have 3 dof, remove (2N+3M) - 3
int n = 0; int n = 0;
nlinear = 0;
if (domain->dimension == 3) { if (domain->dimension == 3) {
for (int ibody = 0; ibody < nbody; ibody++) for (int ibody = 0; ibody < nbody; ibody++)
if (nall[ibody]+mall[ibody] == nrigid[ibody]) { if (nall[ibody]+mall[ibody] == nrigid[ibody]) {
n += 3*nall[ibody] + 6*mall[ibody] - 6; n += 3*nall[ibody] + 6*mall[ibody] - 6;
if (inertia[ibody][0] == 0.0 || inertia[ibody][1] == 0.0 || if (inertia[ibody][0] == 0.0 || inertia[ibody][1] == 0.0 ||
inertia[ibody][2] == 0.0) n++; inertia[ibody][2] == 0.0) {
n++;
nlinear++;
}
} }
} else if (domain->dimension == 2) { } else if (domain->dimension == 2) {
for (int ibody = 0; ibody < nbody; ibody++) for (int ibody = 0; ibody < nbody; ibody++)

View File

@ -72,6 +72,7 @@ class FixRigid : public Fix {
int dimension; // # of dimensions int dimension; // # of dimensions
int nbody; // # of rigid bodies int nbody; // # of rigid bodies
int nlinear; // # of linear rigid bodies
int *nrigid; // # of atoms in each rigid body int *nrigid; // # of atoms in each rigid body
int *mol2body; // convert mol-ID to rigid body index int *mol2body; // convert mol-ID to rigid body index
int *body2mol; // convert rigid body index to mol-ID int *body2mol; // convert rigid body index to mol-ID

View File

@ -59,17 +59,19 @@ FixRigidNHSmall::FixRigidNHSmall(LAMMPS *lmp, int narg, char **arg) :
(p_flag[2] == 1 && p_period[2] <= 0.0)) (p_flag[2] == 1 && p_period[2] <= 0.0))
error->all(FLERR,"Fix rigid/small npt/nph period must be > 0.0"); error->all(FLERR,"Fix rigid/small npt/nph period must be > 0.0");
if (domain->dimension == 2 && p_flag[2]) dimension = domain->dimension;
if (dimension == 2 && p_flag[2])
error->all(FLERR,"Invalid fix rigid/small npt/nph command " error->all(FLERR,"Invalid fix rigid/small npt/nph command "
"for a 2d simulation"); "for a 2d simulation");
if (domain->dimension == 2 && (pcouple == YZ || pcouple == XZ)) if (dimension == 2 && (pcouple == YZ || pcouple == XZ))
error->all(FLERR,"Invalid fix rigid/small npt/nph command " error->all(FLERR,"Invalid fix rigid/small npt/nph command "
"for a 2d simulation"); "for a 2d simulation");
if (pcouple == XYZ && (p_flag[0] == 0 || p_flag[1] == 0)) if (pcouple == XYZ && (p_flag[0] == 0 || p_flag[1] == 0))
error->all(FLERR,"Invalid fix rigid/small npt/nph command " error->all(FLERR,"Invalid fix rigid/small npt/nph command "
"pressure settings"); "pressure settings");
if (pcouple == XYZ && domain->dimension == 3 && p_flag[2] == 0) if (pcouple == XYZ && dimension == 3 && p_flag[2] == 0)
error->all(FLERR,"Invalid fix rigid/small npt/nph command " error->all(FLERR,"Invalid fix rigid/small npt/nph command "
"pressure settings"); "pressure settings");
if (pcouple == XY && (p_flag[0] == 0 || p_flag[1] == 0)) if (pcouple == XY && (p_flag[0] == 0 || p_flag[1] == 0))
@ -97,12 +99,12 @@ FixRigidNHSmall::FixRigidNHSmall(LAMMPS *lmp, int narg, char **arg) :
"Cannot use fix rigid/small npt/nph on a " "Cannot use fix rigid/small npt/nph on a "
"non-periodic dimension"); "non-periodic dimension");
if (pcouple == XYZ && domain->dimension == 3 && if (pcouple == XYZ && dimension == 3 &&
(p_start[0] != p_start[1] || p_start[0] != p_start[2] || (p_start[0] != p_start[1] || p_start[0] != p_start[2] ||
p_stop[0] != p_stop[1] || p_stop[0] != p_stop[2] || p_stop[0] != p_stop[1] || p_stop[0] != p_stop[2] ||
p_period[0] != p_period[1] || p_period[0] != p_period[2])) p_period[0] != p_period[1] || p_period[0] != p_period[2]))
error->all(FLERR,"Invalid fix rigid/small npt/nph command pressure settings"); error->all(FLERR,"Invalid fix rigid/small npt/nph command pressure settings");
if (pcouple == XYZ && domain->dimension == 2 && if (pcouple == XYZ && dimension == 2 &&
(p_start[0] != p_start[1] || p_stop[0] != p_stop[1] || (p_start[0] != p_start[1] || p_stop[0] != p_stop[1] ||
p_period[0] != p_period[1])) p_period[0] != p_period[1]))
error->all(FLERR,"Invalid fix rigid/small npt/nph command pressure settings"); error->all(FLERR,"Invalid fix rigid/small npt/nph command pressure settings");
@ -224,7 +226,6 @@ void FixRigidNHSmall::init()
boltz = force->boltz; boltz = force->boltz;
nktv2p = force->nktv2p; nktv2p = force->nktv2p;
mvv2e = force->mvv2e; mvv2e = force->mvv2e;
dimension = domain->dimension;
if (force->kspace) kspace_flag = 1; if (force->kspace) kspace_flag = 1;
else kspace_flag = 0; else kspace_flag = 0;
@ -322,7 +323,7 @@ void FixRigidNHSmall::setup(int vflag)
nf_r = dimension * nlocal_body; nf_r = dimension * nlocal_body;
for (int ibody = 0; ibody < nlocal_body; ibody++) { for (int ibody = 0; ibody < nlocal_body; ibody++) {
Body *b = &body[ibody]; Body *b = &body[ibody];
for (int k = 0; k < domain->dimension; k++) for (int k = 0; k < dimension; k++)
if (fabs(b->inertia[k]) < EPSILON) nf_r--; if (fabs(b->inertia[k]) < EPSILON) nf_r--;
} }
} else if (dimension == 2) { } else if (dimension == 2) {

View File

@ -123,6 +123,9 @@ FixRigidSmall::FixRigidSmall(LAMMPS *lmp, int narg, char **arg) :
MPI_Allreduce(&maxmol,&itmp,1,MPI_LMP_TAGINT,MPI_MAX,world); MPI_Allreduce(&maxmol,&itmp,1,MPI_LMP_TAGINT,MPI_MAX,world);
maxmol = itmp; maxmol = itmp;
// number of linear molecules is counted later
nlinear = 0;
// parse optional args // parse optional args
int seed; int seed;
@ -1028,12 +1031,16 @@ int FixRigidSmall::dof(int tgroup)
double *inertia; double *inertia;
int n = 0; int n = 0;
nlinear = 0;
if (domain->dimension == 3) { if (domain->dimension == 3) {
for (int ibody = 0; ibody < nlocal_body; ibody++) { for (int ibody = 0; ibody < nlocal_body; ibody++) {
if (counts[ibody][0]+counts[ibody][1] == counts[ibody][2]) { if (counts[ibody][0]+counts[ibody][1] == counts[ibody][2]) {
n += 3*counts[ibody][0] + 6*counts[ibody][1] - 6; n += 3*counts[ibody][0] + 6*counts[ibody][1] - 6;
inertia = body[ibody].inertia; inertia = body[ibody].inertia;
if (inertia[0] == 0.0 || inertia[1] == 0.0 || inertia[2] == 0.0) n++; if (inertia[0] == 0.0 || inertia[1] == 0.0 || inertia[2] == 0.0) {
n++;
nlinear++;
}
} }
} }
} else if (domain->dimension == 2) { } else if (domain->dimension == 2) {
@ -3404,7 +3411,7 @@ double FixRigidSmall::compute_scalar()
double tall; double tall;
MPI_Allreduce(&t,&tall,1,MPI_DOUBLE,MPI_SUM,world); MPI_Allreduce(&t,&tall,1,MPI_DOUBLE,MPI_SUM,world);
double tfactor = force->mvv2e / (6.0*nbody * force->boltz); double tfactor = force->mvv2e / ((6.0*nbody - nlinear) * force->boltz);
tall *= tfactor; tall *= tfactor;
return tall; return tall;
} }

View File

@ -81,6 +81,7 @@ class FixRigidSmall : public Fix {
int setupflag; // 1 if body properties are setup, else 0 int setupflag; // 1 if body properties are setup, else 0
int commflag; // various modes of forward/reverse comm int commflag; // various modes of forward/reverse comm
int nbody; // total # of rigid bodies int nbody; // total # of rigid bodies
int nlinear; // total # of linear rigid bodies
tagint maxmol; // max mol-ID tagint maxmol; // max mol-ID
double maxextent; // furthest distance from body owner to body atom double maxextent; // furthest distance from body owner to body atom

View File

@ -232,47 +232,50 @@ void ComputeAcklandAtom::compute_peratom()
} }
} }
if (chi[7] > 0 || n0 < 11) structure[i] = UNKNOWN;
else if (chi[0] == 7) structure[i] = BCC;
else if (chi[0] == 6) structure[i] = FCC;
else if (chi[0] == 3) structure[i] = HCP;
else {
// Deviations from the different lattice structures // Deviations from the different lattice structures
double delta_bcc = 0.35*chi[4]/(double)(chi[5]+chi[6]-chi[4]);
double delta_cp = fabs(1.-(double)chi[6]/24.); double delta_cp = fabs(1.-(double)chi[6]/24.);
double delta_fcc = 0.61*(fabs((double)(chi[0]+chi[1]-6.))+
(double)chi[2])/6.0; // ensure we do not get divide by zero
double delta_hcp = (fabs((double)chi[0]-3.)+ // and if we will, make delta_bcc irrelevant
fabs((double)chi[0]+(double)chi[1]+ double delta_bcc = delta_cp + 1.0;
(double)chi[2]+(double)chi[3]-9.0))/12.0; int chi56m4 = chi[5]+chi[6]-chi[4];
// note that chi[7] presumed zero
if (chi56m4 != 0) delta_bcc = 0.35*chi[4]/(double)chi56m4;
double delta_fcc = 0.61*(fabs((double)(chi[0]+chi[1]-6))
+(double)chi[2])/6.0;
double delta_hcp = (fabs((double)chi[0]-3.)+fabs((double)chi[0]
+(double)chi[1]+(double)chi[2]+(double)chi[3]
-9.0))/12.0;
// Identification of the local structure according to the reference // Identification of the local structure according to the reference
if (chi[0] == 7) { delta_bcc = 0.; } if (delta_bcc >= 0.1 && delta_cp >= 0.1 && delta_fcc >= 0.1
else if (chi[0] == 6) { delta_fcc = 0.; } && delta_hcp >= 0.1) structure[i] = UNKNOWN;
else if (chi[0] <= 3) { delta_hcp = 0.; }
if (chi[7] > 0.) // not part of Ackland-Jones 2006; included for backward compatibility
structure[i] = UNKNOWN; if (chi[4] < 3. && n1 == 12) structure[i] = ICO;
else
if (chi[4] < 3.) else {
{ if (delta_bcc <= delta_cp && n1 > 10 && n1 < 13) structure[i] = BCC;
if (n1 > 13 || n1 < 11) else {
structure[i] = UNKNOWN; if (n0 > 12) structure[i] = UNKNOWN;
else else {
structure[i] = ICO; if (delta_fcc < delta_hcp) structure[i] = FCC;
} else
if (delta_bcc <= delta_cp)
{
if (n1 < 11)
structure[i] = UNKNOWN;
else
structure[i] = BCC;
} else
if (n1 > 12 || n1 < 11)
structure[i] = UNKNOWN;
else
if (delta_fcc < delta_hcp)
structure[i] = FCC;
else else
structure[i] = HCP; structure[i] = HCP;
}
}
}
}
} else structure[i] = 0.0; } else structure[i] = 0.0;
} }
} }

View File

@ -67,7 +67,7 @@ FixWall::FixWall(LAMMPS *lmp, int narg, char **arg) :
else if (strcmp(arg[iarg],"zlo") == 0) newwall = ZLO; else if (strcmp(arg[iarg],"zlo") == 0) newwall = ZLO;
else if (strcmp(arg[iarg],"zhi") == 0) newwall = ZHI; else if (strcmp(arg[iarg],"zhi") == 0) newwall = ZHI;
for (int m = 0; m < nwall; m++) for (int m = 0; (m < nwall) && (m < 6); m++)
if (newwall == wallwhich[m]) if (newwall == wallwhich[m])
error->all(FLERR,"Wall defined twice in fix wall command"); error->all(FLERR,"Wall defined twice in fix wall command");

View File

@ -58,7 +58,7 @@ FixWallReflect::FixWallReflect(LAMMPS *lmp, int narg, char **arg) :
else if (strcmp(arg[iarg],"zlo") == 0) newwall = ZLO; else if (strcmp(arg[iarg],"zlo") == 0) newwall = ZLO;
else if (strcmp(arg[iarg],"zhi") == 0) newwall = ZHI; else if (strcmp(arg[iarg],"zhi") == 0) newwall = ZHI;
for (int m = 0; m < nwall; m++) for (int m = 0; (m < nwall) && (m < 6); m++)
if (newwall == wallwhich[m]) if (newwall == wallwhich[m])
error->all(FLERR,"Wall defined twice in fix wall/reflect command"); error->all(FLERR,"Wall defined twice in fix wall/reflect command");

View File

@ -106,6 +106,13 @@ Force::~Force()
if (improper) delete improper; if (improper) delete improper;
if (kspace) delete kspace; if (kspace) delete kspace;
pair = NULL;
bond = NULL;
angle = NULL;
dihedral = NULL;
improper = NULL;
kspace = NULL;
delete pair_map; delete pair_map;
} }

View File

@ -1557,6 +1557,7 @@ void ReadData::open(char *file)
void ReadData::parse_keyword(int first) void ReadData::parse_keyword(int first)
{ {
int eof = 0; int eof = 0;
int done = 0;
// proc 0 reads upto non-blank line plus 1 following line // proc 0 reads upto non-blank line plus 1 following line
// eof is set to 1 if any read hits end-of-file // eof is set to 1 if any read hits end-of-file
@ -1565,8 +1566,11 @@ void ReadData::parse_keyword(int first)
if (!first) { if (!first) {
if (fgets(line,MAXLINE,fp) == NULL) eof = 1; if (fgets(line,MAXLINE,fp) == NULL) eof = 1;
} }
while (eof == 0 && strspn(line," \t\n\r") == strlen(line)) { while (eof == 0 && done == 0) {
int blank = strspn(line," \t\n\r");
if ((blank == strlen(line)) || (line[blank] == '#')) {
if (fgets(line,MAXLINE,fp) == NULL) eof = 1; if (fgets(line,MAXLINE,fp) == NULL) eof = 1;
} else done = 1;
} }
if (fgets(buffer,MAXLINE,fp) == NULL) eof = 1; if (fgets(buffer,MAXLINE,fp) == NULL) eof = 1;
} }

View File

@ -60,7 +60,9 @@ enum{VERSION,SMALLINT,TAGINT,BIGINT,
SPECIAL_LJ,SPECIAL_COUL, SPECIAL_LJ,SPECIAL_COUL,
MASS,PAIR,BOND,ANGLE,DIHEDRAL,IMPROPER, MASS,PAIR,BOND,ANGLE,DIHEDRAL,IMPROPER,
MULTIPROC,MPIIO,PROCSPERFILE,PERPROC, MULTIPROC,MPIIO,PROCSPERFILE,PERPROC,
IMAGEINT,BOUNDMIN}; IMAGEINT,BOUNDMIN,TIMESTEP,
ATOM_ID,ATOM_MAP_STYLE,ATOM_MAP_USER,ATOM_SORTFREQ,ATOM_SORTBIN,
COMM_MODE,COMM_CUTOFF,COMM_VEL};
#define LB_FACTOR 1.1 #define LB_FACTOR 1.1
@ -866,6 +868,27 @@ void ReadRestart::header(int incompatible)
read_int(); read_int();
read_double_vec(3,&force->special_coul[1]); read_double_vec(3,&force->special_coul[1]);
} else if (flag == TIMESTEP) {
update->dt = read_double();
} else if (flag == ATOM_ID) {
atom->tag_enable = read_int();
} else if (flag == ATOM_MAP_STYLE) {
atom->map_style = read_int();
} else if (flag == ATOM_MAP_USER) {
atom->map_user = read_int();
} else if (flag == ATOM_SORTFREQ) {
atom->sortfreq = read_int();
} else if (flag == ATOM_SORTBIN) {
atom->userbinsize = read_double();
} else if (flag == COMM_MODE) {
comm->mode = read_int();
} else if (flag == COMM_CUTOFF) {
comm->cutghostuser = read_double();
} else if (flag == COMM_VEL) {
comm->ghost_velocity = read_int();
} else error->all(FLERR,"Invalid flag in header section of restart file"); } else error->all(FLERR,"Invalid flag in header section of restart file");
flag = read_int(); flag = read_int();

View File

@ -306,7 +306,7 @@ void Thermo::compute(int flag)
// check for lost atoms // check for lost atoms
// turn off normflag if natoms = 0 to avoid divide by 0 // turn off normflag if natoms = 0 to avoid divide by 0
natoms = lost_check(); natoms = atom->natoms = lost_check();
if (natoms == 0) normflag = 0; if (natoms == 0) normflag = 0;
else normflag = normvalue; else normflag = normvalue;
@ -380,11 +380,8 @@ bigint Thermo::lost_check()
if (ntotal == atom->natoms) return ntotal; if (ntotal == atom->natoms) return ntotal;
// if not checking or already warned, just return // if not checking or already warned, just return
// reset total atom count
if (lostflag == IGNORE) return ntotal; if (lostflag == IGNORE) return ntotal;
if (lostflag == WARN && lostbefore == 1) { if (lostflag == WARN && lostbefore == 1) {
atom->natoms = ntotal;
return ntotal; return ntotal;
} }
@ -552,7 +549,7 @@ void Thermo::modify_params(int narg, char **arg)
format_float_user = new char[n]; format_float_user = new char[n];
strcpy(format_float_user,arg[iarg+2]); strcpy(format_float_user,arg[iarg+2]);
} else { } else {
int i = atoi(arg[iarg+1]) - 1; int i = force->inumeric(FLERR,arg[iarg+1]) - 1;
if (i < 0 || i >= nfield_initial) if (i < 0 || i >= nfield_initial)
error->all(FLERR,"Illegal thermo_modify command"); error->all(FLERR,"Illegal thermo_modify command");
if (format_user[i]) delete [] format_user[i]; if (format_user[i]) delete [] format_user[i];

View File

@ -73,6 +73,7 @@ void WriteData::command(int narg, char **arg)
// noinit is a hidden arg, only used by -r command-line switch // noinit is a hidden arg, only used by -r command-line switch
pairflag = II; pairflag = II;
coeffflag = 1;
int noinit = 0; int noinit = 0;
int iarg = 1; int iarg = 1;
@ -86,6 +87,9 @@ void WriteData::command(int narg, char **arg)
} else if (strcmp(arg[iarg],"noinit") == 0) { } else if (strcmp(arg[iarg],"noinit") == 0) {
noinit = 1; noinit = 1;
iarg++; iarg++;
} else if (strcmp(arg[iarg],"nocoeff") == 0) {
coeffflag = 0;
iarg++;
} else error->all(FLERR,"Illegal write_data command"); } else error->all(FLERR,"Illegal write_data command");
} }
@ -176,7 +180,7 @@ void WriteData::write(char *file)
if (me == 0) { if (me == 0) {
header(); header();
type_arrays(); type_arrays();
force_fields(); if (coeffflag) force_fields();
} }
// per atom info // per atom info

View File

@ -34,6 +34,7 @@ class WriteData : protected Pointers {
private: private:
int me,nprocs; int me,nprocs;
int pairflag; int pairflag;
int coeffflag;
FILE *fp; FILE *fp;
bigint nbonds_local,nbonds; bigint nbonds_local,nbonds;
bigint nangles_local,nangles; bigint nangles_local,nangles;

View File

@ -22,6 +22,8 @@
#include "dump_image.h" #include "dump_image.h"
#include "atom.h" #include "atom.h"
#include "group.h" #include "group.h"
#include "input.h"
#include "update.h"
#include "error.h" #include "error.h"
using namespace LAMMPS_NS; using namespace LAMMPS_NS;
@ -75,6 +77,9 @@ void WriteDump::command(int narg, char **arg)
if (strcmp(arg[1],"cfg") == 0) if (strcmp(arg[1],"cfg") == 0)
((DumpCFG *) dump)->multifile_override = 1; ((DumpCFG *) dump)->multifile_override = 1;
if (update->first_update == 0)
error->warning(FLERR,"Calling write_dump before a full system init.");
dump->init(); dump->init();
dump->write(); dump->write();

View File

@ -47,4 +47,12 @@ E: Unknown dump style
The choice of dump style is unknown. The choice of dump style is unknown.
W: Calling write_dump before a full system init.
The write_dump command is used before the system has been fully
initialized as part of a 'run' or 'minimize' command. Not all dump
styles and features are fully supported at this point and thus the
command may fail or produce incomplete or incorrect output. Insert
a "run 0" command, if a full system init is required.
*/ */

View File

@ -59,7 +59,9 @@ enum{VERSION,SMALLINT,TAGINT,BIGINT,
SPECIAL_LJ,SPECIAL_COUL, SPECIAL_LJ,SPECIAL_COUL,
MASS,PAIR,BOND,ANGLE,DIHEDRAL,IMPROPER, MASS,PAIR,BOND,ANGLE,DIHEDRAL,IMPROPER,
MULTIPROC,MPIIO,PROCSPERFILE,PERPROC, MULTIPROC,MPIIO,PROCSPERFILE,PERPROC,
IMAGEINT,BOUNDMIN}; IMAGEINT,BOUNDMIN,TIMESTEP,
ATOM_ID,ATOM_MAP_STYLE,ATOM_MAP_USER,ATOM_SORTFREQ,ATOM_SORTBIN,
COMM_MODE,COMM_CUTOFF,COMM_VEL};
enum{IGNORE,WARN,ERROR}; // same as thermo.cpp enum{IGNORE,WARN,ERROR}; // same as thermo.cpp
@ -497,6 +499,18 @@ void WriteRestart::header()
write_double_vec(SPECIAL_LJ,3,&force->special_lj[1]); write_double_vec(SPECIAL_LJ,3,&force->special_lj[1]);
write_double_vec(SPECIAL_COUL,3,&force->special_coul[1]); write_double_vec(SPECIAL_COUL,3,&force->special_coul[1]);
write_double(TIMESTEP,update->dt);
write_int(ATOM_ID,atom->tag_enable);
write_int(ATOM_MAP_STYLE,atom->map_style);
write_int(ATOM_MAP_USER,atom->map_user);
write_int(ATOM_SORTFREQ,atom->sortfreq);
write_double(ATOM_SORTBIN,atom->userbinsize);
write_int(COMM_MODE,comm->mode);
write_double(COMM_CUTOFF,comm->cutghostuser);
write_int(COMM_VEL,comm->ghost_velocity);
// -1 flag signals end of header // -1 flag signals end of header
int flag = -1; int flag = -1;