forked from lijiext/lammps
git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@9429 f3b2605a-c512-4ea7-a41b-209d697bcdaa
This commit is contained in:
parent
99f80bff9f
commit
2b5425cec7
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue