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

This commit is contained in:
sjplimp
2012-06-06 22:47:51 +00:00
parent f46eb9dedb
commit ef9e700545
1408 changed files with 58053 additions and 57983 deletions

View File

@ -5,7 +5,7 @@
Copyright (2003) Sandia Corporation. Under the terms of Contract
DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains
certain rights in this software. This software is distributed under
certain rights in this software. This software is distributed under
the GNU General Public License.
See the README file in the top-level LAMMPS directory.
@ -31,9 +31,9 @@
using namespace LAMMPS_NS;
using namespace FixConst;
enum { SMD_NONE=0,
SMD_TETHER=1<<0, SMD_COUPLE=1<<1,
SMD_CVEL=1<<2, SMD_CFOR=1<<3,
enum { SMD_NONE=0,
SMD_TETHER=1<<0, SMD_COUPLE=1<<1,
SMD_CVEL=1<<2, SMD_CFOR=1<<3,
SMD_AUTOX=1<<4, SMD_AUTOY=1<<5, SMD_AUTOZ=1<<6};
#define SMALL 0.001
@ -69,7 +69,7 @@ FixSMD::FixSMD(LAMMPS *lmp, int narg, char **arg) :
f_smd = atof(arg[argoffs+1]);
argoffs += 2;
} else error->all(FLERR,"Illegal fix smd command");
if (strcmp(arg[argoffs],"tether") == 0) {
if (narg < argoffs+5) error->all(FLERR,"Illegal fix smd command");
styleflag |= SMD_TETHER;
@ -86,10 +86,10 @@ FixSMD::FixSMD(LAMMPS *lmp, int narg, char **arg) :
if (narg < argoffs+6) error->all(FLERR,"Illegal fix smd command");
styleflag |= SMD_COUPLE;
igroup2 = group->find(arg[argoffs+1]);
if (igroup2 == -1)
error->all(FLERR,"Could not find fix smd couple group ID");
if (igroup2 == igroup)
error->all(FLERR,"Two groups cannot be the same in fix smd couple");
if (igroup2 == -1)
error->all(FLERR,"Could not find fix smd couple group ID");
if (igroup2 == igroup)
error->all(FLERR,"Two groups cannot be the same in fix smd couple");
group2bit = group->bitmask[igroup2];
if (strcmp(arg[argoffs+2],"NULL") == 0) xflag = 0;
@ -101,7 +101,7 @@ FixSMD::FixSMD(LAMMPS *lmp, int narg, char **arg) :
if (strcmp(arg[argoffs+4],"NULL") == 0) zflag = 0;
else if (strcmp(arg[argoffs+4],"auto") == 0) styleflag |= SMD_AUTOZ;
else zc = atof(arg[argoffs+4]);
r0 = atof(arg[argoffs+5]);
if (r0 < 0) error->all(FLERR,"R0 < 0 for fix smd command");
argoffs +=6;
@ -144,7 +144,7 @@ void FixSMD::init()
if (styleflag & SMD_AUTOZ) dz = xcm2[2] - xcm[2];
else dz = zc;
}
if (!xflag) dx = 0.0;
if (!yflag) dy = 0.0;
if (!zflag) dz = 0.0;
@ -154,7 +154,7 @@ void FixSMD::init()
yn = dy/r_old;
zn = dz/r_old;
}
if (strstr(update->integrate_style,"respa"))
nlevels_respa = ((Respa *) update->integrate)->nlevels;
}
@ -190,14 +190,14 @@ void FixSMD::smd_tether()
group->xcm(igroup,masstotal,xcm);
// fx,fy,fz = components of k * (r-r0)
double dx,dy,dz,fx,fy,fz,r,dr;
dx = xcm[0] - xc;
dy = xcm[1] - yc;
dz = xcm[2] - zc;
r_now = sqrt(dx*dx + dy*dy + dz*dz);
if (!xflag) dx = 0.0;
if (!yflag) dy = 0.0;
if (!zflag) dz = 0.0;
@ -218,7 +218,7 @@ void FixSMD::smd_tether()
fy = f_smd*dy/r;
fz = f_smd*dz/r;
}
// apply restoring force to atoms in group
// f = -k*(r-r0)*mass/masstotal
@ -227,7 +227,7 @@ void FixSMD::smd_tether()
int *type = atom->type;
double *mass = atom->mass;
int nlocal = atom->nlocal;
ftotal[0] = ftotal[1] = ftotal[2] = 0.0;
force_flag = 0;
@ -251,7 +251,7 @@ void FixSMD::smd_couple()
double xcm[3],xcm2[3];
group->xcm(igroup,masstotal,xcm);
group->xcm(igroup2,masstotal2,xcm2);
// renormalize direction of spring
double dx,dy,dz,r,dr;
if (styleflag & SMD_AUTOX) dx = xcm2[0] - xcm[0];
@ -274,10 +274,10 @@ void FixSMD::smd_couple()
dy = xcm2[1] - xcm[1];
dz = xcm2[2] - xcm[2];
r_now = sqrt(dx*dx + dy*dy + dz*dz);
dx -= xn*r_old;
dy -= yn*r_old;
dz -= zn*r_old;
dz -= zn*r_old;
if (!xflag) dx = 0.0;
if (!yflag) dy = 0.0;
@ -320,7 +320,7 @@ void FixSMD::smd_couple()
force_flag = 0;
double massfrac;
for (int i = 0; i < nlocal; i++) {
for (int i = 0; i < nlocal; i++) {
if (mask[i] & groupbit) {
massfrac = mass[type[i]]/masstotal;
f[i][0] += fx*massfrac;
@ -345,7 +345,7 @@ void FixSMD::write_restart(FILE *fp)
{
#define RESTART_ITEMS 5
double buf[RESTART_ITEMS], fsign;
if (comm->me == 0) {
// make sure we project the force into the direction of the pulling.
fsign = (v_smd<0.0) ? -1.0 : 1.0;