LALSimulation  5.4.0.1-fe68b98
LALSimIMRPhenomX_precession.h
Go to the documentation of this file.
1 #ifndef _LALSIM_IMR_PHENOMX_PRECESSION_H
2 #define _LALSIM_IMR_PHENOMX_PRECESSION_H
3 /*
4  * Copyright (C) 2018/2019 Geraint Pratten
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with with program; see the file COPYING. If not, write to the
18  * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19  * MA 02110-1301 USA
20  */
21 
22 
23 /**
24  * \author Geraint Pratten
25  *
26  */
27 
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
31 
32 #ifdef __GNUC__
33 #define UNUSED __attribute__ ((unused))
34 #else
35 #define UNUSED
36 #endif
37 
38 #include "LALSimIMRPhenomX.h"
41 
42 #include "LALSimIMRPhenomXHM.h"
44 
45 #include <lal/LALStdlib.h>
46 #include <lal/LALSimIMR.h>
47 #include <lal/LALConstants.h>
48 
49 #include <lal/FrequencySeries.h>
50 #include <lal/LALSimInspiral.h>
51 #include <gsl/gsl_spline.h>
52 
53 /**
54  * Tolerance used below which numbers are treated as zero for the calculation of atan2
55  */
56 #define MAX_TOL_ATAN 1.0e-15
57 
58 /* Cartesian 3-vector */
59 typedef struct tagvector
60 {
61  double x; // x-component
62  double y; // y-component
63  double z; // z-component
64 } vector;
65 
66 /* Spherical Polar 3-vector */
67 typedef struct tagsphpolvector
68 {
69  double r; // radial-component
70  double theta; // theta-component
71  double phi; // phi-component
72 } sphpolvector;
73 
74 /* MRD angles utilities */
75 typedef struct tagPhenomXPbetaMRD
76  {
77  double aRD;
78  double bRD;
79  double cRD;
80  double dRD;
81  double cosbeta_sign;
82  bool flat_RD;
83  double dfdamp;
84 
86 
87 typedef struct tagPhenomXPalphaMRD
88  {
89  double aRD;
90  double bRD;
91  double cRD;
92 
94 
95 typedef struct tagPhenomXPInspiralArrays{
96 
108 
109 /* Struct to store all precession relevant variables */
110 typedef struct tagIMRPhenomXPrecessionStruct
111 {
112  /* Flag to define the version of IMRPhenomXP called */
113  INT4 IMRPhenomXPrecVersion; /**< Flag to set version of Euler angles used. */
114 
115  /* Toggle to return coprecessing model without any twisting up */
117 
118  // /* Parameters that define deviation of the tuned coprecessing mode PhenomXCP from PhenomX */
119  // REAL8 MU2; // MR Amplitude
120  // REAL8 MU3; // MR Amplitude
121  // REAL8 MU4; // MR Amplitude
122  // REAL8 NU4; // MR Phase
123  // REAL8 NU5; // MR Phase
124  // REAL8 NU6; // MR Phase
125  // REAL8 ZETA2; // INT Phase
126 
127  /* Debug flag */
128  INT4 debug_prec; /**< Set debugging level. */
129 
130  /* Mass and spin weightings */
131  REAL8 A1; /**< Mass weighted pre-factor, see Eq. 3.2 of Schmidt et al, arXiv:1408.1810 */
132  REAL8 A2; /**< Mass weighted pre-factor, see Eq. 3.2 of Schmidt et al, arXiv:1408.1810 */
133  REAL8 ASp1; /**< \f$A1 * S_{1 \perp}\f$, see Eq. 3.3 of Schmidt et al, arXiv:1408.1810 */
134  REAL8 ASp2; /**< \f$A2 * S_{2 \perp}\f$, see Eq. 3.3 of Schmidt et al, arXiv:1408.1810 */
135  REAL8 chi1_perp; /**< \f$ \chi_{1 \perp} \f$ */
136  REAL8 chi2_perp; /**< \f$ \chi_{2 \perp} \f$ */
137  REAL8 S1_perp; /**< \f$ S_{1 \perp} \f$ */
138  REAL8 S2_perp; /**< \f$ S_{2 \perp} \f$ */
139  REAL8 SL; /**< \f$ \chi_{1 L} m^1_2 + \chi_{2 L} m^2_2 \f$ */
140  REAL8 Sperp; /**< \f$ \chi_{p} m^1_2 \f$ */
141  REAL8 STot_perp; /**< \f$ S_{1 \perp} + S_{2 \perp} \f$ */
143  REAL8 chiTot_perp; /**< \f$ S_{1 \perp} + S_{2 \perp} \f$ */
144 
145  /* Effective precessing spin parameter: Schmidt et al, Phys. Rev. D 91, 024043 (2015), arXiv:1408.1810 */
146  REAL8 chi_p; /**< \f$ \chi_{p} = S_p / (A_1 \chi^2_1) \f$, Eq. 3.4 of Schmidt et al, arXiv:1408.1810 */
147 
148  /* Dimensionless aligned spin components on companion 1 and 2 respectively */
149  REAL8 chi1L; /**< \f$ \chi_{1L} = \chi_{1} \cdot \hat{L} \f$ */
150  REAL8 chi2L; /**< \f$ \chi_{2L} = \chi_{2} \cdot \hat{L} \f$ */
151 
152  /* Angle between J0 and line of sight (z-direction) */
153  REAL8 thetaJN; /**< Angle between J0 and line of sight (z-direction) */
154 
155  /* The initial phase that we pass to the underlying aligned spin IMR waveform model */
156  REAL8 phi0_aligned; /**< Initial phase to feed the underlying aligned-spin model */
157 
158  /* Angle to rotate the polarization */
159  REAL8 zeta_polarization; /**< Angle to rotate the polarizations */
160 
161  /* Post-Newtonian Euler angles */
162  REAL8 alpha0; /**< Coefficient of \f$\alpha\f$ */
163  REAL8 alpha1; /**< Coefficient of \f$\alpha\f$ */
164  REAL8 alpha2; /**< Coefficient of \f$\alpha\f$ */
165  REAL8 alpha3; /**< Coefficient of \f$\alpha\f$ */
166  REAL8 alpha4L; /**< Coefficient of \f$\alpha\f$ */
167  REAL8 alpha5; /**< Coefficient of \f$\alpha\f$ */
168  REAL8 alpha6; /**< Coefficient of \f$\alpha\f$ */
169  REAL8 alphaNNLO; /**< Post Newtonian \f$\alpha\f$ at NNLO. */
170  REAL8 alpha_offset; /**< Offset for \f$\alpha\f$ */
171 
172  REAL8 epsilon0; /**< Coefficient of \f$\epsilon \f$ */
173  REAL8 epsilon1; /**< Coefficient of \f$\epsilon \f$ */
174  REAL8 epsilon2; /**< Coefficient of \f$\epsilon \f$ */
175  REAL8 epsilon3; /**< Coefficient of \f$\epsilon \f$ */
176  REAL8 epsilon4L; /**< Coefficient of \f$\epsilon \f$ */
177  REAL8 epsilon5; /**< Coefficient of \f$\epsilon \f$ */
178  REAL8 epsilon6; /**< Coefficient of \f$\epsilon \f$ */
179  REAL8 epsilonNNLO; /**< Post Newtonian \f$\epsilon \f$ at NNLO. */
180  REAL8 epsilon_offset; /**< Offset for \f$\epsilon \f$ */
181 
182  /* Alpha and epsilon offset for mprime !=2. alpha_offset corresponds to mprime=2 */
183  REAL8 alpha_offset_1; /**< \f$\alpha\f$ offset passed to \f$m = 1\f$ modes. */
184  REAL8 alpha_offset_3; /**< \f$\alpha\f$ offset passed to \f$m = 3\f$ modes. */
185  REAL8 alpha_offset_4; /**< \f$\alpha\f$ offset passed to \f$m = 4\f$ modes. */
186  REAL8 epsilon_offset_1; /**< \f$\epsilon\f$ offset passed to \f$m = 1\f$ modes. */
187  REAL8 epsilon_offset_3; /**< \f$\epsilon\f$ offset passed to \f$m = 3\f$ modes. */
188  REAL8 epsilon_offset_4; /**< \f$\epsilon\f$ offset passed to \f$m = 4\f$ modes. */
189 
190  /* Complex exponential of the Euler angles */
191  COMPLEX16 cexp_i_alpha; /**< \f$e^{i \alpha}\f$ */
192  COMPLEX16 cexp_i_epsilon; /**< \f$e^{i \epsilon}\f$ */
194 
195  /* Multibanding applied to Euler angles */
196  INT4 MBandPrecVersion; /**< Flag to control multibanding for Euler angles. */
197 
198  /* Source Frame Variables */
199  REAL8 J0x_Sf; /**< \f$ J_{0,x}\f$ in L frame. */
200  REAL8 J0y_Sf; /**< \f$ J_{0,y}\f$ in L frame. */
201  REAL8 J0z_Sf; /**< \f$ J_{0,z}\f$ in L frame. */
202  REAL8 J0; /**< \f$ J_{0}\f$ in L frame. */
203  REAL8 thetaJ_Sf; /**< Angle between \f$J_0\f$ and \f$ L_{\rm{N}} \f$ (z-direction) */
204  REAL8 phiJ_Sf; /**< Azimuthal angle of \f$J_0\f$ in the L frame */
205  REAL8 Nx_Sf; /**< Line-of-sight vector component \f$ N_{x}\f$ in L frame. */
206  REAL8 Ny_Sf; /**< Line-of-sight vector component \f$ N_{y}\f$ in L frame. */
207  REAL8 Nz_Sf; /**< Line-of-sight vector component \f$ N_{z}\f$ in L frame. */
208  REAL8 Xx_Sf; /**< Component of triad basis vector X in L frame. */
209  REAL8 Xy_Sf; /**< Component of triad basis vector X in L frame. */
210  REAL8 Xz_Sf; /**< Component of triad basis vector X in L frame. */
211  REAL8 kappa; /**< Eq. C12 of arXiv:XXXX.YYYY */
212 
213  /* J-frame variables */
214  REAL8 Nx_Jf; /**< Line-of-sight vector component \f$ N_{x}\f$ in J frame. */
215  REAL8 Ny_Jf; /**< Line-of-sight vector component \f$ N_{x}\f$ in J frame. */
216  REAL8 Nz_Jf; /**< Line-of-sight vector component \f$ N_{x}\f$ in LJ frame. */
217  REAL8 PArunx_Jf; /**< Component of triad basis vector P in J frame, arXiv:0810.5336. */
218  REAL8 PAruny_Jf; /**< Component of triad basis vector P in J frame, arXiv:0810.5336. */
219  REAL8 PArunz_Jf; /**< Component of triad basis vector P in J frame, arXiv:0810.5336. */
220  REAL8 QArunx_Jf; /**< Component of triad basis vector Q in J frame, arXiv:0810.5336. */
221  REAL8 QAruny_Jf; /**< Component of triad basis vector Q in J frame, arXiv:0810.5336. */
222  REAL8 QArunz_Jf; /**< Component of triad basis vector Q in J frame, arXiv:0810.5336. */
223  REAL8 XdotPArun; /**< \f$ X \cdot P \f$ */
224  REAL8 XdotQArun; /**< \f$ X \cdot Q \f$ */
225 
226  /* Orbital angular momentum */
227  REAL8 L0, L1, L2, L3, L4, L5, L6, L7, L8, L8L, LN, LOrb, LRef,LInit;
228 
229  /* Reference frequencies */
230  REAL8 omega_ref, logomega_ref, omega_ref_cbrt, omega_ref_cbrt2;
231 
232  /* Spin weighted spherical harmonics */
233  /* l = 2 */
234  COMPLEX16 Y2m2, Y2m1, Y20, Y21, Y22;
235 
236  /* l = 3 */
237  COMPLEX16 Y3m3, Y3m2, Y3m1, Y30, Y31, Y32, Y33;
238 
239  /* l = 4 */
240  COMPLEX16 Y4m4, Y4m3, Y4m2, Y4m1, Y40, Y41, Y42, Y43, Y44;
241 
242  /* Useful sqare roots */
243  REAL8 sqrt2, sqrt5, sqrt6, sqrt7, sqrt10, sqrt14, sqrt15, sqrt70, sqrt30, sqrt2p5;
244 
245  /* Variables for MSA precession angles of Chatziioannou et al, arXiv:1703.03967 */
246  /* Lhat = {0,0,1} */
247  REAL8 Lhat_theta, Lhat_phi, Lhat_norm, Lhat_cos_theta;
248 
249  /* Cartesian Dimensionful Spins */
250  REAL8 S1x; /**< \f$ S_{1,x} \f$ in L frame */
251  REAL8 S1y; /**< \f$ S_{1,y} \f$ in L frame */
252  REAL8 S1z; /**< \f$ S_{1,z} \f$ in L frame */
253  REAL8 S2x; /**< \f$ S_{2,x} \f$ in L frame */
254  REAL8 S2y; /**< \f$ S_{2,y} \f$ in L frame */
255  REAL8 S2z; /**< \f$ S_{2,z} \f$ in L frame */
256 
257  /* Spherical Polar Dimensionful Spins */
258  REAL8 S1_norm; /**< \f$ \left| S_{1} \right| \f$ */
259  REAL8 S1_theta; /**< Spherical polar component \f$ S_{1,\theta} \f$ in L frame */
260  REAL8 S1_phi; /**< Spherical polar component \f$ S_{1,\phi} \f$ in L frame */
261  REAL8 S1_cos_theta; /**< Spherical polar component \f$ \cos S_{1,\theta} \f$ in L frame */
262 
263  REAL8 S2_norm; /**< \f$ \left| S_{2} \right| \f$ */
264  REAL8 S2_theta; /**< Spherical polar component \f$ S_{2,\theta} \f$ in L frame */
265  REAL8 S2_phi; /**< Spherical polar component \f$ S_{2,\phi} \f$ in L frame */
266  REAL8 S2_cos_theta; /**< Spherical polar component \f$ \cos S_{2,\theta} \f$ in L frame */
267 
268  /* Cartesian Dimensionless Spin Variables */
269  REAL8 chi1x; /**< \f$ \chi_{1,x} \f$ in L frame */
270  REAL8 chi1y; /**< \f$ \chi_{1,y} \f$ in L frame */
271  REAL8 chi1z; /**< \f$ \chi_{1,z} \f$ in L frame */
272 
273  REAL8 chi2x; /**< \f$ \chi_{2,x} \f$ in L frame */
274  REAL8 chi2y; /**< \f$ \chi_{2,y} \f$ in L frame */
275  REAL8 chi2z; /**< \f$ \chi_{2,z} \f$ in L frame */
276 
277  /* Spherical Polar Dimensionless Spins */
278  REAL8 chi1_theta; /**< Spherical polar component \f$ \chi_{1,\theta} \f$ in L frame */
279  REAL8 chi1_phi; /**< Spherical polar component \f$ \chi_{1,\phi} \f$ in L frame */
280  REAL8 chi1_norm; /**< \f$ \left| \chi_{1} \right| \f$ */
281  REAL8 chi1_cos_theta; /**< Spherical polar component \f$ \cos \chi_{1,\theta} \f$ in L frame */
282 
283  REAL8 chi2_theta; /**< Spherical polar component \f$ \chi_{2,\theta} \f$ in L frame */
284  REAL8 chi2_phi; /**< Spherical polar component \f$ \chi_{2,\phi} \f$ in L frame */
285  REAL8 chi2_norm; /**< \f$ \left| \chi_{2} \right| \f$ */
286  REAL8 chi2_cos_theta; /**< Spherical polar component \f$ \cos \chi_{2,\theta} \f$ in L frame */
287 
288  INT4 ExpansionOrder; /**< Flag to control expansion order of MSA system of equations. */
289 
290  REAL8 twopiGM, piGM;
291 
292  REAL8 L_Norm_N; /**< Norm of Newtonian orbital angular momentum \f$ \left| L_N \right| \f$ */
293  REAL8 L_Norm_3PN; /**< Norm of orbital angular momentum at 3PN \f$ \left| L_{3 \rm{PN}} \right| \f$ */
294  REAL8 J_Norm_N; /**< Norm of total angular momentum using Newtonian orbital angular momentum \f$ \left| J_{N} \right| \f$ */
295  REAL8 J_Norm_3PN; /**< Norm of total angular momentum at 3PN \f$ \left| J_{3 \rm{PN}} \right| \f$ */
296 
297  REAL8 dotS1L; /**< \f$ S_1 \cdot \hat{L} \f$ */
298  REAL8 dotS1Ln; /**< \f$ \hat{S}_1 \cdot \hat{L} \f$ */
299  REAL8 dotS2L; /**< \f$ S_2 \cdot \hat{L} \f$ */
300  REAL8 dotS2Ln; /**< \f$ \hat{S}_1 \cdot \hat{L} \f$ */
301  REAL8 dotS1S2; /**< \f$ S_1 \cdot S_2 \f$ */
302  REAL8 Seff; /**< \f$ S_{\rm{eff}} = (1 + q^{-1}) S_1 \cdot \hat{L} + (1 + q) S_2 \cdot \hat{L} \f$, Eq. 7 of arXiv:1703.03967. Note convention for q. */
303  REAL8 Seff2; /**< \f$ S_{\rm{eff}}^2 \f$ */
304 
305  vector S1_0; /**< Initial value for \f$ S_{1} \f$ */
306  vector S2_0; /**< Initial value for \f$ S_{2} \f$ */
307  vector L_0; /**< Initial value for \f$ L \f$ */
308  vector Lhat_0; /**< Initial value for \f$ \hat{L} \f$ */
309  vector S_0; /**< Initial value for \f$ S_1 + S_2 \f$ */
310  vector J_0; /**< Initial value for \f$ J \f$ */
311 
312  REAL8 S_0_norm, S_0_norm_2;
313  REAL8 J_0_norm, J_0_norm_2;
314  REAL8 L_0_norm, L_0_norm_2;
315 
316  REAL8 deltam_over_M; /**< \f$ (m_1 - m_2) / (m_1 + m_2) \f$ */
317 
318  //REAL8 phiz_0, phiz_1, phiz_2, phiz_3, phiz_4, phiz_5;
319  REAL8 phiz_0_coeff, phiz_1_coeff, phiz_2_coeff, phiz_3_coeff, phiz_4_coeff, phiz_5_coeff;
320 
321  // Omegaz_i coefficients in D10 - D15
322  REAL8 Omegaz0_coeff, Omegaz1_coeff, Omegaz2_coeff, Omegaz3_coeff, Omegaz4_coeff, Omegaz5_coeff;
323 
324  // Omegaz terms in D16 - D21
325  REAL8 Omegaz0, Omegaz1, Omegaz2, Omegaz3, Omegaz4, Omegaz5;
326 
327  REAL8 Omegazeta0_coeff, Omegazeta1_coeff, Omegazeta2_coeff, Omegazeta3_coeff, Omegazeta4_coeff, Omegazeta5_coeff;
328  REAL8 Omegazeta0, Omegazeta1, Omegazeta2, Omegazeta3, Omegazeta4, Omegazeta5;
329 
330  // MSA-SUA Euler Angles
331  REAL8 phiz; /**< Azimuthal angle of L around J */
332  REAL8 zeta; /**< Angle to describe L w.r.t. J */
333  REAL8 cos_theta_L; /**< Cosine of polar angle between L and J */
334 
335  // First order MSA corrections
336  REAL8 zeta_0_MSA; /**< First MSA correction \f$ \zeta_0 \f$, Eq. F19 of arXiv:1703.03967 */
337  REAL8 phiz_0_MSA; /**< First MSA correction \f$ \phi_{z,0} \f$, Eq. 67 of arXiv:1703.03967 */
338 
339  // Initial values
340  REAL8 zeta_0; /**< Initial value of \f$ \zeta \f$ */
341  REAL8 phiz_0; /**< Initial value of \f$ \phi_{z,0} \f$ */
342 
343  // Orbital velocity, v and v^2
344  REAL8 v; /**< Orbital velocity, \f$ v \f$ */
345  REAL8 v2; /**< Orbital velocity squared, \f$ v^2 \f$ */
346 
347  // Reference orbital velocity, v and v^2
348  REAL8 v_0; /**< Orbital velocity at reference frequency, \f$ v_{\rm{ref}} \f$ */
349  REAL8 v_0_2; /**< Orbital velocity at reference frequency squared, \f$ v_{\rm{ref}}^2 \f$ */
350 
351  REAL8 Delta; /**< Eq. C3 of arXiv:1703.03967 */
352 
355 
356  // Precession averaged total spin, Eq. 45
357  REAL8 SAv; /**< \f$ S_{\rm{av}} \f$ as defined in Eq. 45 of arXiv:1703.03967 */
358  REAL8 SAv2; /**< \f$ S_{\rm{av}}^2 \f$ */
359  REAL8 invSAv2; /**< \f$ 1 / S_{\rm{av}}^2 \f$ */
360  REAL8 invSAv; /**< \f$ 1 / S_{\rm{av}} \f$ */
361 
362  // Eq. C1, C2 for Eq. 51
363  REAL8 psi1; /**< \f$ \psi_1 \f$ as defined in Eq. C1 of arXiv:1703.03967 */
364  REAL8 psi2; /**< \f$ \psi_2 \f$ as defined in Eq. C2 of arXiv:1703.03967 */
365 
366  // Integration constant in Eq. 51
367  REAL8 psi0; /**< \f$ \psi_0 \f$ as per Eq. 51 of arXiv:1703.03967 */
368 
369  // Eq. 51 and Eq. 24
370  REAL8 psi; /**< \f$ \psi \f$ as defined by Eq. 51 of arXiv:1703.03967 */
371  REAL8 psi_dot; /**< \f$ \dot{\psi} \f$ as per Eq. 50 of arXiv:1703.03967 */
372 
373 
374  REAL8 Cphi; /**< \f$ C_{\phi} \f$ as defined by Eq. B14 of arXiv:1703.03967 */
375  REAL8 Dphi; /**< \f$ C_{\phi} \f$ as defined by Eq. B15 of arXiv:1703.03967 */
376 
377  //REAL8 phiz_0_MSA_Cphi_term, phiz_0_MSA_Dphi_term;
378 
379  // PN Coefficients in Appendix A of Chatziioannou et al, PRD, 88, 063011, (2013)
380  REAL8 a0, a1, a2, a3, a4, a5, a6, a7, b6, a0_2, a0_3, a2_2;
381  REAL8 c0, c1, c2, c4, c12, c1_over_eta;
382 
383  // Eq. B9 - B11
384  REAL8 d0, d2, d4;
385 
386  // Eq. A1 - A8
387  REAL8 g0, g2, g3, g4, g5, g6, g7, g6L;
388 
389  // Spin-Orbit couplings
390  REAL8 beta3, beta5, beta6, beta7, sigma4;
391 
392  // Total normed spin of primary and secondary BH squared
393  REAL8 S1_norm_2, S2_norm_2;
394 
395  // Precession averaged spin couplings in A9 - A14
396  REAL8 S1L_pav; /**< Precession averaged coupling \f$ \langle S_1 \cdot \hat{L} \rangle_{\rm{pr}} \f$, Eq. A9 of arXiv:1703.03967 */
397  REAL8 S2L_pav; /**< Precession averaged coupling \f$ \langle S_2 \cdot \hat{L} \rangle_{\rm{pr}} \f$, Eq. A10 of arXiv:1703.03967 */
398  REAL8 S1S2_pav; /**< Precession averaged coupling \f$ \langle S_1 \cdot S_2 \rangle_{\rm{pr}} \f$, Eq. A11 of arXiv:1703.03967 */
399  REAL8 S1Lsq_pav; /**< Precession averaged coupling \f$ \langle (S_1 \cdot \hat{L})^2 \rangle_{\rm{pr}} \f$, Eq. A12 of arXiv:1703.03967 */
400  REAL8 S2Lsq_pav; /**< Precession averaged coupling \f$ \langle (S_2 \cdot \hat{L})^2 \rangle_{\rm{pr}} \f$, Eq. A13 of arXiv:1703.03967 */
401  REAL8 S1LS2L_pav; /**< Precession averaged coupling \f$ \langle (S_1 \cdot \hat{L}) (S_2 \cdot \hat{L}) \rangle_{\rm{pr}} \f$, Eq. A14 of arXiv:1703.03967 */
402 
403  // Total spin in Eq. 23 of Chatziioannou et al PRD, 95, 104004, (2017)
404  REAL8 S_norm, S_norm_2;
405 
406  REAL8 Spl2; /**< Largest root of polynomial \f$ S^2_+ \f$, Eq. 22 of arXiv:1703.03967 */
407  REAL8 Smi2; /**< Smallest root of polynomial \f$ S^2_- \f$, Eq. 22 of arXiv:1703.03967 */
408  REAL8 S32; /**< Third root of polynomial \f$ S^2_3 \f$, Eq. 22 of arXiv:1703.03967 */
409  REAL8 Spl; /**< \f$ S_+ \f$ */
410  REAL8 Smi; /**< \f$ S_- \f$ */
411  REAL8 S3; /**< \f$ S_3 \f$ */
412  REAL8 Spl2mSmi2; /**< \f$ S^2_+ - S^2_- \f$ */
413  REAL8 Spl2pSmi2; /**< \f$ S^2_+ + S^2_- \f$ */
414 
415  REAL8 A_coeff, B_coeff, C_coeff, D_coeff;
416 
417  REAL8 qq, invqq, eta, eta2, eta3, eta4;
418  REAL8 delta_qq, delta2_qq, delta3_qq, delta4_qq;
419  REAL8 inveta, inveta2, inveta3, inveta4, sqrt_inveta;
420 
422 
423  REAL8 LPN_coefficients[6];
424 
425  REAL8 constants_L[5];
426 
427  // Variables to interpolate SpinTaylor angles, up to fmax_angles
428  gsl_spline *alpha_spline;
429  gsl_spline *cosbeta_spline;
430  gsl_spline *gamma_spline;
431 
432  gsl_interp_accel *alpha_acc;
433  gsl_interp_accel *cosbeta_acc;
434  gsl_interp_accel *gamma_acc;
435 
439  REAL8 alpha_ftrans; /**< Record value of alpha at end of inspiral, used in IMRPhenomXPHMTwistUp and IMRPhenomXPHMTwistUpOneMode */
440  REAL8 cosbeta_ftrans; /**< Record value of cosbeta at end of inspiral, used in IMRPhenomXPHMTwistUp and IMRPhenomXPHMTwistUpOneMode */
441  REAL8 gamma_ftrans; /**< Record value of gamma at end of inspiral, used in IMRPhenomXPHMTwistUp and IMRPhenomXPHMTwistUpOneMode */
442  REAL8 gamma_in; /**< Record last value of gamma, used in IMRPhenomXPHMTwistUp and IMRPhenomXPHMTwistUpOneMode */
443  PhenomXPalphaMRD *alpha_params; /**< Parameters needed for analytical MRD continuation of alpha */
444  PhenomXPbetaMRD *beta_params; /**< Parameters needed for analytical MRD continuation of cosbeta */
452 
453  INT4 MSA_ERROR; /**< Flag to track errors in initialization of MSA system. */
454 
455  /* PNR-specific additions for single-spin mapping */
456  REAL8 chi_singleSpin; /**< Magnitude of effective single spin used for tapering two-spin angles, Eq. 18 of arXiv:2107.08876 */
457  REAL8 costheta_singleSpin; /**< Polar angle of effective single spin, Eq. 19 or arXiv:2107.08876 */
458  REAL8 costheta_final_singleSpin; /**< Polar angle of approximate final spin, see technical document FIXME: add reference */
459 
460  REAL8 chi_singleSpin_antisymmetric; /**< magnitude of effective single spin of a two spin system for the antisymmetric waveform */
461  REAL8 theta_antisymmetric; /**< Polar angle effective single spin for antisymmetric waveform */
462 
463  REAL8 PNR_HM_Mflow; /**< Mf_alpha_lower stored from alphaParams struct, 2 A4 / 7 from arXiv:2107.08876 */
464  REAL8 PNR_HM_Mfhigh; /**< Mf_beta_lower stored from betaParams struct, Eq. 58 from arXiv:2107.08876 */
465  REAL8 PNR_q_window_lower; /**< Boundary values for PNR angle transition window */
469  UINT4 PNRInspiralScaling; /**< Enforce inpsiral scaling for HM angles outside of calibration window */
470 
471  /* Store PNR-specific waveform flags for turning on and off tuning */
478 
479  /* A copy of the XAS 22 object */
482 
483  /* Store anti-symmetric waveform flag for turning on and off */
485 
486  /* polarization symmetry property, refer to XXXX.YYYYY for details */
488 
489  /* variables to store PNR angles for use in existing XP and XPHM twist-up functions */
493 
495 
496 double IMRPhenomX_L_norm_3PN_of_v(const double v, const double v2, const double L_norm, IMRPhenomXPrecessionStruct *pPrec);
497 
498 /* ~~~~~~~~~~ Perform transformations & initialize struct ~~~~~~~~~~ */
500  REAL8 m1_SI, REAL8 m2_SI,
501  REAL8 S1x, REAL8 S1y, REAL8 S1z,
502  REAL8 S2x, REAL8 S2y, REAL8 S2z,
503  LALDict *lalParams, INT4 debug_flag
504 );
505 
506 /* ~~~~~~~~~~ Post Newtonian Orbital Angular Momentum ~~~~~~~~~~ */
507 /* Functions to generate post-Newtonian Orbital Angular Momenta */
512 
513 REAL8 XLALSimIMRPhenomXLPNAnsatz(REAL8 v, REAL8 LN, REAL8 L0, REAL8 L1, REAL8 L2, REAL8 L3, REAL8 L4, REAL8 L5, REAL8 L6, REAL8 L7, REAL8 L8, REAL8 L8L);
514 
515 /* Function to check the maximum opening angle */
517  IMRPhenomXWaveformStruct *pWF, /**< IMRPhenomX Waveform Struct */
518  IMRPhenomXPrecessionStruct *pPrec /**< IMRPhenomX Precession Struct */
519 );
520 
521 /* ~~~~~~~~~~ Wigner Functions ~~~~~~~~~~ */
522 /* Wigner d Functions */
524  REAL8 *cos_beta_half, /**< [out] cos(beta/2) */
525  REAL8 *sin_beta_half, /**< [out] sin(beta/2) */
526  const REAL8 v, /**< Cubic root of Pi * Frequency in geometric units */
527  IMRPhenomXWaveformStruct *pWF, /**< IMRPhenomX Waveform Struct */
528  IMRPhenomXPrecessionStruct *pPrec /**< IMRPhenomX Precession Struct */
529 );
530 
531 /* Wigner d Functions */
533  REAL8 *cos_beta_half, /**< [out] cos(beta/2) */
534  REAL8 *sin_beta_half, /**< [out] sin(beta/2) */
535  REAL8 cos_beta /**< cos(beta) */
536 );
537 
538 
539 /* ~~~~~~~~~~ Routine to twist up aligned spin model ~~~~~~~~~~ */
540 /* Generic routine for twisting up 22-only models */
542  const REAL8 Mf, /**< Frequency (Hz) */
543  const COMPLEX16 hAS, /**< Underlying aligned-spin IMRPhenomXAS waveform*/
544  IMRPhenomXWaveformStruct *pWF, /**< IMRPhenomX Waveform Struct */
545  IMRPhenomXPrecessionStruct *pPrec, /**< IMRPhenomX Precession Struct */
546  COMPLEX16 *hp, /**< [out] h_+ polarization \f$\tilde h_+\f$ */
547  COMPLEX16 *hc /**< [out] h_x polarization \f$\tilde h_x\f$ */
548 );
549 
550 /* ~~~~~~~~~~ NNLO post-Newtonian Euler Angles ~~~~~~~~~~ */
552  REAL8 f, /**< Geometric frequency */
553  REAL8 eta, /**< Symmetric mass rato */
554  REAL8 chi1L, /**< Dimensionless aligned spin of larger BH */
555  REAL8 chi2L, /**< Dimensionless aligned spin of smaller BH */
556  REAL8 chip, /**< Effective precession parameter: Schmidt, Ohme, Hannam, PRD, 91,024043 (2015) */
557  REAL8 epsilon0 /**< Euler angle at reference Frequency, defines a constant offset */
558 );
559 
561  REAL8 f, /**< Geometric frequency */
562  REAL8 eta, /**< Symmetric mass rato */
563  REAL8 chi1L, /**< Dimensionless aligned spin of larger BH */
564  REAL8 chi2L, /**< Dimensionless aligned spin of smaller BH */
565  REAL8 chip, /**< Effective precession parameter: Schmidt, Ohme, Hannam, PRD, 91,024043 (2015) */
566  REAL8 epsilon0 /**< Euler angle at reference Frequency, defines a constant offset */
567 );
568 
569 
570 /* Get alpha and epsilon offset depending of the mprime (second index of the non-precessing mode) */
572  REAL8 *alpha_offset, /**< [out] alpha offset for mprime */
573  REAL8 *epsilon_offset, /**< [out] epsilon offset for mprime */
574  UINT4 mprime, /**< Second index non-precessing mode */
575  IMRPhenomXPrecessionStruct *pPrec, /**< IMRPhenomX Precession Struct */
576  IMRPhenomXWaveformStruct *pWF /**< IMRPhenomX Waveform Struct */
577 );
578 
580  IMRPhenomXPrecessionStruct *pPrec, /**< IMRPhenomX Precession Struct */
581  const double omega, /**< Orbital frequency */
582  const double omega_cbrt2, /**< Orbital frequency */
583  const double omega_cbrt, /**< Cubic root of orbital frequency */
584  const double logomega /**< Natural logarithm of orbital frequency */
585 );
586 
588  IMRPhenomXPrecessionStruct *pPrec, /**< IMRPhenomX Precession Struct */
589  const double omega, /**< Orbital frequency */
590  const double omega_cbrt2, /**< Orbital frequency */
591  const double omega_cbrt, /**< Cubic root of orbital frequency */
592  const double logomega /**< Natural logarithm of orbital frequency */
593 );
594 
595 
596 /* ~~~~~~~~~~ MSA-SUA Euler Angle Functions ~~~~~~~~~~ */
599 vector IMRPhenomX_Return_Constants_c_MSA(double v, const double JNorm, const IMRPhenomXPrecessionStruct *pPrec);
600 vector IMRPhenomX_Return_Constants_d_MSA(const double LNorm, const double JNorm, const IMRPhenomXPrecessionStruct *pPrec);
601 double IMRPhenomX_costhetaLJ(const double J_norm, const double L_norm, const double S_norm);
602 double IMRPhenomX_Return_Psi_MSA(double v, double v2, const IMRPhenomXPrecessionStruct *pPrec);
603 double IMRPhenomX_Return_Psi_dot_MSA(double v, const IMRPhenomXPrecessionStruct *pPrec);
604 double IMRPhenomX_Return_SNorm_MSA(const double v, IMRPhenomXPrecessionStruct *pPrec);
605 double IMRPhenomX_JNorm_MSA(const double LNorm, IMRPhenomXPrecessionStruct *pPrec);
606 int IMRPhenomX_Get_MSA_Euler_Angles(REAL8 *alpha, REAL8 *beta, REAL8 *mprime_epsilon, REAL8 fHz, INT4 mprime, const REAL8 twopi_Msec, IMRPhenomXPrecessionStruct *pPrec);
607 vector IMRPhenomX_Return_Roots_MSA(const double LNorm, const double JNorm, const IMRPhenomXPrecessionStruct *pPrec);
610 vector IMRPhenomX_Return_MSA_Corrections_MSA(double v, const double LNorm, const double JNorm, const IMRPhenomXPrecessionStruct *pPrec);
611 double IMRPhenomX_Return_zeta_MSA(const double v, const IMRPhenomXPrecessionStruct *pPrec);
612 double IMRPhenomX_Return_phiz_MSA(const double v, const double JNorm, const IMRPhenomXPrecessionStruct *pPrec);
613 double IMRPhenomX_psiofv(const double v, const double v2, const double psi0, const double psi1, const double psi2, const IMRPhenomXPrecessionStruct *pPrec);
615 
616 
617 /* ~~~~~~~~~~ Spin Couplings for post-Newtonian Orbital Angular Momentum ~~~~~~~~~~ */
618 double IMRPhenomX_Get_PN_beta(const double a, const double b, const IMRPhenomXPrecessionStruct *pPrec);
619 double IMRPhenomX_Get_PN_sigma(const double a, const double b, const IMRPhenomXPrecessionStruct *pPrec);
620 double IMRPhenomX_Get_PN_tau(const double a, const double b, const IMRPhenomXPrecessionStruct *pPrec);
621 
622 
623 
624 
625 /* ~~~~~~~~~~ Vector Utility Functions ~~~~~~~~~~ */
626 /* Function to calculate dot product: vout = v1 . v2 */
627 double IMRPhenomX_vector_dot_product(const vector v1, const vector v2);
628 /* Function to calculate cross product: vout = v1 x v2 */
630 /* Function to calculate L2 norm: vout = |v1| */
631 double IMRPhenomX_vector_L2_norm(const vector v1);
632 /* Function to perform scalar multiplications: vout = a * v1 */
633 vector IMRPhenomX_vector_scalar(const vector v1, const double a);
634 /* Vector addition: vout = v1 + v2 */
635 vector IMRPhenomX_vector_sum(const vector v1, const vector v2);
636 /* Vector subtraction: vout = v1 - v2 */
637 vector IMRPhenomX_vector_diff(const vector v1, const vector v2);
638 
639 /* Function to transform polar to Cartesian */
642 
643 /* Function to transform Cartesian to polar */
645 /* Function to rotate vector about z axis by given angle */
646 vector IMRPhenomX_vector_rotate_z(const REAL8 angle, const vector v1);
647 /* Function to rotate vector about y axis by given angle */
648 vector IMRPhenomX_vector_rotate_y(const REAL8 angle, const vector v1);
649 /* Function to rotate vector about z axis by given angle */
650 void IMRPhenomX_rotate_z(const REAL8 angle, REAL8 *vx, REAL8 *vy, REAL8 *vz);
651 /* Function to rotate vector about y axis by given angle */
652 void IMRPhenomX_rotate_y(const REAL8 angle, REAL8 *vx, REAL8 *vy, REAL8 *vz);
653 
654 /* Vector Utility Functions */
655 REAL8 IMRPhenomX_Cartesian_to_SphericalPolar_theta(const double x, const double y, const double z);
656 REAL8 IMRPhenomX_Cartesian_to_SphericalPolar_phi(const double x, const double y, const double z);
657 void IMRPhenomX_CartesianToPolar(REAL8 *polar,REAL8 *azimuthal,REAL8 *magnitude,REAL8 x,REAL8 y,REAL8 z);
658 vector IMRPhenomXCreateSphere(const double r, const double th, const double ph);
659 
660 /* Function to set remnant quantities related to final
661 spin within IMRPhenomXGetAndSetPrecessionVariables */
665  LALDict *lalParams
666 );
667 /* twisting-up functions via precomputed angles*/
669 int IMRPhenomXPSpinTaylorAnglesIMR(REAL8Sequence **alphaFS,REAL8Sequence **cosbetaFS,REAL8Sequence **gammaFS,REAL8Sequence *freqsIN,IMRPhenomXWaveformStruct *pWF,IMRPhenomXPrecessionStruct *pPrec,LALDict *LALparams);
671 /* function to evaluate spline for Euler angle gamma --used in SpinTaylor precessing version */
673 /* wrapper of IMRPhenomX_InterpolateAlphaBeta_SpinTaylor and SpinTaylorGammaSpline */
676  PhenomXPInspiralArrays *arrays, /**< [out] Struct containing solutions returned by PNEvolveOrbit */
677  REAL8 chi1x, /**< x-component of the dimensionless spin of object 1 w.r.t. Lhat = (0,0,1) at fRef */
678  REAL8 chi1y, /**< y-component of the dimensionless spin of object 1 w.r.t. Lhat = (0,0,1) at fRef */
679  REAL8 chi1z, /**< z-component of the dimensionless spin of object 1 w.r.t. Lhat = (0,0,1) at fRef */
680  REAL8 chi2x, /**< x-component of the dimensionless spin of object 2 w.r.t. Lhat = (0,0,1) at fRef */
681  REAL8 chi2y, /**< y-component of the dimensionless spin of object 2 w.r.t. Lhat = (0,0,1) at fRef */
682  REAL8 chi2z, /**< z-component of the dimensionless spin of object 2 w.r.t. Lhat = (0,0,1) at fRef */
683  REAL8 fmin, /**< minimum frequency */
684  int PrecVersion, /**< precessing version (int) */
685  IMRPhenomXWaveformStruct *pWF, /**< Waveform structure [in]*/
686  LALDict *LALparams /**< LAL Dictionary struct */
687  );
688 
690 void IMRPhenomX_GetandSetModes(LALValue *ModeArray,IMRPhenomXPrecessionStruct *pPrec);
691 
692 int betaMRD_coeff(gsl_spline spline_cosb, gsl_interp_accel accel_cosb, double fmaxPN, IMRPhenomXWaveformStruct *pWF, IMRPhenomXPrecessionStruct *pPrec);
693 double betaMRD(double Mf, IMRPhenomXWaveformStruct *pWF,PhenomXPbetaMRD *beta_params);
694 
695 int alphaMRD_coeff(gsl_spline spline_alpha, gsl_interp_accel accel_alpha, double fmaxPN, IMRPhenomXWaveformStruct *pWF, PhenomXPalphaMRD *alpha_params);
696 double alphaMRD(double Mf, PhenomXPalphaMRD *alpha_params);
697 double dalphaMRD(double Mf, PhenomXPalphaMRD *alpha_params);
698 int gamma_from_alpha_cosbeta(double *gamma, double Mf, double deltaMf,IMRPhenomXWaveformStruct *pWF,IMRPhenomXPrecessionStruct *pPrec);
699 
700 
701 #ifdef __cplusplus
702 }
703 #endif
704 
705 #endif /* _LALSIM_IMR_PHENOMX_PRECESSION_H */
const double c1
const double g3
const double g2
const double c2
static double double delta
vector IMRPhenomX_Return_Spin_Evolution_Coefficients_MSA(double LNorm, double JNorm, const IMRPhenomXPrecessionStruct *pPrec)
Get coefficients for Eq 21 of Chatziioannou et al, PRD 95, 104004, (2017), arXiv:1703....
double IMRPhenomX_psiofv(const double v, const double v2, const double psi0, const double psi1, const double psi2, const IMRPhenomXPrecessionStruct *pPrec)
double IMRPhenomX_Return_Psi_MSA(double v, double v2, const IMRPhenomXPrecessionStruct *pPrec)
Get using Eq 51 of Chatziioannou et al, PRD 95, 104004, (2017), arXiv:1703.03967:
double IMRPhenomX_Get_PN_tau(const double a, const double b, const IMRPhenomXPrecessionStruct *pPrec)
Internal function to computes PN spin-spin couplings.
vector IMRPhenomX_vector_PolarToCartesian(const sphpolvector v1)
double dalphaMRD(double Mf, PhenomXPalphaMRD *alpha_params)
int betaMRD_coeff(gsl_spline spline_cosb, gsl_interp_accel accel_cosb, double fmaxPN, IMRPhenomXWaveformStruct *pWF, IMRPhenomXPrecessionStruct *pPrec)
Function to determine coefficients of analytical continuation of beta through MRD.
vector IMRPhenomX_vector_sum(const vector v1, const vector v2)
int IMRPhenomX_SpinTaylorAnglesSplinesAll(REAL8 fmin, REAL8 fmax, IMRPhenomXWaveformStruct *pWF, IMRPhenomXPrecessionStruct *pPrec, LALDict *LALparams)
This function builds and stores splines for and in the frequency range covered by PN,...
vector IMRPhenomX_vector_cross_product(const vector v1, const vector v2)
vector IMRPhenomX_Return_MSA_Corrections_MSA(double v, const double LNorm, const double JNorm, const IMRPhenomXPrecessionStruct *pPrec)
sphpolvector IMRPhenomX_vector_CartesianToPolar(const vector v1)
vector IMRPhenomX_Return_Constants_c_MSA(double v, const double JNorm, const IMRPhenomXPrecessionStruct *pPrec)
Get c constants from Appendix B (B6, B7, B8) of Chatziioannou et al, PRD 95, 104004,...
double IMRPhenomX_Get_PN_beta(const double a, const double b, const IMRPhenomXPrecessionStruct *pPrec)
Internal function to computes the PN spin-orbit couplings.
REAL8 IMRPhenomX_Cartesian_to_SphericalPolar_phi(const double x, const double y, const double z)
vector IMRPhenomX_Return_Roots_MSA(const double LNorm, const double JNorm, const IMRPhenomXPrecessionStruct *pPrec)
Here we solve for the roots of Eq 21 in Chatziioannou et al, PRD 95, 104004, (2017),...
int IMRPhenomXPSpinTaylorAnglesIMR(REAL8Sequence **alphaFS, REAL8Sequence **cosbetaFS, REAL8Sequence **gammaFS, REAL8Sequence *freqsIN, IMRPhenomXWaveformStruct *pWF, IMRPhenomXPrecessionStruct *pPrec, LALDict *LALparams)
This function evaluates the SpinTaylor Euler angles on a frequency grid passed by the user.
int IMRPhenomX_InterpolateGamma_SpinTaylor(REAL8 fmin, REAL8 fmax, IMRPhenomXWaveformStruct *pWF, IMRPhenomXPrecessionStruct *pPrec)
This function computes gamma from the minimal rotation condition and stores a spline for it.
REAL8 IMRPhenomX_Cartesian_to_SphericalPolar_theta(const double x, const double y, const double z)
double IMRPhenomX_Return_zeta_MSA(const double v, const IMRPhenomXPrecessionStruct *pPrec)
Get using Eq F5 in Appendix F of Chatziioannou et al, PRD 95, 104004, (2017):
vector IMRPhenomX_Return_Constants_d_MSA(const double LNorm, const double JNorm, const IMRPhenomXPrecessionStruct *pPrec)
Get d constants from Appendix B (B9, B10, B11) of Chatziioannou et al, PRD 95, 104004,...
int IMRPhenomXWignerdCoefficients_cosbeta(REAL8 *cos_beta_half, REAL8 *sin_beta_half, REAL8 cos_beta)
int IMRPhenomXPTwistUp22(const REAL8 Mf, const COMPLEX16 hAS, IMRPhenomXWaveformStruct *pWF, IMRPhenomXPrecessionStruct *pPrec, COMPLEX16 *hp, COMPLEX16 *hc)
Core twisting up routine, see Section III A of arXiv:2004.06503.
double IMRPhenomX_PN_Euler_epsilon_NNLO(IMRPhenomXPrecessionStruct *pPrec, const double omega, const double omega_cbrt2, const double omega_cbrt, const double logomega)
Internal function to calculate epsilon using pre-cached NNLO PN expressions.
double IMRPhenomX_vector_L2_norm(const vector v1)
REAL8 XLALSimIMRPhenomXPNEuleralphaNNLO(REAL8 f, REAL8 eta, REAL8 chi1L, REAL8 chi2L, REAL8 chip, REAL8 epsilon0)
External wrapper function to next-to-next-to-leading (NNLO) in spin-orbit expression for the PN Euler...
double IMRPhenomX_Return_SNorm_MSA(const double v, IMRPhenomXPrecessionStruct *pPrec)
Get norm of S, see PRD 95, 104004, (2017)
vector IMRPhenomX_vector_PolarToCartesian_components(const REAL8 mag, const REAL8 theta, const REAL8 phi)
int IMRPhenomX_InterpolateAlphaBeta_SpinTaylor(IMRPhenomXWaveformStruct *pWF, IMRPhenomXPrecessionStruct *pPrec, LALDict *LALparams)
This function computes cubic splines of the alpha and beta inspiral Euler angles, which are then stor...
double IMRPhenomX_PN_Euler_alpha_NNLO(IMRPhenomXPrecessionStruct *pPrec, const double omega, const double omega_cbrt2, const double omega_cbrt, const double logomega)
Internal function to calculate alpha using pre-cached NNLO PN expressions.
INT4 IMRPhenomX_SetPrecessingRemnantParams(IMRPhenomXWaveformStruct *pWF, IMRPhenomXPrecessionStruct *pPrec, LALDict *lalParams)
void IMRPhenomX_GetandSetModes(LALValue *ModeArray, IMRPhenomXPrecessionStruct *pPrec)
int IMRPhenomXWignerdCoefficients(REAL8 *cos_beta_half, REAL8 *sin_beta_half, const REAL8 v, IMRPhenomXWaveformStruct *pWF, IMRPhenomXPrecessionStruct *pPrec)
REAL8 XLALSimIMRPhenomXL4PNAS(REAL8 v, REAL8 eta, REAL8 chi1L, REAL8 chi2L, REAL8 delta)
4PN orbital angular momentum as a function of x = v^2 = (Pi M f)^{2/3}
vector IMRPhenomX_vector_rotate_z(const REAL8 angle, const vector v1)
Function to rotate vector about z axis by given angle.
int gamma_from_alpha_cosbeta(double *gamma, double Mf, double deltaMf, IMRPhenomXWaveformStruct *pWF, IMRPhenomXPrecessionStruct *pPrec)
vector IMRPhenomXCreateSphere(const double r, const double th, const double ph)
vector IMRPhenomX_vector_scalar(const vector v1, const double a)
vector IMRPhenomX_vector_diff(const vector v1, const vector v2)
double betaMRD(double Mf, IMRPhenomXWaveformStruct *pWF, PhenomXPbetaMRD *beta_params)
void IMRPhenomX_rotate_y(const REAL8 angle, REAL8 *vx, REAL8 *vy, REAL8 *vz)
Function to rotate vector about y axis by given angle.
void IMRPhenomX_rotate_z(const REAL8 angle, REAL8 *vx, REAL8 *vy, REAL8 *vz)
Function to rotate vector about z axis by given angle.
int IMRPhenomX_Initialize_MSA_System(IMRPhenomXWaveformStruct *pWF, IMRPhenomXPrecessionStruct *pPrec, const int ExpansionOrder)
This function initializes all the core variables required for the MSA system.
double alphaMRD(double Mf, PhenomXPalphaMRD *alpha_params)
REAL8 XLALSimIMRPhenomXL2PNNS(REAL8 v, REAL8 eta)
2PN non-spinning orbital angular momentum as a function of x = v^2 = (Pi M f)^{2/3}
int IMRPhenomXPTwistUp22_NumericalAngles(const COMPLEX16 hAS, REAL8 alpha, REAL8 cos_beta, REAL8 gamma, IMRPhenomXPrecessionStruct *pPrec, COMPLEX16 *hp, COMPLEX16 *hc)
Core twisting up routine for SpinTaylor angles.
int IMRPhenomXPCheckMaxOpeningAngle(IMRPhenomXWaveformStruct *pWF, IMRPhenomXPrecessionStruct *pPrec)
Helper function to check if maximum opening angle > pi/2 or pi/4 and issues a warning.
double IMRPhenomX_Get_PN_sigma(const double a, const double b, const IMRPhenomXPrecessionStruct *pPrec)
Internal function to compute PN spin-spin couplings.
int alphaMRD_coeff(gsl_spline spline_alpha, gsl_interp_accel accel_alpha, double fmaxPN, IMRPhenomXWaveformStruct *pWF, PhenomXPalphaMRD *alpha_params)
Analytical continuation for alpha angle in MRD.
double IMRPhenomX_L_norm_3PN_of_v(const double v, const double v2, const double L_norm, IMRPhenomXPrecessionStruct *pPrec)
Returns the 3PN accurate orbital angular momentum as implemented in LALSimInspiralFDPrecAngles_intern...
REAL8 XLALSimIMRPhenomXL4PNLOSIAS(REAL8 v, REAL8 eta, REAL8 chi1L, REAL8 chi2L, REAL8 delta)
4PN orbital angular momentum as a function of x = v^2 = (Pi M f)^{2/3}
int IMRPhenomX_Initialize_Euler_Angles(IMRPhenomXWaveformStruct *pWF, IMRPhenomXPrecessionStruct *pPrec, LALDict *lalParams)
Wrapper of IMRPhenomX_SpinTaylorAnglesSplinesAll: fmin and fmax are determined by the function based ...
double IMRPhenomX_Spin_Evolution_Equation_MSA(IMRPhenomXWaveformStruct *pWF, IMRPhenomXPrecessionStruct *pPrec)
REAL8 XLALSimIMRPhenomXL3PNAS(REAL8 v, REAL8 eta, REAL8 chi1L, REAL8 chi2L, REAL8 delta)
3PN orbital angular momentum as a function of x = v^2 = (Pi M f)^{2/3}
vector IMRPhenomX_vector_rotate_y(const REAL8 angle, const vector v1)
Function to rotate vector about y axis by given angle.
REAL8 XLALSimIMRPhenomXPNEulerepsilonNNLO(REAL8 f, REAL8 eta, REAL8 chi1L, REAL8 chi2L, REAL8 chip, REAL8 epsilon0)
External wrapper to NNLO PN epsilon angle.
void IMRPhenomX_CartesianToPolar(REAL8 *polar, REAL8 *azimuthal, REAL8 *magnitude, REAL8 x, REAL8 y, REAL8 z)
double IMRPhenomX_JNorm_MSA(const double LNorm, IMRPhenomXPrecessionStruct *pPrec)
Get norm of J using Eq 41 of Chatziioannou et al, PRD 95, 104004, (2017)
int IMRPhenomX_InspiralAngles_SpinTaylor(PhenomXPInspiralArrays *arrays, REAL8 chi1x, REAL8 chi1y, REAL8 chi1z, REAL8 chi2x, REAL8 chi2y, REAL8 chi2z, REAL8 fmin, int PrecVersion, IMRPhenomXWaveformStruct *pWF, LALDict *LALparams)
Wrapper of XLALSimInspiralSpinTaylorPNEvolveOrbit : if integration is successful, stores arrays conta...
double IMRPhenomX_Return_phiz_MSA(const double v, const double JNorm, const IMRPhenomXPrecessionStruct *pPrec)
Get using Eq 66 of Chatziioannou et al, PRD 95, 104004, (2017), arXiv:1703.03967:
vector IMRPhenomX_Return_phi_zeta_costhetaL_MSA(const double xi, IMRPhenomXWaveformStruct *pWF, IMRPhenomXPrecessionStruct *pPrec)
Wrapper to generate , and at a given frequency.
double IMRPhenomX_Return_Psi_dot_MSA(double v, const IMRPhenomXPrecessionStruct *pPrec)
Get using Eq 24 of Chatziioannou et al, PRD 95, 104004, (2017), arXiv:1703.03967:
double IMRPhenomX_vector_dot_product(const vector v1, const vector v2)
int IMRPhenomXGetAndSetPrecessionVariables(IMRPhenomXWaveformStruct *pWF, IMRPhenomXPrecessionStruct *pPrec, REAL8 m1_SI, REAL8 m2_SI, REAL8 S1x, REAL8 S1y, REAL8 S1z, REAL8 S2x, REAL8 S2y, REAL8 S2z, LALDict *lalParams, INT4 debug_flag)
Function to populate the IMRPhenomXPrecessionStruct:
void Get_alphaepsilon_atfref(REAL8 *alpha_offset, REAL8 *epsilon_offset, UINT4 mprime, IMRPhenomXPrecessionStruct *pPrec, IMRPhenomXWaveformStruct *pWF)
Get alpha and epsilon offset depending of the mprime (second index of the non-precessing mode)
int IMRPhenomX_Get_MSA_Euler_Angles(REAL8 *alpha, REAL8 *beta, REAL8 *mprime_epsilon, REAL8 fHz, INT4 mprime, const REAL8 twopi_Msec, IMRPhenomXPrecessionStruct *pPrec)
REAL8 XLALSimIMRPhenomXLPNAnsatz(REAL8 v, REAL8 LN, REAL8 L0, REAL8 L1, REAL8 L2, REAL8 L3, REAL8 L4, REAL8 L5, REAL8 L6, REAL8 L7, REAL8 L8, REAL8 L8L)
This is a convenient wrapper function for PN orbital angular momentum.
double IMRPhenomX_costhetaLJ(const double J_norm, const double L_norm, const double S_norm)
Calculate (L dot J)
static double beta(const double a, const double b, const sysq *system)
Internal function that computes the spin-orbit couplings.
REAL8 g4
REAL8 g5
double theta
Definition: bh_sphwf.c:118
const double a4
const double vy
const double qq
const double a2
const double vz
const double vx
double complex COMPLEX16
double REAL8
uint32_t UINT4
int32_t INT4
static const INT4 r
static const INT4 a
double alpha
Definition: sgwb.c:106
REAL8 phiz
Azimuthal angle of L around J.
REAL8 epsilon_offset_3
offset passed to modes.
REAL8 Ny_Sf
Line-of-sight vector component in L frame.
PhenomXPbetaMRD * beta_params
Parameters needed for analytical MRD continuation of cosbeta.
REAL8 chi2_theta
Spherical polar component in L frame.
REAL8 S2_theta
Spherical polar component in L frame.
REAL8 PNR_q_window_lower
Boundary values for PNR angle transition window.
REAL8 epsilonNNLO
Post Newtonian at NNLO.
INT4 ExpansionOrder
Flag to control expansion order of MSA system of equations.
REAL8 QArunz_Jf
Component of triad basis vector Q in J frame, arXiv:0810.5336.
REAL8 zeta
Angle to describe L w.r.t.
REAL8 S2L_pav
Precession averaged coupling , Eq.
REAL8 QAruny_Jf
Component of triad basis vector Q in J frame, arXiv:0810.5336.
REAL8 alpha_offset_4
offset passed to modes.
REAL8 zeta_polarization
Angle to rotate the polarizations.
REAL8 v_0
Orbital velocity at reference frequency, .
REAL8 S1_theta
Spherical polar component in L frame.
REAL8 A2
Mass weighted pre-factor, see Eq.
REAL8 phiJ_Sf
Azimuthal angle of in the L frame.
REAL8 thetaJ_Sf
Angle between and (z-direction)
REAL8 PNR_HM_Mflow
Mf_alpha_lower stored from alphaParams struct, 2 A4 / 7 from arXiv:2107.08876.
REAL8 cosbeta_ftrans
Record value of cosbeta at end of inspiral, used in IMRPhenomXPHMTwistUp and IMRPhenomXPHMTwistUpOneM...
REAL8 alpha_ftrans
Record value of alpha at end of inspiral, used in IMRPhenomXPHMTwistUp and IMRPhenomXPHMTwistUpOneMod...
REAL8 J_Norm_3PN
Norm of total angular momentum at 3PN .
INT4 MBandPrecVersion
Flag to control multibanding for Euler angles.
REAL8 thetaJN
Angle between J0 and line of sight (z-direction)
REAL8 alpha_offset_3
offset passed to modes.
REAL8 epsilon_offset_4
offset passed to modes.
REAL8 chi1_cos_theta
Spherical polar component in L frame.
REAL8 alpha_offset_1
offset passed to modes.
REAL8 zeta_0_MSA
First MSA correction , Eq.
REAL8 Spl2
Largest root of polynomial , Eq.
REAL8 Ny_Jf
Line-of-sight vector component in J frame.
REAL8 chi2_cos_theta
Spherical polar component in L frame.
REAL8 costheta_singleSpin
Polar angle of effective single spin, Eq.
REAL8 PArunz_Jf
Component of triad basis vector P in J frame, arXiv:0810.5336.
REAL8 S2Lsq_pav
Precession averaged coupling , Eq.
REAL8 alphaNNLO
Post Newtonian at NNLO.
REAL8 Xx_Sf
Component of triad basis vector X in L frame.
REAL8 S1_phi
Spherical polar component in L frame.
REAL8 S2_phi
Spherical polar component in L frame.
REAL8 S32
Third root of polynomial , Eq.
IMRPhenomXWaveformStruct * pWF22AS
REAL8 gamma_ftrans
Record value of gamma at end of inspiral, used in IMRPhenomXPHMTwistUp and IMRPhenomXPHMTwistUpOneMod...
REAL8 PArunx_Jf
Component of triad basis vector P in J frame, arXiv:0810.5336.
REAL8 Nx_Jf
Line-of-sight vector component in J frame.
REAL8 chi1_phi
Spherical polar component in L frame.
REAL8 QArunx_Jf
Component of triad basis vector Q in J frame, arXiv:0810.5336.
INT4 IMRPhenomXPrecVersion
Flag to set version of Euler angles used.
REAL8 gamma_in
Record last value of gamma, used in IMRPhenomXPHMTwistUp and IMRPhenomXPHMTwistUpOneMode.
UINT4 PNRInspiralScaling
Enforce inpsiral scaling for HM angles outside of calibration window.
REAL8 Smi2
Smallest root of polynomial , Eq.
REAL8 chi1_theta
Spherical polar component in L frame.
REAL8 Nz_Jf
Line-of-sight vector component in LJ frame.
INT4 MSA_ERROR
Flag to track errors in initialization of MSA system.
REAL8 chi_singleSpin_antisymmetric
magnitude of effective single spin of a two spin system for the antisymmetric waveform
REAL8 cos_theta_L
Cosine of polar angle between L and J.
REAL8 PAruny_Jf
Component of triad basis vector P in J frame, arXiv:0810.5336.
REAL8 S2_cos_theta
Spherical polar component in L frame.
REAL8 phiz_0_MSA
First MSA correction , Eq.
REAL8 Nz_Sf
Line-of-sight vector component in L frame.
PhenomXPalphaMRD * alpha_params
Parameters needed for analytical MRD continuation of alpha.
REAL8 L_Norm_3PN
Norm of orbital angular momentum at 3PN .
REAL8 v2
Orbital velocity squared, .
REAL8 S1S2_pav
Precession averaged coupling , Eq.
REAL8 S1Lsq_pav
Precession averaged coupling , Eq.
REAL8 Xy_Sf
Component of triad basis vector X in L frame.
REAL8 chi_singleSpin
Magnitude of effective single spin used for tapering two-spin angles, Eq.
REAL8 S1_cos_theta
Spherical polar component in L frame.
REAL8 theta_antisymmetric
Polar angle effective single spin for antisymmetric waveform.
REAL8 epsilon_offset_1
offset passed to modes.
REAL8 L_Norm_N
Norm of Newtonian orbital angular momentum .
REAL8 J_Norm_N
Norm of total angular momentum using Newtonian orbital angular momentum .
REAL8 A1
Mass weighted pre-factor, see Eq.
REAL8 phi0_aligned
Initial phase to feed the underlying aligned-spin model.
REAL8 v_0_2
Orbital velocity at reference frequency squared, .
REAL8 Xz_Sf
Component of triad basis vector X in L frame.
REAL8 Nx_Sf
Line-of-sight vector component in L frame.
REAL8 PNR_HM_Mfhigh
Mf_beta_lower stored from betaParams struct, Eq.
REAL8 S1LS2L_pav
Precession averaged coupling , Eq.
REAL8 S1L_pav
Precession averaged coupling , Eq.
REAL8 chi2_phi
Spherical polar component in L frame.
REAL8 costheta_final_singleSpin
Polar angle of approximate final spin, see technical document FIXME: add reference.