Skip to content

Commit 1ec8353

Browse files
committed
Added sinNPhiCosNPhi
1 parent 99c63e4 commit 1ec8353

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

tlm3_dihedral/Dihed.cc

+15
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,21 @@
77
#define MIN(XXX,YYY) ((XXX<YYY)?XXX:YYY)
88
#define MAX(XXX,YYY) ((XXX<YYY)?YYY:XXX)
99

10+
void sinNPhiCosNPhi(int n, double* sinNPhi, double* cosNPhi,
11+
double sinPhi, double cosPhi )
12+
{
13+
double sinNm1Phi, cosNm1Phi;
14+
if ( n==1 ) {
15+
*sinNPhi = sinPhi;
16+
*cosNPhi = cosPhi;
17+
return;
18+
};
19+
sinNPhiCosNPhi(n-1,&sinNm1Phi,&cosNm1Phi,sinPhi,cosPhi);
20+
*sinNPhi = cosPhi*sinNm1Phi+sinPhi*cosNm1Phi;
21+
*cosNPhi = cosPhi*cosNm1Phi-sinPhi*sinNm1Phi;
22+
return;
23+
}
24+
1025

1126
int enzyme_dup;
1227
int enzyme_out;

0 commit comments

Comments
 (0)