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

This commit is contained in:
sjplimp 2008-08-13 14:39:45 +00:00
parent c0e746622b
commit 7732b4f0c2
7 changed files with 28 additions and 19 deletions

View File

@ -32,6 +32,7 @@ using namespace LAMMPS_NS;
PairGranHertzian::PairGranHertzian(LAMMPS *lmp) : PairGranHistory(lmp)
{
no_virial_compute = 1;
history = 1;
}

View File

@ -46,6 +46,7 @@ using namespace LAMMPS_NS;
PairGranHistory::PairGranHistory(LAMMPS *lmp) : Pair(lmp)
{
single_enable = 0;
no_virial_compute = 1;
history = 1;
fix_history = NULL;
}

View File

@ -54,6 +54,7 @@ PairLJCutCoulLongTIP4P::PairLJCutCoulLongTIP4P(LAMMPS *lmp) :
PairLJCutCoulLong(lmp)
{
single_enable = 0;
no_virial_compute = 1;
}
/* ---------------------------------------------------------------------- */
@ -75,7 +76,7 @@ void PairLJCutCoulLongTIP4P::compute(int eflag, int vflag)
float rsq;
int *int_rsq = (int *) &rsq;
// if vflag_global = 2, reset vflag as if vflag_global = 1
// if global component of incoming vflag = 2, reset vflag as if it were 1
// necessary since TIP4P cannot compute virial as F dot r
// due to find_M() finding bonded H atoms which are not near O atom

View File

@ -256,14 +256,11 @@ void Finish::end(int flag)
if (me == 0) {
if (screen) {
fprintf(screen,"FFT time (%% of Kspce) = %g (%g)\n",time3d,fraction);
fprintf(screen,"FFT Gflps 3d 1d-only = %g %g\n",flop3,flop1);
fprintf(screen,"FFT Gflps 3d (1d only) = %g %g\n",flop3,flop1);
}
if (logfile) {
fprintf(logfile,"FFT time (%% of Kspce) = %g (%g)\n",
time3d,time3d/time_kspace*100.0);
fprintf(logfile,"FFT Gflps 3d 1d-only = %g %g\n",
nflops/1.0e9/(time3d/4.0/nsteps),
nflops/1.0e9/(time1d/4.0/nsteps));
fprintf(logfile,"FFT time (%% of Kspce) = %g (%g)\n",time3d,fraction);
fprintf(logfile,"FFT Gflps 3d (1d only) = %g %g\n",flop3,flop1);
}
}
}

View File

@ -55,6 +55,7 @@ Pair::Pair(LAMMPS *lmp) : Pointers(lmp)
single_enable = 1;
respa_enable = 0;
one_coeff = 0;
no_virial_compute = 0;
// pair_modify settings

View File

@ -37,6 +37,7 @@ class Pair : protected Pointers {
int single_enable; // 1 if single() routine exists
int respa_enable; // 1 if inner/middle/outer rRESPA routines
int one_coeff; // 1 if allows only one coeff * * call
int no_virial_compute; // 1 if does not invoke virial_compute()
int tail_flag; // pair_modify flag for LJ tail correction
double etail,ptail; // energy/pressure tail corrections

View File

@ -59,12 +59,11 @@ PairHybrid::~PairHybrid()
/* ----------------------------------------------------------------------
call each sub-style's compute function
accumulate sub-style global/peratom energy/virial in hybrid
for vflag = 1:
for global vflag = 1:
each sub-style computes own virial[6]
sum sub-style virial[6] to hybrid's virial[6]
for vflag = 2:
call sub-style compute() with vflag % 2
to prevent sub-style from calling virial_compute()
for global vflag = 2:
call sub-style with adjusted vflag to prevent it calling virial_compute()
hybrid calls virial_compute() on final accumulated f
------------------------------------------------------------------------- */
@ -72,18 +71,22 @@ void PairHybrid::compute(int eflag, int vflag)
{
int i,j,m,n;
// if no_virial_compute is set and global component of incoming vflag = 2,
// reset vflag as if it were 1
// necessary since one or more sub-styles cannot compute virial as F dot r
if (no_virial_compute && vflag % 4 == 2) vflag = 1 + vflag/4 * 4;
if (eflag || vflag) ev_setup(eflag,vflag);
else evflag = 0;
// don't allow substyle to invoke virial_compute()
// if vflag has that setting, change vflag passed to substyle
// preserve vflag_atom option in what is passed to substyle
// check if global component of incoming vflag = 2
// if so, reset vflag passed to substyle as if it were 0
// necessary so substyle will not invoke virial_compute()
int vflag_substyle;
int vflag_global_substyle = vflag % 4;
if (vflag_global_substyle == 2) {
vflag_substyle = vflag/4 * 4;
} else vflag_substyle = vflag;
if (vflag % 4 == 2) vflag_substyle = vflag/4 * 4;
else vflag_substyle = vflag;
for (m = 0; m < nstyles; m++) {
styles[m]->compute(eflag,vflag_substyle);
@ -92,8 +95,9 @@ void PairHybrid::compute(int eflag, int vflag)
eng_vdwl += styles[m]->eng_vdwl;
eng_coul += styles[m]->eng_coul;
}
if (vflag_global)
if (vflag_global) {
for (n = 0; n < 6; n++) virial[n] += styles[m]->virial[n];
}
if (eflag_atom) {
n = atom->nlocal;
if (force->newton_pair) n += atom->nghost;
@ -238,11 +242,14 @@ void PairHybrid::settings(int narg, char **arg)
// single_enable = 0 if any sub-style = 0
// respa_enable = 1 if any sub-style is set
// no_virial_compute = 1 if any sub-style is set
for (m = 0; m < nstyles; m++)
if (styles[m]->single_enable == 0) single_enable = 0;
for (m = 0; m < nstyles; m++)
if (styles[m]->respa_enable) respa_enable = 1;
for (m = 0; m < nstyles; m++)
if (styles[m]->no_virial_compute) no_virial_compute = 1;
}
/* ----------------------------------------------------------------------