git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@14220 f3b2605a-c512-4ea7-a41b-209d697bcdaa
This commit is contained in:
@ -15,9 +15,9 @@
|
||||
Contributing author: Sai Jayaraman (University of Notre Dame)
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
#include "mpi.h"
|
||||
#include <mpi.h>
|
||||
#include "atom.h"
|
||||
#include "string.h"
|
||||
#include <string.h>
|
||||
#include "compute_ti.h"
|
||||
#include "update.h"
|
||||
#include "modify.h"
|
||||
@ -42,7 +42,7 @@ ComputeTI::ComputeTI(LAMMPS *lmp, int narg, char **arg) :
|
||||
|
||||
peflag = 1;
|
||||
peratom_flag = 1;
|
||||
peatomflag = 1;
|
||||
peatomflag = 1;
|
||||
scalar_flag = 1;
|
||||
extscalar = 1;
|
||||
timeflag = 1;
|
||||
@ -166,7 +166,7 @@ double ComputeTI::compute_scalar()
|
||||
|
||||
for (int m = 0; m < nterms; m++) {
|
||||
int total_flag = 0;
|
||||
if ((ihi[m]-ilo[m])==atom->ntypes) total_flag = 1;
|
||||
if ((ihi[m]-ilo[m])==atom->ntypes) total_flag = 1;
|
||||
eng = 0.0;
|
||||
value1 = input->variable->compute_equal(ivar1[m]);
|
||||
value2 = input->variable->compute_equal(ivar2[m]);
|
||||
@ -176,26 +176,26 @@ double ComputeTI::compute_scalar()
|
||||
if (total_flag) {
|
||||
eng = pptr[m]->eng_vdwl + pptr[m]->eng_coul;
|
||||
MPI_Allreduce(&eng,&engall,1,MPI_DOUBLE,MPI_SUM,world);
|
||||
}
|
||||
else {
|
||||
}
|
||||
else {
|
||||
int npair = nlocal;
|
||||
double *eatom = pptr[m]->eatom;
|
||||
|
||||
|
||||
if (force->newton_pair) npair += atom->nghost;
|
||||
for (int i = 0; i < npair; i++)
|
||||
if ((ilo[m]<=type[i])&(ihi[m]>=type[i])) eng += eatom[i];
|
||||
for (int i = 0; i < npair; i++)
|
||||
if ((ilo[m]<=type[i])&(ihi[m]>=type[i])) eng += eatom[i];
|
||||
MPI_Allreduce(&eng,&engall,1,MPI_DOUBLE,MPI_SUM,world);
|
||||
}
|
||||
dUdl += engall/value1 * value2;
|
||||
|
||||
|
||||
} else if (which[m] == TAIL) {
|
||||
double vol = domain->xprd*domain->yprd*domain->zprd;
|
||||
if (total_flag)
|
||||
if (total_flag)
|
||||
eng = force->pair->etail / vol;
|
||||
else {
|
||||
eng = 0;
|
||||
eng = 0;
|
||||
for (int it = 1; it <= atom->ntypes; it++) {
|
||||
int jt;
|
||||
int jt;
|
||||
if ((it >= ilo[m])&&(it <=ihi[m])) jt = it;
|
||||
else jt = ilo[m];
|
||||
for (; jt <=ihi[m];jt++) {
|
||||
@ -203,28 +203,28 @@ double ComputeTI::compute_scalar()
|
||||
force->pair->init_one(it,jt);
|
||||
eng += force->pair->etail_ij;
|
||||
}
|
||||
if (it !=jt) eng += force->pair->etail_ij;
|
||||
if (it !=jt) eng += force->pair->etail_ij;
|
||||
}
|
||||
}
|
||||
eng /= vol;
|
||||
eng /= vol;
|
||||
}
|
||||
dUdl += eng/value1 * value2;
|
||||
|
||||
|
||||
} else if (which[m] == KSPACE) {
|
||||
if (total_flag)
|
||||
if (total_flag)
|
||||
eng = force->kspace->energy;
|
||||
else {
|
||||
else {
|
||||
double *eatom = force->kspace->eatom;
|
||||
for(int i = 0; i < nlocal; i++)
|
||||
if ((ilo[m]<=type[i])&(ihi[m]>=type[i]))
|
||||
eng += eatom[i];
|
||||
if ((ilo[m]<=type[i])&(ihi[m]>=type[i]))
|
||||
eng += eatom[i];
|
||||
MPI_Allreduce(&eng,&engall,1,MPI_DOUBLE,MPI_SUM,world);
|
||||
eng = engall;
|
||||
}
|
||||
dUdl += eng/value1 * value2;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
scalar = dUdl;
|
||||
return scalar;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user