From 39a4a7170fb9fedc6195b1e9258cc8a0222d7e6b Mon Sep 17 00:00:00 2001
From: Gabriel Studer <gabriel.studer@unibas.ch>
Date: Sat, 21 Feb 2015 15:43:18 +0100
Subject: [PATCH] silence some compiler warnings

---
 modules/mol/mm/pymod/export_buildingblock.cc |  4 ++--
 modules/mol/mm/pymod/export_interaction.cc   |  3 +--
 modules/mol/mm/pymod/export_openmm.cc        |  2 +-
 modules/mol/mm/src/block_modifiers.hh        |  5 ++++-
 modules/mol/mm/src/buildingblock.hh          | 16 ++++++++--------
 modules/mol/mm/src/simulation.cc             |  6 ++++++
 6 files changed, 22 insertions(+), 14 deletions(-)

diff --git a/modules/mol/mm/pymod/export_buildingblock.cc b/modules/mol/mm/pymod/export_buildingblock.cc
index b9388cb81..4186bd9c2 100644
--- a/modules/mol/mm/pymod/export_buildingblock.cc
+++ b/modules/mol/mm/pymod/export_buildingblock.cc
@@ -1,6 +1,6 @@
-#include <ost/log.hh>
 #include <boost/python.hpp>
 #include <ost/mol/mm/buildingblock.hh>
+#include <ost/log.hh>
 #include <vector>
 
 using namespace boost::python;
@@ -86,4 +86,4 @@ void export_Buildingblock()
 
   boost::python::register_ptr_to_python<ost::mol::mm::BuildingBlockPtr>();
 
-}
\ No newline at end of file
+}
diff --git a/modules/mol/mm/pymod/export_interaction.cc b/modules/mol/mm/pymod/export_interaction.cc
index d95c80d74..c9a223dea 100644
--- a/modules/mol/mm/pymod/export_interaction.cc
+++ b/modules/mol/mm/pymod/export_interaction.cc
@@ -1,10 +1,9 @@
-#include <vector>
-
 #include <boost/python.hpp>
 #include <boost/python/suite/indexing/vector_indexing_suite.hpp>
 
 #include <ost/mol/mm/mm_interaction.hh>
 
+#include <vector>
 
 using namespace boost::python;
 
diff --git a/modules/mol/mm/pymod/export_openmm.cc b/modules/mol/mm/pymod/export_openmm.cc
index 1d3d73d73..7ba82b40b 100644
--- a/modules/mol/mm/pymod/export_openmm.cc
+++ b/modules/mol/mm/pymod/export_openmm.cc
@@ -16,8 +16,8 @@
 // along with this library; if not, write to the Free Software Foundation, Inc.,
 // 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 //------------------------------------------------------------------------------
-#include <OpenMM.h>
 #include <boost/python.hpp>
+#include <OpenMM.h>
 
 using namespace boost::python;
 
diff --git a/modules/mol/mm/src/block_modifiers.hh b/modules/mol/mm/src/block_modifiers.hh
index 275a2540f..d03c43a1f 100644
--- a/modules/mol/mm/src/block_modifiers.hh
+++ b/modules/mol/mm/src/block_modifiers.hh
@@ -26,6 +26,7 @@ typedef enum {
 class HydrogenConstructor{
 public:
   HydrogenConstructor() { }
+  virtual ~HydrogenConstructor() { }
   virtual void ApplyOnBuildingBlock(BuildingBlockPtr p) = 0;
   virtual void ApplyOnResidue(ost::mol::ResidueHandle& res, ost::mol::XCSEditor& ed) = 0;
   virtual void OnSave(ost::io::BinaryDataSink& ds) = 0;
@@ -35,6 +36,7 @@ public:
 class TerminiConstructor{
 public:
   TerminiConstructor() { }
+  virtual ~TerminiConstructor() { }
   virtual void ApplyOnBuildingBlock(BuildingBlockPtr p) = 0;
   virtual void ApplyOnResidue(ost::mol::ResidueHandle& res, ost::mol::XCSEditor& ed) = 0;
   virtual void OnSave(ost::io::BinaryDataSink& ds) = 0;
@@ -44,6 +46,7 @@ public:
 class BlockModifier{
 public:
   BlockModifier() { }
+  virtual ~BlockModifier() { }
   virtual void ApplyOnBuildingBlock(BuildingBlockPtr p) = 0;
   virtual void ApplyOnResidue(ost::mol::ResidueHandle& res, ost::mol::XCSEditor& ed) = 0;
   virtual void OnSave(ost::io::BinaryDataSink& ds) = 0;
@@ -53,4 +56,4 @@ public:
 
 }}} //ns
 
-#endif
\ No newline at end of file
+#endif
diff --git a/modules/mol/mm/src/buildingblock.hh b/modules/mol/mm/src/buildingblock.hh
index f1cacdb51..b313255c6 100644
--- a/modules/mol/mm/src/buildingblock.hh
+++ b/modules/mol/mm/src/buildingblock.hh
@@ -109,7 +109,7 @@ public:
       masses_ = std::vector<Real>(num_atoms);
     }
 
-    for(unsigned int i = 0; i < num_atoms; ++i){
+    for(int i = 0; i < num_atoms; ++i){
       ds & atoms_[i];
       ds & types_[i];
       ds & charges_[i];
@@ -132,7 +132,7 @@ public:
     ds & num_cmaps;
     ds & num_constraints;
 
-    for(unsigned int i = 0; i < num_bonds; ++i){
+    for(int i = 0; i < num_bonds; ++i){
       int func_type;
       if(ds.IsSource()){
         ds & func_type;
@@ -145,7 +145,7 @@ public:
       ds & *(bonds_[i]);
     }
 
-    for(unsigned int i = 0; i < num_angles; ++i){
+    for(int i = 0; i < num_angles; ++i){
       int func_type;
       if(ds.IsSource()){
         ds & func_type;
@@ -158,7 +158,7 @@ public:
       ds & *(angles_[i]);
     }
 
-    for(unsigned int i = 0; i < num_dihedrals; ++i){
+    for(int i = 0; i < num_dihedrals; ++i){
       int func_type;
       if(ds.IsSource()){
         ds & func_type;
@@ -171,7 +171,7 @@ public:
       ds & *(dihedrals_[i]);
     }
 
-    for(unsigned int i = 0; i < num_impropers; ++i){
+    for(int i = 0; i < num_impropers; ++i){
       int func_type;
       if(ds.IsSource()){
         ds & func_type;
@@ -184,7 +184,7 @@ public:
       ds & *(impropers_[i]);
     }
 
-    for(unsigned int i = 0; i < num_exclusions; ++i){
+    for(int i = 0; i < num_exclusions; ++i){
       int func_type;
       if(ds.IsSource()){
         ds & func_type;
@@ -197,7 +197,7 @@ public:
       ds & *(exclusions_[i]);
     }
 
-    for(unsigned int i = 0; i < num_cmaps; ++i){
+    for(int i = 0; i < num_cmaps; ++i){
       int func_type;
       if(ds.IsSource()){
         ds & func_type;
@@ -210,7 +210,7 @@ public:
       ds & *(cmaps_[i]);
     }
 
-    for(unsigned int i = 0; i < num_constraints; ++i){
+    for(int i = 0; i < num_constraints; ++i){
       int func_type;
       if(ds.IsSource()){
         ds & func_type;
diff --git a/modules/mol/mm/src/simulation.cc b/modules/mol/mm/src/simulation.cc
index 2400a5219..e6952ff1d 100644
--- a/modules/mol/mm/src/simulation.cc
+++ b/modules/mol/mm/src/simulation.cc
@@ -161,6 +161,9 @@ SimulationPtr Simulation::Load(const String& filename, MMSettingsPtr settings){
       platform = &OpenMM::Platform::getPlatformByName("CPU");
       break;
     }
+    default:{
+      throw ost::Error("Invalid Platform when Loading simulation!");
+    }
   }
 
   sim_ptr->context_ = ContextPtr(new OpenMM::Context(*(sim_ptr->system_),
@@ -279,6 +282,9 @@ void Simulation::Init(const TopologyPtr top,
       platform = &OpenMM::Platform::getPlatformByName("CPU");
       break;
     }
+    default:{
+      throw ost::Error("Invalid platform encountered when settings up simualation!");
+    }
   }
 
   context_ = ContextPtr(new OpenMM::Context(*system_,*integrator_,*platform));
-- 
GitLab