1 #include <lal/LALSimInspiral.h>
2 #include <lal/LALSimIMR.h>
4 #include <gsl/gsl_vector.h>
5 #include <gsl/gsl_matrix.h>
6 #include <gsl/gsl_blas.h>
8 #include <gsl/gsl_multiroots.h>
9 #include <gsl/gsl_deriv.h>
20 #ifndef _LALSIMIMRSPINPRECEOBINITIALCONDITIONS_C
21 #define _LALSIMIMRSPINPRECEOBINITIALCONDITIONS_C
38 return a[0] * b[0] +
a[1] * b[1] +
a[2] * b[2];
53 return a[(
i + 1) % 3] * b[(
i + 2) % 3] -
a[(
i + 2) % 3] * b[(
i + 1) % 3];
64 REAL8 norm = sqrt(
a[0] *
a[0] +
a[1] *
a[1] +
a[2] *
a[2]);
80 gsl_matrix * rotMatrix,
81 gsl_matrix * rotInverse,
91 REAL8 cosa , sina, cosb, sinb, cosg, sing;
99 a = atan2(L[0], -L[1]);
100 b = atan2(sqrt(L[0] * L[0] + L[1] * L[1]), L[2]);
101 g = atan2(
r[2], v[2]);
104 if ((cosa = cos(
a)) < 1.0e-16)
106 if ((sina = sin(
a)) < 1.0e-16)
108 if ((cosb = cos(b)) < 1.0e-16)
110 if ((sinb = sin(b)) < 1.0e-16)
112 if ((cosg = cos(g)) < 1.0e-16)
114 if ((sing = sin(g)) < 1.0e-16)
135 gsl_matrix_set(rotMatrix, 0, 0,
r[0]);
136 gsl_matrix_set(rotMatrix, 0, 1,
r[1]);
137 gsl_matrix_set(rotMatrix, 0, 2,
r[2]);
138 gsl_matrix_set(rotMatrix, 1, 0, v[0]);
139 gsl_matrix_set(rotMatrix, 1, 1, v[1]);
140 gsl_matrix_set(rotMatrix, 1, 2, v[2]);
141 gsl_matrix_set(rotMatrix, 2, 0, L[0]);
142 gsl_matrix_set(rotMatrix, 2, 1, L[1]);
143 gsl_matrix_set(rotMatrix, 2, 2, L[2]);
147 gsl_matrix_transpose_memcpy(rotInverse, rotMatrix);
179 gsl_matrix * rotMatrix,
185 gsl_vector_view tmpView1 = gsl_vector_view_array(
a, 3);
186 gsl_vector_view tmpView2 = gsl_vector_view_array(b, 3);
187 gsl_vector *tmpVec1 = &tmpView1.vector;
188 gsl_vector *tmpVec2 = &tmpView2.vector;
190 gsl_blas_dgemv(CblasNoTrans, 1.0, rotMatrix, tmpVec1, 0.0, tmpVec2);
192 gsl_vector_memcpy(tmpVec1, tmpVec2);
298 const gsl_vector * x,
307 XLAL_PRINT_INFO(
"\n\nmtotal in XLALFindSphericalOrbitPrec = %f\n", (
float)mTotal);
309 REAL8 py , pz,
r, ptheta, pphi;
312 REAL8 dHdx , dHdpy, dHdpz;
313 REAL8 dHdr , dHdptheta, dHdpphi;
319 REAL8 prefactor = 1.0;
324 rootParams->
values[0] =
r = sqrt(temp*temp+36.0);
328 if(isnan(rootParams->
values[0])) {
329 rootParams->
values[0] = 100.;
331 if(isnan(rootParams->
values[4])) {
332 rootParams->
values[4] = 0.1;
334 if(isnan(rootParams->
values[5])) {
335 rootParams->
values[5] = 0.01;
349 XLAL_PRINT_INFO(
"Input Values r = %.16e, py = %.16e, pz = %.16e\n pthetha = %.16e pphi = %.16e\n",
r, py, pz, ptheta, pphi);
352 REAL8 tmpDValues[14];
354 for (
int i = 0;
i < 3;
i++) {
355 rootParams->
values[
i + 6] /= mTotal * mTotal;
356 rootParams->
values[
i + 9] /= mTotal * mTotal;
362 for (
int i = 0;
i < 3;
i++) {
363 rootParams->
values[
i + 6] *= mTotal * mTotal;
364 rootParams->
values[
i + 9] *= mTotal * mTotal;
384 XLAL_PRINT_INFO(
"rvec = %.16e %.16e %.16e\n", rvec[0], rvec[1], rvec[2]);
385 XLAL_PRINT_INFO(
"pvec = %.16e %.16e %.16e\n", pvec[0], pvec[1], pvec[2]);
390 if (theta1 > 1.0e-6 && theta2 >= 1.0e-6) {
391 dHdx = -tmpDValues[3];
392 dHdpy = tmpDValues[1];
393 dHdpz = tmpDValues[2];
413 XLAL_PRINT_INFO(
"dHdx = %.16e, dHdpy = %.16e, dHdpz = %.16e\n", dHdx, dHdpy, dHdpz);
416 dHdr = dHdx - dHdpy * pphi / (
r *
r) + dHdpz * ptheta / (
r *
r);
417 dHdptheta = -dHdpz /
r;
422 dHdr, dHdptheta, dHdpphi);
424 gsl_vector_set(f, 0, dHdr);
425 gsl_vector_set(f, 1, dHdptheta);
426 gsl_vector_set(f, 2, dHdpphi - rootParams->
omega);
430 gsl_vector_get(f, 0), gsl_vector_get(f, 1), gsl_vector_get(f, 2) );
457 REAL8 cartValues[12];
459 REAL8 dHdr , dHdx, dHdpy, dHdpz;
462 memcpy(sphValues, dParams->
sphValues,
sizeof(sphValues));
466 memcpy(cartValues + 6, sphValues + 6, 6 *
sizeof(
REAL8));
469 ptheta = sphValues[4];
473 REAL8 tmpDValues[14];
475 for (
int i = 0;
i < 3;
i++) {
476 cartValues[
i + 6] /= mTotal * mTotal;
477 cartValues[
i + 9] /= mTotal * mTotal;
483 for (
int i = 0;
i < 3;
i++) {
484 cartValues[
i + 6] *= mTotal * mTotal;
485 cartValues[
i + 9] *= mTotal * mTotal;
488 double rvec [3] = {cartValues[0], cartValues[1], cartValues[2]};
489 double pvec [3] = {cartValues[3], cartValues[4], cartValues[5]};
490 double chi1vec [3] = {cartValues[6], cartValues[7], cartValues[8]};
491 double chi2vec [3] = {cartValues[9], cartValues[10], cartValues[11]};
497 XLAL_PRINT_INFO(
"rvec = %.16e %.16e %.16e\n", rvec[0], rvec[1], rvec[2]);
498 XLAL_PRINT_INFO(
"pvec = %.16e %.16e %.16e\n", pvec[0], pvec[1], pvec[2]);
502 if (theta1 > 1.0e-6 && theta2 >= 1.0e-6) {
506 dHdx = -tmpDValues[3];
508 dHdpy = tmpDValues[1];
510 dHdpz = tmpDValues[2];
513 dHdr = dHdx - dHdpy * pphi / (
r *
r) + dHdpz * ptheta / (
r *
r);
520 dHdpz = tmpDValues[2];
526 dHdpy = tmpDValues[1];
531 XLALPrintError(
"This option is not supported in the second derivative function!\n");
542 dHdr = dHdx - dHdpy * pphi / (
r *
r) + dHdpz * ptheta / (
r *
r);
558 XLALPrintError(
"This option is not supported in the second derivative function!\n");
566 double *result,
double *absErr){
568 gsl_deriv_central(F,
x,h, result, absErr);
571 if (fabs(*absErr)>frac*fabs(*result)){
578 while (!deriv_ok && n<=10){
579 XLAL_PRINT_WARNING(
"Warning: second derivative computation went wrong. Trying again");
580 gsl_deriv_central(F,
x,2*n*h, &temp1, &absErr1);
581 gsl_deriv_central(F,
x,h/(2*n), &temp2, &absErr2);
582 if (fabs(absErr1)/fabs(temp1)<fabs(absErr2)/fabs(temp2) && fabs(absErr1)<frac*fabs(temp1)){
588 else if (fabs(absErr1)/fabs(temp1)>fabs(absErr2)/fabs(temp2) && fabs(absErr2)<frac*fabs(temp2)){
599 XLAL_PRINT_ERROR(
"The computation of the second derivative of H in initial data has failed!");
613 const REAL8 values[],
619 static const REAL8 STEP_SIZE = 3.0e-3;
627 INT4 UNUSED gslStatus;
657 STEP_SIZE, &result, &absErr);
722 int debugPK = 0;
int printPK = 0;
723 FILE* UNUSED out = NULL;
726 XLAL_PRINT_INFO(
"Inside the XLALSimIMRSpinEOBInitialConditionsPrec function!\n");
728 "Inputs: m1 = %.16e, m2 = %.16e, fMin = %.16e, inclination = %.16e\n",
729 mass1, mass2, (
double)fMin, (
double)inc);
731 spin1[0], spin1[1], spin1[2]);
733 spin2[0], spin2[1], spin2[2]);
736 static const int UNUSED lMax = 8;
743 UINT4 SpinAlignedEOBversion;
763 REAL8 qCart [3], pCart[3];
764 REAL8 qSph [3], pSph[3];
776 REAL8 sKerrData[3], sStarData[3];
786 REAL8 cartValues[12];
790 gsl_matrix *rotMatrix = NULL;
791 gsl_matrix *invMatrix = NULL;
792 gsl_matrix *rotMatrix2 = NULL;
793 gsl_matrix *invMatrix2 = NULL;
797 const gsl_multiroot_fsolver_type *T = gsl_multiroot_fsolver_hybrids;
798 gsl_multiroot_fsolver *rootSolver = NULL;
800 gsl_multiroot_function rootFunction;
801 gsl_vector *initValues = NULL;
802 gsl_vector *finalValues = NULL;
804 INT4 cntGslNoProgress = 0, MAXcntGslNoProgress = 5;
806 REAL8 multFacGslNoProgress = 3./5.;
808 const int maxIter = 10000;
810 memset(&rootParams, 0,
sizeof(rootParams));
812 mTotal = mass1 + mass2;
813 eta = mass1 * mass2 / (mTotal * mTotal);
814 memcpy(tmpS1, spin1,
sizeof(tmpS1));
815 memcpy(tmpS2, spin2,
sizeof(tmpS2));
816 memcpy(tmpS1Norm, spin1,
sizeof(tmpS1Norm));
817 memcpy(tmpS2Norm, spin2,
sizeof(tmpS2Norm));
818 for (
i = 0;
i < 3;
i++) {
819 tmpS1Norm[
i] /= mTotal * mTotal;
820 tmpS2Norm[
i] /= mTotal * mTotal;
822 SpinAlignedEOBversion =
params->seobCoeffs->SpinAlignedEOBversion;
824 tmpTortoise =
params->tortoise;
828 nqcCoeffs =
params->nqcCoeffs;
845 if (LnHat[2] > 0.9999) {
847 rHat[1] = rHat[2] = 0.;
849 REAL8 theta0 = atan(-LnHat[2] / LnHat[0]);
851 rHat[0] = sin(theta0);
853 rHat[2] = cos(theta0);
865 for (
i = 0;
i < 3;
i++)
866 XLAL_PRINT_INFO(
" LnHat[%d] = %.16e, rHat[%d] = %.16e, vHat[%d] = %.16e\n",
867 i, LnHat[
i],
i, rHat[
i],
i, vHat[
i]);
870 for (
i = 0;
i < 3;
i++)
878 if (!rotMatrix || !invMatrix) {
880 gsl_matrix_free(rotMatrix);
882 gsl_matrix_free(invMatrix);
886 gsl_matrix_free(rotMatrix);
887 gsl_matrix_free(invMatrix);
902 for (
i = 0;
i < 3;
i++)
903 XLAL_PRINT_INFO(
" LnHat[%d] = %.16e, rHat[%d] = %.16e, vHat[%d] = %.16e\n",
904 i, LnHat[
i],
i, rHat[
i],
i, vHat[
i]);
907 for (
i = 0;
i < 3;
i++)
921 XLAL_CALLGSL(rootSolver = gsl_multiroot_fsolver_alloc(T, 3));
923 gsl_matrix_free(rotMatrix);
924 gsl_matrix_free(invMatrix);
929 gsl_multiroot_fsolver_free(rootSolver);
930 gsl_matrix_free(rotMatrix);
931 gsl_matrix_free(invMatrix);
937 rootFunction.params = &rootParams;
948 rootParams.
omega = omega;
954 rootParams.
values[0] =
scale1 * sqrt(1. / (v0 * v0)*1/(v0*v0) - 36.0);
958 memcpy(rootParams.
values + 6, tmpS1,
sizeof(tmpS1));
959 memcpy(rootParams.
values + 9, tmpS2,
sizeof(tmpS2));
968 gsl_vector_set(initValues, 0, rootParams.
values[0]);
969 gsl_vector_set(initValues, 1, rootParams.
values[4]);
970 gsl_vector_set(initValues, 2, rootParams.
values[5]);
972 gsl_multiroot_fsolver_set(rootSolver, &rootFunction, initValues);
977 out = fopen(
"ICIterations.dat",
"w");
983 XLAL_CALLGSL(gslStatus = gsl_multiroot_fsolver_iterate(rootSolver));
988 r_now = sqrt(rootParams.
values[0]*rootParams.
values[0]+36.0);
989 fprintf( out,
"%.16e\t%.16e\t%.16e\t",
994 finalValues = gsl_multiroot_fsolver_f(rootSolver);
997 fprintf( out,
"%.16e\t%.16e\t%.16e\t",
998 gsl_vector_get(finalValues, 0),
999 gsl_vector_get(finalValues, 1),
1000 gsl_vector_get(finalValues, 2) );
1003 finalValues = gsl_multiroot_fsolver_dx(rootSolver);
1004 temp = gsl_vector_get(finalValues, 0)/
scale1/r_now;
1006 fprintf( out,
"%.16e\t%.16e\t%.16e\t%d\n",
1008 gsl_vector_get(finalValues, 1)/
scale2,
1009 gsl_vector_get(finalValues, 2)/
scale3,
1013 if (gslStatus == GSL_ENOPROG || gslStatus == GSL_ENOPROGJ) {
1015 "\n NO PROGRESS being made by Spherical orbit root solver\n");
1018 finalValues = gsl_multiroot_fsolver_f(rootSolver);
1021 gsl_vector_get(finalValues, 0),
1022 gsl_vector_get(finalValues, 1), gsl_vector_get(finalValues, 2));
1025 finalValues = gsl_multiroot_fsolver_dx(rootSolver);
1033 cntGslNoProgress += 1;
1034 if (cntGslNoProgress >= MAXcntGslNoProgress) {
1035 cntGslNoProgress = 0;
1037 if(multFacGslNoProgress < 1.){ multFacGslNoProgress *= 1.02; }
1038 else{ multFacGslNoProgress /= 1.01; }
1043 rootParams.
values[0] =
scale1 * sqrt(1. / (v0 * v0)*1./(v0*v0) -36.0);
1045 if( cntGslNoProgress % 2 )
1046 rootParams.
values[5] =
scale3 * 1
e-3 / multFacGslNoProgress;
1048 rootParams.
values[5] =
scale3 * 1
e-3 * multFacGslNoProgress;
1050 memcpy(rootParams.
values + 6, tmpS1,
sizeof(tmpS1));
1051 memcpy(rootParams.
values + 9, tmpS2,
sizeof(tmpS2));
1060 gsl_vector_set(initValues, 0, rootParams.
values[0]);
1061 gsl_vector_set(initValues, 1, rootParams.
values[4]);
1062 gsl_vector_set(initValues, 2, rootParams.
values[5]);
1063 gsl_multiroot_fsolver_set(rootSolver, &rootFunction, initValues);
1065 else if (gslStatus == GSL_EBADFUNC) {
1067 "Inf or Nan encountered in evaluluation of spherical orbit Eqn\n");
1068 gsl_multiroot_fsolver_free(rootSolver);
1069 gsl_vector_free(initValues);
1070 gsl_matrix_free(rotMatrix);
1071 gsl_matrix_free(invMatrix);
1074 else if (gslStatus != GSL_SUCCESS) {
1076 gsl_multiroot_fsolver_free(rootSolver);
1077 gsl_vector_free(initValues);
1078 gsl_matrix_free(rotMatrix);
1079 gsl_matrix_free(invMatrix);
1084 XLAL_CALLGSL(gslStatus = gsl_multiroot_test_residual(rootSolver->f, 1.0e-9));
1091 finalValues = gsl_multiroot_fsolver_dx(rootSolver);
1092 if (isnan(gsl_vector_get(finalValues, 1))) {
1093 rootParams.
values[0] =
scale1 * sqrt(1. / (v0 * v0)*1/(v0*v0)*(1.+1.e-8) - 36.0);
1096 memcpy(rootParams.
values + 6, tmpS1,
sizeof(tmpS1));
1097 memcpy(rootParams.
values + 9, tmpS2,
sizeof(tmpS2));
1098 gsl_vector_set(initValues, 0, rootParams.
values[0]);
1099 gsl_vector_set(initValues, 1, rootParams.
values[4]);
1100 gsl_vector_set(initValues, 2, rootParams.
values[5]);
1101 gsl_multiroot_fsolver_set(rootSolver, &rootFunction, initValues);
1107 while (gslStatus == GSL_CONTINUE &&
i <= maxIter);
1109 if(debugPK) { fflush(NULL); fclose(out); }
1111 if (
i > maxIter && gslStatus != GSL_SUCCESS) {
1112 gsl_multiroot_fsolver_free(rootSolver);
1113 gsl_vector_free(initValues);
1114 gsl_matrix_free(rotMatrix);
1115 gsl_matrix_free(invMatrix);
1119 finalValues = gsl_multiroot_fsolver_root(rootSolver);
1122 XLAL_PRINT_INFO(
"Spherical orbit conditions here given by the following:\n");
1124 gsl_vector_get(finalValues, 0)/
scale1,
1125 gsl_vector_get(finalValues, 1)/
scale2,
1126 gsl_vector_get(finalValues, 2)/
scale3);
1128 memset(qCart, 0,
sizeof(qCart));
1129 memset(pCart, 0,
sizeof(pCart));
1131 qCart[0] = sqrt(gsl_vector_get(finalValues, 0)*gsl_vector_get(finalValues, 0)+36.0);
1132 pCart[1] = gsl_vector_get(finalValues, 1)/
scale2;
1133 pCart[2] = gsl_vector_get(finalValues, 2)/
scale3;
1137 gsl_multiroot_fsolver_free(rootSolver);
1138 gsl_vector_free(initValues);
1148 memcpy(qHat, qCart,
sizeof(qCart));
1149 memcpy(pHat, pCart,
sizeof(pCart));
1164 gsl_matrix_free(rotMatrix);
1165 gsl_matrix_free(invMatrix);
1178 gsl_matrix_free(rotMatrix);
1179 gsl_matrix_free(rotMatrix2);
1182 XLAL_PRINT_INFO(
"qCart after rotation2 %3.10f %3.10f %3.10f\n", qCart[0], qCart[1], qCart[2]);
1183 XLAL_PRINT_INFO(
"pCart after rotation2 %3.10f %3.10f %3.10f\n", pCart[0], pCart[1], pCart[2]);
1184 XLAL_PRINT_INFO(
"S1 after rotation2 %3.10f %3.10f %3.10f\n", tmpS1Norm[0], tmpS1Norm[1], tmpS1Norm[2]);
1185 XLAL_PRINT_INFO(
"S2 after rotation2 %3.10f %3.10f %3.10f\n", tmpS2Norm[0], tmpS2Norm[1], tmpS2Norm[2]);
1195 memcpy(sphValues, qSph,
sizeof(qSph));
1196 memcpy(sphValues + 3, pSph,
sizeof(pSph));
1197 memcpy(sphValues + 6, tmpS1,
sizeof(tmpS1));
1198 memcpy(sphValues + 9, tmpS2,
sizeof(tmpS2));
1200 memcpy(cartValues, qCart,
sizeof(qCart));
1201 memcpy(cartValues + 3, pCart,
sizeof(pCart));
1202 memcpy(cartValues + 6, tmpS1,
sizeof(tmpS1));
1203 memcpy(cartValues + 9, tmpS2,
sizeof(tmpS2));
1205 REAL8 dHdpphi , d2Hdr2, d2Hdrdpphi;
1206 REAL8 rDot , dHdpr, flux, dEdr;
1212 XLAL_PRINT_INFO(
"d2Hdr2 = %.16e, d2Hdrdpphi = %.16e\n", d2Hdr2, d2Hdrdpphi);
1216 REAL8 tmpDValues[14];
1218 for (
i = 0;
i < 3;
i++) {
1219 cartValues[
i + 6] /= mTotal * mTotal;
1220 cartValues[
i + 9] /= mTotal * mTotal;
1225 params->ignoreflux = oldignoreflux;
1226 for (
i = 0;
i < 3;
i++) {
1227 cartValues[
i + 6] *= mTotal * mTotal;
1228 cartValues[
i + 9] *= mTotal * mTotal;
1231 dHdpphi = tmpDValues[1] / sqrt(cartValues[0] * cartValues[0] + cartValues[1] * cartValues[1] + cartValues[2] * cartValues[2]);
1234 dEdr = -dHdpphi * d2Hdr2 / d2Hdrdpphi;
1237 XLAL_PRINT_INFO(
"d2Hdr2 = %.16e d2Hdrdpphi = %.16e dHdpphi = %.16e\n",
1238 d2Hdr2, d2Hdrdpphi, dHdpphi);
1240 if (d2Hdr2 != 0.0) {
1245 s1VecNorm.
data = tmpS1Norm;
1246 s2VecNorm.
data = tmpS2Norm;
1247 sKerr.
data = sKerrData;
1248 sStar.
data = sStarData;
1251 qCartVec.
data = qCart;
1252 pCartVec.
data = pCart;
1276 XLAL_PRINT_INFO(
"Stas: hamiltonian in ICs at this point is %.16e\n", ham);
1280 REAL8 polarData[4], cartData[12];
1282 polarDynamics.
length = 4;
1283 polarDynamics.
data = polarData;
1285 polarData[0] = qSph[0];
1287 polarData[2] = pSph[0];
1288 polarData[3] = pSph[2];
1290 cartDynamics.
length = 12;
1291 cartDynamics.
data = cartData;
1293 memcpy(cartData, qCart, 3 *
sizeof(
REAL8));
1294 memcpy(cartData + 3, pCart, 3 *
sizeof(
REAL8));
1295 memcpy(cartData + 6, tmpS1Norm, 3 *
sizeof(
REAL8));
1296 memcpy(cartData + 9, tmpS2Norm, 3 *
sizeof(
REAL8));
1313 rDot = -flux / dEdr;
1324 cartValues[3] = 1.0e-3;
1325 for (
i = 0;
i < 3;
i++) {
1326 cartValues[
i + 6] /= mTotal * mTotal;
1327 cartValues[
i + 9] /= mTotal * mTotal;
1329 oldignoreflux =
params->ignoreflux;
1331 params->seobCoeffs->updateHCoeffs = 1;
1333 params->ignoreflux = oldignoreflux;
1334 for (
i = 0;
i < 3;
i++) {
1335 cartValues[
i + 6] *= mTotal * mTotal;
1336 cartValues[
i + 9] *= mTotal * mTotal;
1340 dHdpr =
csi*tmpDValues[0];
1345 XLAL_PRINT_INFO(
"flux = %.16e, dEdr = %.16e, dHdpr = %.16e, dHdpr/pr = %.16e\n", flux, dEdr, dHdpr, dHdpr / cartValues[3]);
1351 pSph[0] = rDot / (dHdpr / cartValues[3]);
1392 gsl_matrix_free(invMatrix);
1393 gsl_matrix_free(invMatrix2);
1397 REAL8 r = sqrt(qCart[0] * qCart[0] + qCart[1] * qCart[1] + qCart[2] * qCart[2]);
1402 REAL8 pr = (qCart[0] * pCart[0] + qCart[1] * pCart[1] + qCart[2] * pCart[2]) /
r;
1404 params->tortoise = tmpTortoise;
1408 XLAL_PRINT_INFO(
"pCart = %3.10f %3.10f %3.10f\n", pCart[0], pCart[1], pCart[2]);
1410 for (
i = 0;
i < 3;
i++) {
1411 pCart[
i] = pCart[
i] + qCart[
i] *
pr * (
csi - 1.) /
r;
1417 memcpy(initConds->
data, qCart,
sizeof(qCart));
1418 memcpy(initConds->
data + 3, pCart,
sizeof(pCart));
1419 memcpy(initConds->
data + 6, tmpS1Norm,
sizeof(tmpS1Norm));
1420 memcpy(initConds->
data + 9, tmpS2Norm,
sizeof(tmpS2Norm));
1422 for (
i=0;
i<12;
i++) {
1423 if (fabs(initConds->
data[
i]) <=1.0e-15) {
1424 initConds->
data[
i] = 0.;
1430 XLAL_PRINT_INFO(
" %.16e %.16e %.16e\n%.16e %.16e %.16e\n%.16e %.16e %.16e\n%.16e %.16e %.16e\n", initConds->
data[0], initConds->
data[1], initConds->
data[2],
1431 initConds->
data[3], initConds->
data[4], initConds->
data[5], initConds->
data[6], initConds->
data[7], initConds->
data[8],
1432 initConds->
data[9], initConds->
data[10], initConds->
data[11]);
static int XLALSimIMRSpinEOBCalculateSigmaKerr(REAL8Vector *sigmaKerr, REAL8 mass1, REAL8 mass2, REAL8Vector *s1, REAL8Vector *s2)
Function to calculate normalized spin of the deformed-Kerr background in SEOBNRv1.
static int XLALSimIMRSpinEOBCalculateSigmaStar(REAL8Vector *sigmaStar, REAL8 mass1, REAL8 mass2, REAL8Vector *s1, REAL8Vector *s2)
Function to calculate normalized spin of the test particle in SEOBNRv1.
static REAL8 XLALInspiralPrecSpinFactorizedFlux(REAL8Vector *polvalues, REAL8Vector *values, EOBNonQCCoeffs *nqcCoeffs, const REAL8 omega, SpinEOBParams *ak, const REAL8 H, const INT4 lMax, const UINT4 SpinAlignedEOBversion)
This function calculates the spin factorized-resummed GW energy flux for given dynamical variables.
static REAL8 XLALInspiralPrecSpinFactorizedFlux_exact(REAL8Vector *polvalues, REAL8Vector *values, EOBNonQCCoeffs *nqcCoeffs, const REAL8 omega, SpinEOBParams *ak, const REAL8 H, const INT4 lMax, const UINT4 SpinAlignedEOBversion)
This function calculates the spin factorized-resummed GW energy flux for given dynamical variables.
static REAL8 XLALSimIMRSpinPrecEOBHamiltonian(const REAL8 eta, REAL8Vector *restrict x, REAL8Vector *restrict p, REAL8Vector *restrict s1Vec, REAL8Vector *restrict s2Vec, REAL8Vector *restrict sigmaKerr, REAL8Vector *restrict sigmaStar, int tortoise, SpinEOBHCoeffs *coeffs)
static REAL8 XLALSimIMRSpinPrecEOBHamiltonianDeltaT(SpinEOBHCoeffs *coeffs, const REAL8 r, const REAL8 eta, const REAL8 a)
This function calculates the function which appears in the spinning EOB potential function.
static UNUSED REAL8 XLALSimIMRSpinPrecEOBHamiltonianDeltaR(SpinEOBHCoeffs *coeffs, const REAL8 r, const REAL8 eta, const REAL8 a)
This function calculates the DeltaR potential function in the spin EOB Hamiltonian.
static REAL8 XLALSpinPrecHcapNumDerivWRTParam(const INT4 paramIdx, const REAL8 values[], SpinEOBParams *funcParams)
Calculate the derivative of the Hamiltonian w.r.t.
static int XLALSpinPrecHcapNumericalDerivative(double UNUSED t, const REAL8 values[], REAL8 dvalues[], void *funcParams)
Function to calculate numerical derivatives of the spin EOB Hamiltonian, which correspond to time der...
static int XLALFindSphericalOrbitPrec(const gsl_vector *x, void *params, gsl_vector *f)
Root function for gsl root finders.
static double GSLSpinHamiltonianDerivWrapperPrec(double x, void *params)
Wrapper for calculating specific derivative of the Hamiltonian in spherical co-ordinates,...
static int NormalizeVectorPrec(REAL8 a[])
Normalizes the given vector.
static REAL8 CalculateCrossProductPrec(const INT4 i, const REAL8 a[], const REAL8 b[])
Calculates the ith component of the cross product of two vectors, where i is in the range 0-2.
static int XLALSimIMRSpinEOBInitialConditionsPrec(REAL8Vector *initConds, const REAL8 mass1, const REAL8 mass2, const REAL8 fMin, const REAL8 inc, const REAL8 spin1[], const REAL8 spin2[], SpinEOBParams *params, INT4 use_optimized)
Main function for calculating the spinning EOB initial conditions, following the quasi-spherical init...
static int CalculateRotationMatrixPrec(gsl_matrix *rotMatrix, gsl_matrix *rotInverse, REAL8 r[], REAL8 v[], REAL8 L[])
Calculate the rotation matrix and its inverse.
static int ApplyRotationMatrixPrec(gsl_matrix *rotMatrix, REAL8 a[])
Applies a rotation matrix to a given vector.
static int SphericalToCartesianPrec(REAL8 qCart[], REAL8 pCart[], const REAL8 qSph[], const REAL8 pSph[])
Performs a co-ordinate transformation from spherical to Cartesian co-ordinates.
static REAL8 XLALCalculateSphHamiltonianDeriv2Prec(const int idx1, const int idx2, const REAL8 values[], SpinEOBParams *params, INT4 use_optimized)
Function to calculate the second derivative of the Hamiltonian.
static int XLALRobustDerivative(const gsl_function *F, double x, double h, double *result, double *absErr)
static REAL8 CalculateDotProductPrec(const REAL8 a[], const REAL8 b[])
Calculate the dot product of two vectors.
static int CartesianToSphericalPrec(REAL8 qSph[], REAL8 pSph[], const REAL8 qCart[], const REAL8 pCart[])
Perform a co-ordinate transformation from Cartesian to spherical co-ordinates.
#define XLAL_CALLGSL(statement)
#define XLAL_ERROR_REAL8(...)
#define XLAL_PRINT_INFO(...)
#define XLAL_PRINT_WARNING(...)
int XLALPrintError(const char *fmt,...) _LAL_GCC_PRINTF_FORMAT_(1
#define XLAL_PRINT_ERROR(...)
#define XLAL_IS_REAL8_FAIL_NAN(val)
The coefficients which are used in calculating the non-quasicircular correction to the EOBNRv2 model.
Structure consisting SEOBNR parameters that can be used by gsl root finders.
REAL8 omega
< Orbital frequency
REAL8 values[12]
< Dynamical variables, x, y, z, px, py, pz, S1x, S1y, S1z, S2x, S2y and S2z
SpinEOBParams * params
< Spin EOB parameters – physical, pre-computed, etc.
Parameters for the spinning EOB model.