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

This commit is contained in:
sjplimp
2010-09-03 23:12:51 +00:00
parent 0916c0fa16
commit 5810937ea9
8 changed files with 67 additions and 26 deletions

View File

@ -84,8 +84,9 @@ Fix::Fix(LAMMPS *lmp, int narg, char **arg) : Pointers(lmp)
POST_FORCE_RESPA = 4096;
FINAL_INTEGRATE_RESPA = 8192;
MIN_PRE_EXCHANGE = 16384;
MIN_POST_FORCE = 32768;
MIN_ENERGY = 65536;
MIN_PRE_FORCE = 32768;
MIN_POST_FORCE = 65536;
MIN_ENERGY = 121072;
}
/* ---------------------------------------------------------------------- */

View File

@ -80,7 +80,7 @@ class Fix : protected Pointers {
int PRE_FORCE,POST_FORCE,FINAL_INTEGRATE,END_OF_STEP,THERMO_ENERGY;
int INITIAL_INTEGRATE_RESPA,POST_INTEGRATE_RESPA;
int PRE_FORCE_RESPA,POST_FORCE_RESPA,FINAL_INTEGRATE_RESPA;
int MIN_PRE_EXCHANGE,MIN_POST_FORCE,MIN_ENERGY;
int MIN_PRE_EXCHANGE,MIN_PRE_FORCE,MIN_POST_FORCE,MIN_ENERGY;
Fix(class LAMMPS *, int, char **);
virtual ~Fix();
@ -114,13 +114,16 @@ class Fix : protected Pointers {
virtual int size_restart(int) {return 0;}
virtual int maxsize_restart() {return 0;}
virtual void setup_pre_force_respa(int, int) {}
virtual void initial_integrate_respa(int, int, int) {}
virtual void post_integrate_respa(int, int) {}
virtual void pre_force_respa(int, int, int) {}
virtual void post_force_respa(int, int, int) {}
virtual void final_integrate_respa(int, int) {}
virtual void min_setup_pre_force(int) {}
virtual void min_pre_exchange() {}
virtual void min_pre_force(int) {}
virtual void min_post_force(int) {}
virtual double min_energy(double *) {return 0.0;}

View File

@ -229,6 +229,7 @@ void Min::setup()
ev_set(update->ntimestep);
force_clear();
modify->setup_pre_force(vflag);
if (force->pair) force->pair->compute(eflag,vflag);
@ -299,6 +300,7 @@ void Min::setup_minimal(int flag)
ev_set(update->ntimestep);
force_clear();
modify->setup_pre_force(vflag);
if (force->pair) force->pair->compute(eflag,vflag);
@ -454,6 +456,7 @@ double Min::energy_force(int resetflag)
ev_set(update->ntimestep);
force_clear();
if (modify->n_min_pre_force) modify->min_pre_force(vflag);
timer->stamp();

View File

@ -47,8 +47,9 @@ using namespace LAMMPS_NS;
#define POST_FORCE_RESPA 4096
#define FINAL_INTEGRATE_RESPA 8192
#define MIN_PRE_EXCHANGE 16384
#define MIN_POST_FORCE 32768
#define MIN_ENERGY 65536
#define MIN_PRE_FORCE 32768
#define MIN_POST_FORCE 65536
#define MIN_ENERGY 131072
#define MIN(A,B) ((A) < (B)) ? (A) : (B)
#define MAX(A,B) ((A) > (B)) ? (A) : (B)
@ -66,7 +67,7 @@ Modify::Modify(LAMMPS *lmp) : Pointers(lmp)
n_final_integrate = n_end_of_step = n_thermo_energy = 0;
n_initial_integrate_respa = n_post_integrate_respa = 0;
n_pre_force_respa = n_post_force_respa = n_final_integrate_respa = 0;
n_min_pre_exchange = n_min_post_force = n_min_energy = 0;
n_min_pre_exchange = n_min_pre_force = n_min_post_force = n_min_energy = 0;
fix = NULL;
fmask = NULL;
@ -78,7 +79,8 @@ Modify::Modify(LAMMPS *lmp) : Pointers(lmp)
list_initial_integrate_respa = list_post_integrate_respa = NULL;
list_pre_force_respa = list_post_force_respa = NULL;
list_final_integrate_respa = NULL;
list_min_pre_exchange = list_min_post_force = list_min_energy = NULL;
list_min_pre_exchange = list_min_pre_force =
list_min_post_force = list_min_energy = NULL;
end_of_step_every = NULL;
@ -125,6 +127,7 @@ Modify::~Modify()
delete [] list_post_force_respa;
delete [] list_final_integrate_respa;
delete [] list_min_pre_exchange;
delete [] list_min_pre_force;
delete [] list_min_post_force;
delete [] list_min_energy;
@ -170,6 +173,7 @@ void Modify::init()
n_final_integrate_respa,list_final_integrate_respa);
list_init(MIN_PRE_EXCHANGE,n_min_pre_exchange,list_min_pre_exchange);
list_init(MIN_PRE_FORCE,n_min_pre_force,list_min_pre_force);
list_init(MIN_POST_FORCE,n_min_post_force,list_min_post_force);
list_init(MIN_ENERGY,n_min_energy,list_min_energy);
@ -254,8 +258,12 @@ void Modify::setup(int vflag)
void Modify::setup_pre_force(int vflag)
{
if (update->whichflag == 1)
for (int i = 0; i < n_pre_force; i++)
fix[list_pre_force[i]]->setup_pre_force(vflag);
fix[list_min_pre_force[i]]->setup_pre_force(vflag);
else if (update->whichflag == 2)
for (int i = 0; i < n_pre_force; i++)
fix[list_min_pre_force[i]]->min_setup_pre_force(vflag);
}
/* ----------------------------------------------------------------------
@ -354,6 +362,16 @@ double Modify::thermo_energy()
return energy;
}
/* ----------------------------------------------------------------------
setup rRESPA pre_force call, only for relevant fixes
------------------------------------------------------------------------- */
void Modify::setup_pre_force_respa(int vflag, int ilevel)
{
for (int i = 0; i < n_pre_force; i++)
fix[list_pre_force[i]]->setup_pre_force_respa(vflag,ilevel);
}
/* ----------------------------------------------------------------------
1st half of rRESPA integrate call, only for relevant fixes
------------------------------------------------------------------------- */
@ -415,6 +433,16 @@ void Modify::min_pre_exchange()
fix[list_min_pre_exchange[i]]->min_pre_exchange();
}
/* ----------------------------------------------------------------------
minimizer pre-force call, only for relevant fixes
------------------------------------------------------------------------- */
void Modify::min_pre_force(int vflag)
{
for (int i = 0; i < n_min_pre_force; i++)
fix[list_min_pre_force[i]]->min_pre_force(vflag);
}
/* ----------------------------------------------------------------------
minimizer force adjustment call, only for relevant fixes
------------------------------------------------------------------------- */

View File

@ -27,7 +27,7 @@ class Modify : protected Pointers {
int n_final_integrate,n_end_of_step,n_thermo_energy;
int n_initial_integrate_respa,n_post_integrate_respa;
int n_pre_force_respa,n_post_force_respa,n_final_integrate_respa;
int n_min_pre_exchange,n_min_post_force,n_min_energy;
int n_min_pre_exchange,n_min_pre_force,n_min_post_force,n_min_energy;
int restart_pbc_any; // 1 if any fix sets restart_pbc
int nfix_restart_global; // stored fix global info from restart file
@ -55,13 +55,16 @@ class Modify : protected Pointers {
void end_of_step();
double thermo_energy();
void setup_pre_force_respa(int, int);
void initial_integrate_respa(int, int, int);
void post_integrate_respa(int, int);
void pre_force_respa(int, int, int);
void post_force_respa(int, int, int);
void final_integrate_respa(int, int);
void setup_min_pre_force(int);
void min_pre_exchange();
void min_pre_force(int);
void min_post_force(int);
double min_energy(double *);
@ -104,7 +107,8 @@ class Modify : protected Pointers {
int *list_initial_integrate_respa,*list_post_integrate_respa;
int *list_pre_force_respa,*list_post_force_respa;
int *list_final_integrate_respa;
int *list_min_pre_exchange,*list_min_post_force,*list_min_energy;
int *list_min_pre_exchange,*list_min_pre_force;
int *list_min_post_force,*list_min_energy;
int *end_of_step_every;

View File

@ -71,11 +71,7 @@ class Pair : protected Pointers {
virtual void compute_outer(int, int) {}
virtual double single(int, int, int, int,
double, double
, double, double &) {return 0.0;}
double, double, double, double &) {return 0.0;}
virtual void settings(int, char **) = 0;
virtual void coeff(int, char **) = 0;

View File

@ -193,10 +193,11 @@ void PairHybrid::settings(int narg, char **arg)
allocated = 0;
// count sub-styles by skipping numeric args
// one exception is 1st arg of style "table", which is non-numeric word
// one exception is 1st two args of style "lj/coul", which are non-numeric
// one exception is 1st two args of style "buck/coul", which are non-numeric
// one exception is 1st arg of any "gpu" style, which is non-numeric
// exception is 1st arg of style "table", which is non-numeric word
// exception is 1st two args of style "lj/coul", which are non-numeric
// exception is 1st two args of style "buck/coul", which are non-numeric
// exception is 1st arg of any "gpu" style, which is non-numeric
// exception is 1st arg of reax/c style, which is non-numeric
// need a better way to skip these exceptions
nstyles = 0;
@ -206,6 +207,7 @@ void PairHybrid::settings(int narg, char **arg)
if (strcmp(arg[i],"lj/coul") == 0) i += 2;
if (strcmp(arg[i],"buck/coul") == 0) i += 2;
if (strstr(arg[i],"gpu")) i++;
if (strcmp(arg[i],"reax/c") == 0) i++;
i++;
while (i < narg && !isalpha(arg[i][0])) i++;
nstyles++;
@ -218,10 +220,11 @@ void PairHybrid::settings(int narg, char **arg)
// allocate each sub-style and call its settings() with subset of args
// define subset of args for a sub-style by skipping numeric args
// one exception is 1st arg of style "table", which is non-numeric
// one exception is 1st two args of style "lj/coul", which are non-numeric
// one exception is 1st two args of style "buck/coul", which are non-numeric
// one exception is 1st arg of any "gpu" style, which is non-numeric
// exception is 1st arg of style "table", which is non-numeric
// exception is 1st two args of style "lj/coul", which are non-numeric
// exception is 1st two args of style "buck/coul", which are non-numeric
// exception is 1st arg of any "gpu" style, which is non-numeric
// exception is 1st arg of reax/c style, which is non-numeric
// need a better way to skip these exceptions
nstyles = 0;
@ -242,6 +245,7 @@ void PairHybrid::settings(int narg, char **arg)
if (strcmp(arg[i],"lj/coul") == 0) i += 2;
if (strcmp(arg[i],"buck/coul") == 0) i += 2;
if (strstr(arg[i],"gpu")) i++;
if (strcmp(arg[i],"reax/c") == 0) i++;
i++;
while (i < narg && !isalpha(arg[i][0])) i++;
styles[nstyles]->settings(i-istyle-1,&arg[istyle+1]);

View File

@ -345,6 +345,7 @@ void Respa::setup()
for (int ilevel = 0; ilevel < nlevels; ilevel++) {
force_clear(newton[ilevel]);
modify->setup_pre_force_respa(vflag,ilevel);
if (level_bond == ilevel && force->bond)
force->bond->compute(eflag,vflag);
if (level_angle == ilevel && force->angle)
@ -408,6 +409,7 @@ void Respa::setup_minimal(int flag)
for (int ilevel = 0; ilevel < nlevels; ilevel++) {
force_clear(newton[ilevel]);
modify->setup_pre_force_respa(vflag,ilevel);
if (level_bond == ilevel && force->bond)
force->bond->compute(eflag,vflag);
if (level_angle == ilevel && force->angle)