Skip to content
Snippets Groups Projects
Commit e30d080c authored by Marco Biasini's avatar Marco Biasini
Browse files

expose StericEnergy to the outside world

parent 071f7b6f
No related branches found
No related tags found
No related merge requests found
...@@ -24,23 +24,6 @@ namespace ost { namespace qa { ...@@ -24,23 +24,6 @@ namespace ost { namespace qa {
namespace { 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> template <typename T, typename I>
Real do_clash_score(const T& ent_a, const mol::EntityView& ent_b) 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) ...@@ -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) Real ClashScore(const mol::EntityView& ent_a, const mol::EntityView& ent_b)
{ {
return do_clash_score<mol::EntityView, mol::AtomViewIter>(ent_a, ent_b); return do_clash_score<mol::EntityView, mol::AtomViewIter>(ent_a, ent_b);
......
...@@ -52,7 +52,10 @@ Real DLLEXPORT_OST_QA ClashScore(const mol::EntityHandle& ent_a, ...@@ -52,7 +52,10 @@ Real DLLEXPORT_OST_QA ClashScore(const mol::EntityHandle& ent_a,
/// \sa \ref the_hammer.py "The Hammer Example" /// \sa \ref the_hammer.py "The Hammer Example"
Real DLLEXPORT_OST_QA ClashScore(const mol::AtomHandle& atom, Real DLLEXPORT_OST_QA ClashScore(const mol::AtomHandle& atom,
const mol::EntityView& ent_b); 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 /// \example the_hammer.py
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment