| # | Line 12 | Line 12 | ConstrainedBond::ConstrainedBond( Atom &a, Atom &b, do | |
|---|---|---|
| 12 | } | |
| 13 | ||
| 14 | ||
| 15 | + | HarmonicBond::HarmonicBond(Atom &a, Atom &b, double theR0, double theK0 ){ | 
| 16 | + | |
| 17 | + | set_atoms( a, b ); | 
| 18 | + | d0 = theR0; | 
| 19 | + | k0 = theK0; | 
| 20 | + | c_potential_E = 0.0; | 
| 21 | + | } | 
| 22 | + | |
| 23 | + | |
| 24 | + | double HarmonicBond::bond_force( double r_ab ){ | 
| 25 | + | |
| 26 | + | double force; | 
| 27 | + | double dr, dr2; | 
| 28 | + | |
| 29 | + | dr = r_ab - d0; | 
| 30 | + | dr2 = dr * dr; | 
| 31 | + | |
| 32 | + | c_potential_E = k0 * dr2; | 
| 33 | + | force = -2.0 * k0 * dr; | 
| 34 | + | return force; | 
| 35 | + | |
| 36 | + | } | 
| – | Removed lines | 
| + | Added lines | 
| < | Changed lines | 
| > | Changed lines |