git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@14868 f3b2605a-c512-4ea7-a41b-209d697bcdaa
This commit is contained in:
@ -123,6 +123,7 @@ void ReadData::command(int narg, char **arg)
|
||||
// optional args
|
||||
|
||||
addflag = NONE;
|
||||
coeffflag = 1;
|
||||
id_offset = 0;
|
||||
offsetflag = shiftflag = 0;
|
||||
toffset = boffset = aoffset = doffset = ioffset = 0;
|
||||
@ -172,7 +173,9 @@ void ReadData::command(int narg, char **arg)
|
||||
if (domain->dimension == 2 && shift[2] != 0.0)
|
||||
error->all(FLERR,"Non-zero read_data shift z value for 2d simulation");
|
||||
iarg += 4;
|
||||
|
||||
} else if (strcmp(arg[iarg],"nocoeff") == 0) {
|
||||
coeffflag = 0;
|
||||
iarg ++;
|
||||
} else if (strcmp(arg[iarg],"extra/atom/types") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal read_data command");
|
||||
extra_atom_types = force->inumeric(FLERR,arg[iarg+1]);
|
||||
@ -279,6 +282,49 @@ void ReadData::command(int narg, char **arg)
|
||||
MPI_Allreduce(&max,&id_offset,1,MPI_LMP_TAGINT,MPI_MAX,world);
|
||||
}
|
||||
|
||||
// set up pointer to hold original styles while we replace them with "zero"
|
||||
Pair *saved_pair = NULL;
|
||||
Bond *saved_bond = NULL;
|
||||
Angle *saved_angle = NULL;
|
||||
Dihedral *saved_dihedral = NULL;
|
||||
Improper *saved_improper = NULL;
|
||||
KSpace *saved_kspace = NULL;
|
||||
|
||||
if (coeffflag == 0) {
|
||||
char *coeffs[2];
|
||||
coeffs[0] = (char *) "10.0";
|
||||
coeffs[1] = (char *) "nocoeff";
|
||||
|
||||
saved_pair = force->pair;
|
||||
force->pair = NULL;
|
||||
force->create_pair("zero",0);
|
||||
if (force->pair) force->pair->settings(2,coeffs);
|
||||
|
||||
coeffs[0] = coeffs[1];
|
||||
saved_bond = force->bond;
|
||||
force->bond = NULL;
|
||||
force->create_bond("zero",0);
|
||||
if (force->bond) force->bond->settings(1,coeffs);
|
||||
|
||||
saved_angle = force->angle;
|
||||
force->angle = NULL;
|
||||
force->create_angle("zero",0);
|
||||
if (force->angle) force->angle->settings(1,coeffs);
|
||||
|
||||
saved_dihedral = force->dihedral;
|
||||
force->dihedral = NULL;
|
||||
force->create_dihedral("zero",0);
|
||||
if (force->dihedral) force->dihedral->settings(1,coeffs);
|
||||
|
||||
saved_improper = force->improper;
|
||||
force->improper = NULL;
|
||||
force->create_improper("zero",0);
|
||||
if (force->improper) force->improper->settings(1,coeffs);
|
||||
|
||||
saved_kspace = force->kspace;
|
||||
force->kspace = NULL;
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------
|
||||
|
||||
// perform 1-pass read if no molecular topology in file
|
||||
@ -778,6 +824,26 @@ void ReadData::command(int narg, char **arg)
|
||||
error->all(FLERR,
|
||||
"Read_data shrink wrap did not assign all atoms correctly");
|
||||
}
|
||||
|
||||
// restore old styles, when reading with nocoeff flag given
|
||||
if (coeffflag == 0) {
|
||||
if (force->pair) delete force->pair;
|
||||
force->pair = saved_pair;
|
||||
|
||||
if (force->bond) delete force->bond;
|
||||
force->bond = saved_bond;
|
||||
|
||||
if (force->angle) delete force->angle;
|
||||
force->angle = saved_angle;
|
||||
|
||||
if (force->dihedral) delete force->dihedral;
|
||||
force->dihedral = saved_dihedral;
|
||||
|
||||
if (force->improper) delete force->improper;
|
||||
force->improper = saved_improper;
|
||||
|
||||
force->kspace = saved_kspace;
|
||||
}
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user