Index: src/ThermoStatContainer.cpp
===================================================================
--- src/ThermoStatContainer.cpp	(revision bf38179e7a1590020bad970c4931116d7d7e9bbb)
+++ src/ThermoStatContainer.cpp	(revision 14c57a9b8ce2c94b3ca4d4d59b36bd5aa57cabf1)
@@ -21,34 +21,70 @@
 #include "Helpers/Verbose.hpp"
 
+#include <Thermostats/Berendsen.hpp>
+#include <Thermostats/GaussianThermostat.hpp>
+#include <Thermostats/Langevin.hpp>
+#include <Thermostats/NoseHoover.hpp>
+#include <Thermostats/NoThermostat.hpp>
+#include <Thermostats/Woodcock.hpp>
+
 /** Constructor for class ThermoStatContainer.
  *
  */
 ThermoStatContainer::ThermoStatContainer() :
-  Thermostat(4),
-  ThermostatImplemented(NULL),
-  ThermostatNames(NULL),
-  TempFrequency(2.5),
-  alpha(0.),
-  HooverMass(0.),
-  TargetTemp(0.00095004455),
-  ScaleTempStep(25)
+  activeThermostat(0),
+  TargetTemp(0.00095004455)
 {
-  ThermostatImplemented = new int[MaxThermostats];
-  ThermostatNames = new char *[MaxThermostats];
-  for (int j=0;j<MaxThermostats;j++)
-    ThermostatNames[j] = new char[12];
+  ThermostatTraits<Thermostat> *BerendsenTrait = new ThermostatTraits<Berendsen>();
+  availThermostats[BerendsenTrait->getName()] = BerendsenTrait;
+  ThermostatTraits<Thermostat> *GaussianTrait = new ThermostatTraits<GaussianThermostat>();
+  availThermostats[GaussianTrait->getName()] = GaussianTrait;
+  ThermostatTraits<Thermostat> *LangevinTrait = new ThermostatTraits<Langevin>();
+  availThermostats[LangevinTrait->getName()] = LangevinTrait;
+  ThermostatTraits<Thermostat> *NoseHooverTrait = new ThermostatTraits<NoseHoover>();
+  availThermostats[NoseHooverTrait->getName()] = NoseHooverTrait;
+  ThermostatTraits<Thermostat> *NoThermostatTrait = new ThermostatTraits<NoThermostat>();
+  availThermostats[NoThermostatTrait->getName()] = NoThermostatTrait;
+  ThermostatTraits<Thermostat> *WoodcockTrait = new ThermostatTraits<Woodcock>();
+  availThermostats[WoodcockTrait->getName()] = WoodcockTrait;
+  for(traitsMap::iterator iter = availThermostats.begin();iter!=availThermostats.end();++iter){
+    cout << iter->first << endl;
+  }
+  ASSERT(availThermostats.size()==6,"Not all implemented thermostats referenced!\nDid you check the names in the traits?");
+  activeThermostat=new Berendsen();
+}
 
-  strcpy(ThermostatNames[0],"None");
-  ThermostatImplemented[0] = 1;
-  strcpy(ThermostatNames[1],"Woodcock");
-  ThermostatImplemented[1] = 1;
-  strcpy(ThermostatNames[2],"Gaussian");
-  ThermostatImplemented[2] = 1;
-  strcpy(ThermostatNames[3],"Langevin");
-  ThermostatImplemented[3] = 1;
-  strcpy(ThermostatNames[4],"Berendsen");
-  ThermostatImplemented[4] = 1;
-  strcpy(ThermostatNames[5],"NoseHoover");
-  ThermostatImplemented[5] = 1;
+ThermostatTraits<Thermostat> *ThermoStatContainer::getTraitByName(const std::string name){
+  if(!availThermostats.count(name))
+    return 0;
+  return availThermostats[name];
+}
+
+Thermostat *ThermoStatContainer::makeByName(const std::string name,class ConfigFileBuffer * const fb){
+  ThermostatTraits<Thermostat>* trait = getTraitByName(name);
+  if(trait){
+    Thermostat *res = trait->make(fb);
+    res->addToContainer(this);
+    return res;
+  }
+  else{
+    return 0;
+  }
+}
+
+void ThermoStatContainer::makeActive(const std::string name,class ConfigFileBuffer * const fb){
+  Thermostat* newThermostat = makeByName(name,fb);
+  if(newThermostat){
+    if(activeThermostat){
+      delete activeThermostat;
+    }
+    activeThermostat = newThermostat;
+  }
+}
+
+void ThermoStatContainer::chooseNone(){
+  if(activeThermostat){
+    delete activeThermostat;
+  }
+  activeThermostat = new NoThermostat();
 }
 
@@ -58,8 +94,10 @@
 ThermoStatContainer::~ThermoStatContainer()
 {
-  delete[](ThermostatImplemented);
-  for (int j=0;j<MaxThermostats;j++)
-    delete[](ThermostatNames[j]);
-  delete[](ThermostatNames);
+  if(activeThermostat){
+    delete activeThermostat;
+  }
+  for(traitsMap::iterator iter= availThermostats.begin();iter!=availThermostats.end();++iter){
+    delete (iter->second);
+  }
 }
 
