git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@8069 f3b2605a-c512-4ea7-a41b-209d697bcdaa
This commit is contained in:
@ -206,7 +206,7 @@ void PairHybrid::settings(int narg, char **arg)
|
|||||||
|
|
||||||
build_styles();
|
build_styles();
|
||||||
|
|
||||||
// allocate list of sub-styles as big as possibly needed
|
// allocate list of sub-styles as big as possibly needed if no extra args
|
||||||
|
|
||||||
styles = new Pair*[narg];
|
styles = new Pair*[narg];
|
||||||
keywords = new char*[narg];
|
keywords = new char*[narg];
|
||||||
@ -214,6 +214,7 @@ void PairHybrid::settings(int narg, char **arg)
|
|||||||
|
|
||||||
// allocate each sub-style
|
// allocate each sub-style
|
||||||
// call settings() with set of args that are not pair style names
|
// call settings() with set of args that are not pair style names
|
||||||
|
// use known_style() to determine which args these are
|
||||||
|
|
||||||
int iarg,jarg,dummy;
|
int iarg,jarg,dummy;
|
||||||
|
|
||||||
@ -235,12 +236,12 @@ void PairHybrid::settings(int narg, char **arg)
|
|||||||
nstyles++;
|
nstyles++;
|
||||||
}
|
}
|
||||||
|
|
||||||
// free allstyles
|
// free allstyles created by build_styles()
|
||||||
|
|
||||||
for (int i = 0; i < nallstyles; i++) delete [] allstyles[i];
|
for (int i = 0; i < nallstyles; i++) delete [] allstyles[i];
|
||||||
delete [] allstyles;
|
delete [] allstyles;
|
||||||
|
|
||||||
// multiple[i] = 1 to N if sub-style used multiple times, else 0
|
// multiple[i] = 1 to M if sub-style used multiple times, else 0
|
||||||
|
|
||||||
for (int i = 0; i < nstyles; i++) {
|
for (int i = 0; i < nstyles; i++) {
|
||||||
int count = 0;
|
int count = 0;
|
||||||
@ -599,9 +600,12 @@ void PairHybrid::read_restart(FILE *fp)
|
|||||||
if (me == 0) fread(&nstyles,sizeof(int),1,fp);
|
if (me == 0) fread(&nstyles,sizeof(int),1,fp);
|
||||||
MPI_Bcast(&nstyles,1,MPI_INT,0,world);
|
MPI_Bcast(&nstyles,1,MPI_INT,0,world);
|
||||||
|
|
||||||
|
// allocate list of sub-styles
|
||||||
|
|
||||||
styles = new Pair*[nstyles];
|
styles = new Pair*[nstyles];
|
||||||
keywords = new char*[nstyles];
|
keywords = new char*[nstyles];
|
||||||
|
multiple = new int[nstyles];
|
||||||
|
|
||||||
// each sub-style is created via new_pair()
|
// each sub-style is created via new_pair()
|
||||||
// each reads its settings, but no coeff info
|
// each reads its settings, but no coeff info
|
||||||
|
|
||||||
@ -615,6 +619,17 @@ void PairHybrid::read_restart(FILE *fp)
|
|||||||
styles[m] = force->new_pair(keywords[m],lmp->suffix,dummy);
|
styles[m] = force->new_pair(keywords[m],lmp->suffix,dummy);
|
||||||
styles[m]->read_restart_settings(fp);
|
styles[m]->read_restart_settings(fp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// multiple[i] = 1 to M if sub-style used multiple times, else 0
|
||||||
|
|
||||||
|
for (int i = 0; i < nstyles; i++) {
|
||||||
|
int count = 0;
|
||||||
|
for (int j = 0; j < nstyles; j++) {
|
||||||
|
if (strcmp(keywords[j],keywords[i]) == 0) count++;
|
||||||
|
if (j == i) multiple[i] = count;
|
||||||
|
}
|
||||||
|
if (count == 1) multiple[i] = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ----------------------------------------------------------------------
|
/* ----------------------------------------------------------------------
|
||||||
|
|||||||
@ -27,7 +27,7 @@ namespace LAMMPS_NS {
|
|||||||
|
|
||||||
class PairHybrid : public Pair {
|
class PairHybrid : public Pair {
|
||||||
public:
|
public:
|
||||||
int nstyles; // # of different sub-styles
|
int nstyles; // # of sub-styles
|
||||||
Pair **styles; // list of Pair style classes
|
Pair **styles; // list of Pair style classes
|
||||||
char **keywords; // style name of each Pair style
|
char **keywords; // style name of each Pair style
|
||||||
int *multiple; // 0 if style used once, else Mth instance
|
int *multiple; // 0 if style used once, else Mth instance
|
||||||
|
|||||||
Reference in New Issue
Block a user