forked from lijiext/lammps
git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@8153 f3b2605a-c512-4ea7-a41b-209d697bcdaa
This commit is contained in:
parent
c1e5db9ff0
commit
365218d56f
|
@ -1071,8 +1071,8 @@ void Ewald::compute_group_group(int groupbit_A, int groupbit_B, int BA_flag)
|
||||||
const double qscale = force->qqrd2e * scale;
|
const double qscale = force->qqrd2e * scale;
|
||||||
double partial_group;
|
double partial_group;
|
||||||
|
|
||||||
|
|
||||||
// total group A <--> group B energy
|
// total group A <--> group B energy
|
||||||
|
// self and boundary correction terms are in compute_group_group.cpp
|
||||||
|
|
||||||
for (k = 0; k < kcount; k++) {
|
for (k = 0; k < kcount; k++) {
|
||||||
partial_group = sfacrl_A_all[k]*sfacrl_B_all[k] +
|
partial_group = sfacrl_A_all[k]*sfacrl_B_all[k] +
|
||||||
|
@ -1080,37 +1080,8 @@ void Ewald::compute_group_group(int groupbit_A, int groupbit_B, int BA_flag)
|
||||||
e2group += ug[k]*partial_group;
|
e2group += ug[k]*partial_group;
|
||||||
}
|
}
|
||||||
|
|
||||||
// total charge of groups A & B, needed for self-energy correction
|
|
||||||
|
|
||||||
double qsum_group = 0.0, qsqsum_group = 0.0;
|
|
||||||
|
|
||||||
for (int i = 0; i < atom->nlocal; i++) {
|
|
||||||
if ((mask[i] & groupbit_A) && (mask[i] & groupbit_B)) {
|
|
||||||
if (BA_flag) continue;
|
|
||||||
qsqsum_group += q[i]*q[i];
|
|
||||||
}
|
|
||||||
|
|
||||||
//if ((mask[i] & groupbit_A) || (mask[i] & groupbit_B))
|
|
||||||
// qsum_group += q[i];
|
|
||||||
}
|
|
||||||
|
|
||||||
double tmp;
|
|
||||||
MPI_Allreduce(&qsum_group,&tmp,1,MPI_DOUBLE,MPI_SUM,world);
|
|
||||||
qsum_group = tmp;
|
|
||||||
|
|
||||||
//MPI_Allreduce(&qsqsum_group,&tmp,1,MPI_DOUBLE,MPI_SUM,world);
|
|
||||||
//qsqsum_group = tmp;
|
|
||||||
|
|
||||||
// self-energy correction
|
|
||||||
|
|
||||||
e2group -= g_ewald*qsqsum_group/MY_PIS;
|
|
||||||
|
|
||||||
// should we include the boundary condition or not?
|
|
||||||
// e2group += MY_PI2*qsum_group*qsum_group / (g_ewald*g_ewald*volume);
|
|
||||||
|
|
||||||
e2group *= qscale;
|
e2group *= qscale;
|
||||||
|
|
||||||
|
|
||||||
// total group A <--> group B force
|
// total group A <--> group B force
|
||||||
|
|
||||||
for (k = 0; k < kcount; k++) {
|
for (k = 0; k < kcount; k++) {
|
||||||
|
|
|
@ -2577,13 +2577,6 @@ void PPPM::compute_group_group(int groupbit_A, int groupbit_B, int BA_flag)
|
||||||
int nlocal = atom->nlocal;
|
int nlocal = atom->nlocal;
|
||||||
int *mask = atom->mask;
|
int *mask = atom->mask;
|
||||||
|
|
||||||
// convert atoms from box to lamda coords
|
|
||||||
|
|
||||||
if (triclinic == 0) boxlo = domain->boxlo;
|
|
||||||
else {
|
|
||||||
boxlo = domain->boxlo_lamda;
|
|
||||||
domain->x2lamda(atom->nlocal);
|
|
||||||
}
|
|
||||||
|
|
||||||
// map my particle charge onto my local 3d density grid
|
// map my particle charge onto my local 3d density grid
|
||||||
|
|
||||||
|
@ -2627,36 +2620,13 @@ void PPPM::compute_group_group(int groupbit_A, int groupbit_B, int BA_flag)
|
||||||
const double qscale = force->qqrd2e * scale;
|
const double qscale = force->qqrd2e * scale;
|
||||||
|
|
||||||
// total group A <--> group B energy
|
// total group A <--> group B energy
|
||||||
|
// self and boundary correction terms are in compute_group_group.cpp
|
||||||
|
|
||||||
double e2group_all;
|
double e2group_all;
|
||||||
MPI_Allreduce(&e2group,&e2group_all,1,MPI_DOUBLE,MPI_SUM,world);
|
MPI_Allreduce(&e2group,&e2group_all,1,MPI_DOUBLE,MPI_SUM,world);
|
||||||
e2group = e2group_all;
|
e2group = e2group_all;
|
||||||
|
|
||||||
e2group *= 0.5*volume;
|
e2group *= qscale*0.5*volume;
|
||||||
|
|
||||||
// total charge of groups A & B, needed for self-energy correction
|
|
||||||
|
|
||||||
double qsum_group = 0.0, qsqsum_group = 0.0;
|
|
||||||
|
|
||||||
for (int i = 0; i < atom->nlocal; i++) {
|
|
||||||
if ((mask[i] & groupbit_A) && (mask[i] & groupbit_B)) {
|
|
||||||
if (BA_flag) continue;
|
|
||||||
qsqsum_group += q[i]*q[i];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
double tmp;
|
|
||||||
MPI_Allreduce(&qsum_group,&tmp,1,MPI_DOUBLE,MPI_SUM,world);
|
|
||||||
qsum_group = tmp;
|
|
||||||
|
|
||||||
// self-energy correction
|
|
||||||
|
|
||||||
e2group -= g_ewald*qsqsum_group/MY_PIS;
|
|
||||||
|
|
||||||
// should we include this boundary condition or not?
|
|
||||||
// e2group += MY_PI2*qsum_group*qsum_group / (g_ewald*g_ewald*volume);
|
|
||||||
|
|
||||||
e2group *= qscale;
|
|
||||||
|
|
||||||
// total group A <--> group B force
|
// total group A <--> group B force
|
||||||
|
|
||||||
|
@ -2664,15 +2634,11 @@ void PPPM::compute_group_group(int groupbit_A, int groupbit_B, int BA_flag)
|
||||||
MPI_Allreduce(f2group,f2group_all,3,MPI_DOUBLE,MPI_SUM,world);
|
MPI_Allreduce(f2group,f2group_all,3,MPI_DOUBLE,MPI_SUM,world);
|
||||||
|
|
||||||
for (i = 0; i < 3; i++) f2group[i] = qscale*volume*f2group_all[i];
|
for (i = 0; i < 3; i++) f2group[i] = qscale*volume*f2group_all[i];
|
||||||
|
|
||||||
// convert atoms back from lamda to box coords
|
|
||||||
|
|
||||||
if (triclinic) domain->lamda2x(atom->nlocal);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ----------------------------------------------------------------------
|
/* ----------------------------------------------------------------------
|
||||||
allocate group-group memory that depends on # of K-vectors and order
|
allocate group-group memory that depends on # of K-vectors and order
|
||||||
------------------------------------------------------------------------- */
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
void PPPM::allocate_groups()
|
void PPPM::allocate_groups()
|
||||||
{
|
{
|
||||||
|
@ -2686,7 +2652,7 @@ void PPPM::allocate_groups()
|
||||||
|
|
||||||
/* ----------------------------------------------------------------------
|
/* ----------------------------------------------------------------------
|
||||||
deallocate group-group memory that depends on # of K-vectors and order
|
deallocate group-group memory that depends on # of K-vectors and order
|
||||||
------------------------------------------------------------------------- */
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
void PPPM::deallocate_groups()
|
void PPPM::deallocate_groups()
|
||||||
{
|
{
|
||||||
|
@ -2701,7 +2667,7 @@ void PPPM::deallocate_groups()
|
||||||
density(x,y,z) = charge "density" at grid points of my 3d brick
|
density(x,y,z) = charge "density" at grid points of my 3d brick
|
||||||
(nxlo:nxhi,nylo:nyhi,nzlo:nzhi) is extent of my brick (including ghosts)
|
(nxlo:nxhi,nylo:nyhi,nzlo:nzhi) is extent of my brick (including ghosts)
|
||||||
in global grid for group-group interactions
|
in global grid for group-group interactions
|
||||||
------------------------------------------------------------------------- */
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
void PPPM::make_rho_groups(int groupbit_A, int groupbit_B, int BA_flag)
|
void PPPM::make_rho_groups(int groupbit_A, int groupbit_B, int BA_flag)
|
||||||
{
|
{
|
||||||
|
@ -2770,7 +2736,7 @@ void PPPM::make_rho_groups(int groupbit_A, int groupbit_B, int BA_flag)
|
||||||
|
|
||||||
/* ----------------------------------------------------------------------
|
/* ----------------------------------------------------------------------
|
||||||
FFT-based Poisson solver for group-group interactions
|
FFT-based Poisson solver for group-group interactions
|
||||||
------------------------------------------------------------------------- */
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
void PPPM::poisson_groups(int BA_flag)
|
void PPPM::poisson_groups(int BA_flag)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue