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

This commit is contained in:
sjplimp
2011-01-04 20:07:43 +00:00
parent b414a4a22a
commit 3333f6a924
5 changed files with 104 additions and 93 deletions

View File

@ -337,10 +337,10 @@ void ReadData::header(int flag)
// search line for header keyword and set corresponding variable
if (strstr(line,"atoms")) sscanf(line,"%lu",&atom->natoms);
else if (strstr(line,"bonds")) sscanf(line,"%d",&atom->nbonds);
else if (strstr(line,"angles")) sscanf(line,"%d",&atom->nangles);
else if (strstr(line,"dihedrals")) sscanf(line,"%d",&atom->ndihedrals);
else if (strstr(line,"impropers")) sscanf(line,"%d",&atom->nimpropers);
else if (strstr(line,"bonds")) sscanf(line,"%lu",&atom->nbonds);
else if (strstr(line,"angles")) sscanf(line,"%lu",&atom->nangles);
else if (strstr(line,"dihedrals")) sscanf(line,"lu",&atom->ndihedrals);
else if (strstr(line,"impropers")) sscanf(line,"%lu",&atom->nimpropers);
else if (strstr(line,"atom types")) sscanf(line,"%d",&atom->ntypes);
else if (strstr(line,"bond types")) sscanf(line,"%d",&atom->nbondtypes);
@ -434,12 +434,12 @@ void ReadData::atoms()
// check that all atoms were assigned correctly
double tmp = atom->nlocal;
MPI_Allreduce(&tmp,&natoms,1,MPI_DOUBLE,MPI_SUM,world);
bigint tmp = atom->nlocal;
MPI_Allreduce(&tmp,&natoms,1,MPI_UNSIGNED_LONG,MPI_SUM,world);
if (me == 0) {
if (screen) fprintf(screen," %.15g atoms\n",natoms);
if (logfile) fprintf(logfile," %.15g atoms\n",natoms);
if (screen) fprintf(screen," %lu atoms\n",natoms);
if (logfile) fprintf(logfile," %lu atoms\n",natoms);
}
if (natoms != atom->natoms) error->all("Did not assign all atoms correctly");
@ -529,8 +529,8 @@ void ReadData::velocities()
}
if (me == 0) {
if (screen) fprintf(screen," %.15g velocities\n",natoms);
if (logfile) fprintf(logfile," %.15g velocities\n",natoms);
if (screen) fprintf(screen," %lu velocities\n",natoms);
if (logfile) fprintf(logfile," %lu velocities\n",natoms);
}
}
@ -540,9 +540,11 @@ void ReadData::bonds()
{
int i,m,nchunk;
int nread = 0;
while (nread < atom->nbonds) {
nchunk = MIN(atom->nbonds-nread,CHUNK);
bigint nread = 0;
bigint nbonds = atom->nbonds;
while (nread < nbonds) {
nchunk = MIN(nbonds-nread,CHUNK);
if (me == 0) {
char *eof;
m = 0;
@ -563,17 +565,16 @@ void ReadData::bonds()
// check that bonds were assigned correctly
int nlocal = atom->nlocal;
int sum;
int n = 0;
bigint sum;
bigint n = 0;
for (i = 0; i < nlocal; i++) n += atom->num_bond[i];
MPI_Allreduce(&n,&sum,1,MPI_INT,MPI_SUM,world);
MPI_Allreduce(&n,&sum,1,MPI_UNSIGNED_LONG,MPI_SUM,world);
int factor = 1;
if (!force->newton_bond) factor = 2;
if (me == 0) {
if (screen) fprintf(screen," %d bonds\n",sum/factor);
if (logfile) fprintf(logfile," %d bonds\n",sum/factor);
if (screen) fprintf(screen," %lu bonds\n",sum/factor);
if (logfile) fprintf(logfile," %lu bonds\n",sum/factor);
}
if (sum != factor*atom->nbonds) error->all("Bonds assigned incorrectly");
}
@ -584,9 +585,11 @@ void ReadData::angles()
{
int i,m,nchunk;
int nread = 0;
while (nread < atom->nangles) {
nchunk = MIN(atom->nangles-nread,CHUNK);
bigint nread = 0;
bigint nangles = atom->nangles;
while (nread < nangles) {
nchunk = MIN(nangles-nread,CHUNK);
if (me == 0) {
char *eof;
m = 0;
@ -604,20 +607,19 @@ void ReadData::angles()
nread += nchunk;
}
// check that angles were assigned correctly
// check that ang
int nlocal = atom->nlocal;
int sum;
int n = 0;
bigint sum;
bigint n = 0;
for (i = 0; i < nlocal; i++) n += atom->num_angle[i];
MPI_Allreduce(&n,&sum,1,MPI_INT,MPI_SUM,world);
MPI_Allreduce(&n,&sum,1,MPI_UNSIGNED_LONG,MPI_SUM,world);
int factor = 1;
if (!force->newton_bond) factor = 3;
if (me == 0) {
if (screen) fprintf(screen," %d angles\n",sum/factor);
if (logfile) fprintf(logfile," %d angles\n",sum/factor);
if (screen) fprintf(screen," %lu angles\n",sum/factor);
if (logfile) fprintf(logfile," %lu angles\n",sum/factor);
}
if (sum != factor*atom->nangles) error->all("Angles assigned incorrectly");
}
@ -628,9 +630,11 @@ void ReadData::dihedrals()
{
int i,m,nchunk;
int nread = 0;
while (nread < atom->ndihedrals) {
nchunk = MIN(atom->ndihedrals-nread,CHUNK);
bigint nread = 0;
bigint ndihedrals = atom->ndihedrals;
while (nread < ndihedrals) {
nchunk = MIN(ndihedrals-nread,CHUNK);
if (me == 0) {
char *eof;
m = 0;
@ -651,17 +655,16 @@ void ReadData::dihedrals()
// check that dihedrals were assigned correctly
int nlocal = atom->nlocal;
int sum;
int n = 0;
bigint sum;
bigint n = 0;
for (i = 0; i < nlocal; i++) n += atom->num_dihedral[i];
MPI_Allreduce(&n,&sum,1,MPI_INT,MPI_SUM,world);
MPI_Allreduce(&n,&sum,1,MPI_UNSIGNED_LONG,MPI_SUM,world);
int factor = 1;
if (!force->newton_bond) factor = 4;
if (me == 0) {
if (screen) fprintf(screen," %d dihedrals\n",sum/factor);
if (logfile) fprintf(logfile," %d dihedrals\n",sum/factor);
if (screen) fprintf(screen," %lu dihedrals\n",sum/factor);
if (logfile) fprintf(logfile," %lu dihedrals\n",sum/factor);
}
if (sum != factor*atom->ndihedrals)
error->all("Dihedrals assigned incorrectly");
@ -673,9 +676,11 @@ void ReadData::impropers()
{
int i,m,nchunk;
int nread = 0;
while (nread < atom->nimpropers) {
nchunk = MIN(atom->nimpropers-nread,CHUNK);
bigint nread = 0;
bigint nimpropers = atom->nimpropers;
while (nread < nimpropers) {
nchunk = MIN(nread,CHUNK);
if (me == 0) {
char *eof;
m = 0;
@ -696,17 +701,16 @@ void ReadData::impropers()
// check that impropers were assigned correctly
int nlocal = atom->nlocal;
int sum;
int n = 0;
bigint sum;
bigint n = 0;
for (i = 0; i < nlocal; i++) n += atom->num_improper[i];
MPI_Allreduce(&n,&sum,1,MPI_INT,MPI_SUM,world);
MPI_Allreduce(&n,&sum,1,MPI_UNSIGNED_LONG,MPI_SUM,world);
int factor = 1;
if (!force->newton_bond) factor = 4;
if (me == 0) {
if (screen) fprintf(screen," %d impropers\n",sum/factor);
if (logfile) fprintf(logfile," %d impropers\n",sum/factor);
if (screen) fprintf(screen," %lu impropers\n",sum/factor);
if (logfile) fprintf(logfile," %lu impropers\n",sum/factor);
}
if (sum != factor*atom->nimpropers)
error->all("Impropers assigned incorrectly");
@ -972,6 +976,9 @@ void ReadData::scan(int &bond_per_atom, int &angle_per_atom,
int i,tmp1,tmp2,atom1,atom2,atom3,atom4;
char *eof;
if (atom->natoms > MAXINT32)
error->all("Molecular data file has too many atoms");
int natoms = static_cast<int> (atom->natoms);
bond_per_atom = angle_per_atom = dihedral_per_atom = improper_per_atom = 0;