From d2bebaa1f91c9b3e46297c51e64b50aa93563f3a Mon Sep 17 00:00:00 2001
From: Aaron LI <aly@aaronly.me>
Date: Thu, 17 Jan 2019 15:19:44 +0800
Subject: clusters/main: Account for baryon fraction in _simulate_mergers()

---
 fg21sim/extragalactic/clusters/main.py | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

(limited to 'fg21sim')

diff --git a/fg21sim/extragalactic/clusters/main.py b/fg21sim/extragalactic/clusters/main.py
index 52e179c..8affc6c 100644
--- a/fg21sim/extragalactic/clusters/main.py
+++ b/fg21sim/extragalactic/clusters/main.py
@@ -225,13 +225,14 @@ class GalaxyClusters:
         logger.info("Simulating merger histories for each cluster ...")
         num = len(self.catalog)
         num_hasmerger = 0
+        fdm = 1 - COSMO.baryon_fraction
         for i, cdict in enumerate(self.catalog):
             ii = i + 1
             if ii % 100 == 0:
                 logger.info("[%d/%d] %.1f%% ..." % (ii, num, 100*ii/num))
             z0, M0, age0 = cdict["z"], cdict["mass"], cdict["age"]
             zmax = COSMO.redshift(age0 - self.time_traceback)
-            clform = ClusterFormation(M0=M0, z0=z0, zmax=zmax,
+            clform = ClusterFormation(M0=M0*fdm, z0=z0, zmax=zmax,
                                       merger_mass_min=self.merger_mass_min)
             clform.simulate_mtree(main_only=True)
             mergers = clform.mergers()
@@ -239,8 +240,8 @@ class GalaxyClusters:
                 num_hasmerger += 1
                 cdict.update([
                     ("merger_num",   len(mergers)),
-                    ("merger_mass1", [ev["M_main"] for ev in mergers]),
-                    ("merger_mass2", [ev["M_sub"] for ev in mergers]),
+                    ("merger_mass1", [ev["M_main"]/fdm for ev in mergers]),
+                    ("merger_mass2", [ev["M_sub"]/fdm for ev in mergers]),
                     ("merger_z",     [ev["z"] for ev in mergers]),
                     ("merger_age",   [ev["age"] for ev in mergers]),
                 ])
-- 
cgit v1.2.2