From 285d69b590fefeb77e5c11912fedd535fb5ffc3a Mon Sep 17 00:00:00 2001
From: Gabriel Studer <gabriel.studer@unibas.ch>
Date: Mon, 21 Aug 2017 11:36:10 +0200
Subject: [PATCH] move check for enough positions to function that actually
 does the superposition

---
 core/src/superpose.cc | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/core/src/superpose.cc b/core/src/superpose.cc
index 51004902..1d4fad62 100644
--- a/core/src/superpose.cc
+++ b/core/src/superpose.cc
@@ -25,6 +25,11 @@ void TheobaldRMSD(const promod3::core::EMatX3& pos_one,
                   Real& rmsd,
                   promod3::core::EMat3& rot){
 
+  if(pos_one.rows() < 3){
+    throw promod3::Error("Observed superposition with < 3 positions to "
+                         "superpose!");
+  }
+
   promod3::core::EMat3 M = pos_one.transpose() * pos_two;
 
   // for the calculations itself we enforce double precision
@@ -211,11 +216,6 @@ void Superpose(promod3::core::EMatX3& pos_one,
     throw promod3::Error("Cannot superpose positions of different size!");
   }
 
-  if(pos_one.rows() < 3){
-    throw promod3::Error("Observed superposition with < 3 positions to "
-                         "superpose!");
-  }
-
   avg_one = AverageRow(pos_one);
   avg_two = AverageRow(pos_two);
 
-- 
GitLab