1 |
gezelter |
2 |
#include <math.h> |
2 |
|
|
|
3 |
tim |
3 |
#include "primitives/SRI.hpp" |
4 |
|
|
#include "utils/simError.h" |
5 |
gezelter |
2 |
|
6 |
|
|
QuadraticBend::QuadraticBend( Atom &a, Atom &b, Atom &c ){ |
7 |
|
|
|
8 |
|
|
set_atoms( a, b, c ); |
9 |
|
|
c1 = 0.0; |
10 |
|
|
c2 = 0.0; |
11 |
|
|
c3 = 0.0; |
12 |
|
|
theta0 = 0.0; |
13 |
|
|
} |
14 |
|
|
|
15 |
|
|
void QuadraticBend::setConstants( double the_c1, double the_c2, double the_c3, |
16 |
|
|
double the_Th0 ){ |
17 |
|
|
c1 = the_c1; |
18 |
|
|
c2 = the_c2; |
19 |
|
|
c3 = the_c3; |
20 |
|
|
theta0 = the_Th0; |
21 |
|
|
} |
22 |
|
|
|
23 |
|
|
|
24 |
|
|
double QuadraticBend::bend_force( double theta ){ |
25 |
|
|
|
26 |
|
|
double dt, dt2; |
27 |
|
|
double force; |
28 |
|
|
|
29 |
|
|
|
30 |
|
|
|
31 |
|
|
|
32 |
|
|
dt = ( theta - theta0 ) * M_PI / 180.0; |
33 |
|
|
dt2 = dt * dt; |
34 |
|
|
|
35 |
|
|
c_potential_E = ( c1 * dt2 ) + ( c2 * dt ) + c3; |
36 |
|
|
force = -( ( 2.0 * c1 * dt ) + c2 ); |
37 |
|
|
return force; |
38 |
|
|
} |