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

This commit is contained in:
sjplimp 2014-03-10 15:45:25 +00:00
parent df0c8d061f
commit 3d6ac732ad
14 changed files with 42 additions and 34 deletions

View File

@ -620,7 +620,7 @@ int Atom::count_words(const char *line)
strcpy(copy,line);
char *ptr;
if (ptr = strchr(copy,'#')) *ptr = '\0';
if ((ptr = strchr(copy,'#'))) *ptr = '\0';
if (strtok(copy," \t\n\r\f") == NULL) {
memory->destroy(copy);

View File

@ -105,7 +105,7 @@ Dump::Dump(LAMMPS *lmp, int narg, char **arg) : Pointers(lmp)
multiname = NULL;
char *ptr;
if (ptr = strchr(filename,'%')) {
if ((ptr = strchr(filename,'%'))) {
if (strstr(style,"mpiio"))
error->all(FLERR,
"Dump file MPI-IO output not allowed with % in filename");

View File

@ -969,14 +969,14 @@ int DumpImage::modify_param(int narg, char **arg)
int ncount = 1;
char *nextptr;
char *ptr = arg[2];
while (nextptr = strchr(ptr,'/')) {
while ((nextptr = strchr(ptr,'/'))) {
ptr = nextptr + 1;
ncount++;
}
char **ptrs = new char*[ncount+1];
ncount = 0;
ptrs[ncount++] = strtok(arg[2],"/");
while (ptrs[ncount++] = strtok(NULL,"/"));
while ((ptrs[ncount++] = strtok(NULL,"/")));
ncount--;
// assign each of ncount colors in round-robin fashion to types
@ -1029,14 +1029,14 @@ int DumpImage::modify_param(int narg, char **arg)
int ncount = 1;
char *nextptr;
char *ptr = arg[2];
while (nextptr = strchr(ptr,'/')) {
while ((nextptr = strchr(ptr,'/'))) {
ptr = nextptr + 1;
ncount++;
}
char **ptrs = new char*[ncount+1];
ncount = 0;
ptrs[ncount++] = strtok(arg[2],"/");
while (ptrs[ncount++] = strtok(NULL,"/"));
while ((ptrs[ncount++] = strtok(NULL,"/")));
ncount--;
// assign each of ncount colors in round-robin fashion to types

View File

@ -752,7 +752,7 @@ void FixMove::final_integrate()
for (int i = 0; i < nlocal; i++) {
if (mask[i] & groupbit) {
if (xflag)
if (xflag) {
if (rmass) {
dtfm = dtf / rmass[i];
v[i][0] += dtfm * f[i][0];
@ -760,8 +760,9 @@ void FixMove::final_integrate()
dtfm = dtf / mass[type[i]];
v[i][0] += dtfm * f[i][0];
}
}
if (yflag)
if (yflag) {
if (rmass) {
dtfm = dtf / rmass[i];
v[i][1] += dtfm * f[i][1];
@ -769,8 +770,9 @@ void FixMove::final_integrate()
dtfm = dtf / mass[type[i]];
v[i][1] += dtfm * f[i][1];
}
}
if (zflag)
if (zflag) {
if (rmass) {
dtfm = dtf / rmass[i];
v[i][2] += dtfm * f[i][2];
@ -778,6 +780,7 @@ void FixMove::final_integrate()
dtfm = dtf / mass[type[i]];
v[i][2] += dtfm * f[i][2];
}
}
}
}
}

View File

@ -1534,20 +1534,22 @@ double FixNH::compute_vector(int n)
n -= ilen;
} else if (pstyle == ANISO) {
ilen = 3;
if (n < ilen)
if (n < ilen) {
if (p_flag[n])
return p_hydro*(volume-vol0) / (pdim*nktv2p);
else
return 0.0;
}
n -= ilen;
} else {
ilen = 6;
if (n < ilen)
if (n < ilen) {
if (n > 2) return 0.0;
else if (p_flag[n])
return p_hydro*(volume-vol0) / (pdim*nktv2p);
else
return 0.0;
}
n -= ilen;
}
@ -1558,17 +1560,19 @@ double FixNH::compute_vector(int n)
n -= ilen;
} else if (pstyle == ANISO) {
ilen = 3;
if (n < ilen)
if (n < ilen) {
if (p_flag[n])
return 0.5*omega_dot[n]*omega_dot[n]*omega_mass[n];
else return 0.0;
}
n -= ilen;
} else {
ilen = 6;
if (n < ilen)
if (n < ilen) {
if (p_flag[n])
return 0.5*omega_dot[n]*omega_dot[n]*omega_mass[n];
else return 0.0;
}
n -= ilen;
}
@ -2139,7 +2143,7 @@ void FixNH::nh_omega_dot()
if (deviatoric_flag) compute_deviatoric();
mtk_term1 = 0.0;
if (mtk_flag)
if (mtk_flag) {
if (pstyle == ISO) {
mtk_term1 = tdof * boltz * t_current;
mtk_term1 /= pdim * atom->natoms;
@ -2150,6 +2154,7 @@ void FixNH::nh_omega_dot()
mtk_term1 += mvv_current[i];
mtk_term1 /= pdim * atom->natoms;
}
}
for (int i = 0; i < 3; i++)
if (p_flag[i]) {

View File

@ -313,7 +313,7 @@ void Molecule::read(int flag)
// trim anything from '#' onward
// if line is blank, continue
if (ptr = strchr(line,'#')) *ptr = '\0';
if ((ptr = strchr(line,'#'))) *ptr = '\0';
if (strspn(line," \t\n\r") == strlen(line)) continue;
// search line for header keywords and set corresponding variable
@ -1325,7 +1325,7 @@ int Molecule::parse(char *line, char **words, int max)
int nwords = 0;
words[nwords++] = strtok(line," \t\n\r\f");
while (ptr = strtok(NULL," \t\n\r\f")) {
while ((ptr = strtok(NULL," \t\n\r\f"))) {
if (nwords < max) words[nwords] = ptr;
nwords++;
}

View File

@ -131,7 +131,7 @@ void Neighbor::respa_nsq_no_newton(NeighList *list)
tag[j]-tagprev);
else which = 0;
if (which == 0) neighptr[n++] = j;
else if (minchange = domain->minimum_image_check(delx,dely,delz))
else if ((minchange = domain->minimum_image_check(delx,dely,delz)))
neighptr[n++] = j;
else if (which > 0) neighptr[n++] = j ^ (which << SBBITS);
} else neighptr[n++] = j;
@ -309,7 +309,7 @@ void Neighbor::respa_nsq_newton(NeighList *list)
tag[j]-tagprev);
else which = 0;
if (which == 0) neighptr[n++] = j;
else if (minchange = domain->minimum_image_check(delx,dely,delz))
else if ((minchange = domain->minimum_image_check(delx,dely,delz)))
neighptr[n++] = j;
else if (which > 0) neighptr[n++] = j ^ (which << SBBITS);
} else neighptr[n++] = j;
@ -478,7 +478,7 @@ void Neighbor::respa_bin_no_newton(NeighList *list)
tag[j]-tagprev);
else which = 0;
if (which == 0) neighptr[n++] = j;
else if (minchange = domain->minimum_image_check(delx,dely,delz))
else if ((minchange = domain->minimum_image_check(delx,dely,delz)))
neighptr[n++] = j;
else if (which > 0) neighptr[n++] = j ^ (which << SBBITS);
} else neighptr[n++] = j;
@ -651,7 +651,7 @@ void Neighbor::respa_bin_newton(NeighList *list)
tag[j]-tagprev);
else which = 0;
if (which == 0) neighptr[n++] = j;
else if (minchange = domain->minimum_image_check(delx,dely,delz))
else if ((minchange = domain->minimum_image_check(delx,dely,delz)))
neighptr[n++] = j;
else if (which > 0) neighptr[n++] = j ^ (which << SBBITS);
} else neighptr[n++] = j;
@ -695,7 +695,7 @@ void Neighbor::respa_bin_newton(NeighList *list)
tag[j]-tagprev);
else which = 0;
if (which == 0) neighptr[n++] = j;
else if (minchange = domain->minimum_image_check(delx,dely,delz))
else if ((minchange = domain->minimum_image_check(delx,dely,delz)))
neighptr[n++] = j;
else if (which > 0) neighptr[n++] = j ^ (which << SBBITS);
} else neighptr[n++] = j;
@ -873,7 +873,7 @@ void Neighbor::respa_bin_newton_tri(NeighList *list)
tag[j]-tagprev);
else which = 0;
if (which == 0) neighptr[n++] = j;
else if (minchange = domain->minimum_image_check(delx,dely,delz))
else if ((minchange = domain->minimum_image_check(delx,dely,delz)))
neighptr[n++] = j;
else if (which > 0) neighptr[n++] = j ^ (which << SBBITS);
} else neighptr[n++] = j;

View File

@ -291,7 +291,7 @@ void ProcMap::custom_grid(char *cfile, int nprocs,
if (!fgets(line,MAXLINE,fp))
error->one(FLERR,"Unexpected end of custom file");
while (1) {
if (ptr = strchr(line,'#')) *ptr = '\0';
if ((ptr = strchr(line,'#'))) *ptr = '\0';
if (strspn(line," \t\n\r") != strlen(line)) break;
if (!fgets(line,MAXLINE,fp))
error->one(FLERR,"Unexpected end of custom file");

View File

@ -619,7 +619,7 @@ void ReadData::header()
// trim anything from '#' onward
// if line is blank, continue
if (ptr = strchr(line,'#')) *ptr = '\0';
if ((ptr = strchr(line,'#'))) *ptr = '\0';
if (strspn(line," \t\n\r") == strlen(line)) continue;
// allow special fixes first chance to match and process the line
@ -1556,7 +1556,7 @@ void ReadData::skip_lines(bigint n)
void ReadData::parse_coeffs(char *line, const char *addstr, int dupflag)
{
char *ptr;
if (ptr = strchr(line,'#')) *ptr = '\0';
if ((ptr = strchr(line,'#'))) *ptr = '\0';
narg = 0;
char *word = strtok(line," \t\n\r\f");

View File

@ -549,7 +549,7 @@ void ReadRestart::file_search(char *infile, char *outfile)
char *pattern = new char[strlen(filename) + 16];
if (ptr = strchr(filename,'%')) {
if ((ptr = strchr(filename,'%'))) {
*ptr = '\0';
sprintf(pattern,"%s%s%s",filename,"base",ptr+1);
*ptr = '%';
@ -574,7 +574,7 @@ void ReadRestart::file_search(char *infile, char *outfile)
DIR *dp = opendir(dirname);
if (dp == NULL)
error->one(FLERR,"Cannot open dir to search for restart file");
while (ep = readdir(dp)) {
while ((ep = readdir(dp))) {
if (strstr(ep->d_name,begin) != ep->d_name) continue;
if ((ptr = strstr(&ep->d_name[nbegin],end)) == NULL) continue;
if (strlen(end) == 0) ptr = ep->d_name + strlen(ep->d_name);

View File

@ -100,7 +100,7 @@ void Universe::reorder(char *style, char *arg)
if (!fgets(line,MAXLINE,fp))
error->one(FLERR,"Unexpected end of -reorder file");
while (1) {
if (ptr = strchr(line,'#')) *ptr = '\0';
if ((ptr = strchr(line,'#'))) *ptr = '\0';
if (strspn(line," \t\n\r") != strlen(line)) break;
if (!fgets(line,MAXLINE,fp))
error->one(FLERR,"Unexpected end of -reorder file");

View File

@ -4088,7 +4088,7 @@ int VarReader::read_scalar(char *str)
else n = strlen(str);
if (n == 0) break; // end of file
str[n-1] = '\0'; // strip newline
if (ptr = strchr(str,'#')) *ptr = '\0'; // strip comment
if ((ptr = strchr(str,'#'))) *ptr = '\0'; // strip comment
if (strtok(str," \t\n\r\f") == NULL) continue; // skip if blank
n = strlen(str) + 1;
break;
@ -4131,7 +4131,7 @@ int VarReader::read_peratom()
else n = strlen(str);
if (n == 0) break; // end of file
str[n-1] = '\0'; // strip newline
if (ptr = strchr(str,'#')) *ptr = '\0'; // strip comment
if ((ptr = strchr(str,'#'))) *ptr = '\0'; // strip comment
if (strtok(str," \t\n\r\f") == NULL) continue; // skip if blank
n = strlen(str) + 1;
break;

View File

@ -65,7 +65,7 @@ void WriteData::command(int narg, char **arg)
int n = strlen(arg[0]) + 16;
char *file = new char[n];
if (ptr = strchr(arg[0],'*')) {
if ((ptr = strchr(arg[0],'*'))) {
*ptr = '\0';
sprintf(file,"%s" BIGINT_FORMAT "%s",arg[0],update->ntimestep,ptr+1);
} else strcpy(file,arg[0]);
@ -152,11 +152,11 @@ void WriteData::write(char *file)
// sum up bond,angle counts
// may be different than atom->nbonds,nangles if broken/turned-off
if (atom->molecular == 1 && atom->nbonds || atom->nbondtypes) {
if (atom->molecular == 1 && (atom->nbonds || atom->nbondtypes)) {
nbonds_local = atom->avec->pack_bond(NULL);
MPI_Allreduce(&nbonds_local,&nbonds,1,MPI_LMP_BIGINT,MPI_SUM,world);
}
if (atom->molecular == 1 && atom->nangles || atom->nangletypes) {
if (atom->molecular == 1 && (atom->nangles || atom->nangletypes)) {
nangles_local = atom->avec->pack_angle(NULL);
MPI_Allreduce(&nangles_local,&nangles,1,MPI_LMP_BIGINT,MPI_SUM,world);
}

View File

@ -89,7 +89,7 @@ void WriteRestart::command(int narg, char **arg)
int n = strlen(arg[0]) + 16;
char *file = new char[n];
if (ptr = strchr(arg[0],'*')) {
if ((ptr = strchr(arg[0],'*'))) {
*ptr = '\0';
sprintf(file,"%s" BIGINT_FORMAT "%s",arg[0],update->ntimestep,ptr+1);
} else strcpy(file,arg[0]);