LALSimulation  5.4.0.1-fe68b98
LALSimInspiralPNMode.c
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2008 J. Creighton, Evan Ochsner, Chris Pankow, 2018 Riccardo Sturani
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with with program; see the file COPYING. If not, write to the
16  * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
17  * MA 02110-1301 USA
18  */
19 
20 #include <math.h>
21 #include <lal/LALStdlib.h>
22 #include <lal/LALSimInspiral.h>
23 #include <lal/LALConstants.h>
24 #include <lal/TimeSeries.h>
25 #include "check_series_macros.h"
26 
27 #ifdef __GNUC__
28 #define UNUSED __attribute__ ((unused))
29 #else
30 #define UNUSED
31 #endif
32 
33 #define EPS 1.e-6
34 
35 /**
36  * @addtogroup LALSimInspiralPNMode_c
37  * @brief Routines for mode decompositions of post-Newtonian waveforms
38  *
39  * @{
40  */
41 
42 /**
43  * Computes h(l,m) mode timeseries of spherical harmonic decomposition of
44  * the post-Newtonian inspiral waveform.
45  *
46  * See Eqns. (79)-(116) of:
47  * Lawrence E. Kidder, \"Using Full Information When Computing Modes of
48  * Post-Newtonian Waveforms From Inspiralling Compact Binaries in Circular
49  * Orbit\", Physical Review D 77, 044016 (2008), arXiv:0710.0614v1 [gr-qc].
50  */
52  REAL8TimeSeries *v, /**< post-Newtonian parameter */
53  REAL8TimeSeries *phi, /**< orbital phase */
54  REAL8 v0, /**< tail gauge parameter (default = 1) */
55  REAL8 m1, /**< mass of companion 1 (kg) */
56  REAL8 m2, /**< mass of companion 2 (kg) */
57  REAL8 r, /**< distance of source (m) */
58  int O, /**< twice post-Newtonain order */
59  int l, /**< mode number l */
60  int m /**< mode number m */
61  )
62 {
63  LAL_CHECK_VALID_SERIES(v, NULL);
64  LAL_CHECK_VALID_SERIES(phi, NULL);
67  UINT4 j;
68  if ( l == 2 && abs(m) == 2 )
69  hlm = XLALSimInspiralPNMode22(v, phi, v0, m1, m2, r, O);
70  else if ( l == 2 && abs(m) == 1 )
71  hlm = XLALSimInspiralPNMode21(v, phi, v0, m1, m2, r, O);
72  else if ( l == 2 && m == 0 )
73  hlm = XLALSimInspiralPNMode20(v, phi, v0, m1, m2, r, O);
74  else if ( l == 3 && abs(m) == 3 )
75  hlm = XLALSimInspiralPNMode33(v, phi, v0, m1, m2, r, O);
76  else if ( l == 3 && abs(m) == 2 )
77  hlm = XLALSimInspiralPNMode32(v, phi, v0, m1, m2, r, O);
78  else if ( l == 3 && abs(m) == 1 )
79  hlm = XLALSimInspiralPNMode31(v, phi, v0, m1, m2, r, O);
80  else if ( l == 3 && m == 0 )
81  hlm = XLALSimInspiralPNMode30(v, phi, v0, m1, m2, r, O);
82  else if ( l == 4 && abs(m) == 4 )
83  hlm = XLALSimInspiralPNMode44(v, phi, v0, m1, m2, r, O);
84  else if ( l == 4 && abs(m) == 3 )
85  hlm = XLALSimInspiralPNMode43(v, phi, v0, m1, m2, r, O);
86  else if ( l == 4 && abs(m) == 2 )
87  hlm = XLALSimInspiralPNMode42(v, phi, v0, m1, m2, r, O);
88  else if ( l == 4 && abs(m) == 1 )
89  hlm = XLALSimInspiralPNMode41(v, phi, v0, m1, m2, r, O);
90  else if ( l == 4 && m == 0 )
91  hlm = XLALSimInspiralPNMode40(v, phi, v0, m1, m2, r, O);
92  else if ( l == 5 && abs(m) == 5 )
93  hlm = XLALSimInspiralPNMode55(v, phi, v0, m1, m2, r, O);
94  else if ( l == 5 && abs(m) == 4 )
95  hlm = XLALSimInspiralPNMode54(v, phi, v0, m1, m2, r, O);
96  else if ( l == 5 && abs(m) == 3 )
97  hlm = XLALSimInspiralPNMode53(v, phi, v0, m1, m2, r, O);
98  else if ( l == 5 && abs(m) == 2 )
99  hlm = XLALSimInspiralPNMode52(v, phi, v0, m1, m2, r, O);
100  else if ( l == 5 && abs(m) == 1 )
101  hlm = XLALSimInspiralPNMode51(v, phi, v0, m1, m2, r, O);
102  else if ( l == 5 && m == 0 )
103  hlm = XLALSimInspiralPNMode50(v, phi, v0, m1, m2, r, O);
104  else if ( l == 6 && abs(m) == 6 )
105  hlm = XLALSimInspiralPNMode66(v, phi, v0, m1, m2, r, O);
106  else if ( l == 6 && abs(m) == 5 )
107  hlm = XLALSimInspiralPNMode65(v, phi, v0, m1, m2, r, O);
108  else if ( l == 6 && abs(m) == 4 )
109  hlm = XLALSimInspiralPNMode64(v, phi, v0, m1, m2, r, O);
110  else if ( l == 6 && abs(m) == 3 )
111  hlm = XLALSimInspiralPNMode63(v, phi, v0, m1, m2, r, O);
112  else if ( l == 6 && abs(m) == 2 )
113  hlm = XLALSimInspiralPNMode62(v, phi, v0, m1, m2, r, O);
114  else if ( l == 6 && abs(m) == 1 )
115  hlm = XLALSimInspiralPNMode61(v, phi, v0, m1, m2, r, O);
116  else if ( l == 6 && m == 0 )
117  hlm = XLALSimInspiralPNMode60(v, phi, v0, m1, m2, r, O);
118  else {
119  XLALPrintError("XLAL Error - %s: Unsupported mode l=%d, m=%d\n", __func__, l, m );
121  }
122  if ( !hlm )
124  if ( m < 0 ) {
125  REAL8 sign = l % 2 ? -1.0 : 1.0;
126  for ( j = 0; j < hlm->data->length; ++j )
127  hlm->data->data[j] = sign * conj(hlm->data->data[j]);
128  }
129  return hlm;
130 }
131 
132 /**
133  * Computes h(l,m) mode timeseries of spherical harmonic decomposition of
134  * the post-Newtonian inspiral waveform.
135  *
136  * See Eqns. (79)-(116) of:
137  * Lawrence E. Kidder, \"Using Full Information When Computing Modes of
138  * Post-Newtonian Waveforms From Inspiralling Compact Binaries in Circular
139  * Orbit\", Physical Review D 77, 044016 (2008), arXiv:0710.0614v1 [gr-qc].
140  */
142  REAL8TimeSeries *v, /**< post-Newtonian parameter */
143  REAL8TimeSeries *phi, /**< orbital phase */
144  REAL8 m1, /**< mass of companion 1 (kg) */
145  REAL8 m2, /**< mass of companion 2 (kg) */
146  REAL8 r, /**< distance of source (m) */
147  int O, /**< twice post-Newtonain order */
148  int l, /**< mode number l */
149  int m /**< mode number m */
150  )
151 {
152  LAL_CHECK_VALID_SERIES(v, NULL);
153  LAL_CHECK_VALID_SERIES(phi, NULL);
154  LAL_CHECK_CONSISTENT_TIME_SERIES(v, phi, NULL);
155  COMPLEX16TimeSeries *hlm;
156  UINT4 j;
157  if ( l == 2 && abs(m) == 2 )
158  hlm = XLALSimInspiralPNMode22(v, phi, 1., m1, m2, r, O);
159  else if ( l == 2 && abs(m) == 1 )
160  hlm = XLALSimInspiralPNMode21(v, phi, 1., m1, m2, r, O);
161  else if ( l == 2 && m == 0 )
162  hlm = XLALSimInspiralPNMode20(v, phi, 1., m1, m2, r, O);
163  else if ( l == 3 && abs(m) == 3 )
164  hlm = XLALSimInspiralPNMode33(v, phi, 1., m1, m2, r, O);
165  else if ( l == 3 && abs(m) == 2 )
166  hlm = XLALSimInspiralPNMode32(v, phi, 1., m1, m2, r, O);
167  else if ( l == 3 && abs(m) == 1 )
168  hlm = XLALSimInspiralPNMode31(v, phi, 1., m1, m2, r, O);
169  else if ( l == 3 && m == 0 )
170  hlm = XLALSimInspiralPNMode30(v, phi, 1., m1, m2, r, O);
171  else if ( l == 4 && abs(m) == 4 )
172  hlm = XLALSimInspiralPNMode44(v, phi, 1., m1, m2, r, O);
173  else if ( l == 4 && abs(m) == 3 )
174  hlm = XLALSimInspiralPNMode43(v, phi, 1., m1, m2, r, O);
175  else if ( l == 4 && abs(m) == 2 )
176  hlm = XLALSimInspiralPNMode42(v, phi, 1., m1, m2, r, O);
177  else if ( l == 4 && abs(m) == 1 )
178  hlm = XLALSimInspiralPNMode41(v, phi, 1., m1, m2, r, O);
179  else if ( l == 4 && m == 0 )
180  hlm = XLALSimInspiralPNMode40(v, phi, 1., m1, m2, r, O);
181  else if ( l == 5 && abs(m) == 5 )
182  hlm = XLALSimInspiralPNMode55(v, phi, 1., m1, m2, r, O);
183  else if ( l == 5 && abs(m) == 4 )
184  hlm = XLALSimInspiralPNMode54(v, phi, 1., m1, m2, r, O);
185  else if ( l == 5 && abs(m) == 3 )
186  hlm = XLALSimInspiralPNMode53(v, phi, 1., m1, m2, r, O);
187  else if ( l == 5 && abs(m) == 2 )
188  hlm = XLALSimInspiralPNMode52(v, phi, 1., m1, m2, r, O);
189  else if ( l == 5 && abs(m) == 1 )
190  hlm = XLALSimInspiralPNMode51(v, phi, 1., m1, m2, r, O);
191  else if ( l == 5 && m == 0 )
192  hlm = XLALSimInspiralPNMode50(v, phi, 1., m1, m2, r, O);
193  else if ( l == 6 && abs(m) == 6 )
194  hlm = XLALSimInspiralPNMode66(v, phi, 1., m1, m2, r, O);
195  else if ( l == 6 && abs(m) == 5 )
196  hlm = XLALSimInspiralPNMode65(v, phi, 1., m1, m2, r, O);
197  else if ( l == 6 && abs(m) == 4 )
198  hlm = XLALSimInspiralPNMode64(v, phi, 1., m1, m2, r, O);
199  else if ( l == 6 && abs(m) == 3 )
200  hlm = XLALSimInspiralPNMode63(v, phi, 1., m1, m2, r, O);
201  else if ( l == 6 && abs(m) == 2 )
202  hlm = XLALSimInspiralPNMode62(v, phi, 1., m1, m2, r, O);
203  else if ( l == 6 && abs(m) == 1 )
204  hlm = XLALSimInspiralPNMode61(v, phi, 1., m1, m2, r, O);
205  else if ( l == 6 && m == 0 )
206  hlm = XLALSimInspiralPNMode60(v, phi, 1., m1, m2, r, O);
207  else {
208  XLALPrintError("XLAL Error - %s: Unsupported mode l=%d, m=%d\n", __func__, l, m );
210  }
211  if ( !hlm )
213  REAL8 sign=-1;
214  if ( m < 0 ) {
215  sign*= l % 2 ? -1.0 : 1.0;
216  for ( j = 0; j < hlm->data->length; ++j )
217  hlm->data->data[j] = sign * conj(hlm->data->data[j]);
218  }
219  else
220  for ( j = 0; j < hlm->data->length; ++j )
221  hlm->data->data[j] = -hlm->data->data[j];
222 
223  return hlm;
224 }
225 
226 /**
227  * Computes h(2,2) mode of spherical harmonic decomposition of
228  * the post-Newtonian inspiral waveform.
229  *
230  * Implements Equation (79) of:
231  * Lawrence E. Kidder, "Using Full Information When Computing Modes of
232  * Post-Newtonian Waveforms From Inspiralling Compact Binaries in Circular
233  * Orbit", Physical Review D 77, 044016 (2008), arXiv:0710.0614v1 [gr-qc].
234  */
236  REAL8TimeSeries *V, /**< post-Newtonian parameter */
237  REAL8TimeSeries *Phi, /**< orbital phase */
238  REAL8 v0, /**< tail gauge parameter (default=1) */
239  REAL8 m1, /**< mass of companion 1 (kg) */
240  REAL8 m2, /**< mass of companion 2 (kg) */
241  REAL8 r, /**< distance of source (m) */
242  int O /**< twice post-Newtonian order */
243  )
244 {
245  LAL_CHECK_VALID_SERIES(V, NULL);
246  LAL_CHECK_VALID_SERIES(Phi, NULL);
248  COMPLEX16TimeSeries *hlm;
249  hlm = XLALCreateCOMPLEX16TimeSeries( "H_22 MODE", &V->epoch, 0.0,
250  V->deltaT, &lalStrainUnit, V->data->length );
251  if ( !hlm )
253  UINT4 j;
254  REAL8 fac = -8.0*sqrt(LAL_PI/5.0)*LAL_G_SI/LAL_C_SI/LAL_C_SI;
255  REAL8 m = m1 + m2;
256  REAL8 mu = m1*m2/m;
257  REAL8 nu = mu/m;
258  REAL8 nu2 = nu*nu;
259  REAL8 nu3 = nu*nu2;
260  REAL8 pi2 = LAL_PI*LAL_PI;
261  REAL8 phi, v, v2, logv, logv_v0, logv0 = log(v0);
262  COMPLEX16 ans;
263  REAL8 re = 0.0;
264  REAL8 im = 0.0;
265  REAL8 re0 = 1., re2 = 0., re3 = 0., im3log = 0., re4 = 0., re5 = 0.;
266  REAL8 im5 = 0., im5log = 0., re6 = 0., im6 = 0., re6log = 0.;
267  REAL8 re6logsq = 0., im6log = 0.;
268  /* Set coefficients for requested PN (amplitude) order */
269  switch (O) {
270  default: /* unsupported pN order */
271  XLALPrintError("XLAL Error - %s: PN order %d%s not supported\n", __func__, O/2, O%2?".5":"" );
273  case -1: /* use highest available pN order */
274  case 6:
275  re6 = (27027409.0/646800.0) - (856.0/105.0)*LAL_GAMMA
276  + (2.0/3.0)*pi2 - (1712.0/105.0)*log(2.0)
277  - ((278185.0/33264.0) - (41.0/96.0)*pi2)*nu
278  - (20261.0/2772.0)*nu2 + (114635.0/99792.0)*nu3;
279  re6log = - (856.0/105.0);
280  re6logsq = - 72.0;
281  im6 = (428.0/105.0)*LAL_PI;
282  im6log = 24.0*LAL_PI;
283 #if __GNUC__ >= 7 && !defined __INTEL_COMPILER
284  __attribute__ ((fallthrough));
285 #endif
286  case 5:
287  re5 = - ((107.0/21.0) - (34.0/21.0)*nu)*LAL_PI;
288  im5 = - 24.0*nu;
289  im5log = - ((107.0/7.0) - (34.0/7.0)*nu)*2.0;
290 #if __GNUC__ >= 7 && !defined __INTEL_COMPILER
291  __attribute__ ((fallthrough));
292 #endif
293  case 4:
294  re4 = - ((2173.0/1512.0) + (1069.0/216.0)*nu
295  - (2047.0/1512.0)*nu2);
296 #if __GNUC__ >= 7 && !defined __INTEL_COMPILER
297  __attribute__ ((fallthrough));
298 #endif
299  case 3:
300  re3 = 2.0*LAL_PI;
301  im3log = 12.;
302 #if __GNUC__ >= 7 && !defined __INTEL_COMPILER
303  __attribute__ ((fallthrough));
304 #endif
305  case 2:
306  re2 = - ((107.0/42.0) - (55.0/42.0)*nu);
307 #if __GNUC__ >= 7 && !defined __INTEL_COMPILER
308  __attribute__ ((fallthrough));
309 #endif
310  case 1:
311  case 0:
312  break;
313  }
314  /* Loop over time samples, compute hlm(t) */
315  for (j=0; j < V->data->length; j++) {
316  v = V->data->data[j];
317  v2 = v*v;
318  logv = log(v);
319  logv_v0 = logv - logv0;
320  phi = Phi->data->data[j];
321  re = re0 + v2*(re2 + v*(re3 + v*(re4 + v*(re5 + v*(re6
322  + re6log*logv + re6logsq*logv_v0*logv_v0)))));
323  im = v*v2*(im3log*logv_v0 + v2*(im5 + im5log*logv_v0
324  + v*(im6 + im6log*logv_v0)));
325  ans = cpolar(1.0, -2.0*phi) * crect(re, im);
326  hlm->data->data[j] = ans * ((fac*nu*m/r)*v2);
327  }
328  return hlm;
329 }
330 
331 /**
332  * Computes h(2,1) mode of spherical harmonic decomposition of
333  * the post-Newtonian inspiral waveform.
334  *
335  * Implements Equation (80) of:
336  * Lawrence E. Kidder, "Using Full Information When Computing Modes of
337  * Post-Newtonian Waveforms From Inspiralling Compact Binaries in Circular
338  * Orbit", Physical Review D 77, 044016 (2008), arXiv:0710.0614v1 [gr-qc].
339  */
341  REAL8TimeSeries *V, /**< post-Newtonian parameter */
342  REAL8TimeSeries *Phi, /**< orbital phase */
343  REAL8 v0, /**< tail gauge parameter (default=1) */
344  REAL8 m1, /**< mass of companion 1 (kg) */
345  REAL8 m2, /**< mass of companion 2 (kg) */
346  REAL8 r, /**< distance of source (m) */
347  int O /**< twice post-Newtonian order */
348  )
349 {
350  LAL_CHECK_VALID_SERIES(V, NULL);
351  LAL_CHECK_VALID_SERIES(Phi, NULL);
353  COMPLEX16TimeSeries *hlm;
354  hlm = XLALCreateCOMPLEX16TimeSeries( "H_21 MODE", &V->epoch, 0.0,
355  V->deltaT, &lalStrainUnit, V->data->length );
356  if ( !hlm )
358  UINT4 j;
359  REAL8 fac = -(8.0/3.0)*sqrt(LAL_PI/5.0)*LAL_G_SI/LAL_C_SI/LAL_C_SI;
360  REAL8 m = m1 + m2;
361  REAL8 dm = m1 - m2;
362  REAL8 mu = m1*m2/m;
363  REAL8 nu = mu/m;
364  REAL8 nu2 = nu*nu;
365  REAL8 phi, v, v2;
366  COMPLEX16 ans;
367  REAL8 re = 0.0;
368  REAL8 im = 0.0;
369  REAL8 re1 = 0., re3 = 0., re4 = 0., im4 = 0., im4log = 0., re5 = 0.;
370  /* Set coefficients for requested PN (amplitude) order */
371  switch (O) {
372  default: /* unsupported pN order */
373  XLALPrintError("XLAL Error - %s: PN order %d%s not supported\n", __func__, O/2, O%2?".5":"" );
375  case -1: /* use highest available pN order */
376  case 6:
377  case 5:
378  re5 = -((43.0/126.0)+(509.0/126.0)*nu-(79.0/168.0)*nu2);
379 #if __GNUC__ >= 7 && !defined __INTEL_COMPILER
380  __attribute__ ((fallthrough));
381 #endif
382  case 4:
383  re4 = LAL_PI;
384  im4 = -(1.0/2.0) - 2.0*log(2.0);
385  im4log = 6.0;
386 #if __GNUC__ >= 7 && !defined __INTEL_COMPILER
387  __attribute__ ((fallthrough));
388 #endif
389  case 3:
390  re3 = - ((17.0/28.0) - (5.0/7.0)*nu);
391 #if __GNUC__ >= 7 && !defined __INTEL_COMPILER
392  __attribute__ ((fallthrough));
393 #endif
394  case 2:
395  case 1:
396  re1 = 1.;
397 #if __GNUC__ >= 7 && !defined __INTEL_COMPILER
398  __attribute__ ((fallthrough));
399 #endif
400  case 0:
401  break;
402  }
403  /* Loop over time samples, compute hlm(t) */
404  for (j=0; j < V->data->length; j++) {
405  v = V->data->data[j];
406  v2 = v*v;
407  phi = Phi->data->data[j];
408  re = re1 + v2 * (re3 + v * (re4 + v * re5));
409  im = v*v2 * (im4 + im4log * log(v/v0));
410  ans = cpolar(1.0, -phi) * crect(re, im);
411  hlm->data->data[j] = ans * I * ((fac*nu*dm/r)*v2*v);
412  }
413  return hlm;
414 }
415 
416 /**
417  * Computes h(2,0) mode of spherical harmonic decomposition of
418  * the post-Newtonian inspiral waveform.
419  *
420  * Implements Equation (81) of:
421  * Lawrence E. Kidder, "Using Full Information When Computing Modes of
422  * Post-Newtonian Waveforms From Inspiralling Compact Binaries in Circular
423  * Orbit", Physical Review D 77, 044016 (2008), arXiv:0710.0614v1 [gr-qc].
424  */
426  REAL8TimeSeries *V, /**< post-Newtonian parameter */
427  REAL8TimeSeries *Phi, /**< orbital phase */
428  REAL8 UNUSED v0, /**< tail gauge parameter (default=1) */
429  REAL8 m1, /**< mass of companion 1 (kg) */
430  REAL8 m2, /**< mass of companion 2 (kg) */
431  REAL8 r, /**< distance of source (m) */
432  int UNUSED O /**< twice post-Newtonian order */
433  )
434 {
435  LAL_CHECK_VALID_SERIES(V, NULL);
436  LAL_CHECK_VALID_SERIES(Phi, NULL);
438  COMPLEX16TimeSeries *hlm;
439  hlm = XLALCreateCOMPLEX16TimeSeries( "H_20 MODE", &V->epoch, 0.0,
440  V->deltaT, &lalStrainUnit, V->data->length );
441  if ( !hlm )
443  UINT4 j;
444  REAL8 fac = (2./7.)*sqrt(10.*LAL_PI/3.)*LAL_G_SI/LAL_C_SI/LAL_C_SI;
445  REAL8 m = m1 + m2;
446  REAL8 mu = m1*m2/m;
447  REAL8 v, v2;
448  COMPLEX16 ans;
449  /* Loop over time samples, compute hlm(t) */
450  for (j=0; j < V->data->length; j++) {
451  v = V->data->data[j];
452  v2 = v*v;
453  ans = 1.0;
454  hlm->data->data[j] = ans * ((fac*mu/r)*v2);
455  }
456  return hlm;
457 }
458 
459 /**
460  * Computes h(3,3) mode of spherical harmonic decomposition of
461  * the post-Newtonian inspiral waveform.
462  *
463  * Implements Equation (82) of:
464  * Lawrence E. Kidder, "Using Full Information When Computing Modes of
465  * Post-Newtonian Waveforms From Inspiralling Compact Binaries in Circular
466  * Orbit", Physical Review D 77, 044016 (2008), arXiv:0710.0614v1 [gr-qc].
467  */
469  REAL8TimeSeries *V, /**< post-Newtonian parameter */
470  REAL8TimeSeries *Phi, /**< orbital phase */
471  REAL8 v0, /**< tail gauge parameter (default=1) */
472  REAL8 m1, /**< mass of companion 1 (kg) */
473  REAL8 m2, /**< mass of companion 2 (kg) */
474  REAL8 r, /**< distance of source (m) */
475  int O /**< twice post-Newtonian order */
476  )
477 {
478  LAL_CHECK_VALID_SERIES(V, NULL);
479  LAL_CHECK_VALID_SERIES(Phi, NULL);
481  COMPLEX16TimeSeries *hlm;
482  hlm = XLALCreateCOMPLEX16TimeSeries( "H_33 MODE", &V->epoch, 0.0,
483  V->deltaT, &lalStrainUnit, V->data->length );
484  if ( !hlm )
486  UINT4 j;
487  REAL8 fac = 3.0*sqrt(6.0*LAL_PI/7.0)*LAL_G_SI/LAL_C_SI/LAL_C_SI;
488  REAL8 m = m1 + m2;
489  REAL8 dm = m1 - m2;
490  REAL8 mu = m1*m2/m;
491  REAL8 nu = mu/m;
492  REAL8 nu2 = nu*nu;
493  REAL8 phi, v, v2;
494  COMPLEX16 ans;
495  REAL8 re = 0.0;
496  REAL8 im = 0.0;
497  REAL8 re1 = 0., re3 = 0., re4 = 0., im4 = 0., im4log = 0., re5 = 0.;
498  /* Set coefficients for requested PN (amplitude) order */
499  switch (O) {
500  default: /* unsupported pN order */
501  XLALPrintError("XLAL Error - %s: PN order %d%s not supported\n", __func__, O/2, O%2?".5":"" );
503  case -1: /* use highest available pN order */
504  case 6:
505  case 5:
506  re5 = ((123.0/110.0) - (1838.0/165.0)*nu
507  - (887.0/330.0)*nu2);
508 #if __GNUC__ >= 7 && !defined __INTEL_COMPILER
509  __attribute__ ((fallthrough));
510 #endif
511  case 4:
512  re4 = 3.0*LAL_PI;
513  im4 = -(21.0/5.0) + 6.0*log(3.0/2.0);
514  im4log = 18.0;
515 #if __GNUC__ >= 7 && !defined __INTEL_COMPILER
516  __attribute__ ((fallthrough));
517 #endif
518  case 3:
519  re3 = - (4.0 - 2.0*nu);
520 #if __GNUC__ >= 7 && !defined __INTEL_COMPILER
521  __attribute__ ((fallthrough));
522 #endif
523  case 2:
524  case 1:
525  re1 = 1.;
526 #if __GNUC__ >= 7 && !defined __INTEL_COMPILER
527  __attribute__ ((fallthrough));
528 #endif
529  case 0:
530  break;
531  }
532  /* Loop over time samples, compute hlm(t) */
533  for (j=0; j < V->data->length; j++) {
534  v = V->data->data[j];
535  v2 = v*v;
536  phi = Phi->data->data[j];
537  re = re1 + v2 * (re3 + v * (re4 + v * re5));
538  im = v*v2 * (im4 + im4log * log(v/v0));
539  ans = cpolar(1.0, -3.0*phi) * crect(re, im);
540  hlm->data->data[j] = ans * I * ((fac*nu*dm/r)*v2*v);
541  }
542  return hlm;
543 }
544 
545 
546 /**
547  * Computes h(3,2) mode of spherical harmonic decomposition of
548  * the post-Newtonian inspiral waveform.
549  *
550  * Implements Equation (83) of:
551  * Lawrence E. Kidder, "Using Full Information When Computing Modes of
552  * Post-Newtonian Waveforms From Inspiralling Compact Binaries in Circular
553  * Orbit", Physical Review D 77, 044016 (2008), arXiv:0710.0614v1 [gr-qc].
554  */
556  REAL8TimeSeries *V, /**< post-Newtonian parameter */
557  REAL8TimeSeries *Phi, /**< orbital phase */
558  REAL8 v0, /**< tail gauge parameter (default=1) */
559  REAL8 m1, /**< mass of companion 1 (kg) */
560  REAL8 m2, /**< mass of companion 2 (kg) */
561  REAL8 r, /**< distance of source (m) */
562  int O /**< twice post-Newtonian order */
563  )
564 {
565  LAL_CHECK_VALID_SERIES(V, NULL);
566  LAL_CHECK_VALID_SERIES(Phi, NULL);
568  COMPLEX16TimeSeries *hlm;
569  hlm = XLALCreateCOMPLEX16TimeSeries( "H_32 MODE", &V->epoch, 0.0,
570  V->deltaT, &lalStrainUnit, V->data->length );
571  if ( !hlm )
573  UINT4 j;
574  REAL8 fac = -(8.0/3.0)*sqrt(LAL_PI/7.0)*LAL_G_SI/LAL_C_SI/LAL_C_SI;
575  REAL8 m = m1 + m2;
576  REAL8 mu = m1*m2/m;
577  REAL8 nu = mu/m;
578  REAL8 nu2 = nu*nu;
579  REAL8 nuterm = (1. - 3.*nu);
580  REAL8 phi, v, v2;
581  COMPLEX16 ans;
582  REAL8 re = 0.0;
583  REAL8 im = 0.0;
584  REAL8 re2 = 0., re4 = 0., re5 = 0., im5 = 0., im5log = 0.;
585  /* Set coefficients for requested PN (amplitude) order */
586  switch (O) {
587  default: /* unsupported pN order */
588  XLALPrintError("XLAL Error - %s: PN order %d%s not supported\n", __func__, O/2, O%2?".5":"" );
590  case -1: /* use highest available pN order */
591  case 6:
592  case 5:
593  re5 = 2.0*LAL_PI*nuterm;
594  im5 = -3.0 + (66.0/5.0)*nu;
595  im5log = 12.0*nuterm;
596 #if __GNUC__ >= 7 && !defined __INTEL_COMPILER
597  __attribute__ ((fallthrough));
598 #endif
599  case 4:
600  re4 = - ((193.0/90.0) - (145.0/18.0)*nu
601  + (73.0/18.0)*nu2);
602 #if __GNUC__ >= 7 && !defined __INTEL_COMPILER
603  __attribute__ ((fallthrough));
604 #endif
605  case 3:
606  case 2:
607  re2 = nuterm;
608 #if __GNUC__ >= 7 && !defined __INTEL_COMPILER
609  __attribute__ ((fallthrough));
610 #endif
611  case 1:
612  case 0:
613  break;
614  }
615  /* Loop over time samples, compute hlm(t) */
616  for (j=0; j < V->data->length; j++) {
617  v = V->data->data[j];
618  v2 = v*v;
619  phi = Phi->data->data[j];
620  re = re2 + v2 * (re4 + v * re5);
621  im = v*v2 * (im5 + im5log * log(v/v0));
622  ans = cpolar(1.0, -2.0*phi) * crect(re, im);
623  hlm->data->data[j] = ans * ((fac*nu*m/r)*v2*v2);
624  }
625  return hlm;
626 }
627 
628 /**
629  * Computes h(3,1) mode of spherical harmonic decomposition of
630  * the post-Newtonian inspiral waveform.
631  *
632  * Implements Equation (84) of:
633  * Lawrence E. Kidder, "Using Full Information When Computing Modes of
634  * Post-Newtonian Waveforms From Inspiralling Compact Binaries in Circular
635  * Orbit", Physical Review D 77, 044016 (2008), arXiv:0710.0614v1 [gr-qc].
636  */
638  REAL8TimeSeries *V, /**< post-Newtonian parameter */
639  REAL8TimeSeries *Phi, /**< orbital phase */
640  REAL8 v0, /**< tail gauge parameter (default=1) */
641  REAL8 m1, /**< mass of companion 1 (kg) */
642  REAL8 m2, /**< mass of companion 2 (kg) */
643  REAL8 r, /**< distance of source (m) */
644  int O /**< twice post-Newtonian order */
645  )
646 {
647  LAL_CHECK_VALID_SERIES(V, NULL);
648  LAL_CHECK_VALID_SERIES(Phi, NULL);
650  COMPLEX16TimeSeries *hlm;
651  hlm = XLALCreateCOMPLEX16TimeSeries( "H_31 MODE", &V->epoch, 0.0,
652  V->deltaT, &lalStrainUnit, V->data->length );
653  if ( !hlm )
655  UINT4 j;
656  REAL8 fac = -(1.0/3.0)*sqrt(2.0*LAL_PI/35.0)*LAL_G_SI/LAL_C_SI/LAL_C_SI;
657  REAL8 m = m1 + m2;
658  REAL8 dm = m1 - m2;
659  REAL8 mu = m1*m2/m;
660  REAL8 nu = mu/m;
661  REAL8 nu2 = nu*nu;
662  REAL8 phi, v, v2;
663  COMPLEX16 ans;
664  REAL8 re = 0.0;
665  REAL8 im = 0.0;
666  REAL8 re1 = 0., re3 = 0., re4 = 0., im4 = 0., im4log = 0., re5 = 0.;
667  /* Set coefficients for requested PN (amplitude) order */
668  switch (O) {
669  default: /* unsupported pN order */
670  XLALPrintError("XLAL Error - %s: PN order %d%s not supported\n", __func__, O/2, O%2?".5":"" );
672  case -1: /* use highest available pN order */
673  case 6:
674  case 5:
675  re5 = ((607.0/198.0) - (136.0/99.0)*nu
676  - (247.0/198.0)*nu2);
677 #if __GNUC__ >= 7 && !defined __INTEL_COMPILER
678  __attribute__ ((fallthrough));
679 #endif
680  case 4:
681  re4 = LAL_PI;
682  im4 = -(7.0/5.0) - 2.0*log(2.0);
683  im4log = 6.0;
684 #if __GNUC__ >= 7 && !defined __INTEL_COMPILER
685  __attribute__ ((fallthrough));
686 #endif
687  case 3:
688  re3 = - ((8.0/3.0) + (2.0/3.0)*nu);
689 #if __GNUC__ >= 7 && !defined __INTEL_COMPILER
690  __attribute__ ((fallthrough));
691 #endif
692  case 2:
693  case 1:
694  re1 = 1.;
695 #if __GNUC__ >= 7 && !defined __INTEL_COMPILER
696  __attribute__ ((fallthrough));
697 #endif
698  case 0:
699  break;
700  }
701  /* Loop over time samples, compute hlm(t) */
702  for (j=0; j < V->data->length; j++) {
703  v = V->data->data[j];
704  v2 = v*v;
705  phi = Phi->data->data[j];
706  re = re1 + v2 * (re3 + v * (re4 + v * re5));
707  im = v*v2 * (im4 + im4log * log(v/v0));
708  ans = cpolar(1.0, -phi) * crect(re, im);
709  hlm->data->data[j] = ans * I * ((fac*nu*dm/r)*v2*v);
710  }
711  return hlm;
712 }
713 
714 /**
715  * Computes h(3,0) mode of spherical harmonic decomposition of
716  * the post-Newtonian inspiral waveform.
717  *
718  * Implements Equation (85) of:
719  * Lawrence E. Kidder, "Using Full Information When Computing Modes of
720  * Post-Newtonian Waveforms From Inspiralling Compact Binaries in Circular
721  * Orbit", Physical Review D 77, 044016 (2008), arXiv:0710.0614v1 [gr-qc].
722  */
724  REAL8TimeSeries *V, /**< post-Newtonian parameter */
725  REAL8TimeSeries *Phi, /**< orbital phase */
726  REAL8 UNUSED v0, /**< tail gauge parameter (default=1) */
727  REAL8 m1, /**< mass of companion 1 (kg) */
728  REAL8 m2, /**< mass of companion 2 (kg) */
729  REAL8 r, /**< distance of source (m) */
730  int O /**< twice post-Newtonian order */
731  )
732 {
733  LAL_CHECK_VALID_SERIES(V, NULL);
734  LAL_CHECK_VALID_SERIES(Phi, NULL);
736  COMPLEX16TimeSeries *hlm;
737  hlm = XLALCreateCOMPLEX16TimeSeries( "H_30 MODE", &V->epoch, 0.0,
738  V->deltaT, &lalStrainUnit, V->data->length );
739  if ( !hlm )
741  UINT4 j;
742  REAL8 fac = (16./5.)*sqrt(6.*LAL_PI/35.)*LAL_G_SI/LAL_C_SI/LAL_C_SI;
743  REAL8 m = m1 + m2;
744  REAL8 mu = m1*m2/m;
745  REAL8 nu = mu/m;
746  REAL8 nu2 = nu*nu;
747  REAL8 v, v7;
748  COMPLEX16 ans;
749  REAL8 re = 0.0;
750  REAL8 im = 0.0;
751  /* Set coefficients for requested PN (amplitude) order */
752  switch (O) {
753  default: /* unsupported pN order */
754  XLALPrintError("XLAL Error - %s: PN order %d%s not supported\n", __func__, O/2, O%2?".5":"" );
756  case -1: /* use highest available pN order */
757  case 6:
758  case 5:
759  re = 1.;
760  case 4:
761  case 3:
762  case 2:
763  case 1:
764  case 0:
765  break;
766  }
767  /* Loop over time samples, compute hlm(t) */
768  for (j=0; j < V->data->length; j++) {
769  v = V->data->data[j];
770  v7 = v*v*v*v*v*v*v;
771  ans = crect(re, im);
772  hlm->data->data[j] = ans * I * ((fac*m*nu2/r)*v7);
773  }
774  return hlm;
775 }
776 
777 /**
778  * Computes h(4,4) mode of spherical harmonic decomposition of
779  * the post-Newtonian inspiral waveform.
780  *
781  * Implements Equation (86) of:
782  * Lawrence E. Kidder, "Using Full Information When Computing Modes of
783  * Post-Newtonian Waveforms From Inspiralling Compact Binaries in Circular
784  * Orbit", Physical Review D 77, 044016 (2008), arXiv:0710.0614v1 [gr-qc].
785  */
787  REAL8TimeSeries *V, /**< post-Newtonian parameter */
788  REAL8TimeSeries *Phi, /**< orbital phase */
789  REAL8 v0, /**< tail gauge parameter (default=1) */
790  REAL8 m1, /**< mass of companion 1 (kg) */
791  REAL8 m2, /**< mass of companion 2 (kg) */
792  REAL8 r, /**< distance of source (m) */
793  int O /**< twice post-Newtonian order */
794  )
795 {
796  LAL_CHECK_VALID_SERIES(V, NULL);
797  LAL_CHECK_VALID_SERIES(Phi, NULL);
799  COMPLEX16TimeSeries *hlm;
800  hlm = XLALCreateCOMPLEX16TimeSeries( "H_44 MODE", &V->epoch, 0.0,
801  V->deltaT, &lalStrainUnit, V->data->length );
802  if ( !hlm )
804  UINT4 j;
805  REAL8 fac = (64./9.)*sqrt(LAL_PI/7.)*LAL_G_SI/LAL_C_SI/LAL_C_SI;
806  REAL8 m = m1 + m2;
807  REAL8 mu = m1*m2/m;
808  REAL8 nu = mu/m;
809  REAL8 nu2 = nu*nu;
810  REAL8 nuterm = 1. - 3.*nu;
811  REAL8 phi, v, v2;
812  COMPLEX16 ans;
813  REAL8 re = 0.0;
814  REAL8 im = 0.0;
815  REAL8 re2 = 0., re4 = 0., re5 = 0., im5 = 0., im5log = 0., re6 = 0.;
816  /* Set coefficients for requested PN (amplitude) order */
817  switch (O) {
818  default: /* unsupported pN order */
819  XLALPrintError("XLAL Error - %s: PN order %d%s not supported\n", __func__, O/2, O%2?".5":"" );
821  case -1: /* use highest available pN order */
822  case 6:
823  re6 = 1068671./200200. - (1088119./28600.)*nu
824  + (146879./2340.)*nu2 - (226097./17160.)*nu2*nu;
825 #if __GNUC__ >= 7 && !defined __INTEL_COMPILER
826  __attribute__ ((fallthrough));
827 #endif
828  case 5:
829  re5 = 4.*LAL_PI*nuterm;
830  im5 = -42./5. + (1193./40.) *nu + 8.*nuterm*log(2.);
831  im5log = 24.*nuterm;
832 #if __GNUC__ >= 7 && !defined __INTEL_COMPILER
833  __attribute__ ((fallthrough));
834 #endif
835  case 4:
836  re4 = 593./110. - (1273./66.)*nu + (175./22.)*nu2;
837 #if __GNUC__ >= 7 && !defined __INTEL_COMPILER
838  __attribute__ ((fallthrough));
839 #endif
840  case 3:
841  case 2:
842  re2 = nuterm;
843 #if __GNUC__ >= 7 && !defined __INTEL_COMPILER
844  __attribute__ ((fallthrough));
845 #endif
846  case 1:
847  case 0:
848  break;
849  }
850  /* Loop over time samples, compute hlm(t) */
851  for (j=0; j < V->data->length; j++) {
852  v = V->data->data[j];
853  v2 = v*v;
854  phi = Phi->data->data[j];
855  re = re2 + v2 * (re4 + v * (re5 + v * re6));
856  im = v*v2 * (im5 + im5log * log(v/v0));
857  ans = cpolar(1.0, -4.*phi) * crect(re, im);
858  hlm->data->data[j] = ans * ((fac*nu*m/r)*v2*v2);
859  }
860  return hlm;
861 }
862 
863 /**
864  * Computes h(4,3) mode of spherical harmonic decomposition of
865  * the post-Newtonian inspiral waveform.
866  *
867  * Implements Equation (87) of:
868  * Lawrence E. Kidder, "Using Full Information When Computing Modes of
869  * Post-Newtonian Waveforms From Inspiralling Compact Binaries in Circular
870  * Orbit", Physical Review D 77, 044016 (2008), arXiv:0710.0614v1 [gr-qc].
871  */
873  REAL8TimeSeries *V, /**< post-Newtonian parameter */
874  REAL8TimeSeries *Phi, /**< orbital phase */
875  REAL8 UNUSED v0, /**< tail gauge parameter (default=1) */
876  REAL8 m1, /**< mass of companion 1 (kg) */
877  REAL8 m2, /**< mass of companion 2 (kg) */
878  REAL8 r, /**< distance of source (m) */
879  int O /**< twice post-Newtonian order */
880  )
881 {
882  LAL_CHECK_VALID_SERIES(V, NULL);
883  LAL_CHECK_VALID_SERIES(Phi, NULL);
885  COMPLEX16TimeSeries *hlm;
886  hlm = XLALCreateCOMPLEX16TimeSeries( "H_43 MODE", &V->epoch, 0.0,
887  V->deltaT, &lalStrainUnit, V->data->length );
888  if ( !hlm )
890  UINT4 j;
891  REAL8 fac = (9./5.)*sqrt(2.*LAL_PI/7.)*LAL_G_SI/LAL_C_SI/LAL_C_SI;
892  REAL8 m = m1 + m2;
893  REAL8 dm = m1 - m2;
894  REAL8 mu = m1*m2/m;
895  REAL8 nu = mu/m;
896  REAL8 nu2 = nu*nu;
897  REAL8 phi, v, v2;
898  COMPLEX16 ans;
899  REAL8 re = 0.0;
900  REAL8 im = 0.0;
901  REAL8 re3 = 0., re5 = 0.;
902  /* Set coefficients for requested PN (amplitude) order */
903  switch (O) {
904  default: /* unsupported pN order */
905  XLALPrintError("XLAL Error - %s: PN order %d%s not supported\n", __func__, O/2, O%2?".5":"" );
907  case -1: /* use highest available pN order */
908  case 6:
909  case 5:
910  re5 = 39./11. - (1267./132.)*nu + (131./33.)*nu2;
911 #if __GNUC__ >= 7 && !defined __INTEL_COMPILER
912  __attribute__ ((fallthrough));
913 #endif
914  case 4:
915  case 3:
916  re3 = 1. - 2.*nu;
917 #if __GNUC__ >= 7 && !defined __INTEL_COMPILER
918  __attribute__ ((fallthrough));
919 #endif
920  case 2:
921  case 1:
922  case 0:
923  break;
924  }
925  /* Loop over time samples, compute hlm(t) */
926  for (j=0; j < V->data->length; j++) {
927  v = V->data->data[j];
928  v2 = v*v;
929  phi = Phi->data->data[j];
930  re = re3 + v2 * re5;
931  ans = cpolar(1.0, -3.*phi) * crect(re, im);
932  hlm->data->data[j] = ans * ((fac*nu*dm/r)*v*v2*v2);
933  }
934  return hlm;
935 }
936 
937 /**
938  * Computes h(4,2) mode of spherical harmonic decomposition of
939  * the post-Newtonian inspiral waveform.
940  *
941  * Implements Equation (88) of:
942  * Lawrence E. Kidder, "Using Full Information When Computing Modes of
943  * Post-Newtonian Waveforms From Inspiralling Compact Binaries in Circular
944  * Orbit", Physical Review D 77, 044016 (2008), arXiv:0710.0614v1 [gr-qc].
945  */
947  REAL8TimeSeries *V, /**< post-Newtonian parameter */
948  REAL8TimeSeries *Phi, /**< orbital phase */
949  REAL8 v0, /**< tail gauge parameter (default=1) */
950  REAL8 m1, /**< mass of companion 1 (kg) */
951  REAL8 m2, /**< mass of companion 2 (kg) */
952  REAL8 r, /**< distance of source (m) */
953  int O /**< twice post-Newtonian order */
954  )
955 {
956  LAL_CHECK_VALID_SERIES(V, NULL);
957  LAL_CHECK_VALID_SERIES(Phi, NULL);
959  COMPLEX16TimeSeries *hlm;
960  hlm = XLALCreateCOMPLEX16TimeSeries( "H_42 MODE", &V->epoch, 0.0,
961  V->deltaT, &lalStrainUnit, V->data->length );
962  if ( !hlm )
964  UINT4 j;
965  REAL8 fac = - (8./63.)*sqrt(LAL_PI)*LAL_G_SI/LAL_C_SI/LAL_C_SI;
966  REAL8 m = m1 + m2;
967  REAL8 mu = m1*m2/m;
968  REAL8 nu = mu/m;
969  REAL8 nu2 = nu*nu;
970  REAL8 nuterm = 1. - 3.*nu;
971  REAL8 phi, v, v2;
972  COMPLEX16 ans;
973  REAL8 re = 0.0;
974  REAL8 im = 0.0;
975  REAL8 re2 = 0., re4 = 0., re5 = 0., im5 = 0., im5log = 0., re6 = 0.;
976  /* Set coefficients for requested PN (amplitude) order */
977  switch (O) {
978  default: /* unsupported pN order */
979  XLALPrintError("XLAL Error - %s: PN order %d%s not supported\n", __func__, O/2, O%2?".5":"" );
981  case -1: /* use highest available pN order */
982  case 6:
983  re6 = 1038039./200200. - (606751./28600.)*nu
984  + (400453./25740.)*nu2 + (25783./17160.)*nu*nu2;
985 #if __GNUC__ >= 7 && !defined __INTEL_COMPILER
986  __attribute__ ((fallthrough));
987 #endif
988  case 5:
989  re5 = 2.*LAL_PI*nuterm;
990  im5 = -21./5. + (84./5.) *nu + 8.*nuterm*log(2.);
991  im5log = 12.*nuterm;
992 #if __GNUC__ >= 7 && !defined __INTEL_COMPILER
993  __attribute__ ((fallthrough));
994 #endif
995  case 4:
996  re4 = 437./110. - (805./66.)*nu + (19./22.)*nu2;
997 #if __GNUC__ >= 7 && !defined __INTEL_COMPILER
998  __attribute__ ((fallthrough));
999 #endif
1000  case 3:
1001  case 2:
1002  re2 = nuterm;
1003 #if __GNUC__ >= 7 && !defined __INTEL_COMPILER
1004  __attribute__ ((fallthrough));
1005 #endif
1006  case 1:
1007  case 0:
1008  break;
1009  }
1010  /* Loop over time samples, compute hlm(t) */
1011  for (j=0; j < V->data->length; j++) {
1012  v = V->data->data[j];
1013  v2 = v*v;
1014  phi = Phi->data->data[j];
1015  re = re2 + v2 * (re4 + v * (re5 + v * re6));
1016  im = v*v2 * (im5 + im5log * log(v/v0));
1017  ans = cpolar(1.0, -2.*phi) * crect(re, im);
1018  hlm->data->data[j] = ans * ((fac*nu*m/r)*v2*v2);
1019  }
1020  return hlm;
1021 }
1022 
1023 /**
1024  * Computes h(4,1) mode of spherical harmonic decomposition of
1025  * the post-Newtonian inspiral waveform.
1026  *
1027  * Implements Equation (89) of:
1028  * Lawrence E. Kidder, "Using Full Information When Computing Modes of
1029  * Post-Newtonian Waveforms From Inspiralling Compact Binaries in Circular
1030  * Orbit", Physical Review D 77, 044016 (2008), arXiv:0710.0614v1 [gr-qc].
1031  */
1033  REAL8TimeSeries *V, /**< post-Newtonian parameter */
1034  REAL8TimeSeries *Phi, /**< orbital phase */
1035  REAL8 UNUSED v0, /**< tail gauge parameter (default=1) */
1036  REAL8 m1, /**< mass of companion 1 (kg) */
1037  REAL8 m2, /**< mass of companion 2 (kg) */
1038  REAL8 r, /**< distance of source (m) */
1039  int O /**< twice post-Newtonian order */
1040  )
1041 {
1042  LAL_CHECK_VALID_SERIES(V, NULL);
1043  LAL_CHECK_VALID_SERIES(Phi, NULL);
1044  LAL_CHECK_CONSISTENT_TIME_SERIES(V, Phi, NULL);
1045  COMPLEX16TimeSeries *hlm;
1046  hlm = XLALCreateCOMPLEX16TimeSeries( "H_41 MODE", &V->epoch, 0.0,
1047  V->deltaT, &lalStrainUnit, V->data->length );
1048  if ( !hlm )
1050  UINT4 j;
1051  REAL8 fac = - (1./105.)*sqrt(2.*LAL_PI)*LAL_G_SI/LAL_C_SI/LAL_C_SI;
1052  REAL8 m = m1 + m2;
1053  REAL8 dm = m1 - m2;
1054  REAL8 mu = m1*m2/m;
1055  REAL8 nu = mu/m;
1056  REAL8 nu2 = nu*nu;
1057  REAL8 phi, v, v2;
1058  COMPLEX16 ans;
1059  REAL8 re = 0.0;
1060  REAL8 im = 0.0;
1061  REAL8 re3 = 0., re5 = 0.;
1062  /* Set coefficients for requested PN (amplitude) order */
1063  switch (O) {
1064  default: /* unsupported pN order */
1065  XLALPrintError("XLAL Error - %s: PN order %d%s not supported\n", __func__, O/2, O%2?".5":"" );
1067  case -1: /* use highest available pN order */
1068  case 6:
1069  case 5:
1070  re5 = - (101./33. - (337./44.)*nu + (83./33.)*nu2);
1071 #if __GNUC__ >= 7 && !defined __INTEL_COMPILER
1072  __attribute__ ((fallthrough));
1073 #endif
1074  case 4:
1075  case 3:
1076  re3 = 1. - 2.*nu;
1077 #if __GNUC__ >= 7 && !defined __INTEL_COMPILER
1078  __attribute__ ((fallthrough));
1079 #endif
1080  case 2:
1081  case 1:
1082  case 0:
1083  break;
1084  }
1085  /* Loop over time samples, compute hlm(t) */
1086  for (j=0; j < V->data->length; j++) {
1087  v = V->data->data[j];
1088  v2 = v*v;
1089  phi = Phi->data->data[j];
1090  re = re3 + v2 * re5;
1091  ans = cpolar(1.0, -phi) * crect(re, im);
1092  hlm->data->data[j] = ans * I * ((fac*nu*dm/r)*v*v2*v2);
1093  }
1094  return hlm;
1095 }
1096 
1097 /**
1098  * Computes h(4,0) mode of spherical harmonic decomposition of
1099  * the post-Newtonian inspiral waveform.
1100  *
1101  * Implements Equation (90) of:
1102  * Lawrence E. Kidder, "Using Full Information When Computing Modes of
1103  * Post-Newtonian Waveforms From Inspiralling Compact Binaries in Circular
1104  * Orbit", Physical Review D 77, 044016 (2008), arXiv:0710.0614v1 [gr-qc].
1105  */
1107  REAL8TimeSeries *V, /**< post-Newtonian parameter */
1108  REAL8TimeSeries *Phi, /**< orbital phase */
1109  REAL8 UNUSED v0, /**< tail gauge parameter (default=1) */
1110  REAL8 m1, /**< mass of companion 1 (kg) */
1111  REAL8 m2, /**< mass of companion 2 (kg) */
1112  REAL8 r, /**< distance of source (m) */
1113  int UNUSED O /**< twice post-Newtonian order */
1114  )
1115 {
1116  LAL_CHECK_VALID_SERIES(V, NULL);
1117  LAL_CHECK_VALID_SERIES(Phi, NULL);
1118  LAL_CHECK_CONSISTENT_TIME_SERIES(V, Phi, NULL);
1119  COMPLEX16TimeSeries *hlm;
1120  hlm = XLALCreateCOMPLEX16TimeSeries( "H_40 MODE", &V->epoch, 0.0,
1121  V->deltaT, &lalStrainUnit, V->data->length );
1122  if ( !hlm )
1124  UINT4 j;
1125  REAL8 fac = (1./63.)*sqrt(LAL_PI/10.)*LAL_G_SI/LAL_C_SI/LAL_C_SI;
1126  REAL8 m = m1 + m2;
1127  REAL8 mu = m1*m2/m;
1128  REAL8 v, v2;
1129  COMPLEX16 ans;
1130  /* Loop over time samples, compute hlm(t) */
1131  for (j=0; j < V->data->length; j++) {
1132  v = V->data->data[j];
1133  v2 = v*v;
1134  ans = 1.0;
1135  hlm->data->data[j] = ans * ((fac*mu/r)*v2);
1136  }
1137  return hlm;
1138 }
1139 
1140 /**
1141  * Computes h(5,5) mode of spherical harmonic decomposition of
1142  * the post-Newtonian inspiral waveform.
1143  *
1144  * Implements Equation (91) of:
1145  * Lawrence E. Kidder, "Using Full Information When Computing Modes of
1146  * Post-Newtonian Waveforms From Inspiralling Compact Binaries in Circular
1147  * Orbit", Physical Review D 77, 044016 (2008), arXiv:0710.0614v1 [gr-qc].
1148  */
1150  REAL8TimeSeries *V, /**< post-Newtonian parameter */
1151  REAL8TimeSeries *Phi, /**< orbital phase */
1152  REAL8 UNUSED v0, /**< tail gauge parameter (default=1) */
1153  REAL8 m1, /**< mass of companion 1 (kg) */
1154  REAL8 m2, /**< mass of companion 2 (kg) */
1155  REAL8 r, /**< distance of source (m) */
1156  int O /**< twice post-Newtonian order */
1157  )
1158 {
1159  LAL_CHECK_VALID_SERIES(V, NULL);
1160  LAL_CHECK_VALID_SERIES(Phi, NULL);
1161  LAL_CHECK_CONSISTENT_TIME_SERIES(V, Phi, NULL);
1162  COMPLEX16TimeSeries *hlm;
1163  hlm = XLALCreateCOMPLEX16TimeSeries( "H_55 MODE", &V->epoch, 0.0,
1164  V->deltaT, &lalStrainUnit, V->data->length );
1165  if ( !hlm )
1167  UINT4 j;
1168  REAL8 fac = - (125./12.)*sqrt(5.*LAL_PI/66.)*LAL_G_SI/LAL_C_SI/LAL_C_SI;
1169  REAL8 m = m1 + m2;
1170  REAL8 dm = m1 - m2;
1171  REAL8 mu = m1*m2/m;
1172  REAL8 nu = mu/m;
1173  REAL8 nu2 = nu*nu;
1174  REAL8 phi, v, v2;
1175  COMPLEX16 ans;
1176  REAL8 re = 0.0;
1177  REAL8 im = 0.0;
1178  REAL8 re3 = 0., re5 = 0.;
1179  /* Set coefficients for requested PN (amplitude) order */
1180  switch (O) {
1181  default: /* unsupported pN order */
1182  XLALPrintError("XLAL Error - %s: PN order %d%s not supported\n", __func__, O/2, O%2?".5":"" );
1184  case -1: /* use highest available pN order */
1185  case 6:
1186  case 5:
1187  re5 = - (263./39. - (688./39.)*nu + (256./39.)*nu2);
1188 #if __GNUC__ >= 7 && !defined __INTEL_COMPILER
1189  __attribute__ ((fallthrough));
1190 #endif
1191  case 4:
1192  case 3:
1193  re3 = 1. - 2.*nu;
1194 #if __GNUC__ >= 7 && !defined __INTEL_COMPILER
1195  __attribute__ ((fallthrough));
1196 #endif
1197  case 2:
1198  case 1:
1199  case 0:
1200  break;
1201  }
1202  /* Loop over time samples, compute hlm(t) */
1203  for (j=0; j < V->data->length; j++) {
1204  v = V->data->data[j];
1205  v2 = v*v;
1206  phi = Phi->data->data[j];
1207  re = re3 + v2 * re5;
1208  ans = cpolar(1.0, -5.*phi) * crect(re, im);
1209  hlm->data->data[j] = ans * I * ((fac*nu*dm/r)*v*v2*v2);
1210  }
1211  return hlm;
1212 }
1213 
1214 /**
1215  * Computes h(5,4) mode of spherical harmonic decomposition of
1216  * the post-Newtonian inspiral waveform.
1217  *
1218  * Implements Equation (92) of:
1219  * Lawrence E. Kidder, "Using Full Information When Computing Modes of
1220  * Post-Newtonian Waveforms From Inspiralling Compact Binaries in Circular
1221  * Orbit", Physical Review D 77, 044016 (2008), arXiv:0710.0614v1 [gr-qc].
1222  */
1224  REAL8TimeSeries *V, /**< post-Newtonian parameter */
1225  REAL8TimeSeries *Phi, /**< orbital phase */
1226  REAL8 UNUSED v0, /**< tail gauge parameter (default=1) */
1227  REAL8 m1, /**< mass of companion 1 (kg) */
1228  REAL8 m2, /**< mass of companion 2 (kg) */
1229  REAL8 r, /**< distance of source (m) */
1230  int O /**< twice post-Newtonian order */
1231  )
1232 {
1233  LAL_CHECK_VALID_SERIES(V, NULL);
1234  LAL_CHECK_VALID_SERIES(Phi, NULL);
1235  LAL_CHECK_CONSISTENT_TIME_SERIES(V, Phi, NULL);
1236  COMPLEX16TimeSeries *hlm;
1237  hlm = XLALCreateCOMPLEX16TimeSeries( "H_54 MODE", &V->epoch, 0.0,
1238  V->deltaT, &lalStrainUnit, V->data->length );
1239  if ( !hlm )
1241  UINT4 j;
1242  REAL8 fac = (256./45.)*sqrt(LAL_PI/33.)*LAL_G_SI/LAL_C_SI/LAL_C_SI;
1243  REAL8 m = m1 + m2;
1244  REAL8 mu = m1*m2/m;
1245  REAL8 nu = mu/m;
1246  REAL8 nu2 = nu*nu;
1247  REAL8 phi, v, v2;
1248  COMPLEX16 ans;
1249  REAL8 re = 0.0;
1250  REAL8 im = 0.0;
1251  REAL8 re4 = 0., re6 = 0.;
1252  /* Set coefficients for requested PN (amplitude) order */
1253  switch (O) {
1254  default: /* unsupported pN order */
1255  XLALPrintError("XLAL Error - %s: PN order %d%s not supported\n", __func__, O/2, O%2?".5":"" );
1257  case -1: /* use highest available pN order */
1258  case 6:
1259  re6 = - (4451./910. - (3619./130.)*nu + (521./13.)*nu2
1260  - (339./26.)*nu*nu2);
1261 #if __GNUC__ >= 7 && !defined __INTEL_COMPILER
1262  __attribute__ ((fallthrough));
1263 #endif
1264  case 5:
1265  case 4:
1266  re4 = 1. - 5.*nu + 5.*nu2;
1267 #if __GNUC__ >= 7 && !defined __INTEL_COMPILER
1268  __attribute__ ((fallthrough));
1269 #endif
1270  case 3:
1271  case 2:
1272  case 1:
1273  case 0:
1274  break;
1275  }
1276  /* Loop over time samples, compute hlm(t) */
1277  for (j=0; j < V->data->length; j++) {
1278  v = V->data->data[j];
1279  v2 = v*v;
1280  phi = Phi->data->data[j];
1281  re = re4 + v2 * re6;
1282  ans = cpolar(1.0, -4.*phi) * crect(re, im);
1283  hlm->data->data[j] = ans * ((fac*nu*m/r)*v2*v2*v2);
1284  }
1285  return hlm;
1286 }
1287 
1288 /**
1289  * Computes h(5,3) mode of spherical harmonic decomposition of
1290  * the post-Newtonian inspiral waveform.
1291  *
1292  * Implements Equation (93) of:
1293  * Lawrence E. Kidder, "Using Full Information When Computing Modes of
1294  * Post-Newtonian Waveforms From Inspiralling Compact Binaries in Circular
1295  * Orbit", Physical Review D 77, 044016 (2008), arXiv:0710.0614v1 [gr-qc].
1296  */
1298  REAL8TimeSeries *V, /**< post-Newtonian parameter */
1299  REAL8TimeSeries *Phi, /**< orbital phase */
1300  REAL8 UNUSED v0, /**< tail gauge parameter (default=1) */
1301  REAL8 m1, /**< mass of companion 1 (kg) */
1302  REAL8 m2, /**< mass of companion 2 (kg) */
1303  REAL8 r, /**< distance of source (m) */
1304  int O /**< twice post-Newtonian order */
1305  )
1306 {
1307  LAL_CHECK_VALID_SERIES(V, NULL);
1308  LAL_CHECK_VALID_SERIES(Phi, NULL);
1309  LAL_CHECK_CONSISTENT_TIME_SERIES(V, Phi, NULL);
1310  COMPLEX16TimeSeries *hlm;
1311  hlm = XLALCreateCOMPLEX16TimeSeries( "H_53 MODE", &V->epoch, 0.0,
1312  V->deltaT, &lalStrainUnit, V->data->length );
1313  if ( !hlm )
1315  UINT4 j;
1316  REAL8 fac = - (9./20.)*sqrt(2.*LAL_PI/22.)*LAL_G_SI/LAL_C_SI/LAL_C_SI;
1317  REAL8 m = m1 + m2;
1318  REAL8 dm = m1 - m2;
1319  REAL8 mu = m1*m2/m;
1320  REAL8 nu = mu/m;
1321  REAL8 nu2 = nu*nu;
1322  REAL8 phi, v, v2;
1323  COMPLEX16 ans;
1324  REAL8 re = 0.0;
1325  REAL8 im = 0.0;
1326  REAL8 re3 = 0., re5 = 0.;
1327  /* Set coefficients for requested PN (amplitude) order */
1328  switch (O) {
1329  default: /* unsupported pN order */
1330  XLALPrintError("XLAL Error - %s: PN order %d%s not supported\n", __func__, O/2, O%2?".5":"" );
1332  case -1: /* use highest available pN order */
1333  case 6:
1334  case 5:
1335  re5 = - (69./13. - (464./39.)*nu + (88./39.)*nu2);
1336 #if __GNUC__ >= 7 && !defined __INTEL_COMPILER
1337  __attribute__ ((fallthrough));
1338 #endif
1339  case 4:
1340  case 3:
1341  re3 = 1. - 2.*nu;
1342 #if __GNUC__ >= 7 && !defined __INTEL_COMPILER
1343  __attribute__ ((fallthrough));
1344 #endif
1345  case 2:
1346  case 1:
1347  case 0:
1348  break;
1349  }
1350  /* Loop over time samples, compute hlm(t) */
1351  for (j=0; j < V->data->length; j++) {
1352  v = V->data->data[j];
1353  v2 = v*v;
1354  phi = Phi->data->data[j];
1355  re = re3 + v2 * re5;
1356  ans = cpolar(1.0, -3.*phi) * crect(re, im);
1357  hlm->data->data[j] = ans * I * ((fac*nu*dm/r)*v*v2*v2);
1358  }
1359  return hlm;
1360 }
1361 
1362 /**
1363  * Computes h(5,2) mode of spherical harmonic decomposition of
1364  * the post-Newtonian inspiral waveform.
1365  *
1366  * Implements Equation (94) of:
1367  * Lawrence E. Kidder, "Using Full Information When Computing Modes of
1368  * Post-Newtonian Waveforms From Inspiralling Compact Binaries in Circular
1369  * Orbit", Physical Review D 77, 044016 (2008), arXiv:0710.0614v1 [gr-qc].
1370  */
1372  REAL8TimeSeries *V, /**< post-Newtonian parameter */
1373  REAL8TimeSeries *Phi, /**< orbital phase */
1374  REAL8 UNUSED v0, /**< tail gauge parameter (default=1) */
1375  REAL8 m1, /**< mass of companion 1 (kg) */
1376  REAL8 m2, /**< mass of companion 2 (kg) */
1377  REAL8 r, /**< distance of source (m) */
1378  int O /**< twice post-Newtonian order */
1379  )
1380 {
1381  LAL_CHECK_VALID_SERIES(V, NULL);
1382  LAL_CHECK_VALID_SERIES(Phi, NULL);
1383  LAL_CHECK_CONSISTENT_TIME_SERIES(V, Phi, NULL);
1384  COMPLEX16TimeSeries *hlm;
1385  hlm = XLALCreateCOMPLEX16TimeSeries( "H_52 MODE", &V->epoch, 0.0,
1386  V->deltaT, &lalStrainUnit, V->data->length );
1387  if ( !hlm )
1389  UINT4 j;
1390  REAL8 fac = - (16./135.)*sqrt(LAL_PI/11.)*LAL_G_SI/LAL_C_SI/LAL_C_SI;
1391  REAL8 m = m1 + m2;
1392  REAL8 mu = m1*m2/m;
1393  REAL8 nu = mu/m;
1394  REAL8 nu2 = nu*nu;
1395  REAL8 phi, v, v2;
1396  COMPLEX16 ans;
1397  REAL8 re = 0.0;
1398  REAL8 im = 0.0;
1399  REAL8 re4 = 0., re6 = 0.;
1400  /* Set coefficients for requested PN (amplitude) order */
1401  switch (O) {
1402  default: /* unsupported pN order */
1403  XLALPrintError("XLAL Error - %s: PN order %d%s not supported\n", __func__, O/2, O%2?".5":"" );
1405  case -1: /* use highest available pN order */
1406  case 6:
1407  re6 = - (3911./910. - (3079./130.)*nu + (413./13.)*nu2
1408  - (231./26.)*nu*nu2);
1409 #if __GNUC__ >= 7 && !defined __INTEL_COMPILER
1410  __attribute__ ((fallthrough));
1411 #endif
1412  case 5:
1413  case 4:
1414  re4 = 1. - 5.*nu + 5.*nu2;
1415 #if __GNUC__ >= 7 && !defined __INTEL_COMPILER
1416  __attribute__ ((fallthrough));
1417 #endif
1418  case 3:
1419  case 2:
1420  case 1:
1421  case 0:
1422  break;
1423  }
1424  /* Loop over time samples, compute hlm(t) */
1425  for (j=0; j < V->data->length; j++) {
1426  v = V->data->data[j];
1427  v2 = v*v;
1428  phi = Phi->data->data[j];
1429  re = re4 + v2 * re6;
1430  ans = cpolar(1.0, -2.*phi) * crect(re, im);
1431  hlm->data->data[j] = ans * ((fac*nu*m/r)*v2*v2*v2);
1432  }
1433  return hlm;
1434 }
1435 
1436 /**
1437  * Computes h(5,1) mode of spherical harmonic decomposition of
1438  * the post-Newtonian inspiral waveform.
1439  *
1440  * Implements Equation (95) of:
1441  * Lawrence E. Kidder, "Using Full Information When Computing Modes of
1442  * Post-Newtonian Waveforms From Inspiralling Compact Binaries in Circular
1443  * Orbit", Physical Review D 77, 044016 (2008), arXiv:0710.0614v1 [gr-qc].
1444  */
1446  REAL8TimeSeries *V, /**< post-Newtonian parameter */
1447  REAL8TimeSeries *Phi, /**< orbital phase */
1448  REAL8 UNUSED v0, /**< tail gauge parameter (default=1) */
1449  REAL8 m1, /**< mass of companion 1 (kg) */
1450  REAL8 m2, /**< mass of companion 2 (kg) */
1451  REAL8 r, /**< distance of source (m) */
1452  int O /**< twice post-Newtonian order */
1453  )
1454 {
1455  LAL_CHECK_VALID_SERIES(V, NULL);
1456  LAL_CHECK_VALID_SERIES(Phi, NULL);
1457  LAL_CHECK_CONSISTENT_TIME_SERIES(V, Phi, NULL);
1458  COMPLEX16TimeSeries *hlm;
1459  hlm = XLALCreateCOMPLEX16TimeSeries( "H_51 MODE", &V->epoch, 0.0,
1460  V->deltaT, &lalStrainUnit, V->data->length );
1461  if ( !hlm )
1463  UINT4 j;
1464  REAL8 fac = - (1./180.)*sqrt(LAL_PI/77.)*LAL_G_SI/LAL_C_SI/LAL_C_SI;
1465  REAL8 m = m1 + m2;
1466  REAL8 dm = m1 - m2;
1467  REAL8 mu = m1*m2/m;
1468  REAL8 nu = mu/m;
1469  REAL8 nu2 = nu*nu;
1470  REAL8 phi, v, v2;
1471  COMPLEX16 ans;
1472  REAL8 re = 0.0;
1473  REAL8 im = 0.0;
1474  REAL8 re3 = 0., re5 = 0.;
1475  /* Set coefficients for requested PN (amplitude) order */
1476  switch (O) {
1477  default: /* unsupported pN order */
1478  XLALPrintError("XLAL Error - %s: PN order %d%s not supported\n", __func__, O/2, O%2?".5":"" );
1480  case -1: /* use highest available pN order */
1481  case 6:
1482  case 5:
1483  re5 = - (179./39. - (352./39.)*nu + (4./39.)*nu2);
1484 #if __GNUC__ >= 7 && !defined __INTEL_COMPILER
1485  __attribute__ ((fallthrough));
1486 #endif
1487  case 4:
1488  case 3:
1489  re3 = 1. - 2.*nu;
1490 #if __GNUC__ >= 7 && !defined __INTEL_COMPILER
1491  __attribute__ ((fallthrough));
1492 #endif
1493  case 2:
1494  case 1:
1495  case 0:
1496  break;
1497  }
1498  /* Loop over time samples, compute hlm(t) */
1499  for (j=0; j < V->data->length; j++) {
1500  v = V->data->data[j];
1501  v2 = v*v;
1502  phi = Phi->data->data[j];
1503  re = re3 + v2 * re5;
1504  ans = cpolar(1.0, -1.*phi) * crect(re, im);
1505  hlm->data->data[j] = ans * I * ((fac*nu*dm/r)*v*v2*v2);
1506  }
1507  return hlm;
1508 }
1509 
1510 /**
1511  * Computes h(5,0) mode of spherical harmonic decomposition of
1512  * the post-Newtonian inspiral waveform.
1513  *
1514  * THIS MODE IS ZERO TO THE ORDER CONSIDERED IN:
1515  * Lawrence E. Kidder, "Using Full Information When Computing Modes of
1516  * Post-Newtonian Waveforms From Inspiralling Compact Binaries in Circular
1517  * Orbit", Physical Review D 77, 044016 (2008), arXiv:0710.0614v1 [gr-qc].
1518  */
1520  REAL8TimeSeries *V, /**< post-Newtonian parameter */
1521  REAL8TimeSeries *Phi, /**< orbital phase */
1522  REAL8 UNUSED v0, /**< tail gauge parameter (default=1) */
1523  REAL8 UNUSED m1, /**< mass of companion 1 (kg) */
1524  REAL8 UNUSED m2, /**< mass of companion 2 (kg) */
1525  REAL8 UNUSED r, /**< distance of source (m) */
1526  int UNUSED O /**< twice post-Newtonian order */
1527  )
1528 {
1529  LAL_CHECK_VALID_SERIES(V, NULL);
1530  LAL_CHECK_VALID_SERIES(Phi, NULL);
1531  LAL_CHECK_CONSISTENT_TIME_SERIES(V, Phi, NULL);
1532  COMPLEX16TimeSeries *hlm;
1533  hlm = XLALCreateCOMPLEX16TimeSeries( "H_50 MODE", &V->epoch, 0.0,
1534  V->deltaT, &lalStrainUnit, V->data->length );
1535  if ( !hlm )
1537  UINT4 j;
1538  /* Loop over time samples, compute hlm(t) */
1539  for (j=0; j < V->data->length; j++) {
1540  hlm->data->data[j] = 0.0;
1541  }
1542  return hlm;
1543 }
1544 
1545 /**
1546  * Computes h(6,6) mode of spherical harmonic decomposition of
1547  * the post-Newtonian inspiral waveform.
1548  *
1549  * Implements Equation (96) of:
1550  * Lawrence E. Kidder, "Using Full Information When Computing Modes of
1551  * Post-Newtonian Waveforms From Inspiralling Compact Binaries in Circular
1552  * Orbit", Physical Review D 77, 044016 (2008), arXiv:0710.0614v1 [gr-qc].
1553  */
1555  REAL8TimeSeries *V, /**< post-Newtonian parameter */
1556  REAL8TimeSeries *Phi, /**< orbital phase */
1557  REAL8 UNUSED v0, /**< tail gauge parameter (default=1) */
1558  REAL8 m1, /**< mass of companion 1 (kg) */
1559  REAL8 m2, /**< mass of companion 2 (kg) */
1560  REAL8 r, /**< distance of source (m) */
1561  int O /**< twice post-Newtonian order */
1562  )
1563 {
1564  LAL_CHECK_VALID_SERIES(V, NULL);
1565  LAL_CHECK_VALID_SERIES(Phi, NULL);
1566  LAL_CHECK_CONSISTENT_TIME_SERIES(V, Phi, NULL);
1567  COMPLEX16TimeSeries *hlm;
1568  hlm = XLALCreateCOMPLEX16TimeSeries( "H_66 MODE", &V->epoch, 0.0,
1569  V->deltaT, &lalStrainUnit, V->data->length );
1570  if ( !hlm )
1572  UINT4 j;
1573  REAL8 fac = - (432./5.)*sqrt(LAL_PI/715.)*LAL_G_SI/LAL_C_SI/LAL_C_SI;
1574  REAL8 m = m1 + m2;
1575  REAL8 mu = m1*m2/m;
1576  REAL8 nu = mu/m;
1577  REAL8 nu2 = nu*nu;
1578  REAL8 phi, v, v2;
1579  COMPLEX16 ans;
1580  REAL8 re = 0.0;
1581  REAL8 im = 0.0;
1582  REAL8 re4 = 0., re6 = 0.;
1583  /* Set coefficients for requested PN (amplitude) order */
1584  switch (O) {
1585  default: /* unsupported pN order */
1586  XLALPrintError("XLAL Error - %s: PN order %d%s not supported\n", __func__, O/2, O%2?".5":"" );
1588  case -1: /* use highest available pN order */
1589  case 6:
1590  re6 = - (113./14. - (91./2.)*nu + (64.)*nu2
1591  - (39./2.)*nu*nu2);
1592 #if __GNUC__ >= 7 && !defined __INTEL_COMPILER
1593  __attribute__ ((fallthrough));
1594 #endif
1595  case 5:
1596  case 4:
1597  re4 = 1. - 5.*nu + 5.*nu2;
1598 #if __GNUC__ >= 7 && !defined __INTEL_COMPILER
1599  __attribute__ ((fallthrough));
1600 #endif
1601  case 3:
1602  case 2:
1603  case 1:
1604  case 0:
1605  break;
1606  }
1607  /* Loop over time samples, compute hlm(t) */
1608  for (j=0; j < V->data->length; j++) {
1609  v = V->data->data[j];
1610  v2 = v*v;
1611  phi = Phi->data->data[j];
1612  re = re4 + v2 * re6;
1613  ans = cpolar(1.0, -6.*phi) * crect(re, im);
1614  hlm->data->data[j] = ans * ((fac*nu*m/r)*v2*v2*v2);
1615  }
1616  return hlm;
1617 }
1618 
1619 /**
1620  * Computes h(6,5) mode of spherical harmonic decomposition of
1621  * the post-Newtonian inspiral waveform.
1622  *
1623  * Implements Equation (97) of:
1624  * Lawrence E. Kidder, "Using Full Information When Computing Modes of
1625  * Post-Newtonian Waveforms From Inspiralling Compact Binaries in Circular
1626  * Orbit", Physical Review D 77, 044016 (2008), arXiv:0710.0614v1 [gr-qc].
1627  */
1629  REAL8TimeSeries *V, /**< post-Newtonian parameter */
1630  REAL8TimeSeries *Phi, /**< orbital phase */
1631  REAL8 UNUSED v0, /**< tail gauge parameter (default=1) */
1632  REAL8 m1, /**< mass of companion 1 (kg) */
1633  REAL8 m2, /**< mass of companion 2 (kg) */
1634  REAL8 r, /**< distance of source (m) */
1635  int O /**< twice post-Newtonian order */
1636  )
1637 {
1638  LAL_CHECK_VALID_SERIES(V, NULL);
1639  LAL_CHECK_VALID_SERIES(Phi, NULL);
1640  LAL_CHECK_CONSISTENT_TIME_SERIES(V, Phi, NULL);
1641  COMPLEX16TimeSeries *hlm;
1642  hlm = XLALCreateCOMPLEX16TimeSeries( "H_65 MODE", &V->epoch, 0.0,
1643  V->deltaT, &lalStrainUnit, V->data->length );
1644  if ( !hlm )
1646  UINT4 j;
1647  REAL8 fac = -(625./63.)*sqrt(5.*LAL_PI/429.)*LAL_G_SI/LAL_C_SI/LAL_C_SI;
1648  REAL8 m = m1 + m2;
1649  REAL8 dm = m1 - m2;
1650  REAL8 mu = m1*m2/m;
1651  REAL8 nu = mu/m;
1652  REAL8 nu2 = nu*nu;
1653  REAL8 phi, v, v2;
1654  COMPLEX16 ans;
1655  REAL8 re = 0.0;
1656  REAL8 im = 0.0;
1657  REAL8 re5 = 0.;
1658  /* Set coefficients for requested PN (amplitude) order */
1659  switch (O) {
1660  default: /* unsupported pN order */
1661  XLALPrintError("XLAL Error - %s: PN order %d%s not supported\n", __func__, O/2, O%2?".5":"" );
1663  case -1: /* use highest available pN order */
1664  case 6:
1665  case 5:
1666  re5 = 1. - 4.*nu + 3.*nu2;
1667  case 4:
1668  case 3:
1669  case 2:
1670  case 1:
1671  case 0:
1672  break;
1673  }
1674  /* Loop over time samples, compute hlm(t) */
1675  for (j=0; j < V->data->length; j++) {
1676  v = V->data->data[j];
1677  v2 = v*v;
1678  phi = Phi->data->data[j];
1679  re = re5;
1680  ans = cpolar(1.0, -5.*phi) * crect(re, im);
1681  hlm->data->data[j] = ans * I * ((fac*nu*dm/r)*v*v2*v2*v2);
1682  }
1683  return hlm;
1684 }
1685 
1686 /**
1687  * Computes h(6,4) mode of spherical harmonic decomposition of
1688  * the post-Newtonian inspiral waveform.
1689  *
1690  * Implements Equation (98) of:
1691  * Lawrence E. Kidder, "Using Full Information When Computing Modes of
1692  * Post-Newtonian Waveforms From Inspiralling Compact Binaries in Circular
1693  * Orbit", Physical Review D 77, 044016 (2008), arXiv:0710.0614v1 [gr-qc].
1694  */
1696  REAL8TimeSeries *V, /**< post-Newtonian parameter */
1697  REAL8TimeSeries *Phi, /**< orbital phase */
1698  REAL8 UNUSED v0, /**< tail gauge parameter (default=1) */
1699  REAL8 m1, /**< mass of companion 1 (kg) */
1700  REAL8 m2, /**< mass of companion 2 (kg) */
1701  REAL8 r, /**< distance of source (m) */
1702  int O /**< twice post-Newtonian order */
1703  )
1704 {
1705  LAL_CHECK_VALID_SERIES(V, NULL);
1706  LAL_CHECK_VALID_SERIES(Phi, NULL);
1707  LAL_CHECK_CONSISTENT_TIME_SERIES(V, Phi, NULL);
1708  COMPLEX16TimeSeries *hlm;
1709  hlm = XLALCreateCOMPLEX16TimeSeries( "H_64 MODE", &V->epoch, 0.0,
1710  V->deltaT, &lalStrainUnit, V->data->length );
1711  if ( !hlm )
1713  UINT4 j;
1714  REAL8 fac =(1024./495.)*sqrt(2.*LAL_PI/195.)*LAL_G_SI/LAL_C_SI/LAL_C_SI;
1715  REAL8 m = m1 + m2;
1716  REAL8 mu = m1*m2/m;
1717  REAL8 nu = mu/m;
1718  REAL8 nu2 = nu*nu;
1719  REAL8 phi, v, v2;
1720  COMPLEX16 ans;
1721  REAL8 re = 0.0;
1722  REAL8 im = 0.0;
1723  REAL8 re4 = 0., re6 = 0.;
1724  /* Set coefficients for requested PN (amplitude) order */
1725  switch (O) {
1726  default: /* unsupported pN order */
1727  XLALPrintError("XLAL Error - %s: PN order %d%s not supported\n", __func__, O/2, O%2?".5":"" );
1729  case -1: /* use highest available pN order */
1730  case 6:
1731  re6 = - (113./14. - (91./2.)*nu + (64.)*nu2
1732  - (39./2.)*nu*nu2);
1733 #if __GNUC__ >= 7 && !defined __INTEL_COMPILER
1734  __attribute__ ((fallthrough));
1735 #endif
1736  case 5:
1737  case 4:
1738  re4 = 1. - 5.*nu + 5.*nu2;
1739 #if __GNUC__ >= 7 && !defined __INTEL_COMPILER
1740  __attribute__ ((fallthrough));
1741 #endif
1742  case 3:
1743  case 2:
1744  case 1:
1745  case 0:
1746  break;
1747  }
1748  /* Loop over time samples, compute hlm(t) */
1749  for (j=0; j < V->data->length; j++) {
1750  v = V->data->data[j];
1751  v2 = v*v;
1752  phi = Phi->data->data[j];
1753  re = re4 + v2 * re6;
1754  ans = cpolar(1.0, -4.*phi) * crect(re, im);
1755  hlm->data->data[j] = ans * ((fac*nu*m/r)*v2*v2*v2);
1756  }
1757  return hlm;
1758 }
1759 
1760 /**
1761  * Computes h(6,3) mode of spherical harmonic decomposition of
1762  * the post-Newtonian inspiral waveform.
1763  *
1764  * Implements Equation (99) of:
1765  * Lawrence E. Kidder, "Using Full Information When Computing Modes of
1766  * Post-Newtonian Waveforms From Inspiralling Compact Binaries in Circular
1767  * Orbit", Physical Review D 77, 044016 (2008), arXiv:0710.0614v1 [gr-qc].
1768  */
1770  REAL8TimeSeries *V, /**< post-Newtonian parameter */
1771  REAL8TimeSeries *Phi, /**< orbital phase */
1772  REAL8 UNUSED v0, /**< tail gauge parameter (default=1) */
1773  REAL8 m1, /**< mass of companion 1 (kg) */
1774  REAL8 m2, /**< mass of companion 2 (kg) */
1775  REAL8 r, /**< distance of source (m) */
1776  int O /**< twice post-Newtonian order */
1777  )
1778 {
1779  LAL_CHECK_VALID_SERIES(V, NULL);
1780  LAL_CHECK_VALID_SERIES(Phi, NULL);
1781  LAL_CHECK_CONSISTENT_TIME_SERIES(V, Phi, NULL);
1782  COMPLEX16TimeSeries *hlm;
1783  hlm = XLALCreateCOMPLEX16TimeSeries( "H_63 MODE", &V->epoch, 0.0,
1784  V->deltaT, &lalStrainUnit, V->data->length );
1785  if ( !hlm )
1787  UINT4 j;
1788  REAL8 fac = (81./385.)*sqrt(LAL_PI/13.)*LAL_G_SI/LAL_C_SI/LAL_C_SI;
1789  REAL8 m = m1 + m2;
1790  REAL8 dm = m1 - m2;
1791  REAL8 mu = m1*m2/m;
1792  REAL8 nu = mu/m;
1793  REAL8 nu2 = nu*nu;
1794  REAL8 phi, v, v2;
1795  COMPLEX16 ans;
1796  REAL8 re = 0.0;
1797  REAL8 im = 0.0;
1798  REAL8 re5 = 0.;
1799  /* Set coefficients for requested PN (amplitude) order */
1800  switch (O) {
1801  default: /* unsupported pN order */
1802  XLALPrintError("XLAL Error - %s: PN order %d%s not supported\n", __func__, O/2, O%2?".5":"" );
1804  case -1: /* use highest available pN order */
1805  case 6:
1806  case 5:
1807  re5 = 1. - 4.*nu + 3.*nu2;
1808  case 4:
1809  case 3:
1810  case 2:
1811  case 1:
1812  case 0:
1813  break;
1814  }
1815  /* Loop over time samples, compute hlm(t) */
1816  for (j=0; j < V->data->length; j++) {
1817  v = V->data->data[j];
1818  v2 = v*v;
1819  phi = Phi->data->data[j];
1820  re = re5;
1821  ans = cpolar(1.0, -3.*phi) * crect(re, im);
1822  hlm->data->data[j] = ans * I * ((fac*nu*dm/r)*v*v2*v2*v2);
1823  }
1824  return hlm;
1825 }
1826 
1827 /**
1828  * Computes h(6,2) mode of spherical harmonic decomposition of
1829  * the post-Newtonian inspiral waveform.
1830  *
1831  * Implements Equation (100) of:
1832  * Lawrence E. Kidder, "Using Full Information When Computing Modes of
1833  * Post-Newtonian Waveforms From Inspiralling Compact Binaries in Circular
1834  * Orbit", Physical Review D 77, 044016 (2008), arXiv:0710.0614v1 [gr-qc].
1835  */
1837  REAL8TimeSeries *V, /**< post-Newtonian parameter */
1838  REAL8TimeSeries *Phi, /**< orbital phase */
1839  REAL8 UNUSED v0, /**< tail gauge parameter (default=1) */
1840  REAL8 m1, /**< mass of companion 1 (kg) */
1841  REAL8 m2, /**< mass of companion 2 (kg) */
1842  REAL8 r, /**< distance of source (m) */
1843  int O /**< twice post-Newtonian order */
1844  )
1845 {
1846  LAL_CHECK_VALID_SERIES(V, NULL);
1847  LAL_CHECK_VALID_SERIES(Phi, NULL);
1848  LAL_CHECK_CONSISTENT_TIME_SERIES(V, Phi, NULL);
1849  COMPLEX16TimeSeries *hlm;
1850  hlm = XLALCreateCOMPLEX16TimeSeries( "H_62 MODE", &V->epoch, 0.0,
1851  V->deltaT, &lalStrainUnit, V->data->length );
1852  if ( !hlm )
1854  UINT4 j;
1855  REAL8 fac = - (16./1485.)*sqrt(LAL_PI/13.)*LAL_G_SI/LAL_C_SI/LAL_C_SI;
1856  REAL8 m = m1 + m2;
1857  REAL8 mu = m1*m2/m;
1858  REAL8 nu = mu/m;
1859  REAL8 nu2 = nu*nu;
1860  REAL8 phi, v, v2;
1861  COMPLEX16 ans;
1862  REAL8 re = 0.0;
1863  REAL8 im = 0.0;
1864  REAL8 re4 = 0., re6 = 0.;
1865  /* Set coefficients for requested PN (amplitude) order */
1866  switch (O) {
1867  default: /* unsupported pN order */
1868  XLALPrintError("XLAL Error - %s: PN order %d%s not supported\n", __func__, O/2, O%2?".5":"" );
1870  case -1: /* use highest available pN order */
1871  case 6:
1872  re6 = - (81./14. - (59./2.)*nu + 32.*nu2
1873  - (7./2.)*nu*nu2);
1874 #if __GNUC__ >= 7 && !defined __INTEL_COMPILER
1875  __attribute__ ((fallthrough));
1876 #endif
1877  case 5:
1878  case 4:
1879  re4 = 1. - 5.*nu + 5.*nu2;
1880 #if __GNUC__ >= 7 && !defined __INTEL_COMPILER
1881  __attribute__ ((fallthrough));
1882 #endif
1883  case 3:
1884  case 2:
1885  case 1:
1886  case 0:
1887  break;
1888  }
1889  /* Loop over time samples, compute hlm(t) */
1890  for (j=0; j < V->data->length; j++) {
1891  v = V->data->data[j];
1892  v2 = v*v;
1893  phi = Phi->data->data[j];
1894  re = re4 + v2 * re6;
1895  ans = cpolar(1.0, -2.*phi) * crect(re, im);
1896  hlm->data->data[j] = ans * ((fac*nu*m/r)*v2*v2*v2);
1897  }
1898  return hlm;
1899 }
1900 
1901 /**
1902  * Computes h(6,1) mode of spherical harmonic decomposition of
1903  * the post-Newtonian inspiral waveform.
1904  *
1905  * Implements Equation (101) of:
1906  * Lawrence E. Kidder, "Using Full Information When Computing Modes of
1907  * Post-Newtonian Waveforms From Inspiralling Compact Binaries in Circular
1908  * Orbit", Physical Review D 77, 044016 (2008), arXiv:0710.0614v1 [gr-qc].
1909  */
1911  REAL8TimeSeries *V, /**< post-Newtonian parameter */
1912  REAL8TimeSeries *Phi, /**< orbital phase */
1913  REAL8 UNUSED v0, /**< tail gauge parameter (default=1) */
1914  REAL8 m1, /**< mass of companion 1 (kg) */
1915  REAL8 m2, /**< mass of companion 2 (kg) */
1916  REAL8 r, /**< distance of source (m) */
1917  int O /**< twice post-Newtonian order */
1918  )
1919 {
1920  LAL_CHECK_VALID_SERIES(V, NULL);
1921  LAL_CHECK_VALID_SERIES(Phi, NULL);
1922  LAL_CHECK_CONSISTENT_TIME_SERIES(V, Phi, NULL);
1923  COMPLEX16TimeSeries *hlm;
1924  hlm = XLALCreateCOMPLEX16TimeSeries( "H_61 MODE", &V->epoch, 0.0,
1925  V->deltaT, &lalStrainUnit, V->data->length );
1926  if ( !hlm )
1928  UINT4 j;
1929  REAL8 fac = - (1./2079.)*sqrt(2.*LAL_PI/65.)*LAL_G_SI/LAL_C_SI/LAL_C_SI;
1930  REAL8 m = m1 + m2;
1931  REAL8 dm = m1 - m2;
1932  REAL8 mu = m1*m2/m;
1933  REAL8 nu = mu/m;
1934  REAL8 nu2 = nu*nu;
1935  REAL8 phi, v, v2;
1936  COMPLEX16 ans;
1937  REAL8 re = 0.0;
1938  REAL8 im = 0.0;
1939  REAL8 re5 = 0.;
1940  /* Set coefficients for requested PN (amplitude) order */
1941  switch (O) {
1942  default: /* unsupported pN order */
1943  XLALPrintError("XLAL Error - %s: PN order %d%s not supported\n", __func__, O/2, O%2?".5":"" );
1945  case -1: /* use highest available pN order */
1946  case 6:
1947  case 5:
1948  re5 = 1. - 4.*nu + 3.*nu2;
1949  case 4:
1950  case 3:
1951  case 2:
1952  case 1:
1953  case 0:
1954  break;
1955  }
1956  /* Loop over time samples, compute hlm(t) */
1957  for (j=0; j < V->data->length; j++) {
1958  v = V->data->data[j];
1959  v2 = v*v;
1960  phi = Phi->data->data[j];
1961  re = re5;
1962  ans = cpolar(1.0, -phi) * crect(re, im);
1963  hlm->data->data[j] = ans * I * ((fac*nu*dm/r)*v*v2*v2*v2);
1964  }
1965  return hlm;
1966 }
1967 
1968 /**
1969  * Computes h(6,0) mode of spherical harmonic decomposition of
1970  * the post-Newtonian inspiral waveform.
1971  *
1972  * THIS MODE IS ZERO TO THE ORDER CONSIDERED IN:
1973  * Lawrence E. Kidder, "Using Full Information When Computing Modes of
1974  * Post-Newtonian Waveforms From Inspiralling Compact Binaries in Circular
1975  * Orbit", Physical Review D 77, 044016 (2008), arXiv:0710.0614v1 [gr-qc].
1976  */
1978  REAL8TimeSeries *V, /**< post-Newtonian parameter */
1979  REAL8TimeSeries *Phi, /**< orbital phase */
1980  REAL8 UNUSED v0, /**< tail gauge parameter (default=1) */
1981  REAL8 UNUSED m1, /**< mass of companion 1 (kg) */
1982  REAL8 UNUSED m2, /**< mass of companion 2 (kg) */
1983  REAL8 UNUSED r, /**< distance of source (m) */
1984  int UNUSED O /**< twice post-Newtonian order */
1985  )
1986 {
1987  LAL_CHECK_VALID_SERIES(V, NULL);
1988  LAL_CHECK_VALID_SERIES(Phi, NULL);
1989  LAL_CHECK_CONSISTENT_TIME_SERIES(V, Phi, NULL);
1990  COMPLEX16TimeSeries *hlm;
1991  hlm = XLALCreateCOMPLEX16TimeSeries( "H_60 MODE", &V->epoch, 0.0,
1992  V->deltaT, &lalStrainUnit, V->data->length );
1993  if ( !hlm )
1995  UINT4 j;
1996  /* Loop over time samples, compute hlm(t) */
1997  for (j=0; j < V->data->length; j++) {
1998  hlm->data->data[j] = 1.0;
1999  }
2000  return hlm;
2001 }
2002 
2003 /**
2004  * Utility type and function to compute trigonometric functions from the cosine of an angle
2005  */
2006 
2007 typedef struct tagLALSimInspiralInclAngle {
2008  REAL8 ci;
2009  REAL8 si;
2027 
2028 static
2030  REAL8 ciota /** INPUT */
2031  )
2032 {
2034 
2035  angle->ci=ciota;
2036  angle->ciSq=ciota*ciota;
2037  angle->siSq=1.-ciota*ciota;
2038  angle->si=sqrt(angle->siSq);
2039  angle->c2i=angle->ciSq-angle->siSq;
2040  angle->s2i=2.*ciota*angle->si;
2041  angle->c3i=angle->c2i*ciota-angle->s2i*angle->si;
2042  angle->s3i=ciota*angle->s2i+angle->si*angle->c2i;
2043  angle->ciBy2Sq=(1.+ciota)/2.;
2044  angle->siBy2Sq=(1.-ciota)/2.;
2045  angle->ciBy2=sqrt(angle->ciBy2Sq);
2046  angle->siBy2=sqrt(angle->siBy2Sq);
2047  angle->ciBy2Qu=angle->ciBy2Sq*angle->ciBy2Sq;
2048  angle->siBy2Qu=angle->siBy2Sq*angle->siBy2Sq;
2049  angle->ciBy2Sx=angle->ciBy2Qu*angle->ciBy2Sq;
2050  angle->siBy2Sx=angle->siBy2Qu*angle->siBy2Sq;
2051  angle->ciBy2Et=angle->ciBy2Qu*angle->ciBy2Qu;
2052  angle->siBy2Et=angle->siBy2Qu*angle->siBy2Qu;
2053  return angle;
2054 
2055 } /* End of XLALSimInspiralComputeInclAngle*/
2056 
2057 /**
2058  * Computes the 5 l=2 modes of spherical harmonic decomposition of
2059  * the post-Newtonian inspiral waveform for spinning-precessing waveforms.
2060  *
2061  * For reference see eq. B1,2 of
2062  * Arun et al., "Higher-order spin effects in the amplitude and phase of gravitational waveforms
2063  * emitted by inspiraling compact binaries: Ready-to-use gravitational waveforms",
2064  * Physical Review D 79, 104023 (2009), Erratum PRD 84, 049901 (2011), arXiv:0810.5336v3 [gr-qc].
2065  * All variable are inputs.
2066  *
2067  * !!BEWARE!! Spin components are given wrt LNh. LNh components define angles
2068  * incl and alpha (polarization angle) entering the mode analytic form.
2069  *
2070  */
2071 
2073  REAL8TimeSeries *V, /**< post-Newtonian parameter*/
2074  REAL8TimeSeries *Phi, /**< orbital phase */
2075  REAL8TimeSeries *LNhx, /**< angular momentum unit vector x component */
2076  REAL8TimeSeries *LNhy, /**< angular momentum unit vector y component */
2077  REAL8TimeSeries *LNhz, /**< angular momentum unit vector z components */
2078  REAL8TimeSeries *e1x, /**< x-axis tetrad x component*/
2079  REAL8TimeSeries *e1y, /**< x-axis tetrad y component*/
2080  REAL8TimeSeries *e1z, /**< x-axis tetrad z component*/
2081  REAL8TimeSeries *S1x, /**< spin1-x component */
2082  REAL8TimeSeries *S1y, /**< spin1-y component */
2083  REAL8TimeSeries *S1z, /**< spin1-z component */
2084  REAL8TimeSeries *S2x, /**< spin2-x component */
2085  REAL8TimeSeries *S2y, /**< spin2-y component */
2086  REAL8TimeSeries *S2z, /**< spin2-z component */
2087  REAL8 m1, /**< mass of companion 1 (kg) */
2088  REAL8 m2, /**< mass of companion 2 (kg) */
2089  REAL8 distance, /**< distance of source (m) */
2090  int ampO /**< twice post-Newtonian amp-order */
2091  )
2092 {
2093 
2109 
2110  UINT4 idx;
2111  REAL8 eta=m1/(m1+m2)*m2/(m1+m2);
2112  REAL8 dm=(m1-m2)/(m1+m2);
2113 
2114  REAL8 amp1 =0.;
2115  REAL8 amp2 =0.;
2116  REAL8 amp2S =0.;
2117  REAL8 amp3 =0.;
2118  REAL8 amp3pi =0.;
2119  REAL8 amp3S =0.;
2120 
2121  switch (ampO) {
2122  case -1: /* use highest available pN order */
2123 #if __GNUC__ >= 7 && !defined __INTEL_COMPILER
2124  __attribute__ ((fallthrough));
2125 #endif
2126  case 3:
2127  amp3S = 1.;
2128  amp3 = (-1.7+2.*eta)/2.8;
2129  amp3pi = 2.*LAL_PI;
2130 #if __GNUC__ >= 7 && !defined __INTEL_COMPILER
2131  __attribute__ ((fallthrough));
2132 #endif
2133  case 2:
2134  amp2 = -10.7/4.2 +5.5/4.2*eta;
2135  amp2S = 1.;
2136 #if __GNUC__ >= 7 && !defined __INTEL_COMPILER
2137  __attribute__ ((fallthrough));
2138 #endif
2139  case 1:
2140  amp1 = 1.;
2141  case 0:
2142  break;
2143  default: /* unsupported pN order */
2144  XLALPrintError("XLAL Error - %s: PN order %d%s not supported\n", __func__, ampO/2, ampO%2?".5":"" );
2146  }
2147 
2148  REAL8TimeSeries *S1xtmp=XLALCreateREAL8TimeSeries("S1x",&V->epoch,0.,V->deltaT,&lalDimensionlessUnit,V->data->length);
2149  REAL8TimeSeries *S1ytmp=XLALCreateREAL8TimeSeries("S1y",&V->epoch,0.,V->deltaT,&lalDimensionlessUnit,V->data->length);
2150  REAL8TimeSeries *S1ztmp=XLALCreateREAL8TimeSeries("S1z",&V->epoch,0.,V->deltaT,&lalDimensionlessUnit,V->data->length);
2151  REAL8TimeSeries *S2xtmp=XLALCreateREAL8TimeSeries("S2x",&V->epoch,0.,V->deltaT,&lalDimensionlessUnit,V->data->length);
2152  REAL8TimeSeries *S2ytmp=XLALCreateREAL8TimeSeries("S2y",&V->epoch,0.,V->deltaT,&lalDimensionlessUnit,V->data->length);
2153  REAL8TimeSeries *S2ztmp=XLALCreateREAL8TimeSeries("S2z",&V->epoch,0.,V->deltaT,&lalDimensionlessUnit,V->data->length);
2154  for (idx=0;idx<V->data->length;idx++) {
2155  S1xtmp->data->data[idx]=0.;
2156  S1ytmp->data->data[idx]=0.;
2157  S1ztmp->data->data[idx]=0.;
2158  S2xtmp->data->data[idx]=0.;
2159  S2ytmp->data->data[idx]=0.;
2160  S2ztmp->data->data[idx]=0.;
2161  }
2162 
2163  REAL8 checkL,checke;
2164  for (idx=0;idx<LNhx->data->length;idx++){
2165  checkL=LNhx->data->data[idx]*LNhx->data->data[idx]+LNhy->data->data[idx]*LNhy->data->data[idx]+LNhz->data->data[idx]*LNhz->data->data[idx];
2166  if ((checkL<1.-EPS)||(checkL>1.+EPS)) {
2167  XLALPrintError("XLAL Error - %s: LNhat unit vector has not unit norm %12.4e at idx %d\n", __func__,checkL,idx);
2169  }
2170  checke=e1x->data->data[idx]*e1x->data->data[idx]+e1y->data->data[idx]*e1y->data->data[idx]+e1z->data->data[idx]*e1z->data->data[idx];
2171  if ((checke<1.-EPS)||(checke>1.+EPS)) {
2172  XLALPrintError("XLAL Error - %s: e1 unit vector has not unit norm %12.4e at idx %d\n", __func__,checke,idx);
2174  }
2175  }
2176 
2177  if ( S1x ) {
2179  memcpy(S1xtmp->data->data, S1x->data->data, S1xtmp->data->length*sizeof(REAL8) );
2180  }
2181 
2182  if ( S1y ) {
2184  memcpy(S1ytmp->data->data, S1y->data->data, S1ytmp->data->length*sizeof(REAL8) );
2185  }
2186 
2187  if ( S1z ) {
2189  memcpy(S1ztmp->data->data, S1z->data->data, S1ztmp->data->length*sizeof(REAL8) );
2190  }
2191 
2192  if ( S2x ) {
2194  memcpy(S2xtmp->data->data, S2x->data->data, S2xtmp->data->length*sizeof(REAL8) );
2195  }
2196 
2197  if ( S2y ) {
2199  memcpy(S2ytmp->data->data, S2y->data->data, S2ytmp->data->length*sizeof(REAL8) );
2200  }
2201 
2202  if ( S2z ) {
2204  memcpy(S2ztmp->data->data, S2z->data->data, S2ztmp->data->length*sizeof(REAL8) );
2205  }
2206 
2207  REAL8 Psi,v,v2,v3;
2208  REAL8 c2Pp3a,c2Pm3a,c2Pp2a,c2Pm2a,cPp2a,cPm2a,c2Ppa,c2Pma,cPpa,cPma,c2P,cP;
2209  REAL8 s2Pp3a,s2Pm3a,s2Pp2a,s2Pm2a,sPp2a,sPm2a,s2Ppa,s2Pma,sPpa,sPma,s2P,sP;
2210  REAL8 ca,sa,c2a,s2a,c3a,s3a;
2211  REAL8 Sax,Ssx,Say,Ssy;
2212  REAL8 Saz,Ssz;
2213  //REAL8 e2x,nx,lx;
2214  REAL8 e2y,e2z,ny,nz,ly,lz;
2215  LALSimInspiralInclAngle *an=NULL;
2216  COMPLEX16TimeSeries *h22 =XLALCreateCOMPLEX16TimeSeries( "h22", &V->epoch, 0., V->deltaT, &lalStrainUnit, V->data->length);
2217  COMPLEX16TimeSeries *h2m2=XLALCreateCOMPLEX16TimeSeries( "h2-2", &V->epoch, 0., V->deltaT, &lalStrainUnit, V->data->length);
2218  COMPLEX16TimeSeries *h21 =XLALCreateCOMPLEX16TimeSeries( "h21", &V->epoch, 0., V->deltaT, &lalStrainUnit, V->data->length);
2219  COMPLEX16TimeSeries *h2m1=XLALCreateCOMPLEX16TimeSeries( "h2-1", &V->epoch, 0., V->deltaT, &lalStrainUnit, V->data->length);
2220  COMPLEX16TimeSeries *h20 =XLALCreateCOMPLEX16TimeSeries( "h20", &V->epoch, 0., V->deltaT, &lalStrainUnit, V->data->length);
2221  REAL8 amp22=-8.*eta*(m1+m2)*LAL_G_SI/LAL_C_SI/LAL_C_SI / distance * sqrt(LAL_PI / 5.);
2222  REAL8 re023p,re13,re2S,re3S,im023p,im13,im2S,im3S;
2223 
2224  REAL8 const sqrt1p5=sqrt(1.5);
2225 
2226  for (idx=0; idx<V->data->length; idx++) {
2227  v=V->data->data[idx];
2228  v2=v*v;
2229  v3=v2*v;
2230  Psi=Phi->data->data[idx];
2231  an=XLALSimInspiralComputeInclAngle(LNhz->data->data[idx]);
2232  //e2x=LNhy->data->data[idx]*e1z->data->data[idx]-LNhz->data->data[idx]*e1y->data->data[idx];
2233  e2y=LNhz->data->data[idx]*e1x->data->data[idx]-LNhx->data->data[idx]*e1z->data->data[idx];
2234  e2z=LNhx->data->data[idx]*e1y->data->data[idx]-LNhy->data->data[idx]*e1x->data->data[idx];
2235  //nx=e1x->data->data[idx]*cos(Psi)+e2x*sin(Psi);
2236  ny=e1y->data->data[idx]*cos(Psi)+e2y*sin(Psi);
2237  nz=e1z->data->data[idx]*cos(Psi)+e2z*sin(Psi);
2238  //lx=e2x*cos(Psi)-e1x->data->data[idx]*sin(Psi);
2239  ly=e2y*cos(Psi)-e1y->data->data[idx]*sin(Psi);
2240  lz=e2z*cos(Psi)-e1z->data->data[idx]*sin(Psi);
2241  if (an->si>EPS) {
2242  ca=LNhx->data->data[idx]/an->si;
2243  sa=LNhy->data->data[idx]/an->si;
2244  sP=nz/an->si;
2245  cP=lz/an->si;
2246  }
2247  else {
2248  // If L//N then alpha is ill defined, only alpha + phi is defined
2249  ca=1.;
2250  sa=0.;
2251  cP=ca*ny-sa*ly;
2252  sP=-sa*ny-ca*ly;
2253  }
2254  c2a=2.*ca*ca-1.;
2255  s2a=2.*ca*sa;
2256  c3a=c2a*ca-s2a*sa;
2257  s3a=c2a*sa+s2a*ca;
2258  c2P=cP*cP-sP*sP;
2259  s2P=2.*cP*sP;
2260  c2Pp2a=c2P*c2a-s2P*s2a;
2261  c2Pm2a=c2P*c2a+s2P*s2a;
2262  s2Pp2a=s2P*c2a+c2P*s2a;
2263  s2Pm2a=s2P*c2a-c2P*s2a;
2264  c2Pp3a=c2P*c3a-s2P*s3a;
2265  c2Pm3a=c2P*c3a+s2P*s3a;
2266  s2Pp3a=c2P*s3a+s2P*c3a;
2267  s2Pm3a=-c2P*s3a+s2P*c3a;
2268  c2Ppa=c2P*ca-s2P*sa;
2269  c2Pma=c2P*ca+s2P*sa;
2270  s2Ppa=s2P*ca+c2P*sa;
2271  s2Pma=s2P*ca-c2P*sa;
2272  cPpa=cP*ca-sP*sa;
2273  cPma=cP*ca+sP*sa;
2274  sPpa=sP*ca+cP*sa;
2275  sPma=sP*ca-cP*sa;
2276  cPp2a=cP*c2a-sP*s2a;
2277  cPm2a=cP*c2a+sP*s2a;
2278  sPp2a=sP*c2a+cP*s2a;
2279  sPm2a=sP*c2a-cP*s2a;
2280 
2281  Sax=( S1xtmp->data->data[idx]-S2xtmp->data->data[idx])/2.;
2282  Ssx=( S1xtmp->data->data[idx]+S2xtmp->data->data[idx])/2.;
2283  Say=( S1ytmp->data->data[idx]-S2ytmp->data->data[idx])/2.;
2284  Ssy=( S1ytmp->data->data[idx]+S2ytmp->data->data[idx])/2.;
2285  Saz=( S1ztmp->data->data[idx]-S2ztmp->data->data[idx])/2.;
2286  Ssz=( S1ztmp->data->data[idx]+S2ztmp->data->data[idx])/2.;
2287 
2288  //l=2, m=2,-2
2289  re023p = (1. + v2*amp2 + v3*amp3pi ) * ( c2Pp2a*an->ciBy2Qu + c2Pm2a*an->siBy2Qu );
2290  re13 = v * dm/3.*amp1*an->si*(1.+v2*amp3)*( cPp2a*an->ciBy2Sq + cPm2a*an->siBy2Sq);
2291  re2S = v2*amp2S * 0.5 *( (-cPpa*an->ciBy2Sq - cPma*an->siBy2Sq )*(Sax+dm*Ssx) + (-sPma*an->siBy2Sq + sPpa*an->ciBy2Sq)*(Say+dm*Ssy) );
2292  re3S = ( ca*( 1.-an->siSq*c2a) - 5./3.*( an->ciBy2Qu*c2Pp3a+an->siBy2Qu*c2Pm3a) + 1./6.*( (1.-5.*an->ci)*an->ciBy2Sq*c2Ppa+(1.+5.*an->ci)*an->siBy2Sq*c2Pma) )*(Ssx+dm*Sax);
2293  re3S+= eta*(-0.5*ca*(1.-an->siSq*c2a) -1./6.*( an->ciBy2Qu*c2Pp3a+an->siBy2Qu*c2Pm3a) + 1./12.*(( 9.-an->ci)*an->ciBy2Sq*c2Ppa+(9.+an->ci)*an->siBy2Sq*c2Pma) )*Ssx;
2294  re3S+= (-sa*(1.+an->siSq*c2a) + 5./3.*(-an->ciBy2Qu*s2Pp3a+an->siBy2Qu*s2Pm3a) + 1./6.*( (-1.+5.*an->ci)*an->ciBy2Sq*s2Ppa+(1.+5.*an->ci)*an->siBy2Sq*s2Pma) )*(Ssy+dm*Say);
2295  re3S+= eta*( 0.5*sa*(1.+c2a*an->siSq) + 1./6.*(-an->ciBy2Qu*s2Pp3a+an->siBy2Qu*s2Pm3a) + 1./12.*((-9.+an->ci)*an->ciBy2Sq*s2Ppa+(9.+an->ci)*an->siBy2Sq*s2Pma) )*Ssy;
2296  re3S*= an->si;
2297  re3S+= (-c2a*an->ci*an->siSq + 2.*((1.-5./3.*an->ci)*an->ciBy2Qu*c2Pp2a-(1.+5./3.*an->ci)*an->siBy2Qu*c2Pm2a))*(Ssz+dm*Saz);
2298  re3S+= eta*(0.5*c2a*an->siSq*an->ci + 1./3.*((5.-an->ci)*an->ciBy2Qu*c2Pp2a - (5.+an->ci)*an->siBy2Qu*c2Pm2a) )*Ssz;
2299  re3S*=amp3S*v3;
2300 
2301  im023p = (1. + v2*amp2 + v3*amp3pi ) * (-s2Pp2a*an->ciBy2Qu + s2Pm2a*an->siBy2Qu );
2302  im13 = v * dm/3.*amp1*an->si*(1.+v2*amp3)*(-sPp2a*an->ciBy2Sq + sPm2a*an->siBy2Sq);
2303  im2S = v2*amp2S * 0.5 *( ( sPpa*an->ciBy2Sq - sPma*an->siBy2Sq)*(Sax+dm*Ssx) + ( cPpa*an->ciBy2Sq + cPma*an->siBy2Sq )*(Say+dm*Ssy) );
2304  im3S = ( -sa*(1.-2.*an->siSq*ca*ca) + 5./3.*( an->ciBy2Qu*s2Pp3a-an->siBy2Qu*s2Pm3a) + 1./6.*(-(1.-5.*an->ci)*an->ciBy2Sq*s2Ppa+(1.+5.*an->ci)*an->siBy2Sq*s2Pma) )*(Ssx+dm*Sax);
2305  im3S+= eta*(0.5*sa*(1.-2.*an->siSq*ca*ca)+1./6.*( an->ciBy2Qu*s2Pp3a-an->siBy2Qu*s2Pm3a) + 1./12.*((-9.+an->ci)*an->ciBy2Sq*s2Ppa+(9.+an->ci)*an->siBy2Sq*s2Pma) )*Ssx;
2306  im3S+= ( -ca*(1.-2.*an->siSq*sa*sa) - 5./3.*(an->ciBy2Qu*c2Pp3a+an->siBy2Qu*c2Pm3a) - 1./6.*((1.-5.*an->ci)*an->ciBy2Sq*c2Ppa+(1.+5.*an->ci)*an->siBy2Sq*c2Pma) )*(Ssy+dm*Say);
2307  im3S+= eta*( 0.5*ca*(1.-2.*an->siSq*sa*sa) - 1./6.*(an->ciBy2Qu*c2Pp3a + an->siBy2Qu*c2Pm3a) + 1./12.*((-9.+an->ci)*an->ciBy2Sq*c2Ppa-(9.+an->ci)*an->siBy2Sq*c2Pma) )*Ssy;
2308  im3S*= an->si;
2309  im3S+= ( s2a*an->ci*an->siSq - 2.*((1.-5./3.*an->ci)*an->ciBy2Qu*s2Pp2a + (1.+5./3.*an->ci)*an->siBy2Qu*s2Pm2a) ) * (Ssz+dm*Saz);
2310  im3S+= eta*(-0.5*s2a*an->ci*an->siSq - 1./3.*((5.-an->ci)*an->ciBy2Qu*s2Pp2a + (5.+an->ci)*an->siBy2Qu*s2Pm2a ) )*Ssz;
2311  im3S*=amp3S*v3;
2312 
2313  h22->data->data[idx] =amp22*v2*(re023p+re13+re2S+re3S+I*( im023p+im13+im2S+im3S));
2314  h2m2->data->data[idx]=amp22*v2*(re023p-re13-re2S+re3S+I*(-im023p+im13+im2S-im3S));
2315 
2316  //l=2, m=1,-1
2317  re023p = an->si * ( 1. + v2*amp2 + v3*amp3pi ) * ( c2Ppa * an->ciBy2Sq - c2Pma * an->siBy2Sq );
2318  re13 = v * dm/3.*amp1*(1.+v2*amp3)*(-cPpa*(an->ci+an->c2i)/2. -cPma*an->siBy2Sq*(1.+2.*an->ci) );
2319  re2S = v2*amp2S * 0.5 * ( an->si*sP*(Say+dm*Ssy) + (cPma*an->siBy2Sq+cPpa*an->ciBy2Sq)*(Saz+dm*Ssz) );
2320  re3S = an->si*(ca*an->c2i + (1.-10./3.*an->ci)*an->ciBy2Sq*c2Ppa + (1.+10./3.*an->ci)*an->siBy2Sq*c2Pma)*(Ssz+dm*Saz);
2321  re3S+= an->si*eta*( (5.-2.*an->ci)/6.*an->ciBy2Sq*c2Ppa+an->siBy2Sq*(5.+2.*an->ci)/6.*c2Pma - 0.5*ca*an->c2i )*Ssz;
2322  re3S+= 1./3.*((-7.+10.*an->ci)*an->ciBy2Qu*s2Pp2a-(7.+10.*an->ci)*an->siBy2Qu*s2Pm2a + .5*an->siSq*s2P + 3.*an->ci*an->siSq*s2a) * (dm*Say+Ssy);
2323  re3S+= eta*((0.5+an->ci/3.)*an->ciBy2Qu*s2Pp2a+(0.5-an->ci/3.)*an->siBy2Qu*s2Pm2a -1.3/1.2*an->siSq*s2P - 0.5*an->ci*an->siSq*s2a) * Ssy;
2324  re3S+= 1./3.*((-7.+10.*an->ci)*an->ciBy2Qu*c2Pp2a+(7.+10.*an->ci)*an->siBy2Qu*c2Pm2a - 5.*an->siSq*an->ci*c2P + 3.*an->ci*(an->siSq*c2a-an->ciSq)) * (dm*Sax+Ssx);
2325  re3S+= eta*((0.5+an->ci/3.)*an->ciBy2Qu*c2Pp2a-(0.5-an->ci/3.)*an->siBy2Qu*c2Pm2a -1./6.*an->ci*an->siSq*c2P - 0.5*an->ci*(an->siSq*c2a-an->ciSq)) * Ssx;
2326  re3S*=amp3S*v3;
2327 
2328  im023p = an->si * ( 1. + v2*amp2 + v3*amp3pi ) * (-s2Ppa * an->ciBy2Sq - s2Pma * an->siBy2Sq );
2329  im13 = v * dm/3.*amp1*(1.+v2*amp3)*( sPpa*(an->ci+an->c2i)/2. -sPma*an->siBy2Sq*(1.+2.*an->ci) );
2330  im2S = v2*amp2S * 0.5 * ( an->si*sP*(Sax+dm*Ssx) + (sPma*an->siBy2Sq-sPpa*an->ciBy2Sq)*(Saz+dm*Ssz) );
2331  im3S = an->si*(-sa*an->c2i + (-1.+10./3.*an->ci)*an->ciBy2Sq*s2Ppa + (1.+10./3.*an->ci)*an->siBy2Sq*s2Pma)*(Ssz+dm*Saz);
2332  im3S+= an->si*eta*( (-5.+2.*an->ci)/6.*an->ciBy2Sq*s2Ppa+an->siBy2Sq*(5.+2.*an->ci)/6.*s2Pma+0.5*sa*an->c2i)*Ssz;
2333  im3S+= 1./3.*((-7.+10.*an->ci)*an->ciBy2Qu*c2Pp2a+(7.+10.*an->ci)*an->siBy2Qu*c2Pm2a + 5.*an->siSq*an->ci*c2P + 3.*an->ci*(an->siSq*c2a+an->ciSq)) * (dm*Say+Ssy);
2334  im3S+= eta*((0.5+an->ci/3.)*an->ciBy2Qu*c2Pp2a+(-0.5+an->ci/3.)*an->siBy2Qu*c2Pm2a + 1./6.*an->ci*an->siSq*c2P - 0.5*an->ci*(an->siSq*c2a+an->ciSq)) * Ssy;
2335  im3S+= 1./3.*((7.-10.*an->ci)*an->ciBy2Qu*s2Pp2a+(7.+10.*an->ci)*an->siBy2Qu*s2Pm2a + .5*an->siSq*s2P - 3.*an->ci*an->siSq*s2a) * (dm*Sax+Ssx);
2336  im3S+= eta*(-(0.5+an->ci/3.)*an->ciBy2Qu*s2Pp2a-(0.5-an->ci/3.)*an->siBy2Qu*s2Pm2a -1.3/1.2*an->siSq*s2P + 0.5*an->ci*an->siSq*s2a) * Ssx;
2337  im3S*=amp3S*v3;
2338 
2339  h21->data->data[idx] =amp22*v2*( re023p+re13+re2S+re3S+I*( im023p+im13+im2S+im3S));
2340  h2m1->data->data[idx]=amp22*v2*(-re023p+re13+re2S-re3S+I*( im023p-im13-im2S+im3S));
2341 
2342  //l=2, m=0
2343  //Real components
2344  re023p = ( 1. + v2*amp2 + v3*amp3pi) * ( an->siSq*c2P );
2345  re13 = 0.;
2346  re2S = 0.;
2347  re3S = an->s2i/3.*( (3.-5.*c2P)*(Ssz+dm*Saz) - eta/2.*(3.+c2P)*Ssz );
2348  re3S+=(-2.*ca*an->ciSq + 2./3.*(5.*an->ci-2.)*an->ciBy2Sq*c2Ppa - 2./3.*(5.*an->ci+2.)*an->siBy2Sq*c2Pma)*(Ssx+dm*Sax);
2349  re3S+=eta*( ca*an->ciSq + an->ciBy2Sq/3.*(an->ci+4.)*c2Ppa + an->siBy2Sq/3.*(4.-an->ci)*c2Pma)*Ssx;
2350  re3S+=(-2.*sa*an->ciSq + 2./3.*(5.*an->ci-2.)*an->ciBy2Sq*s2Ppa + 2./3.*(5.*an->ci+2.)*an->siBy2Sq*s2Pma)*(Ssy+dm*Say);
2351  re3S+=eta*(sa*an->ciSq + 1./3.*(4.+an->ci)*an->ciBy2Sq*s2Ppa - an->siBy2Sq*(4.-an->ci)/3.*s2Pma)*Ssy;
2352  re3S*=amp3S*v3*an->si;
2353  //Imaginary components
2354  im023p = 0.;
2355  im13 = v*amp1*dm/3.*(1.+v2*amp3)*an->s2i*sP;
2356  im2S = v2*amp2S/3.* (-2.*sP*an->si*(Saz+dm*Ssz) + (-sPpa*an->ciBy2Sq+sPma*an->siBy2Sq)*(Sax+dm*Ssx) + (cPpa*an->ciBy2Sq+cPma*an->siBy2Sq)*(Say+dm*Ssy) );
2357  im3S = 0.;
2358  //h20
2359  h20->data->data[idx]=amp22*v2*sqrt1p5*(re023p+re13+re2S+re3S+I*(im023p+im13+im2S+im3S));
2360 
2361  LALFree(an); an=NULL;
2362 
2363  }
2364 
2371 
2372  *h2ms=XLALSphHarmTimeSeriesAddMode(*h2ms, h22, 2, 2);
2374  *h2ms=XLALSphHarmTimeSeriesAddMode(*h2ms, h21, 2, 1);
2376  *h2ms=XLALSphHarmTimeSeriesAddMode(*h2ms, h20, 2, 0);
2378  *h2ms=XLALSphHarmTimeSeriesAddMode(*h2ms, h2m1, 2, -1);
2380  *h2ms=XLALSphHarmTimeSeriesAddMode(*h2ms, h2m2, 2, -2);
2382 
2383  return XLAL_SUCCESS;
2384 
2385 } /* End of XLALSimSpinInspiralPNMode2m*/
2386 
2387 /**
2388  * Computes all l=3 modes of spherical harmonic decomposition of
2389  * the post-Newtonian inspiral waveform for spinning-precessing waveforms.
2390  *
2391  * For reference see eq. B3 of
2392  * Arun et al., "Higher-order spin effects in the amplitude and phase of gravitational waveforms
2393  * emitted by inspiraling compact binaries: Ready-to-use gravitational waveforms",
2394  * Physical Review D 79, 104023 (2009), Erratum PRD 84, 049901 (2011), arXiv:0810.5336v3 [gr-qc].
2395  * All variable are inputs.
2396  *
2397  * !!BEWARE!! Spin components are given wrt LNh. LNh components define angles
2398  * incl and alpha (polarization angle) entering the mode analytic form.
2399  *
2400  */
2401 
2403  REAL8TimeSeries *V, /**< post-Newtonian parameter */
2404  REAL8TimeSeries *Phi, /**< orbital phase */
2405  REAL8TimeSeries *LNhx, /**< angular momentum unit vector x components */
2406  REAL8TimeSeries *LNhy, /**< angular momentum unit vector y components */
2407  REAL8TimeSeries *LNhz, /**< angular momentum unit vector z components */
2408  REAL8TimeSeries *e1x, /**< x-axis tetrad x component*/
2409  REAL8TimeSeries *e1y, /**< x-axis tetrad y component*/
2410  REAL8TimeSeries *e1z, /**< x-axis tetrad z component*/
2411  REAL8TimeSeries *S1x, /**< spin1-x component */
2412  REAL8TimeSeries *S1y, /**< spin1-y component */
2413  REAL8TimeSeries *S1z, /**< spin1-z component */
2414  REAL8TimeSeries *S2x, /**< spin2-x component */
2415  REAL8TimeSeries *S2y, /**< spin2-y component */
2416  REAL8TimeSeries *S2z, /**< spin2-z component */
2417  REAL8 m1, /**< mass of companion 1 (kg) */
2418  REAL8 m2, /**< mass of companion 2 (kg) */
2419  REAL8 distance, /**< distance of source (m) */
2420  int ampO /**< twice post-Newtonian amplitude order */)
2421 {
2437 
2438  UINT4 idx;
2439  REAL8 eta=m1/(m1+m2)*m2/(m1+m2);
2440  REAL8 dm=(m1-m2)/(m1+m2);
2441 
2442  REAL8 amp3 =0.;
2443  REAL8 amp3S=0.;
2444  REAL8 amp2 =0.;
2445  REAL8 amp1 =0.;
2446 
2447  switch (ampO) {
2448  case -1: /* use highest available pN order */
2449 #if __GNUC__ >= 7 && !defined __INTEL_COMPILER
2450  __attribute__ ((fallthrough));
2451 #endif
2452  case 3:
2453  amp3 = 1.;
2454  amp3S= 1.;
2455 #if __GNUC__ >= 7 && !defined __INTEL_COMPILER
2456  __attribute__ ((fallthrough));
2457 #endif
2458  case 2:
2459  amp2 = (1.-3.*eta);
2460 #if __GNUC__ >= 7 && !defined __INTEL_COMPILER
2461  __attribute__ ((fallthrough));
2462 #endif
2463  case 1:
2464  amp1 = 1.;
2465  case 0:
2466  break;
2467  default: /* unsupported pN order */
2468  XLALPrintError("XLAL Error - %s: PN order %d%s not supported\n", __func__, ampO/2, ampO%2?".5":"" );
2470  }
2471 
2472  REAL8 checkL,checke;
2473  for (idx=0;idx<LNhx->data->length;idx++){
2474  checkL=LNhx->data->data[idx]*LNhx->data->data[idx]+LNhy->data->data[idx]*LNhy->data->data[idx]+LNhz->data->data[idx]*LNhz->data->data[idx];
2475  if ((checkL<1.-EPS)||(checkL>1.+EPS)) {
2476  XLALPrintError("XLAL Error - %s: LNhat unit vector has not unit norm %12.4e\n", __func__,checkL);
2478  }
2479  checke=e1x->data->data[idx]*e1x->data->data[idx]+e1y->data->data[idx]*e1y->data->data[idx]+e1z->data->data[idx]*e1z->data->data[idx];
2480  if ((checke<1.-EPS)||(checke>1.+EPS)) {
2481  XLALPrintError("XLAL Error - %s: e1 unit vector has not unit norm %12.4e at idx %d\n", __func__,checke,idx);
2483  }
2484  }
2485 
2486  REAL8TimeSeries *S1xtmp=XLALCreateREAL8TimeSeries("S1x",&V->epoch,0.,V->deltaT,&lalDimensionlessUnit,V->data->length);
2487  REAL8TimeSeries *S1ytmp=XLALCreateREAL8TimeSeries("S1y",&V->epoch,0.,V->deltaT,&lalDimensionlessUnit,V->data->length);
2488  REAL8TimeSeries *S1ztmp=XLALCreateREAL8TimeSeries("S1z",&V->epoch,0.,V->deltaT,&lalDimensionlessUnit,V->data->length);
2489  REAL8TimeSeries *S2xtmp=XLALCreateREAL8TimeSeries("S2x",&V->epoch,0.,V->deltaT,&lalDimensionlessUnit,V->data->length);
2490  REAL8TimeSeries *S2ytmp=XLALCreateREAL8TimeSeries("S2y",&V->epoch,0.,V->deltaT,&lalDimensionlessUnit,V->data->length);
2491  REAL8TimeSeries *S2ztmp=XLALCreateREAL8TimeSeries("S2z",&V->epoch,0.,V->deltaT,&lalDimensionlessUnit,V->data->length);
2492  for (idx=0;idx<V->data->length;idx++) {
2493  S1xtmp->data->data[idx]=0.;
2494  S1ytmp->data->data[idx]=0.;
2495  S1ztmp->data->data[idx]=0.;
2496  S2xtmp->data->data[idx]=0.;
2497  S2ytmp->data->data[idx]=0.;
2498  S2ztmp->data->data[idx]=0.;
2499  }
2500 
2501  if ( S1x ) {
2503  memcpy(S1xtmp->data->data, S1x->data->data, S1xtmp->data->length*sizeof(REAL8) );
2504  }
2505 
2506  if ( S1y ) {
2508  memcpy(S1ytmp->data->data, S1y->data->data, S1ytmp->data->length*sizeof(REAL8) );
2509  }
2510 
2511  if ( S1z ) {
2513  memcpy(S1ztmp->data->data, S1z->data->data, S1ztmp->data->length*sizeof(REAL8) );
2514  }
2515 
2516  if ( S2x ) {
2518  memcpy(S2xtmp->data->data, S2x->data->data, S2xtmp->data->length*sizeof(REAL8) );
2519  }
2520 
2521  if ( S2y ) {
2523  memcpy(S2ytmp->data->data, S2y->data->data, S2ytmp->data->length*sizeof(REAL8) );
2524  }
2525 
2526  if ( S2z ) {
2528  memcpy(S2ztmp->data->data, S2z->data->data, S2ztmp->data->length*sizeof(REAL8) );
2529  }
2530 
2531  REAL8 Psi,v,v2,v3;
2532  REAL8 c3Pp3a,c3Pm3a,c3Pp2a,c3Pm2a,c3Ppa,c3Pma,c2Pp3a,c2Pm3a,c2Pp2a,c2Pm2a,c2Ppa,c2Pma,cPp3a,cPm3a,cPp2a,cPm2a,cPpa,cPma,cP,c2P,c3P;
2533  REAL8 s3Pp3a,s3Pm3a,s3Pp2a,s3Pm2a,s3Ppa,s3Pma,s2Pp3a,s2Pm3a,s2Pp2a,s2Pm2a,s2Ppa,sPp2a,sPm2a,s2Pma,sPpa,sPma,sPp3a,sPm3a,sP,s2P,s3P;
2534  REAL8 ca,sa,c2a,s2a,c3a,s3a;
2535  //REAL8 Sax, Say, Saz;
2536  REAL8 Ssx,Ssy,Ssz;
2537  //REAL8 e2x,nx,lx;
2538  REAL8 e2y,e2z,ny,nz,ly,lz;
2539  LALSimInspiralInclAngle *an=NULL;
2540  COMPLEX16TimeSeries *h33=XLALCreateCOMPLEX16TimeSeries( "h33", &V->epoch, 0., V->deltaT, &lalStrainUnit, V->data->length);
2541  COMPLEX16TimeSeries *h3m3=XLALCreateCOMPLEX16TimeSeries( "h3-3", &V->epoch, 0., V->deltaT, &lalStrainUnit, V->data->length);
2542  COMPLEX16TimeSeries *h32=XLALCreateCOMPLEX16TimeSeries( "h32", &V->epoch, 0., V->deltaT, &lalStrainUnit, V->data->length);
2543  COMPLEX16TimeSeries *h3m2=XLALCreateCOMPLEX16TimeSeries( "h3-2", &V->epoch, 0., V->deltaT, &lalStrainUnit, V->data->length);
2544  COMPLEX16TimeSeries *h31=XLALCreateCOMPLEX16TimeSeries( "h31", &V->epoch, 0., V->deltaT, &lalStrainUnit, V->data->length);
2545  COMPLEX16TimeSeries *h3m1=XLALCreateCOMPLEX16TimeSeries( "h3-1", &V->epoch, 0., V->deltaT, &lalStrainUnit, V->data->length);
2546  COMPLEX16TimeSeries *h30=XLALCreateCOMPLEX16TimeSeries( "h30", &V->epoch, 0., V->deltaT, &lalStrainUnit, V->data->length);
2547 
2548  REAL8 amp33= eta*(m1+m2)*LAL_G_SI/pow(LAL_C_SI,2) / distance * sqrt(2.*LAL_PI / 21.);
2549  REAL8 re3,re4,re5,re5S,im3,im4,im5,im5S;
2550 
2551  for (idx=0; idx<V->data->length; idx++) {
2552  v=V->data->data[idx];
2553  v2=v*v;
2554  v3=v2*v;
2555  Psi=Phi->data->data[idx];
2556  an=XLALSimInspiralComputeInclAngle(LNhz->data->data[idx]);
2557  //e2x=LNhy->data->data[idx]*e1z->data->data[idx]-LNhz->data->data[idx]*e1y->data->data[idx];
2558  e2y=LNhz->data->data[idx]*e1x->data->data[idx]-LNhx->data->data[idx]*e1z->data->data[idx];
2559  e2z=LNhx->data->data[idx]*e1y->data->data[idx]-LNhy->data->data[idx]*e1x->data->data[idx];
2560  //nx=e1x->data->data[idx]*cos(Psi)+e2x*sin(Psi);
2561  ny=e1y->data->data[idx]*cos(Psi)+e2y*sin(Psi);
2562  nz=e1z->data->data[idx]*cos(Psi)+e2z*sin(Psi);
2563  //lx=e2x*cos(Psi)-e1x->data->data[idx]*sin(Psi);
2564  ly=e2y*cos(Psi)-e1y->data->data[idx]*sin(Psi);
2565  lz=e2z*cos(Psi)-e1z->data->data[idx]*sin(Psi);
2566  if (an->si>EPS) {
2567  ca=LNhx->data->data[idx]/an->si;
2568  sa=LNhy->data->data[idx]/an->si;
2569  sP=nz/an->si;
2570  cP=lz/an->si;
2571  }
2572  else {
2573  // If L//N then alpha is ill defined, only alpha + phi is defined
2574  ca=1.;
2575  sa=0.;
2576  cP=ca*ny-sa*ly;
2577  sP=-sa*ny-ca*ly;
2578  }
2579  c2a=2.*ca*ca-1.;
2580  s2a=2.*ca*sa;
2581  c3a=c2a*ca-s2a*sa;
2582  s3a=c2a*sa+s2a*ca;
2583  c2P=cP*cP-sP*sP;
2584  s2P=2.*cP*sP;
2585  c3P=c2P*cP-s2P*sP;
2586  s3P=c2P*sP+s2P*cP;
2587  c3Pp3a=c3P*c3a-s3P*s3a;
2588  c3Pm3a=c3P*c3a+s3P*s3a;
2589  s3Pp3a=s3P*c3a+c3P*s3a;
2590  s3Pm3a=s3P*c3a-c3P*s3a;
2591  c3Pp2a=c3P*c2a-s3P*s2a;
2592  c3Pm2a=c3P*c2a+s3P*s2a;
2593  s3Pp2a=s3P*c2a+c3P*s2a;
2594  s3Pm2a=s3P*c2a-c3P*s2a;
2595  c3Ppa=c3P*ca-s3P*sa;
2596  c3Pma=c3P*ca+s3P*sa;
2597  s3Ppa=s3P*ca+c3P*sa;
2598  s3Pma=s3P*ca-c3P*sa;
2599  c2Pp3a=c2P*c3a-s2P*s3a;
2600  c2Pm3a=c2P*c3a+s2P*s3a;
2601  s2Pp3a=s2P*c3a+c2P*s3a;
2602  s2Pm3a=s2P*c3a-c2P*s3a;
2603  c2Pp2a=c2P*c2a-s2P*s2a;
2604  c2Pm2a=c2P*c2a+s2P*s2a;
2605  s2Pp2a=s2P*c2a+c2P*s2a;
2606  s2Pm2a=s2P*c2a-c2P*s2a;
2607  c2Ppa=c2P*ca-s2P*sa;
2608  c2Pma=c2P*ca+s2P*sa;
2609  s2Ppa=s2P*ca+c2P*sa;
2610  s2Pma=s2P*ca-c2P*sa;
2611  cPp3a=cP*c3a-sP*s3a;
2612  cPm3a=cP*c3a+sP*s3a;
2613  sPp3a=sP*c3a+cP*s3a;
2614  sPm3a=sP*c3a-cP*s3a;
2615  cPp2a=cP*c2a-sP*s2a;
2616  cPm2a=cP*c2a+sP*s2a;
2617  sPp2a=sP*c2a+cP*s2a;
2618  sPm2a=sP*c2a-cP*s2a;
2619  cPpa=cP*ca-sP*sa;
2620  cPma=cP*ca+sP*sa;
2621  sPpa=sP*ca+cP*sa;
2622  sPma=sP*ca-cP*sa;
2623 
2624  //Sax=S1xtmp->data->data[idx]-S2xtmp->data->data[idx];
2625  Ssx=S1xtmp->data->data[idx]+S2xtmp->data->data[idx];
2626  //Say=S1ytmp->data->data[idx]-S2ytmp->data->data[idx];
2627  Ssy=S1ytmp->data->data[idx]+S2ytmp->data->data[idx];
2628  //Saz=S1ztmp->data->data[idx]-S2ztmp->data->data[idx];
2629  Ssz=S1ztmp->data->data[idx]+S2ztmp->data->data[idx];
2630 
2631  //l=3, m=3,-3
2632  re3 = amp1*v*dm* (-9.*c3Pm3a*an->siBy2Sx - cPm3a*an->siBy2Qu*an->ciBy2Sq + cPp3a*an->siBy2Sq*an->ciBy2Qu + 9.*c3Pp3a*an->ciBy2Sx);
2633  re4 = -4.*amp2*v2*an->si*(c2Pm3a*an->siBy2Qu - c2Pp3a*an->ciBy2Qu);
2634  re5 = amp3*v3*dm* (36.*(1.-0.5*eta)*(-an->ciBy2Sx*c3Pp3a + an->siBy2Sx*c3Pm3a) + 2./3.*(1.+0.25*eta)*an->siSq*(-an->ciBy2Sq*cPp3a+an->siBy2Sq*cPm3a) );
2635  re5S= amp3S*v3*eta*16.*( (-an->siBy2Qu*c2Pm2a + an->ciBy2Qu*c2Pp2a)*Ssx + (-an->siBy2Qu*s2Pm2a - an->ciBy2Qu*s2Pp2a)*Ssy );
2636  im3 = amp1*v*dm* (-9.*s3Pm3a*an->siBy2Sx - sPm3a*an->siBy2Qu*an->ciBy2Sq - sPp3a*an->siBy2Sq*an->ciBy2Qu - 9.*s3Pp3a*an->ciBy2Sx);
2637  im4 = -4.*amp2*v2*an->si*(s2Pm3a*an->siBy2Qu + s2Pp3a*an->ciBy2Qu);
2638  im5 = amp3*v3*dm* (36.*(1.-0.5*eta)*( an->ciBy2Sx*s3Pp3a + an->siBy2Sx*s3Pm3a) + 2./3.*(1.+0.25*eta)*an->siSq*( an->ciBy2Sq*sPp3a+an->siBy2Sq*sPm3a) );
2639  im5S= amp3S*v3*eta*16.*( (-an->siBy2Qu*s2Pm2a - an->ciBy2Qu*s2Pp2a)*Ssx + ( an->siBy2Qu*c2Pm2a - an->ciBy2Qu*c2Pp2a)*Ssy );
2640  h33->data->data[idx] =amp33*v2*( re3+re4+re5+re5S+I*(im3+im4+im5+im5S));
2641  h3m3->data->data[idx]=amp33*v2*(-re3+re4-re5+re5S+I*(im3-im4+im5-im5S));
2642 
2643  //l=3, m=2,-2
2644  re3 = amp1*v*dm*an->si/4.*( 18.*c3Pm2a*an->siBy2Qu + cPm2a/3.*(1.+3.*an->ci)*an->siBy2Sq + cPp2a/3.*(1.-3.*an->ci)*an->ciBy2Sq + 18.*c3Pp2a*an->ciBy2Qu );
2645  re4 = amp2*v2*4.*( an->ciBy2Qu*c2Pp2a*(2./3.-an->ci) + an->siBy2Qu*c2Pm2a*(2./3.+an->ci) );
2646  re5 = amp3*v3*dm*an->si*(-18.*(1.-0.5*eta)*(an->ciBy2Qu*c3Pp2a + an->siBy2Qu*c3Pm2a) + (1.+0.25*eta)*2./9.*((-1.+3.*an->ci)*an->ciBy2Sq*cPp2a - (1.+3.*an->ci)*an->siBy2Sq*cPm2a ) );
2647  re5S= amp3S*v3*eta*16./3.*( an->si*(( an->ciBy2Sq*c2Ppa + an->siBy2Sq*c2Pma)*Ssx + (-an->ciBy2Sq*s2Ppa + an->siBy2Sq*s2Pma)*Ssy) + (-an->ciBy2Qu*c2Pp2a + an->siBy2Qu*c2Pm2a)*Ssz );
2648  im3 = amp1*v*dm*an->si/4.*( 18.*s3Pm2a*an->siBy2Qu + sPm2a/3.*(1.+3.*an->ci)*an->siBy2Sq - sPp2a/3.*(1.-3.*an->ci)*an->ciBy2Sq - 18.*s3Pp2a*an->ciBy2Qu );
2649  im4 = amp2*v2*4.*(-an->ciBy2Qu*s2Pp2a*(2./3.-an->ci) + an->siBy2Qu*s2Pm2a*(2./3.+an->ci) );
2650  im5 = amp3*v3*dm*an->si*( 18.*(1.-0.5*eta)*(an->ciBy2Qu*s3Pp2a - an->siBy2Qu*s3Pm2a) + (1.+0.25*eta)*2./9.*(( 1.-3.*an->ci)*an->ciBy2Sq*sPp2a - (1.+3.*an->ci)*an->siBy2Sq*sPm2a ) );
2651  im5S= amp3S*v3*eta*16./3.*( an->si*((-an->ciBy2Sq*s2Ppa + an->siBy2Sq*s2Pma)*Ssx + (-an->ciBy2Sq*c2Ppa - an->siBy2Sq*c2Pma)*Ssy) + ( an->ciBy2Qu*s2Pp2a + an->siBy2Qu*s2Pm2a)*Ssz );
2652  h32->data->data[idx] =amp33*sqrt(6.)*v2*(re3+re4+re5+re5S+I*( im3+im4+im5+im5S));
2653  h3m2->data->data[idx]=amp33*sqrt(6.)*v2*(re3-re4+re5-re5S+I*(-im3+im4-im5+im5S));
2654 
2655  //l=3, m=1,-1
2656  re3 = amp1*v*dm/4.*( 45.*c3Ppa*an->siSq*an->ciBy2Sq - 180.*c3Pma*an->siBy2Qu*an->ciBy2Sq - cPma/2.*an->siBy2Sq*(13./3.+20./3.*an->ci+5.*an->c2i) + cPpa/2.*an->ciBy2Sq*(13./3.-20./3.*an->ci+5.*an->c2i) );
2657  re4 = amp2*v2*10./3.*an->si*(an->ciBy2Sq*c2Ppa*(1.-3.*an->ci) - an->siBy2Sq*c2Pma*(1.+3.*an->ci));
2658  re5 = amp3*v3*dm*( -180.*(1.-0.5*eta)*an->ciBy2Sq*an->siBy2Sq*( an->ciBy2Sq*c3Ppa - an->siBy2Sq*c3Pma) + 8./9.*(1.+0.25*eta)*(-an->ciBy2Sq*(13./8.-2.5*an->ci+15./8.*an->c2i)*cPpa + an->siBy2Sq*(13./8.+2.5*an->ci+15./8.*an->c2i)*cPma ) );
2659  re5S= amp3S*v3*eta*16./3.*( 4.*an->si*(-an->ciBy2Sq*c2Ppa - an->siBy2Sq*c2Pma)*Ssz + (-an->ciBy2Qu*c2Pp2a + an->siBy2Qu*c2Pm2a)*Ssx + (-an->ciBy2Qu*s2Pp2a - an->siBy2Qu*s2Pm2a - 3.*an->siSq*s2P)*Ssy );
2660  im3 = amp1*v*dm/4.*(-45.*s3Ppa*an->siSq*an->ciBy2Sq - 180.*s3Pma*an->siBy2Qu*an->ciBy2Sq - sPma/2.*an->siBy2Sq*(13./3.+20./3.*an->ci+5.*an->c2i) - sPpa/2.*an->ciBy2Sq*(13./3.-20./3.*an->ci+5.*an->c2i) );
2661  im4 = amp2*v2*10./3.*an->si*(-an->ciBy2Sq*s2Ppa*(1.-3.*an->ci) - an->siBy2Sq*s2Pma*(1.+3.*an->ci));
2662  im5 = amp3*v3*dm*( -180.*(1.-0.5*eta)*an->ciBy2Sq*an->siBy2Sq*(-an->ciBy2Sq*s3Ppa - an->siBy2Sq*s3Pma) + 8./9.*(1.+0.25*eta)*( an->ciBy2Sq*(13./8.-2.5*an->ci+15./8.*an->c2i)*sPpa + an->siBy2Sq*(13./8.+2.5*an->ci+15./8.*an->c2i)*sPma ) );
2663  im5S= amp3S*v3*eta*16./3.*( 4*an->si*( an->ciBy2Sq*s2Ppa - an->siBy2Sq*s2Pma)*Ssz + ( an->ciBy2Qu*s2Pp2a + an->siBy2Qu*s2Pm2a -3.*an->siSq*s2P)*Ssx + (-an->ciBy2Qu*c2Pp2a + an->siBy2Qu*c2Pm2a)*Ssy );
2664  h31->data->data[idx] =amp33*sqrt(.6)*v2*( re3+re4+re5+re5S+I*(im3+im4+im5+im5S));
2665  h3m1->data->data[idx]=amp33*sqrt(.6)*v2*(-re3+re4-re5+re5S+I*(im3-im4+im5-im5S));
2666 
2667  //l=3, m=0
2668  re3 = amp1*v*dm*an->si*( cP/4.*(3.+5.*an->c2i) +22.5*c3P*an->siSq);
2669  re4 = 0.;
2670  re5 = amp3*v3*dm*an->si*(-90.*(1.-0.5*eta)*an->siSq*c3P - 2.*(1.+0.25*eta)*(1.+5./3.*an->c2i)*cP);
2671  re5S= 0.;
2672  im3 = 0.;
2673  im4 = amp2*v2*20.*an->ci*an->siSq*s2P;
2674  im5 = 0.;
2675  im5S= amp3S*v3*eta*an->si*16.*( 2.*(an->ciBy2Sq*s2Ppa - an->siBy2Sq*s2Pma)*Ssx - 2.*( an->ciBy2Sq*c2Ppa + an->siBy2Sq*c2Pma)*Ssy + 3.*(an->si*s2P)*Ssz );
2676  h30->data->data[idx]=amp33/sqrt(5.)*v2*(re3+re4+re5+re5S+I*(im3+im4+im5+im5S));
2677 
2678  LALFree(an);
2679  an=NULL;
2680 
2681  }
2682 
2689 
2690  *h3ms=XLALSphHarmTimeSeriesAddMode(*h3ms, h33, 3, 3);
2692  *h3ms=XLALSphHarmTimeSeriesAddMode(*h3ms, h32, 3, 2);
2694  *h3ms=XLALSphHarmTimeSeriesAddMode(*h3ms, h31, 3, 1);
2696  *h3ms=XLALSphHarmTimeSeriesAddMode(*h3ms, h30, 3, 0);
2698  *h3ms=XLALSphHarmTimeSeriesAddMode(*h3ms, h3m1, 3, -1);
2700  *h3ms=XLALSphHarmTimeSeriesAddMode(*h3ms, h3m2, 3, -2);
2702  *h3ms=XLALSphHarmTimeSeriesAddMode(*h3ms, h3m3, 3, -3);
2704 
2705  return XLAL_SUCCESS;
2706 
2707 } /* End of XLALSimSpinInspiralPNMode3m*/
2708 
2709 /**
2710  * Computes all l=3 modes of spherical harmonic decomposition of
2711  * the post-Newtonian inspiral waveform for spinning-precessing waveforms.
2712  *
2713  * For reference see eq. B3 of
2714  * Arun et al., "Higher-order spin effects in the amplitude and phase of gravitational waveforms
2715  * emitted by inspiraling compact binaries: Ready-to-use gravitational waveforms",
2716  * Physical Review D 79, 104023 (2009), Erratum PRD 84, 049901 (2011), arXiv:0810.5336v3 [gr-qc].
2717  * All variable are inputs.
2718  *
2719  * !!BEWARE!! Spin components are given wrt LNh. LNh components define angles
2720  * incl and alpha (polarization angle) entering the mode analytic form.
2721  *
2722  */
2724  REAL8TimeSeries *V, /**< post-Newtonian parameter */
2725  REAL8TimeSeries *Phi, /**< orbital phase */
2726  REAL8TimeSeries *LNhx, /**< angular momentum unit vector x components */
2727  REAL8TimeSeries *LNhy, /**< angular momentum unit vector y components */
2728  REAL8TimeSeries *LNhz, /**< angular momentum unit vector z components */
2729  REAL8TimeSeries *e1x, /**< x-axis tetrad x component*/
2730  REAL8TimeSeries *e1y, /**< x-axis tetrad y component*/
2731  REAL8TimeSeries *e1z, /**< x-axis tetrad z component*/
2732  UNUSED REAL8TimeSeries *S1x, /**< spin1-x component */
2733  UNUSED REAL8TimeSeries *S1y, /**< spin1-y component */
2734  UNUSED REAL8TimeSeries *S1z, /**< spin1-z component */
2735  UNUSED REAL8TimeSeries *S2x, /**< spin2-x component */
2736  UNUSED REAL8TimeSeries *S2y, /**< spin2-y component */
2737  UNUSED REAL8TimeSeries *S2z, /**< spin2-z component */
2738  REAL8 m1, /**< mass of companion 1 (kg) */
2739  REAL8 m2, /**< mass of companion 2 (kg) */
2740  REAL8 distance, /**< distance of source (m) */
2741  int ampO /**< twice post-Newtonian amplitude order */)
2742 {
2758 
2759  UINT4 idx;
2760  REAL8 eta=m1/(m1+m2)*m2/(m1+m2);
2761  REAL8 dm=(m1-m2)/(m1+m2);
2762 
2763  REAL8 amp3 =0.;
2764  REAL8 amp2 =0.;
2765 
2766  switch (ampO) {
2767  case -1: /* use highest available pN order */
2768 #if __GNUC__ >= 7 && !defined __INTEL_COMPILER
2769  __attribute__ ((fallthrough));
2770 #endif
2771  case 3:
2772  amp3 = 1.-2.*eta;
2773 #if __GNUC__ >= 7 && !defined __INTEL_COMPILER
2774  __attribute__ ((fallthrough));
2775 #endif
2776  case 2:
2777  amp2 = 1.-3.*eta;
2778  case 1:
2779  case 0:
2780  break;
2781  default: /* unsupported pN order */
2782  XLALPrintError("XLAL Error - %s: PN order %d%s not supported\n", __func__, ampO/2, ampO%2?".5":"" );
2784  }
2785 
2786  REAL8 checkL,checke;
2787  for (idx=0;idx<LNhx->data->length;idx++){
2788  checkL=LNhx->data->data[idx]*LNhx->data->data[idx]+LNhy->data->data[idx]*LNhy->data->data[idx]+LNhz->data->data[idx]*LNhz->data->data[idx];
2789  if ((checkL<1.-EPS)||(checkL>1.+EPS)) {
2790  XLALPrintError("XLAL Error - %s: LNhat unit vector has not unit norm %12.4e\n", __func__,checkL);
2792  }
2793  checke=e1x->data->data[idx]*e1x->data->data[idx]+e1y->data->data[idx]*e1y->data->data[idx]+e1z->data->data[idx]*e1z->data->data[idx];
2794  if ((checke<1.-EPS)||(checke>1.+EPS)) {
2795  XLALPrintError("XLAL Error - %s: e1 unit vector has not unit norm %12.4e at idx %d\n", __func__,checke,idx);
2797  }
2798  }
2799 
2800  /*REAL8TimeSeries *S1xtmp=XLALCreateREAL8TimeSeries("S1x",&V->epoch,0.,V->deltaT,&lalDimensionlessUnit,V->data->length);
2801  REAL8TimeSeries *S1ytmp=XLALCreateREAL8TimeSeries("S1y",&V->epoch,0.,V->deltaT,&lalDimensionlessUnit,V->data->length);
2802  REAL8TimeSeries *S1ztmp=XLALCreateREAL8TimeSeries("S1z",&V->epoch,0.,V->deltaT,&lalDimensionlessUnit,V->data->length);
2803  REAL8TimeSeries *S2xtmp=XLALCreateREAL8TimeSeries("S2x",&V->epoch,0.,V->deltaT,&lalDimensionlessUnit,V->data->length);
2804  REAL8TimeSeries *S2ytmp=XLALCreateREAL8TimeSeries("S2y",&V->epoch,0.,V->deltaT,&lalDimensionlessUnit,V->data->length);
2805  REAL8TimeSeries *S2ztmp=XLALCreateREAL8TimeSeries("S2z",&V->epoch,0.,V->deltaT,&lalDimensionlessUnit,V->data->length);
2806  for (idx=0;idx<V->data->length;idx++) {
2807  S1xtmp->data->data[idx]=0.;
2808  S1ytmp->data->data[idx]=0.;
2809  S1ztmp->data->data[idx]=0.;
2810  S2xtmp->data->data[idx]=0.;
2811  S2ytmp->data->data[idx]=0.;
2812  S2ztmp->data->data[idx]=0.;
2813  }
2814 
2815  if ( S1x ) {
2816  LAL_CHECK_CONSISTENT_TIME_SERIES(V, S1x, XLAL_FAILURE);
2817  memcpy(S1xtmp->data->data, S1x->data->data, S1xtmp->data->length*sizeof(REAL8) );
2818  }
2819 
2820  if ( S1y ) {
2821  LAL_CHECK_CONSISTENT_TIME_SERIES(V, S1y, XLAL_FAILURE);
2822  memcpy(S1ytmp->data->data, S1y->data->data, S1ytmp->data->length*sizeof(REAL8) );
2823  }
2824 
2825  if ( S1z ) {
2826  LAL_CHECK_CONSISTENT_TIME_SERIES(V, S1z, XLAL_FAILURE);
2827  memcpy(S1ztmp->data->data, S1z->data->data, S1ztmp->data->length*sizeof(REAL8) );
2828  }
2829 
2830  if ( S2x ) {
2831  LAL_CHECK_CONSISTENT_TIME_SERIES(V, S2x, XLAL_FAILURE);
2832  memcpy(S2xtmp->data->data, S2x->data->data, S2xtmp->data->length*sizeof(REAL8) );
2833  }
2834 
2835  if ( S2y ) {
2836  LAL_CHECK_CONSISTENT_TIME_SERIES(V, S2y, XLAL_FAILURE);
2837  memcpy(S2ytmp->data->data, S2y->data->data, S2ytmp->data->length*sizeof(REAL8) );
2838  }
2839 
2840  if ( S2z ) {
2841  LAL_CHECK_CONSISTENT_TIME_SERIES(V, S2z, XLAL_FAILURE);
2842  memcpy(S2ztmp->data->data, S2z->data->data, S2ztmp->data->length*sizeof(REAL8) );
2843  }*/
2844 
2845  REAL8 Psi,v,v2,v3;
2846  REAL8 cP,sP,c2P,s2P,c3P,s3P,c4P,s4P;
2847  REAL8 ca,sa,c2a,s2a,c3a,s3a,c4a,s4a;
2848  //REAL8 e2x,nx,lx;
2849  REAL8 ny,nz,ly,lz,e2y,e2z;
2850  REAL8 c4Pm4a,c3Pm4a,c2Pm4a,cPm4a,cPp4a,c2Pp4a,c3Pp4a,c4Pp4a,c4Pm3a,c3Pm3a,c2Pm3a,cPm3a,cPp3a,c2Pp3a,c3Pp3a,c4Pp3a,c4Pm2a,c3Pm2a,c2Pm2a,cPm2a,cPp2a,c2Pp2a,c3Pp2a,c4Pp2a,c4Pma,c3Pma,c2Pma,cPma,cPpa,c2Ppa,c3Ppa,c4Ppa;
2851  REAL8 s4Pm4a,s3Pm4a,s2Pm4a,sPm4a,sPp4a,s2Pp4a,s3Pp4a,s4Pp4a,s4Pm3a,s3Pm3a,s2Pm3a,sPm3a,sPp3a,s2Pp3a,s3Pp3a,s4Pp3a,s4Pm2a,s3Pm2a,s2Pm2a,sPm2a,sPp2a,s2Pp2a,s3Pp2a,s4Pp2a,s4Pma,s3Pma,s2Pma,sPma,sPpa,s2Ppa,s3Ppa,s4Ppa;
2852  //REAL8 Ssx, Ssy, Ssz;
2853  //REAL8 Sax, Say, Saz;
2854  LALSimInspiralInclAngle *an=NULL;
2855  COMPLEX16TimeSeries *h44 =XLALCreateCOMPLEX16TimeSeries( "h44", &V->epoch, 0., V->deltaT, &lalStrainUnit, V->data->length);
2856  COMPLEX16TimeSeries *h4m4=XLALCreateCOMPLEX16TimeSeries( "h4-4", &V->epoch, 0., V->deltaT, &lalStrainUnit, V->data->length);
2857  COMPLEX16TimeSeries *h43 =XLALCreateCOMPLEX16TimeSeries( "h43", &V->epoch, 0., V->deltaT, &lalStrainUnit, V->data->length);
2858  COMPLEX16TimeSeries *h4m3=XLALCreateCOMPLEX16TimeSeries( "h4-3", &V->epoch, 0., V->deltaT, &lalStrainUnit, V->data->length);
2859  COMPLEX16TimeSeries *h42 =XLALCreateCOMPLEX16TimeSeries( "h42", &V->epoch, 0., V->deltaT, &lalStrainUnit, V->data->length);
2860  COMPLEX16TimeSeries *h4m2=XLALCreateCOMPLEX16TimeSeries( "h4-2", &V->epoch, 0., V->deltaT, &lalStrainUnit, V->data->length);
2861  COMPLEX16TimeSeries *h41 =XLALCreateCOMPLEX16TimeSeries( "h41", &V->epoch, 0., V->deltaT, &lalStrainUnit, V->data->length);
2862  COMPLEX16TimeSeries *h4m1=XLALCreateCOMPLEX16TimeSeries( "h4-1", &V->epoch, 0., V->deltaT, &lalStrainUnit, V->data->length);
2863  COMPLEX16TimeSeries *h40 =XLALCreateCOMPLEX16TimeSeries( "h40", &V->epoch, 0., V->deltaT, &lalStrainUnit, V->data->length);
2864 
2865  REAL8 amp44= 2.*eta*(m1+m2)*LAL_G_SI/pow(LAL_C_SI,2) / distance * sqrt(LAL_PI / 7.);
2866  REAL8 re4,re5,im4,im5;
2867 
2868  for (idx=0; idx<V->data->length; idx++) {
2869  v=V->data->data[idx];
2870  v2=v*v;
2871  v3=v2*v;
2872  Psi=Phi->data->data[idx];
2873  an=XLALSimInspiralComputeInclAngle(LNhz->data->data[idx]);
2874  //e2x=LNhy->data->data[idx]*e1z->data->data[idx]-LNhz->data->data[idx]*e1y->data->data[idx];
2875  e2y=LNhz->data->data[idx]*e1x->data->data[idx]-LNhx->data->data[idx]*e1z->data->data[idx];
2876  e2z=LNhx->data->data[idx]*e1y->data->data[idx]-LNhy->data->data[idx]*e1x->data->data[idx];
2877  //nx=e1x->data->data[idx]*cos(Psi)+e2x*sin(Psi);
2878  ny=e1y->data->data[idx]*cos(Psi)+e2y*sin(Psi);
2879  nz=e1z->data->data[idx]*cos(Psi)+e2z*sin(Psi);
2880  //lx=e2x*cos(Psi)-e1x->data->data[idx]*sin(Psi);
2881  ly=e2y*cos(Psi)-e1y->data->data[idx]*sin(Psi);
2882  lz=e2z*cos(Psi)-e1z->data->data[idx]*sin(Psi);
2883  if (an->si>EPS) {
2884  ca=LNhx->data->data[idx]/an->si;
2885  sa=LNhy->data->data[idx]/an->si;
2886  sP=nz/an->si;
2887  cP=lz/an->si;
2888  }
2889  else {
2890  ca=1.;
2891  sa=0.;
2892  cP=ca*ny-sa*ly;
2893  sP=-sa*ny-ca*ly;
2894  }
2895  c2a=2.*ca*ca-1.;
2896  s2a=2.*ca*sa;
2897  c3a=c2a*ca-s2a*sa;
2898  s3a=c2a*sa+s2a*ca;
2899  c4a=c2a*c2a-s2a*s2a;
2900  s4a=c2a*s2a+s2a*c2a;
2901  c2P=cP*cP-sP*sP;
2902  s2P=2.*cP*sP;
2903  c3P=c2P*cP-s2P*sP;
2904  s3P=c2P*sP+s2P*cP;
2905  c4P=c2P*c2P-s2P*s2P;
2906  s4P=c2P*s2P+s2P*c2P;
2907  c4Pp4a=c4P*c4a-s4P*s4a;
2908  c4Pm4a=c4P*c4a+s4P*s4a;
2909  s4Pp4a=s4P*c4a+c4P*s4a;
2910  s4Pm4a=s4P*c4a-c4P*s4a;
2911  c4Pp3a=c4P*c3a-s4P*s3a;
2912  c4Pm3a=c4P*c3a+s4P*s3a;
2913  s4Pp3a=s4P*c3a+c4P*s3a;
2914  s4Pm3a=s4P*c3a-c4P*s3a;
2915  c4Pp2a=c4P*c2a-s4P*s2a;
2916  c4Pm2a=c4P*c2a+s4P*s2a;
2917  s4Pp2a=s4P*c2a+c4P*s2a;
2918  s4Pm2a=s4P*c2a-c4P*s2a;
2919  c4Ppa=c4P*ca-s4P*sa;
2920  c4Pma=c4P*ca+s4P*sa;
2921  s4Ppa=s4P*ca+c4P*sa;
2922  s4Pma=s4P*ca-c4P*sa;
2923  c3Pp4a=c3P*c4a-s3P*s4a;
2924  c3Pm4a=c3P*c4a+s3P*s4a;
2925  s3Pp4a=s3P*c4a+c3P*s4a;
2926  s3Pm4a=s3P*c4a-c3P*s4a;
2927  c3Pp3a=c3P*c3a-s3P*s3a;
2928  c3Pm3a=c3P*c3a+s3P*s3a;
2929  s3Pp3a=s3P*c3a+c3P*s3a;
2930  s3Pm3a=s3P*c3a-c3P*s3a;
2931  c3Pp2a=c3P*c2a-s3P*s2a;
2932  c3Pm2a=c3P*c2a+s3P*s2a;
2933  s3Pp2a=s3P*c2a+c3P*s2a;
2934  s3Pm2a=s3P*c2a-c3P*s2a;
2935  c3Ppa=c3P*ca-s3P*sa;
2936  c3Pma=c3P*ca+s3P*sa;
2937  s3Ppa=s3P*ca+c3P*sa;
2938  s3Pma=s3P*ca-c3P*sa;
2939  c2Pp4a=c2P*c4a-s2P*s4a;
2940  c2Pm4a=c2P*c4a+s2P*s4a;
2941  s2Pp4a=s2P*c4a+c2P*s4a;
2942  s2Pm4a=s2P*c4a-c2P*s4a;
2943  c2Pp3a=c2P*c3a-s2P*s3a;
2944  c2Pm3a=c2P*c3a+s2P*s3a;
2945  s2Pp3a=s2P*c3a+c2P*s3a;
2946  s2Pm3a=s2P*c3a-c2P*s3a;
2947  c2Pp2a=c2P*c2a-s2P*s2a;
2948  c2Pm2a=c2P*c2a+s2P*s2a;
2949  s2Pp2a=s2P*c2a+c2P*s2a;
2950  s2Pm2a=s2P*c2a-c2P*s2a;
2951  c2Ppa=c2P*ca-s2P*sa;
2952  c2Pma=c2P*ca+s2P*sa;
2953  s2Ppa=s2P*ca+c2P*sa;
2954  s2Pma=s2P*ca-c2P*sa;
2955  cPp4a=cP*c4a-sP*s4a;
2956  cPm4a=cP*c4a+sP*s4a;
2957  sPp4a=sP*c4a+cP*s4a;
2958  sPm4a=sP*c4a-cP*s4a;
2959  cPp3a=cP*c3a-sP*s3a;
2960  cPm3a=cP*c3a+sP*s3a;
2961  sPp3a=sP*c3a+cP*s3a;
2962  sPm3a=sP*c3a-cP*s3a;
2963  cPp2a=cP*c2a-sP*s2a;
2964  cPm2a=cP*c2a+sP*s2a;
2965  sPp2a=sP*c2a+cP*s2a;
2966  sPm2a=sP*c2a-cP*s2a;
2967  cPpa=cP*ca-sP*sa;
2968  cPma=cP*ca+sP*sa;
2969  sPpa=sP*ca+cP*sa;
2970  sPma=sP*ca-cP*sa;
2971 
2972  //Sax=S1xtmp->data->data[idx]-S2xtmp->data->data[idx];
2973  //Ssx=S1xtmp->data->data[idx]+S2xtmp->data->data[idx];
2974  //Say=S1ytmp->data->data[idx]-S2ytmp->data->data[idx];
2975  //Ssy=S1ytmp->data->data[idx]+S2ytmp->data->data[idx];
2976  //Saz=S1ztmp->data->data[idx]-S2ztmp->data->data[idx];
2977  //Ssz=S1ztmp->data->data[idx]+S2ztmp->data->data[idx];
2978 
2979  //l=4, m=4,-4
2980  re4 = -8./9.*amp2*v2*(4.*c4Pm4a*an->siBy2Et + c2Pm4a*an->siBy2Sx*an->ciBy2Sq + c2Pp4a*an->siBy2Sq*an->ciBy2Sx + 4.*c4Pp4a*an->ciBy2Et);
2981  re5 = amp3*v3*dm*an->si*(-9./5.*(c3Pp4a*an->ciBy2Sx + c3Pm4a*an->siBy2Sx) -1./60.*an->siSq*( cPp4a*an->ciBy2Sq + cPm4a*an->siBy2Sq) );
2982  im4 = -8./9.*amp2*v2*(4.*s4Pm4a*an->siBy2Et + s2Pm4a*an->siBy2Sx*an->ciBy2Sq - s2Pp4a*an->siBy2Sq*an->ciBy2Sx - 4.*s4Pp4a*an->ciBy2Et);
2983  im5 = amp3*v3*dm*an->si*( 9./5.*(s3Pp4a*an->ciBy2Sx - s3Pm4a*an->siBy2Sx) +1./60.*an->siSq*( sPp4a*an->ciBy2Sq - sPm4a*an->siBy2Sq) );
2984  h44->data->data[idx] =amp44*v2*( re4+re5+I*( im4+im5));
2985  h4m4->data->data[idx]=amp44*v2*( re4-re5+I*(-im4+im5));
2986 
2987  //l=4, m=3,-3
2988  re4 = 8./9.*amp2*v2*an->si*( 4.*(c4Pm3a*an->siBy2Sx - c4Pp3a*an->ciBy2Sx) + 0.5*(an->siBy2Qu*(0.5+an->ci)*c2Pm3a - an->ciBy2Qu*(0.5-an->ci)*c2Pp3a ) );
2989  re5 = amp3*v3*dm* (9./5.*( an->ciBy2Sx*(-1.5+2.*an->ci)*c3Pp3a + an->siBy2Sx*(1.5+2.*an->ci)*c3Pm3a ) + 1./80.*an->siSq*( cPp3a*(an->ci+1./3.+2./3.*an->c2i) + cPm3a*(an->ci-1./3.-2./3.*an->c2i) ) );
2990  im4 = 8./9.*amp2*v2*an->si*( 4.*(s4Pm3a*an->siBy2Sx + s4Pp3a*an->ciBy2Sx) + 0.5*(an->siBy2Qu*(0.5+an->ci)*s2Pm3a + an->ciBy2Qu*(0.5-an->ci)*s2Pp3a ) );
2991  im5 = amp3*v3*dm* (9./5.*(-an->ciBy2Sx*(-1.5+2.*an->ci)*s3Pp3a + an->siBy2Sx*(1.5+2.*an->ci)*s3Pm3a ) + 1./80.*an->siSq*(-sPp3a*(an->ci+1./3.+2./3.*an->c2i) + sPm3a*(an->ci-1./3.-2./3.*an->c2i) ) );
2992  h43->data->data[idx] =amp44*sqrt(2.)*v2*( re4+re5+I*( im4+im5));
2993  h4m3->data->data[idx]=amp44*sqrt(2.)*v2*(-re4+re5+I*( im4-im5));
2994 
2995  //l=4, m=2,-2
2996  re4 = -1./63.*amp2*v2*( 112.*an->siSq*(c4Pm2a*an->siBy2Qu + c4Pp2a*an->ciBy2Qu ) + an->siBy2Qu*c2Pm2a*2.*(7.*an->c2i+14.*an->ci+9.) + an->ciBy2Qu*c2Pp2a*2.*(7.*an->c2i-14.*an->ci+9.) );
2997  re5 = amp3*v3*dm*an->si*( 9./10.*( c3Pp2a*an->ciBy2Qu*(-1.+2.*an->ci) - c3Pm2a*an->siBy2Qu*(1.+2.*an->ci) ) - 1./70.*( cPp2a*an->ciBy2Sq*(1.-7./6.*an->ci+7./6.*an->c2i) + cPm2a*an->siBy2Sq*(1.+7./6.*an->ci+7./6.*an->c2i) ) );
2998  im4 = -1./63.*amp2*v2*( 112.*an->siSq*(s4Pm2a*an->siBy2Qu - s4Pp2a*an->ciBy2Qu ) + an->siBy2Qu*s2Pm2a*2.*(7.*an->c2i+14.*an->ci+9.) - an->ciBy2Qu*s2Pp2a*2.*(7.*an->c2i-14.*an->ci+9.) );
2999  im5 = amp3*v3*dm*an->si*( 9./10.*( s3Pp2a*an->ciBy2Qu*( 1.-2.*an->ci) - s3Pm2a*an->siBy2Qu*(1.+2.*an->ci) ) + 1./70.*( sPp2a*an->ciBy2Sq*(1.-7./6.*an->ci+7./6.*an->c2i) - sPm2a*an->siBy2Sq*(1.+7./6.*an->ci+7./6.*an->c2i) ) );
3000  h42->data->data[idx] =amp44*sqrt(7.)*v2*( re4+re5+I*( im4+im5));
3001  h4m2->data->data[idx]=amp44*sqrt(7.)*v2*( re4-re5+I*(-im4+im5));
3002 
3003  //l=4, m=1,-1
3004  re4 = amp2*v2/9.*an->si*( 56.*an->siSq*( c4Pma*an->siBy2Sq - c4Ppa*an->ciBy2Sq) + 2.*( c2Pma*an->siBy2Sq*(3.+3.5*an->ci+3.5*an->c2i) - c2Ppa*an->ciBy2Sq*(3.-3.5*an->ci+3.5*an->c2i) ) );
3005  re5 = amp3*v3*dm*( 63./40.*an->siSq*( c3Ppa*an->ciBy2Sq*(-1.+4.*an->ci) + c3Pma*an->siBy2Sq*(1.+4.*an->ci) ) + 1./30.*( cPpa*an->ciBy2Sq*(-15./8.+15./4.*an->ci-21./8.*an->c2i+7./4.*an->c3i) + cPma*an->siBy2Sq*( 15./8.+15./4.*an->ci+21./8.*an->c2i+7./4.*an->c3i) ) );
3006  im4 = amp2*v2/9.*an->si*( 56.*an->siSq*( s4Pma*an->siBy2Sq + s4Ppa*an->ciBy2Sq) + 2.*( s2Pma*an->siBy2Sq*(3.+3.5*an->ci+3.5*an->c2i) + s2Ppa*an->ciBy2Sq*(3.-3.5*an->ci+3.5*an->c2i) ) );
3007  im5 = amp3*v3*dm*( 63./40.*an->siSq*( s3Ppa*an->ciBy2Sq*( 1.-4.*an->ci) + s3Pma*an->siBy2Sq*(1.+4.*an->ci) ) + 1./30.*( sPpa*an->ciBy2Sq*( 15./8.-15./4.*an->ci+21./8.*an->c2i-7./4.*an->c3i) + sPma*an->siBy2Sq*( 15./8.+15./4.*an->ci+21./8.*an->c2i+7./4.*an->c3i) ) );
3008  h41->data->data[idx] =amp44*sqrt(2./7.)*v2*( re4+re5+I*(im4+im5));
3009  h4m1->data->data[idx]=amp44*sqrt(2./7.)*v2*(-re4+re5+I*(im4-im5));
3010 
3011  //l=4, m=0
3012  re4 = -amp2*v2/18.*an->siSq*( 56.*an->siSq*c4P + (5.+7.*an->c2i)*c2P );
3013  re5 = 0.;
3014  im4 = 0.;
3015  im5 = -amp3*v3*dm*an->s2i/40.*( 63.*an->siSq*s3P + (1.+7.*an->c2i)/6.*sP );
3016  h40->data->data[idx]=amp44*sqrt(10./7.)*v2*(re4+re5+I*(im4+im5));
3017 
3018  LALFree(an);
3019  an=NULL;
3020 
3021  }
3022 
3023  /*XLALDestroyREAL8TimeSeries(S1xtmp);
3024  XLALDestroyREAL8TimeSeries(S1ytmp);
3025  XLALDestroyREAL8TimeSeries(S1ztmp);
3026  XLALDestroyREAL8TimeSeries(S2xtmp);
3027  XLALDestroyREAL8TimeSeries(S2ytmp);
3028  XLALDestroyREAL8TimeSeries(S2ztmp);*/
3029 
3030  *h4ms=XLALSphHarmTimeSeriesAddMode(*h4ms, h44, 4, 4);
3032  *h4ms=XLALSphHarmTimeSeriesAddMode(*h4ms, h43, 4, 3);
3034  *h4ms=XLALSphHarmTimeSeriesAddMode(*h4ms, h42, 4, 2);
3036  *h4ms=XLALSphHarmTimeSeriesAddMode(*h4ms, h41, 4, 1);
3038  *h4ms=XLALSphHarmTimeSeriesAddMode(*h4ms, h40, 4, 0);
3040  *h4ms=XLALSphHarmTimeSeriesAddMode(*h4ms, h4m1, 4, -1);
3042  *h4ms=XLALSphHarmTimeSeriesAddMode(*h4ms, h4m2, 4, -2);
3044  *h4ms=XLALSphHarmTimeSeriesAddMode(*h4ms, h4m3, 4, -3);
3046  *h4ms=XLALSphHarmTimeSeriesAddMode(*h4ms, h4m4, 4, -4);
3048 
3049  return XLAL_SUCCESS;
3050 
3051 } /* End of XLALSimSpinInspiralPNMode4m*/
3052 
3053 /** @} */
#define LALMalloc(n)
#define LALFree(p)
#define EPS
int l
Definition: bh_qnmode.c:135
#define LAL_CHECK_VALID_SERIES(s, val)
#define LAL_CHECK_CONSISTENT_TIME_SERIES(s1, s2, val)
const double ny
const double nz
#define __attribute__(x)
#define LAL_C_SI
#define LAL_PI
#define LAL_GAMMA
#define LAL_G_SI
#define crect(re, im)
#define cpolar(r, th)
double complex COMPLEX16
double REAL8
uint32_t UINT4
int32_t INT4
COMPLEX16TimeSeries * XLALSimInspiralPNMode41(REAL8TimeSeries *V, REAL8TimeSeries *Phi, REAL8 UNUSED v0, REAL8 m1, REAL8 m2, REAL8 r, int O)
Computes h(4,1) mode of spherical harmonic decomposition of the post-Newtonian inspiral waveform.
COMPLEX16TimeSeries * XLALSimInspiralPNMode43(REAL8TimeSeries *V, REAL8TimeSeries *Phi, REAL8 UNUSED v0, REAL8 m1, REAL8 m2, REAL8 r, int O)
Computes h(4,3) mode of spherical harmonic decomposition of the post-Newtonian inspiral waveform.
COMPLEX16TimeSeries * XLALSimInspiralPNMode33(REAL8TimeSeries *V, REAL8TimeSeries *Phi, REAL8 v0, REAL8 m1, REAL8 m2, REAL8 r, int O)
Computes h(3,3) mode of spherical harmonic decomposition of the post-Newtonian inspiral waveform.
COMPLEX16TimeSeries * XLALSimInspiralPNMode64(REAL8TimeSeries *V, REAL8TimeSeries *Phi, REAL8 UNUSED v0, REAL8 m1, REAL8 m2, REAL8 r, int O)
Computes h(6,4) mode of spherical harmonic decomposition of the post-Newtonian inspiral waveform.
COMPLEX16TimeSeries * XLALSimInspiralPNMode54(REAL8TimeSeries *V, REAL8TimeSeries *Phi, REAL8 UNUSED v0, REAL8 m1, REAL8 m2, REAL8 r, int O)
Computes h(5,4) mode of spherical harmonic decomposition of the post-Newtonian inspiral waveform.
COMPLEX16TimeSeries * XLALCreateSimInspiralPNModeCOMPLEX16TimeSeries(REAL8TimeSeries *v, REAL8TimeSeries *phi, REAL8 v0, REAL8 m1, REAL8 m2, REAL8 r, int O, int l, int m)
Computes h(l,m) mode timeseries of spherical harmonic decomposition of the post-Newtonian inspiral wa...
COMPLEX16TimeSeries * XLALSimInspiralPNMode55(REAL8TimeSeries *V, REAL8TimeSeries *Phi, REAL8 UNUSED v0, REAL8 m1, REAL8 m2, REAL8 r, int O)
Computes h(5,5) mode of spherical harmonic decomposition of the post-Newtonian inspiral waveform.
INT4 XLALSimInspiralSpinPNMode2m(SphHarmTimeSeries **h2ms, REAL8TimeSeries *V, REAL8TimeSeries *Phi, REAL8TimeSeries *LNhx, REAL8TimeSeries *LNhy, REAL8TimeSeries *LNhz, REAL8TimeSeries *e1x, REAL8TimeSeries *e1y, REAL8TimeSeries *e1z, REAL8TimeSeries *S1x, REAL8TimeSeries *S1y, REAL8TimeSeries *S1z, REAL8TimeSeries *S2x, REAL8TimeSeries *S2y, REAL8TimeSeries *S2z, REAL8 m1, REAL8 m2, REAL8 distance, int ampO)
Computes the 5 l=2 modes of spherical harmonic decomposition of the post-Newtonian inspiral waveform ...
COMPLEX16TimeSeries * XLALSimInspiralPNMode60(REAL8TimeSeries *V, REAL8TimeSeries *Phi, REAL8 UNUSED v0, REAL8 UNUSED m1, REAL8 UNUSED m2, REAL8 UNUSED r, int UNUSED O)
Computes h(6,0) mode of spherical harmonic decomposition of the post-Newtonian inspiral waveform.
COMPLEX16TimeSeries * XLALSimInspiralPNMode44(REAL8TimeSeries *V, REAL8TimeSeries *Phi, REAL8 v0, REAL8 m1, REAL8 m2, REAL8 r, int O)
Computes h(4,4) mode of spherical harmonic decomposition of the post-Newtonian inspiral waveform.
COMPLEX16TimeSeries * XLALSimInspiralPNMode63(REAL8TimeSeries *V, REAL8TimeSeries *Phi, REAL8 UNUSED v0, REAL8 m1, REAL8 m2, REAL8 r, int O)
Computes h(6,3) mode of spherical harmonic decomposition of the post-Newtonian inspiral waveform.
COMPLEX16TimeSeries * XLALSimInspiralPNMode50(REAL8TimeSeries *V, REAL8TimeSeries *Phi, REAL8 UNUSED v0, REAL8 UNUSED m1, REAL8 UNUSED m2, REAL8 UNUSED r, int UNUSED O)
Computes h(5,0) mode of spherical harmonic decomposition of the post-Newtonian inspiral waveform.
COMPLEX16TimeSeries * XLALSimInspiralPNMode42(REAL8TimeSeries *V, REAL8TimeSeries *Phi, REAL8 v0, REAL8 m1, REAL8 m2, REAL8 r, int O)
Computes h(4,2) mode of spherical harmonic decomposition of the post-Newtonian inspiral waveform.
COMPLEX16TimeSeries * XLALSimInspiralPNMode40(REAL8TimeSeries *V, REAL8TimeSeries *Phi, REAL8 UNUSED v0, REAL8 m1, REAL8 m2, REAL8 r, int UNUSED O)
Computes h(4,0) mode of spherical harmonic decomposition of the post-Newtonian inspiral waveform.
COMPLEX16TimeSeries * XLALCreateSimInspiralPNModeCOMPLEX16TimeSeriesLALConvention(REAL8TimeSeries *v, REAL8TimeSeries *phi, REAL8 m1, REAL8 m2, REAL8 r, int O, int l, int m)
Computes h(l,m) mode timeseries of spherical harmonic decomposition of the post-Newtonian inspiral wa...
COMPLEX16TimeSeries * XLALSimInspiralPNMode62(REAL8TimeSeries *V, REAL8TimeSeries *Phi, REAL8 UNUSED v0, REAL8 m1, REAL8 m2, REAL8 r, int O)
Computes h(6,2) mode of spherical harmonic decomposition of the post-Newtonian inspiral waveform.
COMPLEX16TimeSeries * XLALSimInspiralPNMode30(REAL8TimeSeries *V, REAL8TimeSeries *Phi, REAL8 UNUSED v0, REAL8 m1, REAL8 m2, REAL8 r, int O)
Computes h(3,0) mode of spherical harmonic decomposition of the post-Newtonian inspiral waveform.
COMPLEX16TimeSeries * XLALSimInspiralPNMode20(REAL8TimeSeries *V, REAL8TimeSeries *Phi, REAL8 UNUSED v0, REAL8 m1, REAL8 m2, REAL8 r, int UNUSED O)
Computes h(2,0) mode of spherical harmonic decomposition of the post-Newtonian inspiral waveform.
static LALSimInspiralInclAngle * XLALSimInspiralComputeInclAngle(REAL8 ciota)
COMPLEX16TimeSeries * XLALSimInspiralPNMode65(REAL8TimeSeries *V, REAL8TimeSeries *Phi, REAL8 UNUSED v0, REAL8 m1, REAL8 m2, REAL8 r, int O)
Computes h(6,5) mode of spherical harmonic decomposition of the post-Newtonian inspiral waveform.
INT4 XLALSimInspiralSpinPNMode4m(SphHarmTimeSeries **h4ms, REAL8TimeSeries *V, REAL8TimeSeries *Phi, REAL8TimeSeries *LNhx, REAL8TimeSeries *LNhy, REAL8TimeSeries *LNhz, REAL8TimeSeries *e1x, REAL8TimeSeries *e1y, REAL8TimeSeries *e1z, UNUSED REAL8TimeSeries *S1x, UNUSED REAL8TimeSeries *S1y, UNUSED REAL8TimeSeries *S1z, UNUSED REAL8TimeSeries *S2x, UNUSED REAL8TimeSeries *S2y, UNUSED REAL8TimeSeries *S2z, REAL8 m1, REAL8 m2, REAL8 distance, int ampO)
Computes all l=3 modes of spherical harmonic decomposition of the post-Newtonian inspiral waveform fo...
COMPLEX16TimeSeries * XLALSimInspiralPNMode66(REAL8TimeSeries *V, REAL8TimeSeries *Phi, REAL8 UNUSED v0, REAL8 m1, REAL8 m2, REAL8 r, int O)
Computes h(6,6) mode of spherical harmonic decomposition of the post-Newtonian inspiral waveform.
COMPLEX16TimeSeries * XLALSimInspiralPNMode21(REAL8TimeSeries *V, REAL8TimeSeries *Phi, REAL8 v0, REAL8 m1, REAL8 m2, REAL8 r, int O)
Computes h(2,1) mode of spherical harmonic decomposition of the post-Newtonian inspiral waveform.
COMPLEX16TimeSeries * XLALSimInspiralPNMode61(REAL8TimeSeries *V, REAL8TimeSeries *Phi, REAL8 UNUSED v0, REAL8 m1, REAL8 m2, REAL8 r, int O)
Computes h(6,1) mode of spherical harmonic decomposition of the post-Newtonian inspiral waveform.
INT4 XLALSimInspiralSpinPNMode3m(SphHarmTimeSeries **h3ms, REAL8TimeSeries *V, REAL8TimeSeries *Phi, REAL8TimeSeries *LNhx, REAL8TimeSeries *LNhy, REAL8TimeSeries *LNhz, REAL8TimeSeries *e1x, REAL8TimeSeries *e1y, REAL8TimeSeries *e1z, REAL8TimeSeries *S1x, REAL8TimeSeries *S1y, REAL8TimeSeries *S1z, REAL8TimeSeries *S2x, REAL8TimeSeries *S2y, REAL8TimeSeries *S2z, REAL8 m1, REAL8 m2, REAL8 distance, int ampO)
Computes all l=3 modes of spherical harmonic decomposition of the post-Newtonian inspiral waveform fo...
COMPLEX16TimeSeries * XLALSimInspiralPNMode31(REAL8TimeSeries *V, REAL8TimeSeries *Phi, REAL8 v0, REAL8 m1, REAL8 m2, REAL8 r, int O)
Computes h(3,1) mode of spherical harmonic decomposition of the post-Newtonian inspiral waveform.
COMPLEX16TimeSeries * XLALSimInspiralPNMode32(REAL8TimeSeries *V, REAL8TimeSeries *Phi, REAL8 v0, REAL8 m1, REAL8 m2, REAL8 r, int O)
Computes h(3,2) mode of spherical harmonic decomposition of the post-Newtonian inspiral waveform.
COMPLEX16TimeSeries * XLALSimInspiralPNMode51(REAL8TimeSeries *V, REAL8TimeSeries *Phi, REAL8 UNUSED v0, REAL8 m1, REAL8 m2, REAL8 r, int O)
Computes h(5,1) mode of spherical harmonic decomposition of the post-Newtonian inspiral waveform.
COMPLEX16TimeSeries * XLALSimInspiralPNMode22(REAL8TimeSeries *V, REAL8TimeSeries *Phi, REAL8 v0, REAL8 m1, REAL8 m2, REAL8 r, int O)
Computes h(2,2) mode of spherical harmonic decomposition of the post-Newtonian inspiral waveform.
COMPLEX16TimeSeries * XLALSimInspiralPNMode52(REAL8TimeSeries *V, REAL8TimeSeries *Phi, REAL8 UNUSED v0, REAL8 m1, REAL8 m2, REAL8 r, int O)
Computes h(5,2) mode of spherical harmonic decomposition of the post-Newtonian inspiral waveform.
COMPLEX16TimeSeries * XLALSimInspiralPNMode53(REAL8TimeSeries *V, REAL8TimeSeries *Phi, REAL8 UNUSED v0, REAL8 m1, REAL8 m2, REAL8 r, int O)
Computes h(5,3) mode of spherical harmonic decomposition of the post-Newtonian inspiral waveform.
SphHarmTimeSeries * XLALSphHarmTimeSeriesAddMode(SphHarmTimeSeries *appended, const COMPLEX16TimeSeries *inmode, UINT4 l, INT4 m)
Prepend a node to a linked list of SphHarmTimeSeries, or create a new head.
static const INT4 r
static const INT4 m
REAL8TimeSeries * XLALCreateREAL8TimeSeries(const CHAR *name, const LIGOTimeGPS *epoch, REAL8 f0, REAL8 deltaT, const LALUnit *sampleUnits, size_t length)
void XLALDestroyCOMPLEX16TimeSeries(COMPLEX16TimeSeries *series)
void XLALDestroyREAL8TimeSeries(REAL8TimeSeries *series)
COMPLEX16TimeSeries * XLALCreateCOMPLEX16TimeSeries(const CHAR *name, const LIGOTimeGPS *epoch, REAL8 f0, REAL8 deltaT, const LALUnit *sampleUnits, size_t length)
const LALUnit lalStrainUnit
const LALUnit lalDimensionlessUnit
#define XLAL_ERROR_NULL(...)
#define XLAL_ERROR(...)
int XLALPrintError(const char *fmt,...) _LAL_GCC_PRINTF_FORMAT_(1
XLAL_SUCCESS
XLAL_EFUNC
XLAL_EINVAL
XLAL_FAILURE
list mu
COMPLEX16Sequence * data
COMPLEX16 * data
Utility type and function to compute trigonometric functions from the cosine of an angle.
REAL8Sequence * data
REAL8 * data
Structure to carry a collection of spherical harmonic modes in COMPLEX16 time series.
double V
Definition: unicorn.c:25