From e30d080c5de249d4e88c2772f322e70981168b04 Mon Sep 17 00:00:00 2001
From: Marco Biasini <marco.biasini@unibas.ch>
Date: Tue, 4 Jan 2011 10:29:08 +0100
Subject: [PATCH] expose StericEnergy to the outside world

---
 modules/qa/src/clash_score.cc | 34 +++++++++++++++++-----------------
 modules/qa/src/clash_score.hh |  5 ++++-
 2 files changed, 21 insertions(+), 18 deletions(-)

diff --git a/modules/qa/src/clash_score.cc b/modules/qa/src/clash_score.cc
index d05a4e3fe..852260660 100644
--- a/modules/qa/src/clash_score.cc
+++ b/modules/qa/src/clash_score.cc
@@ -24,23 +24,6 @@ namespace ost { namespace qa {
 
 namespace {
   
-Real StericEnergy(const geom::Vec3& pos1, Real r1, 
-                  const geom::Vec3& pos2, Real r2)
-{
-  geom::Vec3 d=pos1-pos2;
-  // delay calculation of square root as long as possible. It is only needed
-  // in the rare case when 0.8254*rr <= d <= rr
-  Real distance_sqr=geom::Length2(d); 
-  Real rr=r1+r2;
-  if (distance_sqr>rr*rr) {
-    return 0.0;
-  }
-  if (distance_sqr<0.8254*0.8254*rr*rr) {
-    return 10.0;
-  }
-  return 57.273*(1.0-sqrt(distance_sqr)/rr);
-}
-
 template <typename T, typename I>
 Real do_clash_score(const T& ent_a, const mol::EntityView& ent_b)
 {
@@ -61,6 +44,23 @@ Real do_clash_score(const T& ent_a, const mol::EntityView& ent_b)
 
 }
 
+Real StericEnergy(const geom::Vec3& pos1, Real r1,
+                  const geom::Vec3& pos2, Real r2)
+{
+  geom::Vec3 d=pos1-pos2;
+  // delay calculation of square root as long as possible. It is only needed
+  // in the rare case when 0.8254*rr <= d <= rr
+  Real distance_sqr=geom::Length2(d); 
+  Real rr=r1+r2;
+  if (distance_sqr>rr*rr) {
+    return 0.0;
+  }
+  if (distance_sqr<0.8254*0.8254*rr*rr) {
+    return 10.0;
+  }
+  return 57.273*(1.0-sqrt(distance_sqr)/rr);
+}
+
 Real ClashScore(const mol::EntityView& ent_a, const mol::EntityView& ent_b)
 {
   return do_clash_score<mol::EntityView, mol::AtomViewIter>(ent_a, ent_b);
diff --git a/modules/qa/src/clash_score.hh b/modules/qa/src/clash_score.hh
index 15b0994ce..bbf73a10a 100644
--- a/modules/qa/src/clash_score.hh
+++ b/modules/qa/src/clash_score.hh
@@ -52,7 +52,10 @@ Real DLLEXPORT_OST_QA ClashScore(const mol::EntityHandle& ent_a,
 /// \sa \ref the_hammer.py "The Hammer Example"
 Real DLLEXPORT_OST_QA ClashScore(const mol::AtomHandle& atom, 
                                  const mol::EntityView& ent_b);
-                                 
+
+/// \brief calculate steric energy of two atoms
+Real DLLEXPORT_OST_QA StericEnergy(const geom::Vec3& pos1, Real r1,
+                                   const geom::Vec3& pos2, Real r2);
 //@}
 
 /// \example the_hammer.py
-- 
GitLab