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

This commit is contained in:
sjplimp 2013-02-09 19:31:37 +00:00
parent 99f80bff9f
commit 2b5425cec7
4 changed files with 13 additions and 7 deletions

View File

@ -189,11 +189,13 @@ void BondHarmonicShift::read_restart(FILE *fp)
/* ---------------------------------------------------------------------- */
double BondHarmonicShift::single(int type, double rsq, int i, int j)
double BondHarmonicShift::single(int type, double rsq, int i, int j,
double &fforce)
{
double r = sqrt(rsq);
double dr = r - r0[type];
double dr2=r0[type]-r1[type];
fforce = -2.0*k[type]*dr/r;
return k[type]*(dr*dr - dr2*dr2);
}

View File

@ -1,4 +1,4 @@
/* ----------------------------------------------------------------------
/* -*- c++ -*- ----------------------------------------------------------
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
http://lammps.sandia.gov, Sandia National Laboratories
Steve Plimpton, sjplimp@sandia.gov
@ -34,7 +34,7 @@ class BondHarmonicShift : public Bond {
double equilibrium_distance(int);
void write_restart(FILE *);
void read_restart(FILE *);
double single(int, double, int, int);
double single(int, double, int, int, double &);
protected:
double *k,*r0,*r1;

View File

@ -190,13 +190,17 @@ void BondHarmonicShiftCut::read_restart(FILE *fp)
/* ---------------------------------------------------------------------- */
double BondHarmonicShiftCut::single(int type, double rsq, int i, int j)
double BondHarmonicShiftCut::single(int type, double rsq, int i, int j,
double &fforce)
{
fforce = 0.0;
double r = sqrt(rsq);
if (r>r1[type]) return 0;
if (r>r1[type]) return 0.0;
double dr = r - r0[type];
double dr2=r0[type]-r1[type];
fforce = -2.0*k[type]*dr/r;
return k[type]*(dr*dr - dr2*dr2);
}

View File

@ -1,4 +1,4 @@
/* ----------------------------------------------------------------------
/* -*- c++ -*- ----------------------------------------------------------
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
http://lammps.sandia.gov, Sandia National Laboratories
Steve Plimpton, sjplimp@sandia.gov
@ -34,7 +34,7 @@ class BondHarmonicShiftCut : public Bond {
double equilibrium_distance(int);
void write_restart(FILE *);
void read_restart(FILE *);
double single(int, double, int, int);
double single(int, double, int, int, double &);
protected:
double *k,*r0,*r1;