Added tad example

git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@5477 f3b2605a-c512-4ea7-a41b-209d697bcdaa
This commit is contained in:
athomps
2011-01-05 00:30:27 +00:00
parent 55e8b2bee6
commit 2b8ae7a82f
3 changed files with 151 additions and 3 deletions

View File

@ -106,6 +106,14 @@ int MinFire::iterate(int maxiter)
vdotf += v[i][0]*f[i][0] + v[i][1]*f[i][1] + v[i][2]*f[i][2];
MPI_Allreduce(&vdotf,&vdotfall,1,MPI_DOUBLE,MPI_SUM,world);
// sum vdotf over replicas, if necessary
// this communicator would be invalid for multiprocess replicas
if (update->multireplica == 1) {
vdotf = vdotfall;
MPI_Allreduce(&vdotf,&vdotfall,1,MPI_DOUBLE,MPI_SUM,universe->uworld);
}
// if (v dot f) > 0:
// v = (1-alpha) v + alpha |v| Fhat
// |v| = length of v, Fhat = unit f
@ -117,11 +125,28 @@ int MinFire::iterate(int maxiter)
for (int i = 0; i < nlocal; i++)
vdotv += v[i][0]*v[i][0] + v[i][1]*v[i][1] + v[i][2]*v[i][2];
MPI_Allreduce(&vdotv,&vdotvall,1,MPI_DOUBLE,MPI_SUM,world);
// sum vdotv over replicas, if necessary
// this communicator would be invalid for multiprocess replicas
if (update->multireplica == 1) {
vdotv = vdotvall;
MPI_Allreduce(&vdotv,&vdotvall,1,MPI_DOUBLE,MPI_SUM,universe->uworld);
}
fdotf = 0.0;
for (int i = 0; i < nlocal; i++)
fdotf += f[i][0]*f[i][0] + f[i][1]*f[i][1] + f[i][2]*f[i][2];
MPI_Allreduce(&fdotf,&fdotfall,1,MPI_DOUBLE,MPI_SUM,world);
// sum fdotf over replicas, if necessary
// this communicator would be invalid for multiprocess replicas
if (update->multireplica == 1) {
fdotf = fdotfall;
MPI_Allreduce(&fdotf,&fdotfall,1,MPI_DOUBLE,MPI_SUM,universe->uworld);
}
scale1 = 1.0 - alpha;
if (fdotfall == 0.0) scale2 = 0.0;
else scale2 = alpha * sqrt(vdotvall/fdotfall);
@ -162,6 +187,14 @@ int MinFire::iterate(int maxiter)
}
MPI_Allreduce(&dtvone,&dtv,1,MPI_DOUBLE,MPI_MIN,world);
// min dtv over replicas, if necessary
// this communicator would be invalid for multiprocess replicas
if (update->multireplica == 1) {
dtvone = dtv;
MPI_Allreduce(&dtvone,&dtv,1,MPI_DOUBLE,MPI_MIN,universe->uworld);
}
// Euler integration step
double **x = atom->x;