forgot to reduce energies

This commit is contained in:
robeme
2018-05-08 10:46:41 +02:00
parent 53fc9f1f0f
commit 16697fc4cb
2 changed files with 15 additions and 5 deletions

View File

@ -652,8 +652,16 @@ double FixRestrain::compute_scalar()
double FixRestrain::compute_vector(int n) double FixRestrain::compute_vector(int n)
{ {
if (n == 0) return ebond; if (n == 0) {
if (n == 1) return eangle; MPI_Allreduce(&ebond,&ebond_all,1,MPI_DOUBLE,MPI_SUM,world);
if (n == 2) return edihed; return ebond_all;
return 0.0; } else if (n == 1) {
MPI_Allreduce(&eangle,&eangle_all,1,MPI_DOUBLE,MPI_SUM,world);
return eangle_all;
} else if (n == 2) {
MPI_Allreduce(&edihed,&edihed_all,1,MPI_DOUBLE,MPI_SUM,world);
return edihed_all;
} else {
return 0.0;
}
} }

View File

@ -47,7 +47,9 @@ class FixRestrain : public Fix {
double *kstart,*kstop,*target; double *kstart,*kstop,*target;
double *cos_target,*sin_target; double *cos_target,*sin_target;
double energy,energy_all; double energy,energy_all;
double ebond,eangle,edihed; double ebond,ebond_all;
double eangle,eangle_all;
double edihed,edihed_all;
void restrain_bond(int); void restrain_bond(int);
void restrain_angle(int); void restrain_angle(int);