diff --git a/doc/RTD/source/Planetary/equations_of_state.rst b/doc/RTD/source/Planetary/equations_of_state.rst
index 4b0d2dfd988234048350fccb22b7e7608e5c35bd..cb6d5dea60c90a5cbedb4b45d86e38805b843a77 100644
--- a/doc/RTD/source/Planetary/equations_of_state.rst
+++ b/doc/RTD/source/Planetary/equations_of_state.rst
@@ -22,6 +22,7 @@ softening is very small.
 
 So far, we have implemented several Tillotson, ANEOS, SESAME,
 and Hubbard \& MacFarlane (1980) materials, with more on the way.
+Custom materials in SESAME-style tables can also be provided.
 The material's ID is set by a somewhat arbitrary base type ID
 (multiplied by 100) plus an individual value:
 
@@ -36,15 +37,17 @@ The material's ID is set by a somewhat arbitrary base type ID
     + Hydrogen-helium atmosphere: ``200``
     + Ice H20-CH4-NH3 mix: ``201``
     + Rock SiO2-MgO-FeS-FeO mix: ``202``
-+ SESAME (and similar): ``3``
++ SESAME (and others in similar-style tables): ``3``
     + Iron (2140): ``300``
     + Basalt (7530): ``301``
     + Water (7154): ``302``
-    + Senft \& Stewart (2008) water in a SESAME-style table: ``303``
+    + Senft \& Stewart (2008) water: ``303``
 + ANEOS (in SESAME-style tables): ``4``
     + Forsterite (Stewart et al. 2019): ``400``
     + Iron (Stewart, zenodo.org/record/3866507): ``401``
     + Fe85Si15 (Stewart, zenodo.org/record/3866550): ``402``
++ Custom (in SESAME-style tables): ``9``
+    + User-provided custom material(s): ``900``, ``901``, ..., ``909``
 
 The data files for the tabulated EoS can be downloaded using
 the ``examples/Planetary/EoSTables/get_eos_tables.sh`` script.
@@ -96,5 +99,6 @@ is similar to the SESAME 301 (etc) style. The file contents are:
 
 The ``version_date`` must match the value in the ``sesame.h`` ``SESAME_params``
 objects, so we can ensure that any version updates work with the git repository.
+This is ignored for custom materials.
 The header contains a first line that gives the material name, followed by the
 same 11 lines printed here to describe the contents.
diff --git a/examples/parameter_example.yml b/examples/parameter_example.yml
index 7ae76282ec93bf7a68d81d24d84240cf4e868678..976115b264104e2bd42367dd125670dec427d5ab 100644
--- a/examples/parameter_example.yml
+++ b/examples/parameter_example.yml
@@ -310,6 +310,16 @@ EoS:
   planetary_use_ANEOS_forsterite:   0       # ANEOS forsterite (Stewart et al. 2019), material ID 400
   planetary_use_ANEOS_iron:         0       # ANEOS iron (Stewart 2020), material ID 401
   planetary_use_ANEOS_Fe85Si15:     0       # ANEOS Fe85Si15 (Stewart 2020), material ID 402
+  planetary_use_custom_0:   0               # Generic user-provided custom tables, material IDs 90[0-9]
+  planetary_use_custom_1:   0
+  planetary_use_custom_2:   0
+  planetary_use_custom_3:   0
+  planetary_use_custom_4:   0
+  planetary_use_custom_5:   0
+  planetary_use_custom_6:   0
+  planetary_use_custom_7:   0
+  planetary_use_custom_8:   0
+  planetary_use_custom_9:   0
   # Tablulated EoS file paths.
   planetary_HM80_HHe_table_file:    ./EoSTables/HM80_HHe.txt
   planetary_HM80_ice_table_file:    ./EoSTables/HM80_ice.txt
@@ -321,6 +331,16 @@ EoS:
   planetary_ANEOS_forsterite_table_file:    ./EoSTables/ANEOS_forsterite_S19.txt
   planetary_ANEOS_iron_table_file:          ./EoSTables/ANEOS_iron_S20.txt
   planetary_ANEOS_Fe85Si15_table_file:      ./EoSTables/ANEOS_Fe85Si15_S20.txt
+  planetary_custom_0_table_file:    ./EoSTables/custom_0.txt
+  planetary_custom_1_table_file:    ./EoSTables/custom_1.txt
+  planetary_custom_2_table_file:    ./EoSTables/custom_2.txt
+  planetary_custom_3_table_file:    ./EoSTables/custom_3.txt
+  planetary_custom_4_table_file:    ./EoSTables/custom_4.txt
+  planetary_custom_5_table_file:    ./EoSTables/custom_5.txt
+  planetary_custom_6_table_file:    ./EoSTables/custom_6.txt
+  planetary_custom_7_table_file:    ./EoSTables/custom_7.txt
+  planetary_custom_8_table_file:    ./EoSTables/custom_8.txt
+  planetary_custom_9_table_file:    ./EoSTables/custom_9.txt
 
 # Parameters related to external potentials --------------------------------------------
 
diff --git a/src/equation_of_state/planetary/equation_of_state.h b/src/equation_of_state/planetary/equation_of_state.h
old mode 100644
new mode 100755
index 56261eff292ebc67e0a9e6be559665bee74a79c2..699ff93c42359dc1f1793cfc48fdbb1c7746b69e
--- a/src/equation_of_state/planetary/equation_of_state.h
+++ b/src/equation_of_state/planetary/equation_of_state.h
@@ -66,6 +66,9 @@ enum eos_planetary_type_id {
 
   /*! ANEOS */
   eos_planetary_type_ANEOS = 4,
+
+  /*! Custom */
+  eos_planetary_type_custom = 9,
 };
 
 /**
@@ -161,6 +164,7 @@ struct eos_parameters {
   struct HM80_params HM80_HHe, HM80_ice, HM80_rock;
   struct SESAME_params SESAME_iron, SESAME_basalt, SESAME_water, SS08_water;
   struct SESAME_params ANEOS_forsterite, ANEOS_iron, ANEOS_Fe85Si15;
+  struct SESAME_params custom[10];
 };
 
 /**
@@ -182,21 +186,14 @@ gas_internal_energy_from_entropy(float density, float entropy,
     /* Ideal gas EoS */
     case eos_planetary_type_idg:
 
-      /* Select the material and check it has been enabled */
+      /* Select the material of this type */
       switch (mat_id) {
         case eos_planetary_id_idg_def:
-#ifdef SWIFT_DEBUG_CHECKS
-          if (eos.idg_def.mat_id != mat_id)
-            error("EoS not enabled. Please set EoS:planetary_use_idg_def: 1");
-#endif
           return idg_internal_energy_from_entropy(density, entropy,
                                                   &eos.idg_def);
           break;
 
         default:
-#ifdef SWIFT_DEBUG_CHECKS
-          error("Unknown material ID! mat_id = %d", mat_id);
-#endif
           return -1.f;
       };
       break;
@@ -204,50 +201,29 @@ gas_internal_energy_from_entropy(float density, float entropy,
     /* Tillotson EoS */
     case eos_planetary_type_Til:
 
-      /* Select the material and check it has been enabled */
+      /* Select the material of this type */
       switch (mat_id) {
         case eos_planetary_id_Til_iron:
-#ifdef SWIFT_DEBUG_CHECKS
-          if (eos.Til_iron.mat_id != mat_id)
-            error("EoS not enabled. Please set EoS:planetary_use_Til_iron: 1");
-#endif
           return Til_internal_energy_from_entropy(density, entropy,
                                                   &eos.Til_iron);
           break;
 
         case eos_planetary_id_Til_granite:
-#ifdef SWIFT_DEBUG_CHECKS
-          if (eos.Til_granite.mat_id != mat_id)
-            error(
-                "EoS not enabled. Please set EoS:planetary_use_Til_granite: 1");
-#endif
           return Til_internal_energy_from_entropy(density, entropy,
                                                   &eos.Til_granite);
           break;
 
         case eos_planetary_id_Til_water:
-#ifdef SWIFT_DEBUG_CHECKS
-          if (eos.Til_water.mat_id != mat_id)
-            error("EoS not enabled. Please set EoS:planetary_use_Til_water: 1");
-#endif
           return Til_internal_energy_from_entropy(density, entropy,
                                                   &eos.Til_water);
           break;
 
         case eos_planetary_id_Til_basalt:
-#ifdef SWIFT_DEBUG_CHECKS
-          if (eos.Til_basalt.mat_id != mat_id)
-            error(
-                "EoS not enabled. Please set EoS:planetary_use_Til_basalt: 1");
-#endif
           return Til_internal_energy_from_entropy(density, entropy,
                                                   &eos.Til_basalt);
           break;
 
         default:
-#ifdef SWIFT_DEBUG_CHECKS
-          error("Unknown material ID! mat_id = %d", mat_id);
-#endif
           return -1.f;
       };
       break;
@@ -255,39 +231,24 @@ gas_internal_energy_from_entropy(float density, float entropy,
     /* Hubbard & MacFarlane (1980) EoS */
     case eos_planetary_type_HM80:
 
-      /* Select the material and check it has been enabled */
+      /* Select the material of this type */
       switch (mat_id) {
         case eos_planetary_id_HM80_HHe:
-#ifdef SWIFT_DEBUG_CHECKS
-          if (eos.HM80_HHe.mat_id != mat_id)
-            error("EoS not enabled. Please set EoS:planetary_use_HM80_HHe: 1");
-#endif
           return HM80_internal_energy_from_entropy(density, entropy,
                                                    &eos.HM80_HHe);
           break;
 
         case eos_planetary_id_HM80_ice:
-#ifdef SWIFT_DEBUG_CHECKS
-          if (eos.HM80_ice.mat_id != mat_id)
-            error("EoS not enabled. Please set EoS:planetary_use_HM80_ice: 1");
-#endif
           return HM80_internal_energy_from_entropy(density, entropy,
                                                    &eos.HM80_ice);
           break;
 
         case eos_planetary_id_HM80_rock:
-#ifdef SWIFT_DEBUG_CHECKS
-          if (eos.HM80_rock.mat_id != mat_id)
-            error("EoS not enabled. Please set EoS:planetary_use_HM80_rock: 1");
-#endif
           return HM80_internal_energy_from_entropy(density, entropy,
                                                    &eos.HM80_rock);
           break;
 
         default:
-#ifdef SWIFT_DEBUG_CHECKS
-          error("Unknown material ID! mat_id = %d", mat_id);
-#endif
           return -1.f;
       };
       break;
@@ -295,54 +256,29 @@ gas_internal_energy_from_entropy(float density, float entropy,
     /* SESAME EoS */
     case eos_planetary_type_SESAME:;
 
-      /* Select the material and check it has been enabled */
+      /* Select the material of this type */
       switch (mat_id) {
         case eos_planetary_id_SESAME_iron:
-#ifdef SWIFT_DEBUG_CHECKS
-          if (eos.SESAME_iron.mat_id != mat_id)
-            error(
-                "EoS not enabled. Please set EoS:planetary_use_SESAME_iron: 1");
-#endif
           return SESAME_internal_energy_from_entropy(density, entropy,
                                                      &eos.SESAME_iron);
           break;
 
         case eos_planetary_id_SESAME_basalt:
-#ifdef SWIFT_DEBUG_CHECKS
-          if (eos.SESAME_basalt.mat_id != mat_id)
-            error(
-                "EoS not enabled. Please set EoS:planetary_use_SESAME_basalt: "
-                "1");
-#endif
           return SESAME_internal_energy_from_entropy(density, entropy,
                                                      &eos.SESAME_basalt);
           break;
 
         case eos_planetary_id_SESAME_water:
-#ifdef SWIFT_DEBUG_CHECKS
-          if (eos.SESAME_water.mat_id != mat_id)
-            error(
-                "EoS not enabled. Please set EoS:planetary_use_SESAME_water: "
-                "1");
-#endif
           return SESAME_internal_energy_from_entropy(density, entropy,
                                                      &eos.SESAME_water);
           break;
 
         case eos_planetary_id_SS08_water:
-#ifdef SWIFT_DEBUG_CHECKS
-          if (eos.SS08_water.mat_id != mat_id)
-            error(
-                "EoS not enabled. Please set EoS:planetary_use_SS08_water: 1");
-#endif
           return SESAME_internal_energy_from_entropy(density, entropy,
                                                      &eos.SS08_water);
           break;
 
         default:
-#ifdef SWIFT_DEBUG_CHECKS
-          error("Unknown material ID! mat_id = %d", mat_id);
-#endif
           return -1.f;
       };
       break;
@@ -350,52 +286,38 @@ gas_internal_energy_from_entropy(float density, float entropy,
     /* ANEOS -- using SESAME-style tables */
     case eos_planetary_type_ANEOS:;
 
-      /* Select the material and check it has been enabled */
+      /* Select the material of this type */
       switch (mat_id) {
         case eos_planetary_id_ANEOS_forsterite:
-#ifdef SWIFT_DEBUG_CHECKS
-          if (eos.ANEOS_forsterite.mat_id != mat_id)
-            error(
-                "EoS not enabled. Please set "
-                "EoS:planetary_use_ANEOS_forsterite: 1");
-#endif
           return SESAME_internal_energy_from_entropy(density, entropy,
                                                      &eos.ANEOS_forsterite);
           break;
 
         case eos_planetary_id_ANEOS_iron:
-#ifdef SWIFT_DEBUG_CHECKS
-          if (eos.ANEOS_iron.mat_id != mat_id)
-            error(
-                "EoS not enabled. Please set EoS:planetary_use_ANEOS_iron: 1");
-#endif
           return SESAME_internal_energy_from_entropy(density, entropy,
                                                      &eos.ANEOS_iron);
           break;
 
         case eos_planetary_id_ANEOS_Fe85Si15:
-#ifdef SWIFT_DEBUG_CHECKS
-          if (eos.ANEOS_Fe85Si15.mat_id != mat_id)
-            error(
-                "EoS not enabled. Please set EoS:planetary_use_ANEOS_Fe85Si15: "
-                "1");
-#endif
           return SESAME_internal_energy_from_entropy(density, entropy,
                                                      &eos.ANEOS_Fe85Si15);
           break;
 
         default:
-#ifdef SWIFT_DEBUG_CHECKS
-          error("Unknown material ID! mat_id = %d", mat_id);
-#endif
           return -1.f;
       };
       break;
 
+    /*! Generic user-provided custom tables */
+    case eos_planetary_type_custom: {
+      const int i_custom =
+          mat_id - eos_planetary_type_custom * eos_planetary_type_factor;
+      return SESAME_internal_energy_from_entropy(density, entropy,
+                                                 &eos.custom[i_custom]);
+      break;
+    }
+
     default:
-#ifdef SWIFT_DEBUG_CHECKS
-      error("Unknown material type! mat_id = %d", mat_id);
-#endif
       return -1.f;
   }
 }
@@ -418,20 +340,13 @@ __attribute__((always_inline)) INLINE static float gas_pressure_from_entropy(
     /* Ideal gas EoS */
     case eos_planetary_type_idg:
 
-      /* Select the material and check it has been enabled */
+      /* Select the material of this type */
       switch (mat_id) {
         case eos_planetary_id_idg_def:
-#ifdef SWIFT_DEBUG_CHECKS
-          if (eos.idg_def.mat_id != mat_id)
-            error("EoS not enabled. Please set EoS:planetary_use_idg_def: 1");
-#endif
           return idg_pressure_from_entropy(density, entropy, &eos.idg_def);
           break;
 
         default:
-#ifdef SWIFT_DEBUG_CHECKS
-          error("Unknown material ID! mat_id = %d", mat_id);
-#endif
           return -1.f;
       };
       break;
@@ -439,46 +354,25 @@ __attribute__((always_inline)) INLINE static float gas_pressure_from_entropy(
     /* Tillotson EoS */
     case eos_planetary_type_Til:
 
-      /* Select the material and check it has been enabled */
+      /* Select the material of this type */
       switch (mat_id) {
         case eos_planetary_id_Til_iron:
-#ifdef SWIFT_DEBUG_CHECKS
-          if (eos.Til_iron.mat_id != mat_id)
-            error("EoS not enabled. Please set EoS:planetary_use_Til_iron: 1");
-#endif
           return Til_pressure_from_entropy(density, entropy, &eos.Til_iron);
           break;
 
         case eos_planetary_id_Til_granite:
-#ifdef SWIFT_DEBUG_CHECKS
-          if (eos.Til_granite.mat_id != mat_id)
-            error(
-                "EoS not enabled. Please set EoS:planetary_use_Til_granite: 1");
-#endif
           return Til_pressure_from_entropy(density, entropy, &eos.Til_granite);
           break;
 
         case eos_planetary_id_Til_water:
-#ifdef SWIFT_DEBUG_CHECKS
-          if (eos.Til_water.mat_id != mat_id)
-            error("EoS not enabled. Please set EoS:planetary_use_Til_water: 1");
-#endif
           return Til_pressure_from_entropy(density, entropy, &eos.Til_water);
           break;
 
         case eos_planetary_id_Til_basalt:
-#ifdef SWIFT_DEBUG_CHECKS
-          if (eos.Til_basalt.mat_id != mat_id)
-            error(
-                "EoS not enabled. Please set EoS:planetary_use_Til_basalt: 1");
-#endif
           return Til_pressure_from_entropy(density, entropy, &eos.Til_basalt);
           break;
 
         default:
-#ifdef SWIFT_DEBUG_CHECKS
-          error("Unknown material ID! mat_id = %d", mat_id);
-#endif
           return -1.f;
       };
       break;
@@ -486,36 +380,21 @@ __attribute__((always_inline)) INLINE static float gas_pressure_from_entropy(
     /* Hubbard & MacFarlane (1980) EoS */
     case eos_planetary_type_HM80:
 
-      /* Select the material and check it has been enabled */
+      /* Select the material of this type */
       switch (mat_id) {
         case eos_planetary_id_HM80_HHe:
-#ifdef SWIFT_DEBUG_CHECKS
-          if (eos.HM80_HHe.mat_id != mat_id)
-            error("EoS not enabled. Please set EoS:planetary_use_HM80_HHe: 1");
-#endif
           return HM80_pressure_from_entropy(density, entropy, &eos.HM80_HHe);
           break;
 
         case eos_planetary_id_HM80_ice:
-#ifdef SWIFT_DEBUG_CHECKS
-          if (eos.HM80_ice.mat_id != mat_id)
-            error("EoS not enabled. Please set EoS:planetary_use_HM80_ice: 1");
-#endif
           return HM80_pressure_from_entropy(density, entropy, &eos.HM80_ice);
           break;
 
         case eos_planetary_id_HM80_rock:
-#ifdef SWIFT_DEBUG_CHECKS
-          if (eos.HM80_rock.mat_id != mat_id)
-            error("EoS not enabled. Please set EoS:planetary_use_HM80_rock: 1");
-#endif
           return HM80_pressure_from_entropy(density, entropy, &eos.HM80_rock);
           break;
 
         default:
-#ifdef SWIFT_DEBUG_CHECKS
-          error("Unknown material ID! mat_id = %d", mat_id);
-#endif
           return -1.f;
       };
       break;
@@ -523,54 +402,29 @@ __attribute__((always_inline)) INLINE static float gas_pressure_from_entropy(
     /* SESAME EoS */
     case eos_planetary_type_SESAME:;
 
-      /* Select the material and check it has been enabled */
+      /* Select the material of this type */
       switch (mat_id) {
         case eos_planetary_id_SESAME_iron:
-#ifdef SWIFT_DEBUG_CHECKS
-          if (eos.SESAME_iron.mat_id != mat_id)
-            error(
-                "EoS not enabled. Please set EoS:planetary_use_SESAME_iron: 1");
-#endif
           return SESAME_pressure_from_entropy(density, entropy,
                                               &eos.SESAME_iron);
           break;
 
         case eos_planetary_id_SESAME_basalt:
-#ifdef SWIFT_DEBUG_CHECKS
-          if (eos.SESAME_basalt.mat_id != mat_id)
-            error(
-                "EoS not enabled. Please set EoS:planetary_use_SESAME_basalt: "
-                "1");
-#endif
           return SESAME_pressure_from_entropy(density, entropy,
                                               &eos.SESAME_basalt);
           break;
 
         case eos_planetary_id_SESAME_water:
-#ifdef SWIFT_DEBUG_CHECKS
-          if (eos.SESAME_water.mat_id != mat_id)
-            error(
-                "EoS not enabled. Please set EoS:planetary_use_SESAME_water: "
-                "1");
-#endif
           return SESAME_pressure_from_entropy(density, entropy,
                                               &eos.SESAME_water);
+          break;
 
         case eos_planetary_id_SS08_water:
-#ifdef SWIFT_DEBUG_CHECKS
-          if (eos.SS08_water.mat_id != mat_id)
-            error(
-                "EoS not enabled. Please set EoS:planetary_use_SS08_water: 1");
-#endif
           return SESAME_pressure_from_entropy(density, entropy,
                                               &eos.SS08_water);
           break;
-          break;
 
         default:
-#ifdef SWIFT_DEBUG_CHECKS
-          error("Unknown material ID! mat_id = %d", mat_id);
-#endif
           return -1.f;
       };
       break;
@@ -578,52 +432,38 @@ __attribute__((always_inline)) INLINE static float gas_pressure_from_entropy(
     /* ANEOS -- using SESAME-style tables */
     case eos_planetary_type_ANEOS:;
 
-      /* Select the material and check it has been enabled */
+      /* Select the material of this type */
       switch (mat_id) {
         case eos_planetary_id_ANEOS_forsterite:
-#ifdef SWIFT_DEBUG_CHECKS
-          if (eos.ANEOS_forsterite.mat_id != mat_id)
-            error(
-                "EoS not enabled. Please set "
-                "EoS:planetary_use_ANEOS_forsterite: 1");
-#endif
           return SESAME_pressure_from_entropy(density, entropy,
                                               &eos.ANEOS_forsterite);
           break;
 
         case eos_planetary_id_ANEOS_iron:
-#ifdef SWIFT_DEBUG_CHECKS
-          if (eos.ANEOS_iron.mat_id != mat_id)
-            error(
-                "EoS not enabled. Please set EoS:planetary_use_ANEOS_iron: 1");
-#endif
           return SESAME_pressure_from_entropy(density, entropy,
                                               &eos.ANEOS_iron);
           break;
 
         case eos_planetary_id_ANEOS_Fe85Si15:
-#ifdef SWIFT_DEBUG_CHECKS
-          if (eos.ANEOS_Fe85Si15.mat_id != mat_id)
-            error(
-                "EoS not enabled. Please set EoS:planetary_use_ANEOS_Fe85Si15: "
-                "1");
-#endif
           return SESAME_pressure_from_entropy(density, entropy,
                                               &eos.ANEOS_Fe85Si15);
           break;
 
         default:
-#ifdef SWIFT_DEBUG_CHECKS
-          error("Unknown material ID! mat_id = %d", mat_id);
-#endif
           return -1.f;
       };
       break;
 
+    /*! Generic user-provided custom tables */
+    case eos_planetary_type_custom: {
+      const int i_custom =
+          mat_id - eos_planetary_type_custom * eos_planetary_type_factor;
+      return SESAME_pressure_from_entropy(density, entropy,
+                                          &eos.custom[i_custom]);
+      break;
+    }
+
     default:
-#ifdef SWIFT_DEBUG_CHECKS
-      error("Unknown material type! mat_id = %d", mat_id);
-#endif
       return -1.f;
   }
 }
@@ -647,20 +487,13 @@ __attribute__((always_inline)) INLINE static float gas_entropy_from_pressure(
     /* Ideal gas EoS */
     case eos_planetary_type_idg:
 
-      /* Select the material and check it has been enabled */
+      /* Select the material of this type */
       switch (mat_id) {
         case eos_planetary_id_idg_def:
-#ifdef SWIFT_DEBUG_CHECKS
-          if (eos.idg_def.mat_id != mat_id)
-            error("EoS not enabled. Please set EoS:planetary_use_idg_def: 1");
-#endif
           return idg_entropy_from_pressure(density, P, &eos.idg_def);
           break;
 
         default:
-#ifdef SWIFT_DEBUG_CHECKS
-          error("Unknown material ID! mat_id = %d", mat_id);
-#endif
           return -1.f;
       };
       break;
@@ -668,46 +501,25 @@ __attribute__((always_inline)) INLINE static float gas_entropy_from_pressure(
     /* Tillotson EoS */
     case eos_planetary_type_Til:
 
-      /* Select the material and check it has been enabled */
+      /* Select the material of this type */
       switch (mat_id) {
         case eos_planetary_id_Til_iron:
-#ifdef SWIFT_DEBUG_CHECKS
-          if (eos.Til_iron.mat_id != mat_id)
-            error("EoS not enabled. Please set EoS:planetary_use_Til_iron: 1");
-#endif
           return Til_entropy_from_pressure(density, P, &eos.Til_iron);
           break;
 
         case eos_planetary_id_Til_granite:
-#ifdef SWIFT_DEBUG_CHECKS
-          if (eos.Til_granite.mat_id != mat_id)
-            error(
-                "EoS not enabled. Please set EoS:planetary_use_Til_granite: 1");
-#endif
           return Til_entropy_from_pressure(density, P, &eos.Til_granite);
           break;
 
         case eos_planetary_id_Til_water:
-#ifdef SWIFT_DEBUG_CHECKS
-          if (eos.Til_water.mat_id != mat_id)
-            error("EoS not enabled. Please set EoS:planetary_use_Til_water: 1");
-#endif
           return Til_entropy_from_pressure(density, P, &eos.Til_water);
           break;
 
         case eos_planetary_id_Til_basalt:
-#ifdef SWIFT_DEBUG_CHECKS
-          if (eos.Til_basalt.mat_id != mat_id)
-            error(
-                "EoS not enabled. Please set EoS:planetary_use_Til_basalt: 1");
-#endif
           return Til_entropy_from_pressure(density, P, &eos.Til_basalt);
           break;
 
         default:
-#ifdef SWIFT_DEBUG_CHECKS
-          error("Unknown material ID! mat_id = %d", mat_id);
-#endif
           return -1.f;
       };
       break;
@@ -715,36 +527,21 @@ __attribute__((always_inline)) INLINE static float gas_entropy_from_pressure(
     /* Hubbard & MacFarlane (1980) EoS */
     case eos_planetary_type_HM80:
 
-      /* Select the material and check it has been enabled */
+      /* Select the material of this type */
       switch (mat_id) {
         case eos_planetary_id_HM80_HHe:
-#ifdef SWIFT_DEBUG_CHECKS
-          if (eos.HM80_HHe.mat_id != mat_id)
-            error("EoS not enabled. Please set EoS:planetary_use_HM80_HHe: 1");
-#endif
           return HM80_entropy_from_pressure(density, P, &eos.HM80_HHe);
           break;
 
         case eos_planetary_id_HM80_ice:
-#ifdef SWIFT_DEBUG_CHECKS
-          if (eos.HM80_ice.mat_id != mat_id)
-            error("EoS not enabled. Please set EoS:planetary_use_HM80_ice: 1");
-#endif
           return HM80_entropy_from_pressure(density, P, &eos.HM80_ice);
           break;
 
         case eos_planetary_id_HM80_rock:
-#ifdef SWIFT_DEBUG_CHECKS
-          if (eos.HM80_rock.mat_id != mat_id)
-            error("EoS not enabled. Please set EoS:planetary_use_HM80_rock: 1");
-#endif
           return HM80_entropy_from_pressure(density, P, &eos.HM80_rock);
           break;
 
         default:
-#ifdef SWIFT_DEBUG_CHECKS
-          error("Unknown material ID! mat_id = %d", mat_id);
-#endif
           return -1.f;
       };
       break;
@@ -752,50 +549,25 @@ __attribute__((always_inline)) INLINE static float gas_entropy_from_pressure(
     /* SESAME EoS */
     case eos_planetary_type_SESAME:;
 
-      /* Select the material and check it has been enabled */
+      /* Select the material of this type */
       switch (mat_id) {
         case eos_planetary_id_SESAME_iron:
-#ifdef SWIFT_DEBUG_CHECKS
-          if (eos.SESAME_iron.mat_id != mat_id)
-            error(
-                "EoS not enabled. Please set EoS:planetary_use_SESAME_iron: 1");
-#endif
           return SESAME_entropy_from_pressure(density, P, &eos.SESAME_iron);
           break;
 
         case eos_planetary_id_SESAME_basalt:
-#ifdef SWIFT_DEBUG_CHECKS
-          if (eos.SESAME_basalt.mat_id != mat_id)
-            error(
-                "EoS not enabled. Please set EoS:planetary_use_SESAME_basalt: "
-                "1");
-#endif
           return SESAME_entropy_from_pressure(density, P, &eos.SESAME_basalt);
           break;
 
         case eos_planetary_id_SESAME_water:
-#ifdef SWIFT_DEBUG_CHECKS
-          if (eos.SESAME_water.mat_id != mat_id)
-            error(
-                "EoS not enabled. Please set EoS:planetary_use_SESAME_water: "
-                "1");
-#endif
           return SESAME_entropy_from_pressure(density, P, &eos.SESAME_water);
           break;
 
         case eos_planetary_id_SS08_water:
-#ifdef SWIFT_DEBUG_CHECKS
-          if (eos.SS08_water.mat_id != mat_id)
-            error(
-                "EoS not enabled. Please set EoS:planetary_use_SS08_water: 1");
-#endif
           return SESAME_entropy_from_pressure(density, P, &eos.SS08_water);
           break;
 
         default:
-#ifdef SWIFT_DEBUG_CHECKS
-          error("Unknown material ID! mat_id = %d", mat_id);
-#endif
           return -1.f;
       };
       break;
@@ -803,50 +575,35 @@ __attribute__((always_inline)) INLINE static float gas_entropy_from_pressure(
     /* ANEOS -- using SESAME-style tables */
     case eos_planetary_type_ANEOS:;
 
-      /* Select the material and check it has been enabled */
+      /* Select the material of this type */
       switch (mat_id) {
         case eos_planetary_id_ANEOS_forsterite:
-#ifdef SWIFT_DEBUG_CHECKS
-          if (eos.ANEOS_forsterite.mat_id != mat_id)
-            error(
-                "EoS not enabled. Please set "
-                "EoS:planetary_use_ANEOS_forsterite: 1");
-#endif
           return SESAME_entropy_from_pressure(density, P,
                                               &eos.ANEOS_forsterite);
           break;
 
         case eos_planetary_id_ANEOS_iron:
-#ifdef SWIFT_DEBUG_CHECKS
-          if (eos.ANEOS_iron.mat_id != mat_id)
-            error(
-                "EoS not enabled. Please set EoS:planetary_use_ANEOS_iron: 1");
-#endif
           return SESAME_entropy_from_pressure(density, P, &eos.ANEOS_iron);
           break;
 
         case eos_planetary_id_ANEOS_Fe85Si15:
-#ifdef SWIFT_DEBUG_CHECKS
-          if (eos.ANEOS_Fe85Si15.mat_id != mat_id)
-            error(
-                "EoS not enabled. Please set EoS:planetary_use_ANEOS_Fe85Si15: "
-                "1");
-#endif
           return SESAME_entropy_from_pressure(density, P, &eos.ANEOS_Fe85Si15);
           break;
 
         default:
-#ifdef SWIFT_DEBUG_CHECKS
-          error("Unknown material ID! mat_id = %d", mat_id);
-#endif
           return -1.f;
       };
       break;
 
+    /*! Generic user-provided custom tables */
+    case eos_planetary_type_custom: {
+      const int i_custom =
+          mat_id - eos_planetary_type_custom * eos_planetary_type_factor;
+      return SESAME_entropy_from_pressure(density, P, &eos.custom[i_custom]);
+      break;
+    }
+
     default:
-#ifdef SWIFT_DEBUG_CHECKS
-      error("Unknown material type! mat_id = %d", mat_id);
-#endif
       return -1.f;
   }
 }
@@ -869,20 +626,13 @@ __attribute__((always_inline)) INLINE static float gas_soundspeed_from_entropy(
     /* Ideal gas EoS */
     case eos_planetary_type_idg:
 
-      /* Select the material and check it has been enabled */
+      /* Select the material of this type */
       switch (mat_id) {
         case eos_planetary_id_idg_def:
-#ifdef SWIFT_DEBUG_CHECKS
-          if (eos.idg_def.mat_id != mat_id)
-            error("EoS not enabled. Please set EoS:planetary_use_idg_def: 1");
-#endif
           return idg_soundspeed_from_entropy(density, entropy, &eos.idg_def);
           break;
 
         default:
-#ifdef SWIFT_DEBUG_CHECKS
-          error("Unknown material ID! mat_id = %d", mat_id);
-#endif
           return -1.f;
       };
       break;
@@ -890,47 +640,26 @@ __attribute__((always_inline)) INLINE static float gas_soundspeed_from_entropy(
     /* Tillotson EoS */
     case eos_planetary_type_Til:
 
-      /* Select the material and check it has been enabled */
+      /* Select the material of this type */
       switch (mat_id) {
         case eos_planetary_id_Til_iron:
-#ifdef SWIFT_DEBUG_CHECKS
-          if (eos.Til_iron.mat_id != mat_id)
-            error("EoS not enabled. Please set EoS:planetary_use_Til_iron: 1");
-#endif
           return Til_soundspeed_from_entropy(density, entropy, &eos.Til_iron);
           break;
 
         case eos_planetary_id_Til_granite:
-#ifdef SWIFT_DEBUG_CHECKS
-          if (eos.Til_granite.mat_id != mat_id)
-            error(
-                "EoS not enabled. Please set EoS:planetary_use_Til_granite: 1");
-#endif
           return Til_soundspeed_from_entropy(density, entropy,
                                              &eos.Til_granite);
           break;
 
         case eos_planetary_id_Til_water:
-#ifdef SWIFT_DEBUG_CHECKS
-          if (eos.Til_water.mat_id != mat_id)
-            error("EoS not enabled. Please set EoS:planetary_use_Til_water: 1");
-#endif
           return Til_soundspeed_from_entropy(density, entropy, &eos.Til_water);
           break;
 
         case eos_planetary_id_Til_basalt:
-#ifdef SWIFT_DEBUG_CHECKS
-          if (eos.Til_basalt.mat_id != mat_id)
-            error(
-                "EoS not enabled. Please set EoS:planetary_use_Til_basalt: 1");
-#endif
           return Til_soundspeed_from_entropy(density, entropy, &eos.Til_basalt);
           break;
 
         default:
-#ifdef SWIFT_DEBUG_CHECKS
-          error("Unknown material ID! mat_id = %d", mat_id);
-#endif
           return -1.f;
       };
       break;
@@ -938,36 +667,21 @@ __attribute__((always_inline)) INLINE static float gas_soundspeed_from_entropy(
     /* Hubbard & MacFarlane (1980) EoS */
     case eos_planetary_type_HM80:
 
-      /* Select the material and check it has been enabled */
+      /* Select the material of this type */
       switch (mat_id) {
         case eos_planetary_id_HM80_HHe:
-#ifdef SWIFT_DEBUG_CHECKS
-          if (eos.HM80_HHe.mat_id != mat_id)
-            error("EoS not enabled. Please set EoS:planetary_use_HM80_HHe: 1");
-#endif
           return HM80_soundspeed_from_entropy(density, entropy, &eos.HM80_HHe);
           break;
 
         case eos_planetary_id_HM80_ice:
-#ifdef SWIFT_DEBUG_CHECKS
-          if (eos.HM80_ice.mat_id != mat_id)
-            error("EoS not enabled. Please set EoS:planetary_use_HM80_ice: 1");
-#endif
           return HM80_soundspeed_from_entropy(density, entropy, &eos.HM80_ice);
           break;
 
         case eos_planetary_id_HM80_rock:
-#ifdef SWIFT_DEBUG_CHECKS
-          if (eos.HM80_rock.mat_id != mat_id)
-            error("EoS not enabled. Please set EoS:planetary_use_HM80_rock: 1");
-#endif
           return HM80_soundspeed_from_entropy(density, entropy, &eos.HM80_rock);
           break;
 
         default:
-#ifdef SWIFT_DEBUG_CHECKS
-          error("Unknown material ID! mat_id = %d", mat_id);
-#endif
           return -1.f;
       };
       break;
@@ -975,54 +689,29 @@ __attribute__((always_inline)) INLINE static float gas_soundspeed_from_entropy(
     /* SESAME EoS */
     case eos_planetary_type_SESAME:;
 
-      /* Select the material and check it has been enabled */
+      /* Select the material of this type */
       switch (mat_id) {
         case eos_planetary_id_SESAME_iron:
-#ifdef SWIFT_DEBUG_CHECKS
-          if (eos.SESAME_iron.mat_id != mat_id)
-            error(
-                "EoS not enabled. Please set EoS:planetary_use_SESAME_iron: 1");
-#endif
           return SESAME_soundspeed_from_entropy(density, entropy,
                                                 &eos.SESAME_iron);
           break;
 
         case eos_planetary_id_SESAME_basalt:
-#ifdef SWIFT_DEBUG_CHECKS
-          if (eos.SESAME_basalt.mat_id != mat_id)
-            error(
-                "EoS not enabled. Please set EoS:planetary_use_SESAME_basalt: "
-                "1");
-#endif
           return SESAME_soundspeed_from_entropy(density, entropy,
                                                 &eos.SESAME_basalt);
           break;
 
         case eos_planetary_id_SESAME_water:
-#ifdef SWIFT_DEBUG_CHECKS
-          if (eos.SESAME_water.mat_id != mat_id)
-            error(
-                "EoS not enabled. Please set EoS:planetary_use_SESAME_water: "
-                "1");
-#endif
           return SESAME_soundspeed_from_entropy(density, entropy,
                                                 &eos.SESAME_water);
           break;
 
         case eos_planetary_id_SS08_water:
-#ifdef SWIFT_DEBUG_CHECKS
-          if (eos.SS08_water.mat_id != mat_id)
-            error(
-                "EoS not enabled. Please set EoS:planetary_use_SS08_water: 1");
-#endif
           return SESAME_soundspeed_from_entropy(density, entropy,
                                                 &eos.SS08_water);
           break;
 
         default:
-#ifdef SWIFT_DEBUG_CHECKS
-          error("Unknown material ID! mat_id = %d", mat_id);
-#endif
           return -1.f;
       };
       break;
@@ -1030,52 +719,38 @@ __attribute__((always_inline)) INLINE static float gas_soundspeed_from_entropy(
     /* ANEOS -- using SESAME-style tables */
     case eos_planetary_type_ANEOS:;
 
-      /* Select the material and check it has been enabled */
+      /* Select the material of this type */
       switch (mat_id) {
         case eos_planetary_id_ANEOS_forsterite:
-#ifdef SWIFT_DEBUG_CHECKS
-          if (eos.ANEOS_forsterite.mat_id != mat_id)
-            error(
-                "EoS not enabled. Please set "
-                "EoS:planetary_use_ANEOS_forsterite: 1");
-#endif
           return SESAME_soundspeed_from_entropy(density, entropy,
                                                 &eos.ANEOS_forsterite);
           break;
 
         case eos_planetary_id_ANEOS_iron:
-#ifdef SWIFT_DEBUG_CHECKS
-          if (eos.ANEOS_iron.mat_id != mat_id)
-            error(
-                "EoS not enabled. Please set EoS:planetary_use_ANEOS_iron: 1");
-#endif
           return SESAME_soundspeed_from_entropy(density, entropy,
                                                 &eos.ANEOS_iron);
           break;
 
         case eos_planetary_id_ANEOS_Fe85Si15:
-#ifdef SWIFT_DEBUG_CHECKS
-          if (eos.ANEOS_Fe85Si15.mat_id != mat_id)
-            error(
-                "EoS not enabled. Please set EoS:planetary_use_ANEOS_Fe85Si15: "
-                "1");
-#endif
           return SESAME_soundspeed_from_entropy(density, entropy,
                                                 &eos.ANEOS_Fe85Si15);
           break;
 
         default:
-#ifdef SWIFT_DEBUG_CHECKS
-          error("Unknown material ID! mat_id = %d", mat_id);
-#endif
           return -1.f;
       };
       break;
 
+    /*! Generic user-provided custom tables */
+    case eos_planetary_type_custom: {
+      const int i_custom =
+          mat_id - eos_planetary_type_custom * eos_planetary_type_factor;
+      return SESAME_soundspeed_from_entropy(density, entropy,
+                                            &eos.custom[i_custom]);
+      break;
+    }
+
     default:
-#ifdef SWIFT_DEBUG_CHECKS
-      error("Unknown material type! mat_id = %d", mat_id);
-#endif
       return -1.f;
   }
 }
@@ -1098,20 +773,13 @@ gas_entropy_from_internal_energy(float density, float u,
     /* Ideal gas EoS */
     case eos_planetary_type_idg:
 
-      /* Select the material and check it has been enabled */
+      /* Select the material of this type */
       switch (mat_id) {
         case eos_planetary_id_idg_def:
-#ifdef SWIFT_DEBUG_CHECKS
-          if (eos.idg_def.mat_id != mat_id)
-            error("EoS not enabled. Please set EoS:planetary_use_idg_def: 1");
-#endif
           return idg_entropy_from_internal_energy(density, u, &eos.idg_def);
           break;
 
         default:
-#ifdef SWIFT_DEBUG_CHECKS
-          error("Unknown material ID! mat_id = %d", mat_id);
-#endif
           return -1.f;
       };
       break;
@@ -1119,46 +787,25 @@ gas_entropy_from_internal_energy(float density, float u,
     /* Tillotson EoS */
     case eos_planetary_type_Til:
 
-      /* Select the material and check it has been enabled */
+      /* Select the material of this type */
       switch (mat_id) {
         case eos_planetary_id_Til_iron:
-#ifdef SWIFT_DEBUG_CHECKS
-          if (eos.Til_iron.mat_id != mat_id)
-            error("EoS not enabled. Please set EoS:planetary_use_Til_iron: 1");
-#endif
           return Til_entropy_from_internal_energy(density, u, &eos.Til_iron);
           break;
 
         case eos_planetary_id_Til_granite:
-#ifdef SWIFT_DEBUG_CHECKS
-          if (eos.Til_granite.mat_id != mat_id)
-            error(
-                "EoS not enabled. Please set EoS:planetary_use_Til_granite: 1");
-#endif
           return Til_entropy_from_internal_energy(density, u, &eos.Til_granite);
           break;
 
         case eos_planetary_id_Til_water:
-#ifdef SWIFT_DEBUG_CHECKS
-          if (eos.Til_water.mat_id != mat_id)
-            error("EoS not enabled. Please set EoS:planetary_use_Til_water: 1");
-#endif
           return Til_entropy_from_internal_energy(density, u, &eos.Til_water);
           break;
 
         case eos_planetary_id_Til_basalt:
-#ifdef SWIFT_DEBUG_CHECKS
-          if (eos.Til_basalt.mat_id != mat_id)
-            error(
-                "EoS not enabled. Please set EoS:planetary_use_Til_basalt: 1");
-#endif
           return Til_entropy_from_internal_energy(density, u, &eos.Til_basalt);
           break;
 
         default:
-#ifdef SWIFT_DEBUG_CHECKS
-          error("Unknown material ID! mat_id = %d", mat_id);
-#endif
           return -1.f;
       };
       break;
@@ -1166,36 +813,21 @@ gas_entropy_from_internal_energy(float density, float u,
     /* Hubbard & MacFarlane (1980) EoS */
     case eos_planetary_type_HM80:
 
-      /* Select the material and check it has been enabled */
+      /* Select the material of this type */
       switch (mat_id) {
         case eos_planetary_id_HM80_HHe:
-#ifdef SWIFT_DEBUG_CHECKS
-          if (eos.HM80_HHe.mat_id != mat_id)
-            error("EoS not enabled. Please set EoS:planetary_use_HM80_HHe: 1");
-#endif
           return HM80_entropy_from_internal_energy(density, u, &eos.HM80_HHe);
           break;
 
         case eos_planetary_id_HM80_ice:
-#ifdef SWIFT_DEBUG_CHECKS
-          if (eos.HM80_ice.mat_id != mat_id)
-            error("EoS not enabled. Please set EoS:planetary_use_HM80_ice: 1");
-#endif
           return HM80_entropy_from_internal_energy(density, u, &eos.HM80_ice);
           break;
 
         case eos_planetary_id_HM80_rock:
-#ifdef SWIFT_DEBUG_CHECKS
-          if (eos.HM80_rock.mat_id != mat_id)
-            error("EoS not enabled. Please set EoS:planetary_use_HM80_rock: 1");
-#endif
           return HM80_entropy_from_internal_energy(density, u, &eos.HM80_rock);
           break;
 
         default:
-#ifdef SWIFT_DEBUG_CHECKS
-          error("Unknown material ID! mat_id = %d", mat_id);
-#endif
           return -1.f;
       };
       break;
@@ -1203,54 +835,29 @@ gas_entropy_from_internal_energy(float density, float u,
     /* SESAME EoS */
     case eos_planetary_type_SESAME:;
 
-      /* Select the material and check it has been enabled */
+      /* Select the material of this type */
       switch (mat_id) {
         case eos_planetary_id_SESAME_iron:
-#ifdef SWIFT_DEBUG_CHECKS
-          if (eos.SESAME_iron.mat_id != mat_id)
-            error(
-                "EoS not enabled. Please set EoS:planetary_use_SESAME_iron: 1");
-#endif
           return SESAME_entropy_from_internal_energy(density, u,
                                                      &eos.SESAME_iron);
           break;
 
         case eos_planetary_id_SESAME_basalt:
-#ifdef SWIFT_DEBUG_CHECKS
-          if (eos.SESAME_basalt.mat_id != mat_id)
-            error(
-                "EoS not enabled. Please set EoS:planetary_use_SESAME_basalt: "
-                "1");
-#endif
           return SESAME_entropy_from_internal_energy(density, u,
                                                      &eos.SESAME_basalt);
           break;
 
         case eos_planetary_id_SESAME_water:
-#ifdef SWIFT_DEBUG_CHECKS
-          if (eos.SESAME_water.mat_id != mat_id)
-            error(
-                "EoS not enabled. Please set EoS:planetary_use_SESAME_water: "
-                "1");
-#endif
           return SESAME_entropy_from_internal_energy(density, u,
                                                      &eos.SESAME_water);
           break;
 
         case eos_planetary_id_SS08_water:
-#ifdef SWIFT_DEBUG_CHECKS
-          if (eos.SS08_water.mat_id != mat_id)
-            error(
-                "EoS not enabled. Please set EoS:planetary_use_SS08_water: 1");
-#endif
           return SESAME_entropy_from_internal_energy(density, u,
                                                      &eos.SS08_water);
           break;
 
         default:
-#ifdef SWIFT_DEBUG_CHECKS
-          error("Unknown material ID! mat_id = %d", mat_id);
-#endif
           return -1.f;
       };
       break;
@@ -1258,52 +865,38 @@ gas_entropy_from_internal_energy(float density, float u,
     /* ANEOS -- using SESAME-style tables */
     case eos_planetary_type_ANEOS:;
 
-      /* Select the material and check it has been enabled */
+      /* Select the material of this type */
       switch (mat_id) {
         case eos_planetary_id_ANEOS_forsterite:
-#ifdef SWIFT_DEBUG_CHECKS
-          if (eos.ANEOS_forsterite.mat_id != mat_id)
-            error(
-                "EoS not enabled. Please set "
-                "EoS:planetary_use_ANEOS_forsterite: 1");
-#endif
           return SESAME_entropy_from_internal_energy(density, u,
                                                      &eos.ANEOS_forsterite);
           break;
 
         case eos_planetary_id_ANEOS_iron:
-#ifdef SWIFT_DEBUG_CHECKS
-          if (eos.ANEOS_iron.mat_id != mat_id)
-            error(
-                "EoS not enabled. Please set EoS:planetary_use_ANEOS_iron: 1");
-#endif
           return SESAME_entropy_from_internal_energy(density, u,
                                                      &eos.ANEOS_iron);
           break;
 
         case eos_planetary_id_ANEOS_Fe85Si15:
-#ifdef SWIFT_DEBUG_CHECKS
-          if (eos.ANEOS_Fe85Si15.mat_id != mat_id)
-            error(
-                "EoS not enabled. Please set EoS:planetary_use_ANEOS_Fe85Si15: "
-                "1");
-#endif
           return SESAME_entropy_from_internal_energy(density, u,
                                                      &eos.ANEOS_Fe85Si15);
           break;
 
         default:
-#ifdef SWIFT_DEBUG_CHECKS
-          error("Unknown material ID! mat_id = %d", mat_id);
-#endif
           return -1.f;
       };
       break;
 
+    /*! Generic user-provided custom tables */
+    case eos_planetary_type_custom: {
+      const int i_custom =
+          mat_id - eos_planetary_type_custom * eos_planetary_type_factor;
+      return SESAME_entropy_from_internal_energy(density, u,
+                                                 &eos.custom[i_custom]);
+      break;
+    }
+
     default:
-#ifdef SWIFT_DEBUG_CHECKS
-      error("Unknown material type! mat_id = %d", mat_id);
-#endif
       return -1.f;
   }
 }
@@ -1327,7 +920,7 @@ gas_pressure_from_internal_energy(float density, float u,
     /* Ideal gas EoS */
     case eos_planetary_type_idg:
 
-      /* Select the material and check it has been enabled */
+      /* Select the material of this type */
       switch (mat_id) {
         case eos_planetary_id_idg_def:
 #ifdef SWIFT_DEBUG_CHECKS
@@ -1348,7 +941,7 @@ gas_pressure_from_internal_energy(float density, float u,
     /* Tillotson EoS */
     case eos_planetary_type_Til:
 
-      /* Select the material and check it has been enabled */
+      /* Select the material of this type */
       switch (mat_id) {
         case eos_planetary_id_Til_iron:
 #ifdef SWIFT_DEBUG_CHECKS
@@ -1396,7 +989,7 @@ gas_pressure_from_internal_energy(float density, float u,
     /* Hubbard & MacFarlane (1980) EoS */
     case eos_planetary_type_HM80:
 
-      /* Select the material and check it has been enabled */
+      /* Select the material of this type */
       switch (mat_id) {
         case eos_planetary_id_HM80_HHe:
 #ifdef SWIFT_DEBUG_CHECKS
@@ -1433,7 +1026,7 @@ gas_pressure_from_internal_energy(float density, float u,
     /* SESAME EoS */
     case eos_planetary_type_SESAME:;
 
-      /* Select the material and check it has been enabled */
+      /* Select the material of this type */
       switch (mat_id) {
         case eos_planetary_id_SESAME_iron:
 #ifdef SWIFT_DEBUG_CHECKS
@@ -1488,7 +1081,7 @@ gas_pressure_from_internal_energy(float density, float u,
     /* ANEOS -- using SESAME-style tables */
     case eos_planetary_type_ANEOS:;
 
-      /* Select the material and check it has been enabled */
+      /* Select the material of this type */
       switch (mat_id) {
         case eos_planetary_id_ANEOS_forsterite:
 #ifdef SWIFT_DEBUG_CHECKS
@@ -1530,6 +1123,20 @@ gas_pressure_from_internal_energy(float density, float u,
       };
       break;
 
+    /*! Generic user-provided custom tables */
+    case eos_planetary_type_custom: {
+      const int i_custom =
+          mat_id - eos_planetary_type_custom * eos_planetary_type_factor;
+#ifdef SWIFT_DEBUG_CHECKS
+      if (eos.custom[i_custom].mat_id != mat_id)
+        error("EoS not enabled. Please set EoS:planetary_use_custom_%d: 1",
+              i_custom);
+#endif
+      return SESAME_pressure_from_internal_energy(density, u,
+                                                  &eos.custom[i_custom]);
+      break;
+    }
+
     default:
 #ifdef SWIFT_DEBUG_CHECKS
       error("Unknown material type! mat_id = %d", mat_id);
@@ -1560,20 +1167,13 @@ gas_internal_energy_from_pressure(float density, float P,
     /* Ideal gas EoS */
     case eos_planetary_type_idg:
 
-      /* Select the material and check it has been enabled */
+      /* Select the material of this type */
       switch (mat_id) {
         case eos_planetary_id_idg_def:
-#ifdef SWIFT_DEBUG_CHECKS
-          if (eos.idg_def.mat_id != mat_id)
-            error("EoS not enabled. Please set EoS:planetary_use_idg_def: 1");
-#endif
           return idg_internal_energy_from_pressure(density, P, &eos.idg_def);
           break;
 
         default:
-#ifdef SWIFT_DEBUG_CHECKS
-          error("Unknown material ID! mat_id = %d", mat_id);
-#endif
           return -1.f;
       };
       break;
@@ -1581,47 +1181,26 @@ gas_internal_energy_from_pressure(float density, float P,
     /* Tillotson EoS */
     case eos_planetary_type_Til:
 
-      /* Select the material and check it has been enabled */
+      /* Select the material of this type */
       switch (mat_id) {
         case eos_planetary_id_Til_iron:
-#ifdef SWIFT_DEBUG_CHECKS
-          if (eos.Til_iron.mat_id != mat_id)
-            error("EoS not enabled. Please set EoS:planetary_use_Til_iron: 1");
-#endif
           return Til_internal_energy_from_pressure(density, P, &eos.Til_iron);
           break;
 
         case eos_planetary_id_Til_granite:
-#ifdef SWIFT_DEBUG_CHECKS
-          if (eos.Til_granite.mat_id != mat_id)
-            error(
-                "EoS not enabled. Please set EoS:planetary_use_Til_granite: 1");
-#endif
           return Til_internal_energy_from_pressure(density, P,
                                                    &eos.Til_granite);
           break;
 
         case eos_planetary_id_Til_water:
-#ifdef SWIFT_DEBUG_CHECKS
-          if (eos.Til_water.mat_id != mat_id)
-            error("EoS not enabled. Please set EoS:planetary_use_Til_water: 1");
-#endif
           return Til_internal_energy_from_pressure(density, P, &eos.Til_water);
           break;
 
         case eos_planetary_id_Til_basalt:
-#ifdef SWIFT_DEBUG_CHECKS
-          if (eos.Til_basalt.mat_id != mat_id)
-            error(
-                "EoS not enabled. Please set EoS:planetary_use_Til_basalt: 1");
-#endif
           return Til_internal_energy_from_pressure(density, P, &eos.Til_basalt);
           break;
 
         default:
-#ifdef SWIFT_DEBUG_CHECKS
-          error("Unknown material ID! mat_id = %d", mat_id);
-#endif
           return -1.f;
       };
       break;
@@ -1629,36 +1208,21 @@ gas_internal_energy_from_pressure(float density, float P,
     /* Hubbard & MacFarlane (1980) EoS */
     case eos_planetary_type_HM80:
 
-      /* Select the material and check it has been enabled */
+      /* Select the material of this type */
       switch (mat_id) {
         case eos_planetary_id_HM80_HHe:
-#ifdef SWIFT_DEBUG_CHECKS
-          if (eos.HM80_HHe.mat_id != mat_id)
-            error("EoS not enabled. Please set EoS:planetary_use_HM80_HHe: 1");
-#endif
           return HM80_internal_energy_from_pressure(density, P, &eos.HM80_HHe);
           break;
 
         case eos_planetary_id_HM80_ice:
-#ifdef SWIFT_DEBUG_CHECKS
-          if (eos.HM80_ice.mat_id != mat_id)
-            error("EoS not enabled. Please set EoS:planetary_use_HM80_ice: 1");
-#endif
           return HM80_internal_energy_from_pressure(density, P, &eos.HM80_ice);
           break;
 
         case eos_planetary_id_HM80_rock:
-#ifdef SWIFT_DEBUG_CHECKS
-          if (eos.HM80_rock.mat_id != mat_id)
-            error("EoS not enabled. Please set EoS:planetary_use_HM80_rock: 1");
-#endif
           return HM80_internal_energy_from_pressure(density, P, &eos.HM80_rock);
           break;
 
         default:
-#ifdef SWIFT_DEBUG_CHECKS
-          error("Unknown material ID! mat_id = %d", mat_id);
-#endif
           return -1.f;
       };
       break;
@@ -1666,54 +1230,29 @@ gas_internal_energy_from_pressure(float density, float P,
     /* SESAME EoS */
     case eos_planetary_type_SESAME:;
 
-      /* Select the material and check it has been enabled */
+      /* Select the material of this type */
       switch (mat_id) {
         case eos_planetary_id_SESAME_iron:
-#ifdef SWIFT_DEBUG_CHECKS
-          if (eos.SESAME_iron.mat_id != mat_id)
-            error(
-                "EoS not enabled. Please set EoS:planetary_use_SESAME_iron: 1");
-#endif
           return SESAME_internal_energy_from_pressure(density, P,
                                                       &eos.SESAME_iron);
           break;
 
         case eos_planetary_id_SESAME_basalt:
-#ifdef SWIFT_DEBUG_CHECKS
-          if (eos.SESAME_basalt.mat_id != mat_id)
-            error(
-                "EoS not enabled. Please set EoS:planetary_use_SESAME_basalt: "
-                "1");
-#endif
           return SESAME_internal_energy_from_pressure(density, P,
                                                       &eos.SESAME_basalt);
           break;
 
         case eos_planetary_id_SESAME_water:
-#ifdef SWIFT_DEBUG_CHECKS
-          if (eos.SESAME_water.mat_id != mat_id)
-            error(
-                "EoS not enabled. Please set EoS:planetary_use_SESAME_water: "
-                "1");
-#endif
           return SESAME_internal_energy_from_pressure(density, P,
                                                       &eos.SESAME_water);
           break;
 
         case eos_planetary_id_SS08_water:
-#ifdef SWIFT_DEBUG_CHECKS
-          if (eos.SS08_water.mat_id != mat_id)
-            error(
-                "EoS not enabled. Please set EoS:planetary_use_SS08_water: 1");
-#endif
           return SESAME_internal_energy_from_pressure(density, P,
                                                       &eos.SS08_water);
           break;
 
         default:
-#ifdef SWIFT_DEBUG_CHECKS
-          error("Unknown material ID! mat_id = %d", mat_id);
-#endif
           return -1.f;
       };
       break;
@@ -1721,52 +1260,38 @@ gas_internal_energy_from_pressure(float density, float P,
     /* ANEOS -- using SESAME-style tables */
     case eos_planetary_type_ANEOS:;
 
-      /* Select the material and check it has been enabled */
+      /* Select the material of this type */
       switch (mat_id) {
         case eos_planetary_id_ANEOS_forsterite:
-#ifdef SWIFT_DEBUG_CHECKS
-          if (eos.ANEOS_forsterite.mat_id != mat_id)
-            error(
-                "EoS not enabled. Please set "
-                "EoS:planetary_use_ANEOS_forsterite: 1");
-#endif
           return SESAME_internal_energy_from_pressure(density, P,
                                                       &eos.ANEOS_forsterite);
           break;
 
         case eos_planetary_id_ANEOS_iron:
-#ifdef SWIFT_DEBUG_CHECKS
-          if (eos.ANEOS_iron.mat_id != mat_id)
-            error(
-                "EoS not enabled. Please set EoS:planetary_use_ANEOS_iron: 1");
-#endif
           return SESAME_internal_energy_from_pressure(density, P,
                                                       &eos.ANEOS_iron);
           break;
 
         case eos_planetary_id_ANEOS_Fe85Si15:
-#ifdef SWIFT_DEBUG_CHECKS
-          if (eos.ANEOS_Fe85Si15.mat_id != mat_id)
-            error(
-                "EoS not enabled. Please set EoS:planetary_use_ANEOS_Fe85Si15: "
-                "1");
-#endif
           return SESAME_internal_energy_from_pressure(density, P,
                                                       &eos.ANEOS_Fe85Si15);
           break;
 
         default:
-#ifdef SWIFT_DEBUG_CHECKS
-          error("Unknown material ID! mat_id = %d", mat_id);
-#endif
           return -1.f;
       };
       break;
 
+    /*! Generic user-provided custom tables */
+    case eos_planetary_type_custom: {
+      const int i_custom =
+          mat_id - eos_planetary_type_custom * eos_planetary_type_factor;
+      return SESAME_internal_energy_from_pressure(density, P,
+                                                  &eos.custom[i_custom]);
+      break;
+    }
+
     default:
-#ifdef SWIFT_DEBUG_CHECKS
-      error("Unknown material type! mat_id = %d", mat_id);
-#endif
       return -1.f;
   }
 }
@@ -1790,20 +1315,13 @@ gas_soundspeed_from_internal_energy(float density, float u,
     /* Ideal gas EoS */
     case eos_planetary_type_idg:
 
-      /* Select the material and check it has been enabled */
+      /* Select the material of this type */
       switch (mat_id) {
         case eos_planetary_id_idg_def:
-#ifdef SWIFT_DEBUG_CHECKS
-          if (eos.idg_def.mat_id != mat_id)
-            error("EoS not enabled. Please set EoS:planetary_use_idg_def: 1");
-#endif
           return idg_soundspeed_from_internal_energy(density, u, &eos.idg_def);
           break;
 
         default:
-#ifdef SWIFT_DEBUG_CHECKS
-          error("Unknown material ID! mat_id = %d", mat_id);
-#endif
           return -1.f;
       };
       break;
@@ -1811,49 +1329,28 @@ gas_soundspeed_from_internal_energy(float density, float u,
     /* Tillotson EoS */
     case eos_planetary_type_Til:
 
-      /* Select the material and check it has been enabled */
+      /* Select the material of this type */
       switch (mat_id) {
         case eos_planetary_id_Til_iron:
-#ifdef SWIFT_DEBUG_CHECKS
-          if (eos.Til_iron.mat_id != mat_id)
-            error("EoS not enabled. Please set EoS:planetary_use_Til_iron: 1");
-#endif
           return Til_soundspeed_from_internal_energy(density, u, &eos.Til_iron);
           break;
 
         case eos_planetary_id_Til_granite:
-#ifdef SWIFT_DEBUG_CHECKS
-          if (eos.Til_granite.mat_id != mat_id)
-            error(
-                "EoS not enabled. Please set EoS:planetary_use_Til_granite: 1");
-#endif
           return Til_soundspeed_from_internal_energy(density, u,
                                                      &eos.Til_granite);
           break;
 
         case eos_planetary_id_Til_water:
-#ifdef SWIFT_DEBUG_CHECKS
-          if (eos.Til_water.mat_id != mat_id)
-            error("EoS not enabled. Please set EoS:planetary_use_Til_water: 1");
-#endif
           return Til_soundspeed_from_internal_energy(density, u,
                                                      &eos.Til_water);
           break;
 
         case eos_planetary_id_Til_basalt:
-#ifdef SWIFT_DEBUG_CHECKS
-          if (eos.Til_basalt.mat_id != mat_id)
-            error(
-                "EoS not enabled. Please set EoS:planetary_use_Til_basalt: 1");
-#endif
           return Til_soundspeed_from_internal_energy(density, u,
                                                      &eos.Til_basalt);
           break;
 
         default:
-#ifdef SWIFT_DEBUG_CHECKS
-          error("Unknown material ID! mat_id = %d", mat_id);
-#endif
           return -1.f;
       };
       break;
@@ -1861,39 +1358,24 @@ gas_soundspeed_from_internal_energy(float density, float u,
     /* Hubbard & MacFarlane (1980) EoS */
     case eos_planetary_type_HM80:
 
-      /* Select the material and check it has been enabled */
+      /* Select the material of this type */
       switch (mat_id) {
         case eos_planetary_id_HM80_HHe:
-#ifdef SWIFT_DEBUG_CHECKS
-          if (eos.HM80_HHe.mat_id != mat_id)
-            error("EoS not enabled. Please set EoS:planetary_use_HM80_HHe: 1");
-#endif
           return HM80_soundspeed_from_internal_energy(density, u,
                                                       &eos.HM80_HHe);
           break;
 
         case eos_planetary_id_HM80_ice:
-#ifdef SWIFT_DEBUG_CHECKS
-          if (eos.HM80_ice.mat_id != mat_id)
-            error("EoS not enabled. Please set EoS:planetary_use_HM80_ice: 1");
-#endif
           return HM80_soundspeed_from_internal_energy(density, u,
                                                       &eos.HM80_ice);
           break;
 
         case eos_planetary_id_HM80_rock:
-#ifdef SWIFT_DEBUG_CHECKS
-          if (eos.HM80_rock.mat_id != mat_id)
-            error("EoS not enabled. Please set EoS:planetary_use_HM80_rock: 1");
-#endif
           return HM80_soundspeed_from_internal_energy(density, u,
                                                       &eos.HM80_rock);
           break;
 
         default:
-#ifdef SWIFT_DEBUG_CHECKS
-          error("Unknown material ID! mat_id = %d", mat_id);
-#endif
           return -1.f;
       };
       break;
@@ -1901,54 +1383,29 @@ gas_soundspeed_from_internal_energy(float density, float u,
     /* SESAME EoS */
     case eos_planetary_type_SESAME:;
 
-      /* Select the material and check it has been enabled */
+      /* Select the material of this type */
       switch (mat_id) {
         case eos_planetary_id_SESAME_iron:
-#ifdef SWIFT_DEBUG_CHECKS
-          if (eos.SESAME_iron.mat_id != mat_id)
-            error(
-                "EoS not enabled. Please set EoS:planetary_use_SESAME_iron: 1");
-#endif
           return SESAME_soundspeed_from_internal_energy(density, u,
                                                         &eos.SESAME_iron);
           break;
 
         case eos_planetary_id_SESAME_basalt:
-#ifdef SWIFT_DEBUG_CHECKS
-          if (eos.SESAME_basalt.mat_id != mat_id)
-            error(
-                "EoS not enabled. Please set EoS:planetary_use_SESAME_basalt: "
-                "1");
-#endif
           return SESAME_soundspeed_from_internal_energy(density, u,
                                                         &eos.SESAME_basalt);
           break;
 
         case eos_planetary_id_SESAME_water:
-#ifdef SWIFT_DEBUG_CHECKS
-          if (eos.SESAME_water.mat_id != mat_id)
-            error(
-                "EoS not enabled. Please set EoS:planetary_use_SESAME_water: "
-                "1");
-#endif
           return SESAME_soundspeed_from_internal_energy(density, u,
                                                         &eos.SESAME_water);
           break;
 
         case eos_planetary_id_SS08_water:
-#ifdef SWIFT_DEBUG_CHECKS
-          if (eos.SS08_water.mat_id != mat_id)
-            error(
-                "EoS not enabled. Please set EoS:planetary_use_SS08_water: 1");
-#endif
           return SESAME_soundspeed_from_internal_energy(density, u,
                                                         &eos.SS08_water);
           break;
 
         default:
-#ifdef SWIFT_DEBUG_CHECKS
-          error("Unknown material ID! mat_id = %d", mat_id);
-#endif
           return -1.f;
       };
       break;
@@ -1956,52 +1413,38 @@ gas_soundspeed_from_internal_energy(float density, float u,
     /* ANEOS -- using SESAME-style tables */
     case eos_planetary_type_ANEOS:;
 
-      /* Select the material and check it has been enabled */
+      /* Select the material of this type */
       switch (mat_id) {
         case eos_planetary_id_ANEOS_forsterite:
-#ifdef SWIFT_DEBUG_CHECKS
-          if (eos.ANEOS_forsterite.mat_id != mat_id)
-            error(
-                "EoS not enabled. Please set "
-                "EoS:planetary_use_ANEOS_forsterite: 1");
-#endif
           return SESAME_soundspeed_from_internal_energy(density, u,
                                                         &eos.ANEOS_forsterite);
           break;
 
         case eos_planetary_id_ANEOS_iron:
-#ifdef SWIFT_DEBUG_CHECKS
-          if (eos.ANEOS_iron.mat_id != mat_id)
-            error(
-                "EoS not enabled. Please set EoS:planetary_use_ANEOS_iron: 1");
-#endif
           return SESAME_soundspeed_from_internal_energy(density, u,
                                                         &eos.ANEOS_iron);
           break;
 
         case eos_planetary_id_ANEOS_Fe85Si15:
-#ifdef SWIFT_DEBUG_CHECKS
-          if (eos.ANEOS_Fe85Si15.mat_id != mat_id)
-            error(
-                "EoS not enabled. Please set EoS:planetary_use_ANEOS_Fe85Si15: "
-                "1");
-#endif
           return SESAME_soundspeed_from_internal_energy(density, u,
                                                         &eos.ANEOS_Fe85Si15);
           break;
 
         default:
-#ifdef SWIFT_DEBUG_CHECKS
-          error("Unknown material ID! mat_id = %d", mat_id);
-#endif
           return -1.f;
       };
       break;
 
+    /*! Generic user-provided custom tables */
+    case eos_planetary_type_custom: {
+      const int i_custom =
+          mat_id - eos_planetary_type_custom * eos_planetary_type_factor;
+      return SESAME_soundspeed_from_internal_energy(density, u,
+                                                    &eos.custom[i_custom]);
+      break;
+    }
+
     default:
-#ifdef SWIFT_DEBUG_CHECKS
-      error("Unknown material type! mat_id = %d", mat_id);
-#endif
       return -1.f;
   }
 }
@@ -2024,20 +1467,13 @@ __attribute__((always_inline)) INLINE static float gas_soundspeed_from_pressure(
     /* Ideal gas EoS */
     case eos_planetary_type_idg:
 
-      /* Select the material and check it has been enabled */
+      /* Select the material of this type */
       switch (mat_id) {
         case eos_planetary_id_idg_def:
-#ifdef SWIFT_DEBUG_CHECKS
-          if (eos.idg_def.mat_id != mat_id)
-            error("EoS not enabled. Please set EoS:planetary_use_idg_def: 1");
-#endif
           return idg_soundspeed_from_pressure(density, P, &eos.idg_def);
           break;
 
         default:
-#ifdef SWIFT_DEBUG_CHECKS
-          error("Unknown material ID! mat_id = %d", mat_id);
-#endif
           return -1.f;
       };
       break;
@@ -2045,46 +1481,25 @@ __attribute__((always_inline)) INLINE static float gas_soundspeed_from_pressure(
     /* Tillotson EoS */
     case eos_planetary_type_Til:
 
-      /* Select the material and check it has been enabled */
+      /* Select the material of this type */
       switch (mat_id) {
         case eos_planetary_id_Til_iron:
-#ifdef SWIFT_DEBUG_CHECKS
-          if (eos.Til_iron.mat_id != mat_id)
-            error("EoS not enabled. Please set EoS:planetary_use_Til_iron: 1");
-#endif
           return Til_soundspeed_from_pressure(density, P, &eos.Til_iron);
           break;
 
         case eos_planetary_id_Til_granite:
-#ifdef SWIFT_DEBUG_CHECKS
-          if (eos.Til_granite.mat_id != mat_id)
-            error(
-                "EoS not enabled. Please set EoS:planetary_use_Til_granite: 1");
-#endif
           return Til_soundspeed_from_pressure(density, P, &eos.Til_granite);
           break;
 
         case eos_planetary_id_Til_water:
-#ifdef SWIFT_DEBUG_CHECKS
-          if (eos.Til_water.mat_id != mat_id)
-            error("EoS not enabled. Please set EoS:planetary_use_Til_water: 1");
-#endif
           return Til_soundspeed_from_pressure(density, P, &eos.Til_water);
           break;
 
         case eos_planetary_id_Til_basalt:
-#ifdef SWIFT_DEBUG_CHECKS
-          if (eos.Til_basalt.mat_id != mat_id)
-            error(
-                "EoS not enabled. Please set EoS:planetary_use_Til_basalt: 1");
-#endif
           return Til_soundspeed_from_pressure(density, P, &eos.Til_basalt);
           break;
 
         default:
-#ifdef SWIFT_DEBUG_CHECKS
-          error("Unknown material ID! mat_id = %d", mat_id);
-#endif
           return -1.f;
       };
       break;
@@ -2092,36 +1507,21 @@ __attribute__((always_inline)) INLINE static float gas_soundspeed_from_pressure(
     /* Hubbard & MacFarlane (1980) EoS */
     case eos_planetary_type_HM80:
 
-      /* Select the material and check it has been enabled */
+      /* Select the material of this type */
       switch (mat_id) {
         case eos_planetary_id_HM80_HHe:
-#ifdef SWIFT_DEBUG_CHECKS
-          if (eos.HM80_HHe.mat_id != mat_id)
-            error("EoS not enabled. Please set EoS:planetary_use_HM80_HHe: 1");
-#endif
           return HM80_soundspeed_from_pressure(density, P, &eos.HM80_HHe);
           break;
 
         case eos_planetary_id_HM80_ice:
-#ifdef SWIFT_DEBUG_CHECKS
-          if (eos.HM80_ice.mat_id != mat_id)
-            error("EoS not enabled. Please set EoS:planetary_use_HM80_ice: 1");
-#endif
           return HM80_soundspeed_from_pressure(density, P, &eos.HM80_ice);
           break;
 
         case eos_planetary_id_HM80_rock:
-#ifdef SWIFT_DEBUG_CHECKS
-          if (eos.HM80_rock.mat_id != mat_id)
-            error("EoS not enabled. Please set EoS:planetary_use_HM80_rock: 1");
-#endif
           return HM80_soundspeed_from_pressure(density, P, &eos.HM80_rock);
           break;
 
         default:
-#ifdef SWIFT_DEBUG_CHECKS
-          error("Unknown material ID! mat_id = %d", mat_id);
-#endif
           return -1.f;
       };
       break;
@@ -2129,51 +1529,26 @@ __attribute__((always_inline)) INLINE static float gas_soundspeed_from_pressure(
     /* SESAME EoS */
     case eos_planetary_type_SESAME:;
 
-      /* Select the material and check it has been enabled */
+      /* Select the material of this type */
       switch (mat_id) {
         case eos_planetary_id_SESAME_iron:
-#ifdef SWIFT_DEBUG_CHECKS
-          if (eos.SESAME_iron.mat_id != mat_id)
-            error(
-                "EoS not enabled. Please set EoS:planetary_use_SESAME_iron: 1");
-#endif
           return SESAME_soundspeed_from_pressure(density, P, &eos.SESAME_iron);
           break;
 
         case eos_planetary_id_SESAME_basalt:
-#ifdef SWIFT_DEBUG_CHECKS
-          if (eos.SESAME_basalt.mat_id != mat_id)
-            error(
-                "EoS not enabled. Please set EoS:planetary_use_SESAME_basalt: "
-                "1");
-#endif
           return SESAME_soundspeed_from_pressure(density, P,
                                                  &eos.SESAME_basalt);
           break;
 
         case eos_planetary_id_SESAME_water:
-#ifdef SWIFT_DEBUG_CHECKS
-          if (eos.SESAME_water.mat_id != mat_id)
-            error(
-                "EoS not enabled. Please set EoS:planetary_use_SESAME_water: "
-                "1");
-#endif
           return SESAME_soundspeed_from_pressure(density, P, &eos.SESAME_water);
           break;
 
         case eos_planetary_id_SS08_water:
-#ifdef SWIFT_DEBUG_CHECKS
-          if (eos.SS08_water.mat_id != mat_id)
-            error(
-                "EoS not enabled. Please set EoS:planetary_use_SS08_water: 1");
-#endif
           return SESAME_soundspeed_from_pressure(density, P, &eos.SS08_water);
           break;
 
         default:
-#ifdef SWIFT_DEBUG_CHECKS
-          error("Unknown material ID! mat_id = %d", mat_id);
-#endif
           return -1.f;
       };
       break;
@@ -2181,51 +1556,36 @@ __attribute__((always_inline)) INLINE static float gas_soundspeed_from_pressure(
     /* ANEOS -- using SESAME-style tables */
     case eos_planetary_type_ANEOS:;
 
-      /* Select the material and check it has been enabled */
+      /* Select the material of this type */
       switch (mat_id) {
         case eos_planetary_id_ANEOS_forsterite:
-#ifdef SWIFT_DEBUG_CHECKS
-          if (eos.ANEOS_forsterite.mat_id != mat_id)
-            error(
-                "EoS not enabled. Please set "
-                "EoS:planetary_use_ANEOS_forsterite: 1");
-#endif
           return SESAME_soundspeed_from_pressure(density, P,
                                                  &eos.ANEOS_forsterite);
           break;
 
         case eos_planetary_id_ANEOS_iron:
-#ifdef SWIFT_DEBUG_CHECKS
-          if (eos.ANEOS_iron.mat_id != mat_id)
-            error(
-                "EoS not enabled. Please set EoS:planetary_use_ANEOS_iron: 1");
-#endif
           return SESAME_soundspeed_from_pressure(density, P, &eos.ANEOS_iron);
           break;
 
         case eos_planetary_id_ANEOS_Fe85Si15:
-#ifdef SWIFT_DEBUG_CHECKS
-          if (eos.ANEOS_Fe85Si15.mat_id != mat_id)
-            error(
-                "EoS not enabled. Please set EoS:planetary_use_ANEOS_Fe85Si15: "
-                "1");
-#endif
           return SESAME_soundspeed_from_pressure(density, P,
                                                  &eos.ANEOS_Fe85Si15);
           break;
 
         default:
-#ifdef SWIFT_DEBUG_CHECKS
-          error("Unknown material ID! mat_id = %d", mat_id);
-#endif
           return -1.f;
       };
       break;
 
+    /*! Generic user-provided custom tables */
+    case eos_planetary_type_custom: {
+      const int i_custom =
+          mat_id - eos_planetary_type_custom * eos_planetary_type_factor;
+      return SESAME_soundspeed_from_pressure(density, P, &eos.custom[i_custom]);
+      break;
+    }
+
     default:
-#ifdef SWIFT_DEBUG_CHECKS
-      error("Unknown material type! mat_id = %d", mat_id);
-#endif
       return -1.f;
   }
 }
@@ -2363,6 +1723,24 @@ __attribute__((always_inline)) INLINE static void eos_init(
     prepare_table_SESAME(&e->ANEOS_Fe85Si15);
     convert_units_SESAME(&e->ANEOS_Fe85Si15, us);
   }
+
+  // Custom generic tables -- using SESAME-style tables
+  for (int i_custom = 0; i_custom <= 9; i_custom++) {
+    char param_name[PARSER_MAX_LINE_SIZE];
+    sprintf(param_name, "EoS:planetary_use_custom_%d", i_custom);
+    if (parser_get_opt_param_int(params, param_name, 0)) {
+      char custom_table_file[PARSER_MAX_LINE_SIZE];
+      int mat_id =
+          eos_planetary_type_custom * eos_planetary_type_factor + i_custom;
+      set_custom(&e->custom[i_custom], (enum eos_planetary_material_id)mat_id);
+
+      sprintf(param_name, "EoS:planetary_custom_%d_table_file", i_custom);
+      parser_get_param_string(params, param_name, custom_table_file);
+      load_table_SESAME(&e->custom[i_custom], custom_table_file);
+      prepare_table_SESAME(&e->custom[i_custom]);
+      convert_units_SESAME(&e->custom[i_custom], us);
+    }
+  }
 }
 
 /**
diff --git a/src/equation_of_state/planetary/sesame.h b/src/equation_of_state/planetary/sesame.h
old mode 100644
new mode 100755
index f59c687acdaefa652e85b99eae19db8beb694257..e86111664cce4e98625629a24d2729ddf5e67f8d
--- a/src/equation_of_state/planetary/sesame.h
+++ b/src/equation_of_state/planetary/sesame.h
@@ -96,6 +96,13 @@ INLINE static void set_ANEOS_Fe85Si15(struct SESAME_params *mat,
   mat->version_date = 20220714;
 }
 
+// Generic user-provided custom materials
+INLINE static void set_custom(struct SESAME_params *mat,
+                              enum eos_planetary_material_id mat_id) {
+  mat->mat_id = mat_id;
+  mat->version_date = 0;
+}
+
 /*
     Skip a line while reading a file.
 */
@@ -153,7 +160,7 @@ INLINE static void load_table_SESAME(struct SESAME_params *mat,
   int version_date;
   int c = fscanf(f, "%d", &version_date);
   if (c != 1) error("Failed to read the SESAME EoS table %s", table_file);
-  if (version_date != mat->version_date)
+  if ((version_date != mat->version_date) && (mat->version_date != 0))
     error(
         "EoS file %s version_date %d does not match expected %d (YYYYMMDD)."
         "\nPlease download the file using "
@@ -242,12 +249,9 @@ INLINE static void prepare_table_SESAME(struct SESAME_params *mat) {
       if (mat->table_log_u_rho_T[i_rho * mat->num_T + i_T] <
           mat->table_log_u_rho_T[i_rho * mat->num_T + i_T - 1]) {
 
-        // Replace it and all elements below it with that value
-        for (int j_T = 0; j_T < i_T; j_T++) {
-          mat->table_log_u_rho_T[i_rho * mat->num_T + j_T] =
-              mat->table_log_u_rho_T[i_rho * mat->num_T + i_T];
-        }
-        break;
+        // Replace with this lower value
+        mat->table_log_u_rho_T[i_rho * mat->num_T + i_T - 1] =
+            mat->table_log_u_rho_T[i_rho * mat->num_T + i_T];
       }
 
       // Smallest positive values