From 361fe63c35f541cf5379e8d58fe0351f69f420ff Mon Sep 17 00:00:00 2001
From: gm0027 <gm0027@surrey.ac.uk>
Date: Mon, 9 Aug 2021 10:33:09 +0100
Subject: [PATCH] made newstar->k2 use MOMENT_OF_INERTIA

---
 src/MINT/MINT_data_columns_MS_list.def | 1 +
 src/MINT/MINT_data_tables.def          | 2 +-
 src/MINT/MINT_generic_data_types.def   | 1 +
 src/MINT/MINT_stellar_structure_CHeB.c | 7 ++++++-
 src/MINT/MINT_stellar_structure_MS.c   | 6 +++++-
 5 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/src/MINT/MINT_data_columns_MS_list.def b/src/MINT/MINT_data_columns_MS_list.def
index c2b161bc3..d5147ba0b 100644
--- a/src/MINT/MINT_data_columns_MS_list.def
+++ b/src/MINT/MINT_data_columns_MS_list.def
@@ -75,6 +75,7 @@
     X(K2, NOTHING)                                      \
     X(TIDAL_E2, NOTHING)                                \
     X(TIDAL_E_FOR_LAMBDA, NOTHING)                      \
+    X(MOMENT_OF_INERTIA_FACTOR, NOTHING)                \
     X(TIMESCALE_KELVIN_HELMHOLTZ, NOTHING)              \
     X(TIMESCALE_DYNAMICAL, NOTHING)                     \
     X(TIMESCALE_NUCLEAR, NOTHING)                       \
diff --git a/src/MINT/MINT_data_tables.def b/src/MINT/MINT_data_tables.def
index db1a7f1e0..a8cbff7bf 100644
--- a/src/MINT/MINT_data_tables.def
+++ b/src/MINT/MINT_data_tables.def
@@ -25,7 +25,7 @@
     X(MS,"MS/grid_ZZ_chebyshev_withE.dat",&MINT_load_MS_grid,TRUE)      \
         X(HG,NULL,NULL,FALSE)                                           \
         X(GB,NULL,NULL,FALSE)                                           \
-        X(CHeB,"CHeB/grid_ZZ_chebyshev_withE.dat",&MINT_load_CHeB_grid,FALSE) \
+        X(CHeB,NULL, NULL, FALSE) \
         X(EAGB,NULL,NULL,FALSE)                                         \
         X(TPAGB,NULL,NULL,FALSE)                                        \
     X(HeMS,NULL,NULL,FALSE)                                             \
diff --git a/src/MINT/MINT_generic_data_types.def b/src/MINT/MINT_generic_data_types.def
index ac1cd6ace..7cc547b48 100644
--- a/src/MINT/MINT_generic_data_types.def
+++ b/src/MINT/MINT_generic_data_types.def
@@ -27,6 +27,7 @@
     X(K2)                                       \
     X(TIDAL_E2)                                 \
     X(TIDAL_E_FOR_LAMBDA)                       \
+    X(MOMENT_OF_INERTIA_FACTOR)                 \
     X(TIMESCALE_KELVIN_HELMHOLTZ)               \
     X(TIMESCALE_DYNAMICAL)                      \
     X(TIMESCALE_NUCLEAR)                        \
diff --git a/src/MINT/MINT_stellar_structure_CHeB.c b/src/MINT/MINT_stellar_structure_CHeB.c
index f28b30a22..859b7596a 100644
--- a/src/MINT/MINT_stellar_structure_CHeB.c
+++ b/src/MINT/MINT_stellar_structure_CHeB.c
@@ -282,8 +282,13 @@ Stellar_type MINT_stellar_structure_CHeB(struct stardata_t * RESTRICT const star
                          newstar->age,
                          newstar->epoch);
 
-
             newstar->k2 = get_data(MINT_CHeB_K2);
+            /*
+             * The line above should be replaced with 
+             * newstar->k2 = get_data(MINT_CHeB_MOMENT_OF_INERTIA_FACTOR);
+             * once that quantity is available in CHeB grids
+             * The K2 above is MESA's and not I/(MR^2)
+             */
             newstar->E2 =
                 available[MINT_CHeB_TIDAL_E2] ?
                 get_data(MINT_CHeB_TIDAL_E2) :
diff --git a/src/MINT/MINT_stellar_structure_MS.c b/src/MINT/MINT_stellar_structure_MS.c
index 3378a094b..363a03395 100644
--- a/src/MINT/MINT_stellar_structure_MS.c
+++ b/src/MINT/MINT_stellar_structure_MS.c
@@ -293,7 +293,11 @@ Stellar_type MINT_stellar_structure_MS(struct stardata_t * RESTRICT const starda
                      newstar->starnum,
                      stardata->model.dt);
 
-        newstar->k2 = get_data(MINT_MS_K2);
+        newstar->k2 = get_data(MINT_MS_MOMENT_OF_INERTIA_FACTOR);
+        if(vb)printf("Moment of inertia factor k2=I/(MR^2) : star = %d, k22 = %g\n",
+                     newstar->starnum,
+                     stardata->k2);
+
         newstar->E2 =
             available[MINT_MS_TIDAL_E2] ?
             get_data(MINT_MS_TIDAL_E2) :
-- 
GitLab