Skip to content

Commit 891e76d

Browse files
author
Ilya Mandel
committed
Fix for issue #1380
1 parent 62110b9 commit 891e76d

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

src/HG.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -134,9 +134,9 @@ double HG::CalculateLambdaLoveridge(const double p_EnvMass, const bool p_IsMassL
134134
logBindingEnergy += 33.29866; // + logBE0
135135
double bindingEnergy = PPOW(10.0, logBindingEnergy);
136136

137-
return utils::Compare(bindingEnergy, 0.0) > 0 && utils::Compare(p_EnvMass, 0.0) > 0
138-
? (G_CGS * m_Mass * MSOL_TO_G * p_EnvMass * MSOL_TO_G) / (m_Radius * RSOL_TO_AU * AU_TO_CM * bindingEnergy)
139-
: 1.0; // default to 1.0 (usual lambda default) if binding energy is not sensible [should never happen] or if envelope mass is not positive [can be zero]
137+
return utils::Compare(bindingEnergy, 0.0) > 0 && utils::Compare(1.0 / bindingEnergy, 0.0) > 0.0 && utils::Compare(p_EnvMass, 0.0) > 0
138+
? (G_CGS * m_Mass * MSOL_TO_G * p_EnvMass * MSOL_TO_G) / (m_Radius * RSOL_TO_AU * AU_TO_CM * bindingEnergy)
139+
: 1.0; // default to 1.0 (usual lambda default) if binding energy is not sensible [sometimes can be infinite if logBindingEnergy is too high] or if envelope mass is not positive [can be zero]
140140
}
141141

142142

src/changelog.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1543,7 +1543,9 @@
15431543
// 03.18.02 IM - May 1, 2025 - Enhancement:
15441544
// - Added several outputs to the BSE and SSE Switch logs necessary for inter-run post-processing comparisons
15451545
// - Changed the default behaviour to use enhanced Nanjing lambdas (for common envelope calculations), interpolating in mass and metallicity
1546+
// 03.18.03 IM - May 2, 2025 - Defect repair:
1547+
// - Fix for issue #1380, which appears when the Loveridge binding energy is so high that lambda is rounded off to zero
15461548

1547-
const std::string VERSION_STRING = "03.18.02";
1549+
const std::string VERSION_STRING = "03.18.03";
15481550

15491551
# endif // __changelog_h__

0 commit comments

Comments
 (0)