ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/trunk/OOPSE/libmdtools/BondExtensions.cpp
Revision: 597
Committed: Mon Jul 14 21:28:54 2003 UTC (20 years, 11 months ago) by mmeineke
File size: 540 byte(s)
Log Message:
found a bug. Unit vectors were not being updated

File Contents

# User Rev Content
1 mmeineke 377
2    
3     #include "SRI.hpp"
4    
5    
6     ConstrainedBond::ConstrainedBond( Atom &a, Atom &b, double constraint ){
7    
8     set_atoms( a, b );
9     constrain( constraint );
10     d0 = constraint;
11     c_potential_E = 0.0;
12     }
13    
14    
15 mmeineke 564 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 mmeineke 597 c_potential_E = 0.5 * k0 * dr2;
33 mmeineke 594 force = - k0 * dr;
34 mmeineke 564 return force;
35    
36     }