kima 6.4.2__cp315-cp315-win_amd64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- kima/AMDstability.cp315-win_amd64.pyd +0 -0
- kima/AMDstability.cpp +292 -0
- kima/AMDstability.h +44 -0
- kima/ApodizedRVmodel.cp315-win_amd64.pyd +0 -0
- kima/ApodizedRVmodel.cpp +1295 -0
- kima/ApodizedRVmodel.h +260 -0
- kima/ApodizedRVmodel.pyi +290 -0
- kima/BINARIESmodel.cp315-win_amd64.pyd +0 -0
- kima/BINARIESmodel.cpp +1311 -0
- kima/BINARIESmodel.h +200 -0
- kima/BINARIESmodel.pyi +298 -0
- kima/ConditionalPrior.cp315-win_amd64.pyd +0 -0
- kima/ConditionalPrior.cpp +977 -0
- kima/ConditionalPrior.h +381 -0
- kima/Data.cp315-win_amd64.pyd +0 -0
- kima/Data.cpp +1816 -0
- kima/Data.h +603 -0
- kima/Data.pyi +514 -0
- kima/ETVmodel.cp315-win_amd64.pyd +0 -0
- kima/ETVmodel.cpp +617 -0
- kima/ETVmodel.h +156 -0
- kima/ETVmodel.pyi +204 -0
- kima/GAIAmodel.cp315-win_amd64.pyd +0 -0
- kima/GAIAmodel.cpp +1262 -0
- kima/GAIAmodel.h +239 -0
- kima/GAIAmodel.pyi +447 -0
- kima/GP.cp315-win_amd64.pyd +0 -0
- kima/GP.cpp +599 -0
- kima/GP.h +394 -0
- kima/GPmodel.cp315-win_amd64.pyd +0 -0
- kima/GPmodel.cpp +1555 -0
- kima/GPmodel.h +258 -0
- kima/GPmodel.pyi +326 -0
- kima/OutlierRVmodel.cp315-win_amd64.pyd +0 -0
- kima/OutlierRVmodel.cpp +840 -0
- kima/OutlierRVmodel.h +175 -0
- kima/OutlierRVmodel.pyi +138 -0
- kima/RVFWHMRHKmodel.cp315-win_amd64.pyd +0 -0
- kima/RVFWHMRHKmodel.cpp +1725 -0
- kima/RVFWHMRHKmodel.h +287 -0
- kima/RVFWHMRHKmodel.pyi +350 -0
- kima/RVFWHMmodel.cp315-win_amd64.pyd +0 -0
- kima/RVFWHMmodel.cpp +1501 -0
- kima/RVFWHMmodel.h +269 -0
- kima/RVFWHMmodel.pyi +336 -0
- kima/RVGAIAmodel.cp315-win_amd64.pyd +0 -0
- kima/RVGAIAmodel.cpp +1716 -0
- kima/RVGAIAmodel.h +287 -0
- kima/RVGAIAmodel.pyi +473 -0
- kima/RVHGPMmodel.cp315-win_amd64.pyd +0 -0
- kima/RVHGPMmodel.cpp +1534 -0
- kima/RVHGPMmodel.h +317 -0
- kima/RVHGPMmodel.pyi +435 -0
- kima/RVmodel.cp315-win_amd64.pyd +0 -0
- kima/RVmodel.cpp +1638 -0
- kima/RVmodel.h +307 -0
- kima/RVmodel.pyi +444 -0
- kima/SPLEAFmodel.cp315-win_amd64.pyd +0 -0
- kima/SPLEAFmodel.cpp +1480 -0
- kima/SPLEAFmodel.h +242 -0
- kima/SPLEAFmodel.pyi +267 -0
- kima/Sampler.cp315-win_amd64.pyd +0 -0
- kima/Sampler.pyi +87 -0
- kima/TRANSITmodel.cp315-win_amd64.pyd +0 -0
- kima/TRANSITmodel.cpp +642 -0
- kima/TRANSITmodel.h +168 -0
- kima/TRANSITmodel.pyi +216 -0
- kima/__init__.py +257 -0
- kima/_run_doc.py +34 -0
- kima/bessel-library.cpp +11008 -0
- kima/bessel-library.hpp +176 -0
- kima/default_priors.cp315-win_amd64.pyd +0 -0
- kima/default_priors.cpp +128 -0
- kima/default_priors.h +33 -0
- kima/distributions/BivariateGaussian.cpp +30 -0
- kima/distributions/BivariateGaussian.h +35 -0
- kima/distributions/ExponentialRayleighMixture.cpp +54 -0
- kima/distributions/ExponentialRayleighMixture.h +38 -0
- kima/distributions/Gamma.cpp +50 -0
- kima/distributions/Gamma.h +33 -0
- kima/distributions/GaussianMixture.cpp +55 -0
- kima/distributions/GaussianMixture.h +53 -0
- kima/distributions/InverseGamma.cpp +42 -0
- kima/distributions/InverseGamma.h +32 -0
- kima/distributions/InverseMoment.cpp +50 -0
- kima/distributions/InverseMoment.h +32 -0
- kima/distributions/PowerLaw.cpp +38 -0
- kima/distributions/PowerLaw.h +57 -0
- kima/distributions/Sine.cpp +36 -0
- kima/distributions/Sine.h +32 -0
- kima/distributions/SpikeAndSlab.cpp +60 -0
- kima/distributions/SpikeAndSlab.h +44 -0
- kima/distributions.cp315-win_amd64.pyd +0 -0
- kima/distributions.cpp +681 -0
- kima/distributions.h +24 -0
- kima/distributions.pyi +1368 -0
- kima/examples/BL2009/BL2009_dataset1.rv +34 -0
- kima/examples/BL2009/BL2009_dataset2.rv +34 -0
- kima/examples/BL2009/__init__.py +50 -0
- kima/examples/CoRoT7/__init__.py +44 -0
- kima/examples/CoRoT7/corot7.txt +179 -0
- kima/examples/GaiaBH3/GAIA/__init__.py +84 -0
- kima/examples/GaiaBH3/GAIA_free/__init__.py +72 -0
- kima/examples/GaiaBH3/Gaia_RVs_BH3.rdb +19 -0
- kima/examples/GaiaBH3/Gaia_astrometry_BH3.gaia +73 -0
- kima/examples/GaiaBH3/RVGAIA/__init__.py +82 -0
- kima/examples/GaiaBH3/__init__.py +15 -0
- kima/examples/Kepler16/Kepler16.rdb +142 -0
- kima/examples/Kepler16/__init__.py +56 -0
- kima/examples/TIC172900988/SOPHIE.rv +63 -0
- kima/examples/TIC172900988/__init__.py +104 -0
- kima/examples/_51Peg/51Peg.rv +256 -0
- kima/examples/_51Peg/__init__.py +42 -0
- kima/examples/__init__.py +20 -0
- kima/examples/multi_instruments/HD106252_ELODIE.txt +42 -0
- kima/examples/multi_instruments/HD106252_HET.txt +45 -0
- kima/examples/multi_instruments/HD106252_HJS.txt +14 -0
- kima/examples/multi_instruments/HD106252_Lick.txt +17 -0
- kima/examples/multi_instruments/HD106252_joined.txt +111 -0
- kima/examples/multi_instruments/__init__.py +65 -0
- kima/examples/trend/__init__.py +88 -0
- kima/kepler.cp315-win_amd64.pyd +0 -0
- kima/kepler.cpp +1451 -0
- kima/kepler.h +116 -0
- kima/kepler.pyi +136 -0
- kima/kmath.cp315-win_amd64.pyd +0 -0
- kima/kmath.cpp +66 -0
- kima/kmath.h +16 -0
- kima/nb_shared.h +17 -0
- kima/postkepler.cp315-win_amd64.pyd +0 -0
- kima/postkepler.cpp +469 -0
- kima/postkepler.h +49 -0
- kima/postkepler.pyi +5 -0
- kima/py.typed +0 -0
- kima/pykima/GP.py +1074 -0
- kima/pykima/__init__.py +0 -0
- kima/pykima/analysis.py +2083 -0
- kima/pykima/classic.py +594 -0
- kima/pykima/cli.py +116 -0
- kima/pykima/crossing_orbits.py +176 -0
- kima/pykima/display.py +6010 -0
- kima/pykima/display_hooks.py +118 -0
- kima/pykima/loading.py +111 -0
- kima/pykima/results.py +4895 -0
- kima/pykima/showresults.py +525 -0
- kima/pykima/utils.py +1660 -0
- kima/pykima/version.py +2 -0
- kima/run.cpp +161 -0
- kima/transits.cp315-win_amd64.pyd +0 -0
- kima/transits.cpp +325 -0
- kima/transits.h +29 -0
- kima/utils.h +158 -0
- kima-6.4.2.dist-info/DELVEWHEEL +2 -0
- kima-6.4.2.dist-info/METADATA +69 -0
- kima-6.4.2.dist-info/RECORD +160 -0
- kima-6.4.2.dist-info/WHEEL +5 -0
- kima-6.4.2.dist-info/entry_points.txt +4 -0
- kima-6.4.2.dist-info/licenses/LICENSE +21 -0
- kima.libs/msvcp140-a4c2229bdc2a2a630acdc095b4d86008.dll +0 -0
- kima.libs/msvcp140_2-fe68f6b61d8de0f75e5717671051586a.dll +0 -0
|
Binary file
|
kima/AMDstability.cpp
ADDED
|
@@ -0,0 +1,292 @@
|
|
|
1
|
+
#include "AMDstability.h"
|
|
2
|
+
|
|
3
|
+
#define DEBUG false
|
|
4
|
+
|
|
5
|
+
namespace AMD
|
|
6
|
+
{
|
|
7
|
+
/**
|
|
8
|
+
* Returns the indices that would sort an array.
|
|
9
|
+
* @param array input array
|
|
10
|
+
* @return indices w.r.t sorted array
|
|
11
|
+
*/
|
|
12
|
+
vector<size_t> argsort(const vd &array) {
|
|
13
|
+
vector<size_t> indices(array.size());
|
|
14
|
+
iota(indices.begin(), indices.end(), 0);
|
|
15
|
+
sort(indices.begin(), indices.end(),
|
|
16
|
+
[&array](size_t left, size_t right) -> bool {
|
|
17
|
+
// sort indices according to corresponding array element
|
|
18
|
+
return array[left] < array[right];
|
|
19
|
+
});
|
|
20
|
+
return indices;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
int AMD_stable(const vector<vd>& components, double star_mass)
|
|
24
|
+
{
|
|
25
|
+
//? order of parameters: P, K, φ, ecc, w
|
|
26
|
+
size_t NP = components.size();
|
|
27
|
+
int is_stable = 0; // system is stable if is_stable=0
|
|
28
|
+
|
|
29
|
+
vd periods(NP), masses(NP), sma(NP), eccentricities(NP), incs(NP);
|
|
30
|
+
|
|
31
|
+
for (size_t i = 0; i < NP; i++)
|
|
32
|
+
periods[i] = components[i][0];
|
|
33
|
+
|
|
34
|
+
auto indices = argsort(periods);
|
|
35
|
+
|
|
36
|
+
int j = 0;
|
|
37
|
+
for (auto i : indices)
|
|
38
|
+
{
|
|
39
|
+
double P = components[i][0];
|
|
40
|
+
double K = components[i][1];
|
|
41
|
+
double ecc = components[i][3];
|
|
42
|
+
double m; // [Mjup]
|
|
43
|
+
m = 4.919e-3 * pow(star_mass, 2./3) * pow(P, 1./3) * K * sqrt(1 - ecc*ecc);
|
|
44
|
+
m = m * mjup2msun; // [Msun]
|
|
45
|
+
m = m / star_mass; // planet/star mass ratio
|
|
46
|
+
|
|
47
|
+
double a; // [AU]
|
|
48
|
+
a = G13 * pow(star_mass, 1./3) * pow(P / (2 * M_PI), 2./3);
|
|
49
|
+
|
|
50
|
+
#if DEBUG
|
|
51
|
+
cout << "P: " << P << "\t" << "K: " << K << '\t';
|
|
52
|
+
cout << "e: " << ecc << "\t" << "a: " << a << '\t' << "mass: " << m;
|
|
53
|
+
cout << endl;
|
|
54
|
+
#endif
|
|
55
|
+
|
|
56
|
+
masses[j] = m;
|
|
57
|
+
sma[j] = a;
|
|
58
|
+
eccentricities[j] = ecc;
|
|
59
|
+
incs[j] = 0.0;
|
|
60
|
+
j += 1;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
auto Lambda = am_circular(masses, sma);
|
|
64
|
+
double AMD = total_AMD_system(masses, sma, eccentricities, incs);
|
|
65
|
+
#if DEBUG
|
|
66
|
+
cout << "total AMD: " << AMD << '\t' << "Lambda: ";
|
|
67
|
+
for (auto l: Lambda)
|
|
68
|
+
cout << l << '\t';
|
|
69
|
+
cout << endl;
|
|
70
|
+
#endif
|
|
71
|
+
|
|
72
|
+
// Can planet 1 collide with the star?
|
|
73
|
+
if (AMD > Lambda[0])
|
|
74
|
+
return COLLISION;
|
|
75
|
+
|
|
76
|
+
for (size_t k = 1; k < NP; k++)
|
|
77
|
+
{
|
|
78
|
+
double Cx = AMD / Lambda[k];
|
|
79
|
+
is_stable = AMD_stability_pair(masses[k-1], masses[k],
|
|
80
|
+
sma[k-1], sma[k], Cx);
|
|
81
|
+
if (is_stable != 0)
|
|
82
|
+
return is_stable;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
return is_stable;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/*
|
|
89
|
+
Compute the total AMD of a system.
|
|
90
|
+
@param μ : list of planet/star mass ratios
|
|
91
|
+
@param a : list of semimajor axes
|
|
92
|
+
@param e : list of eccentricities
|
|
93
|
+
@param i : list of mutual inclinations (in radians)
|
|
94
|
+
Note: μ and a must be sorted from innermost to outermost planet
|
|
95
|
+
@return AMD : the total AMD of the system.
|
|
96
|
+
*/
|
|
97
|
+
double total_AMD_system(vd mu, vd a, vd e, vd i)
|
|
98
|
+
{
|
|
99
|
+
auto Lambda = am_circular(mu, a);
|
|
100
|
+
double AMD = 0.0;
|
|
101
|
+
for (size_t k=0; k<mu.size(); k++)
|
|
102
|
+
AMD += Lambda[k] * (1 - sqrt((1 - e[k]) * (1 + e[k])) * cos(i[k]));
|
|
103
|
+
return AMD;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
vd am_circular(vd mu, vd a)
|
|
107
|
+
{
|
|
108
|
+
vd amc(mu.size());
|
|
109
|
+
for (size_t i = 0; i < mu.size(); i++)
|
|
110
|
+
amc[i] = mu[i] * sqrt(a[i]);
|
|
111
|
+
return amc;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
/*
|
|
116
|
+
Determines the AMD stability of a pair of planets using the collision
|
|
117
|
+
condition and the MMR overlap conditions of Laskar & Petit (2017) and
|
|
118
|
+
Petit & Laskar (2017).
|
|
119
|
+
|
|
120
|
+
@param μ1 Planet/star mass ratio of inner planet
|
|
121
|
+
@param μ2 Planet/star mass ratio of outer planet
|
|
122
|
+
@param a1 Semimajor axis of inner planet
|
|
123
|
+
@param a2 Semimajor axis of outer planet
|
|
124
|
+
@param Cx Relative AMD (Eq. 29 of Laskar & Petit 2017)
|
|
125
|
+
|
|
126
|
+
@return stable
|
|
127
|
+
STABLE AMD stable
|
|
128
|
+
COLLISION Fails collision condition
|
|
129
|
+
MMR_CIRCULAR Fails MMR overlap condition for circular orbits
|
|
130
|
+
MMR_ECCENTRIC Fails MMR overlap condition for eccentric orbits
|
|
131
|
+
*/
|
|
132
|
+
int AMD_stability_pair(double mu1, double mu2, double a1, double a2, double Cx)
|
|
133
|
+
{
|
|
134
|
+
double y = mu1 / mu2;
|
|
135
|
+
double a = a1 / a2;
|
|
136
|
+
double e = mu1 + mu2; // Equation 4 of Petit, Laskar, & Boue 2017
|
|
137
|
+
|
|
138
|
+
// Equation 76 and Section 3.6 of Petit, Laskar, & Boue 2017
|
|
139
|
+
double a_crit = 1 - 1.46 * pow(e, 2./7);
|
|
140
|
+
if (a > a_crit) // fails MMR circular
|
|
141
|
+
return MMR_CIRCULAR;
|
|
142
|
+
|
|
143
|
+
// Relative AMD from collision condition (Laskar & Petit 2017)
|
|
144
|
+
double C_coll = relative_AMD_collision(mu1, mu2, a1, a2);
|
|
145
|
+
|
|
146
|
+
// Relative AMD from MMR overlap condition (Petit, Laskar, & Boue 2017)
|
|
147
|
+
double C_mmr = relative_AMD_MMR_overlap(mu1, mu2, a1, a2);
|
|
148
|
+
|
|
149
|
+
#if DEBUG
|
|
150
|
+
cout << "C_coll: " << C_coll << '\t' << "C_mmr: " << C_mmr << endl;
|
|
151
|
+
#endif
|
|
152
|
+
|
|
153
|
+
// Final result
|
|
154
|
+
double C_crit = min(C_coll, C_mmr);
|
|
155
|
+
double ratio = Cx / C_crit;
|
|
156
|
+
if (Cx < C_crit)
|
|
157
|
+
return STABLE;
|
|
158
|
+
else if (C_coll < C_mmr)
|
|
159
|
+
return COLLISION;
|
|
160
|
+
else
|
|
161
|
+
return MMR_ECCENTRIC;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
/*
|
|
166
|
+
# Compute the critical (minimum) relative AMD for collision, based on Equations 29 & 39 in Laskar & Petit (2017).
|
|
167
|
+
# # Arguments:
|
|
168
|
+
# - `μ1`: planet/star mass ratio of inner planet.
|
|
169
|
+
# - `μ2`: planet/star mass ratio of outer planet.
|
|
170
|
+
# - `a1`: semimajor axis of inner planet.
|
|
171
|
+
# - `a2`: semimajor axis of outer planet.
|
|
172
|
+
# # Returns:
|
|
173
|
+
# - `C_coll::Float64`: critical relative AMD for collision.
|
|
174
|
+
*/
|
|
175
|
+
double relative_AMD_collision(double mu1, double mu2, double a1, double a2)
|
|
176
|
+
{
|
|
177
|
+
double y = mu1 / mu2;
|
|
178
|
+
double a = a1 / a2;
|
|
179
|
+
|
|
180
|
+
double e1 = critical_eccentricity(y, a);
|
|
181
|
+
double e2 = 1 - a - a * e1;
|
|
182
|
+
double C_coll = y * sqrt(a) * (1 - sqrt((1 - e1) * (1 + e1))) + (1 - sqrt((1 - e2) * (1 + e2)));
|
|
183
|
+
return C_coll;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
|
|
187
|
+
/*
|
|
188
|
+
# Finds the root of F(e,γ,α) from Equation 35 of Laskar & Petit (2017).
|
|
189
|
+
# INPUT:
|
|
190
|
+
# γ m_in / m_out ; planet-planet mass ratio.
|
|
191
|
+
# α a_in / a_out ; semimajor axis ratio
|
|
192
|
+
# [tol] Tolenrance (default: 1e-15)
|
|
193
|
+
# OUTPUT: Critical eccentricity of the inner planet.
|
|
194
|
+
*/
|
|
195
|
+
double critical_eccentricity(double y, double a)
|
|
196
|
+
{
|
|
197
|
+
double tol = 1e-15;
|
|
198
|
+
|
|
199
|
+
// Find the root of F() by Newton's method + bisection
|
|
200
|
+
double eR, FR, eL, FL, ex;
|
|
201
|
+
double e0 = 0.5; // Initial guess
|
|
202
|
+
double F0 = F(e0, y, a);
|
|
203
|
+
|
|
204
|
+
if (F0 >= 0)
|
|
205
|
+
{
|
|
206
|
+
eR = e0;
|
|
207
|
+
FR = F0;
|
|
208
|
+
eL = 0.0;
|
|
209
|
+
ex = 0.0;
|
|
210
|
+
FL = F(eL, y, a);
|
|
211
|
+
}
|
|
212
|
+
else
|
|
213
|
+
{
|
|
214
|
+
eL = e0;
|
|
215
|
+
FL = F0;
|
|
216
|
+
eR = 1.0;
|
|
217
|
+
ex = 1.0;
|
|
218
|
+
FR = F(eR, y, a);
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
while (std::abs(ex - e0) > tol)
|
|
222
|
+
{
|
|
223
|
+
// Try a Newton step first
|
|
224
|
+
ex = e0 - F0 / dFde(e0, y, a);
|
|
225
|
+
if ((ex <= eL) | (ex >= eR))
|
|
226
|
+
{
|
|
227
|
+
// Newton's method jumped out of the interval.
|
|
228
|
+
// Switch to linear interpolation.
|
|
229
|
+
double m = (FR - FL) / (eR - eL);
|
|
230
|
+
double b = F0 - m * e0;
|
|
231
|
+
ex = -b / m;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
// Swap and update
|
|
235
|
+
swap(ex, e0);
|
|
236
|
+
F0 = F(e0, y, a);
|
|
237
|
+
|
|
238
|
+
if (F0 >= 0)
|
|
239
|
+
{
|
|
240
|
+
eR = e0;
|
|
241
|
+
FR = F0;
|
|
242
|
+
}
|
|
243
|
+
else
|
|
244
|
+
{
|
|
245
|
+
eL = e0;
|
|
246
|
+
FL = F0;
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
return ex;
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
|
|
253
|
+
// F(e,γ,α) from Equation 35 of Laskar & Petit (2017)
|
|
254
|
+
double F(double e, double y, double a)
|
|
255
|
+
{
|
|
256
|
+
return a * e + y * e / sqrt(a * (1 - e) * (1 + e) + y*y * e*e) - 1.0 + a;
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
// dF/de from Equation 36 of Laskar & Petit (2017). dF/de > 0 always
|
|
260
|
+
double dFde(double e, double y, double a)
|
|
261
|
+
{
|
|
262
|
+
return a + a * y / pow(a * (1 - e) * (1 + e) + y*y * e*e, 1.5);
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
/*
|
|
266
|
+
# relative_AMD_MMR_overlap(μ1, μ2, a1, a2)
|
|
267
|
+
# Compute the critical (minimum) relative AMD for MMR overlap, based on Equation 74 in Petit, Laskar, & Boue (2017).
|
|
268
|
+
# # Arguments:
|
|
269
|
+
# - `μ1`: planet/star mass ratio of inner planet.
|
|
270
|
+
# - `μ2`: planet/star mass ratio of outer planet.
|
|
271
|
+
# - `a1`: semimajor axis of inner planet.
|
|
272
|
+
# - `a2`: semimajor axis of outer planet.
|
|
273
|
+
# # Returns:
|
|
274
|
+
# - `C_mmr::Float64`: critical relative AMD for MMR overlap.
|
|
275
|
+
*/
|
|
276
|
+
double relative_AMD_MMR_overlap(double mu1, double mu2, double a1, double a2)
|
|
277
|
+
{
|
|
278
|
+
double y = mu1 / mu2;
|
|
279
|
+
double a = a1 / a2;
|
|
280
|
+
double e = mu1 + mu2;
|
|
281
|
+
double r = 0.80199; // Equation 28 of Petit, Laskar, & Boue (2017)
|
|
282
|
+
|
|
283
|
+
double g = ( (81 * pow(1 - a, 5)) / (512 * r * e)) - ((32 * r * e) / (9 * pow(1 - a, 2)));
|
|
284
|
+
double C_mmr = (g*g * y * sqrt(a)) / (2 + 2 * y * sqrt(a));
|
|
285
|
+
return C_mmr;
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
NB_MODULE(AMDstability, m) {
|
|
291
|
+
m.def("AMD_stable", &AMD::AMD_stable);
|
|
292
|
+
}
|
kima/AMDstability.h
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
#pragma once
|
|
2
|
+
|
|
3
|
+
#include <cmath>
|
|
4
|
+
#include <iostream>
|
|
5
|
+
#include <vector>
|
|
6
|
+
#include <algorithm>
|
|
7
|
+
#include <numeric>
|
|
8
|
+
|
|
9
|
+
// for nanobind
|
|
10
|
+
#include <nanobind/nanobind.h>
|
|
11
|
+
#include <nanobind/stl/vector.h>
|
|
12
|
+
namespace nb = nanobind;
|
|
13
|
+
using namespace nb::literals;
|
|
14
|
+
|
|
15
|
+
// gravitational constant G in AU**3 / (Msun * day**2), to the power of 1/3
|
|
16
|
+
#define G13 0.0666378476025686
|
|
17
|
+
// 1 Jupiter mass in Earth masses
|
|
18
|
+
#define mjup2mearth 317.8284065946748
|
|
19
|
+
// 1 Jupiter mass in solar masses
|
|
20
|
+
#define mjup2msun 0.0009545942339693249
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
#define STABLE 0
|
|
24
|
+
#define COLLISION 1
|
|
25
|
+
#define MMR_CIRCULAR 2
|
|
26
|
+
#define MMR_ECCENTRIC 3
|
|
27
|
+
|
|
28
|
+
using namespace std;
|
|
29
|
+
|
|
30
|
+
typedef vector<double> vd;
|
|
31
|
+
|
|
32
|
+
namespace AMD
|
|
33
|
+
{
|
|
34
|
+
vector<size_t> argsort(const vd &array);
|
|
35
|
+
int AMD_stable(const vector<vd>& components, double star_mass=1.0);
|
|
36
|
+
double total_AMD_system(vd mu, vd a, vd e, vd i);
|
|
37
|
+
vd am_circular(vd mu, vd a);
|
|
38
|
+
int AMD_stability_pair(double mu1, double mu2, double a1, double a2, double Cx);
|
|
39
|
+
double relative_AMD_collision(double mu1, double mu2, double a1, double a2);
|
|
40
|
+
double critical_eccentricity(double y, double a);
|
|
41
|
+
inline double F(double e, double y, double a);
|
|
42
|
+
inline double dFde(double e, double y, double a);
|
|
43
|
+
double relative_AMD_MMR_overlap(double mu1, double mu2, double a1, double a2);
|
|
44
|
+
}
|
|
Binary file
|