diff --git a/modules/qa/src/impl/reduced_impl.cc b/modules/qa/src/impl/reduced_impl.cc index 0efa531b3e3befc326b22489b39e84f90a3af8ca..8994fada4c0d00b6bc074eb5f331a54440427b59 100644 --- a/modules/qa/src/impl/reduced_impl.cc +++ b/modules/qa/src/impl/reduced_impl.cc @@ -58,34 +58,35 @@ bool ReducedPotentialImpl::VisitResidue(const mol::ResidueHandle& res) bool ReducedPotentialImpl::GetCAlphaCBetaPos(const mol::ResidueHandle& res, geom::Vec3& ca_pos, geom::Vec3& cb_pos) - { - const static Real bond_length=1.5; - mol::AtomHandle ca=res.FindAtom("CA"); - if (!ca.IsValid()) { - return false; - } - ca_pos=ca.GetPos(); - mol::AtomHandle cb=res.FindAtom("CB"); - if (cb.IsValid()) { - cb_pos=cb.GetPos(); - return true; - } - mol::AtomHandle n=res.FindAtom("N"); - mol::AtomHandle c=res.FindAtom("C"); - if (!(ca.IsValid() && c.IsValid() && n.IsValid())) { - LOG_WARNING("residue " << res.GetQualifiedName() - << " doesn't have enough atoms to reconstruct Cbeta position"); - return false; - } - geom::Vec3 v1=geom::Normalize(ca.GetPos()-n.GetPos()); - geom::Vec3 v2=geom::Normalize(ca.GetPos()-c.GetPos()); - geom::Vec3 in_plane_v=geom::Normalize(v1+v2); - geom::Plane p(ca.GetPos() ,n.GetPos(), c.GetPos()); - // rotate around vector perpendicular to p and in_plane_v - geom::Vec3 axis=geom::Normalize(geom::Cross(p.GetNormal(), in_plane_v)); - geom::Mat3 rot_mat=geom::AxisRotation(axis, (-54/180.0)*M_PI); - cb_pos=ca.GetPos()+rot_mat*in_plane_v*bond_length; +{ + const static Real bond_length=1.5; + mol::AtomHandle ca=res.FindAtom("CA"); + if (!ca.IsValid()) { + return false; + } + ca_pos=ca.GetPos(); + mol::AtomHandle cb=res.FindAtom("CB"); + if (cb.IsValid()) { + cb_pos=cb.GetPos(); return true; - } + } + mol::AtomHandle n=res.FindAtom("N"); + mol::AtomHandle c=res.FindAtom("C"); + if (!(ca.IsValid() && c.IsValid() && n.IsValid())) { + LOG_WARNING("residue " << res.GetQualifiedName() + << " doesn't have enough atoms to reconstruct Cbeta position"); + return false; + } + geom::Vec3 v1=geom::Normalize(ca.GetPos()-n.GetPos()); + geom::Vec3 v2=geom::Normalize(ca.GetPos()-c.GetPos()); + geom::Vec3 in_plane_v=geom::Normalize(v1+v2); + geom::Plane p(ca.GetPos() ,n.GetPos(), c.GetPos()); + // rotate around vector perpendicular to p and in_plane_v + geom::Vec3 axis=geom::Normalize(geom::Cross(p.GetNormal(), in_plane_v)); + geom::Mat3 rot_mat=geom::AxisRotation(axis, (-54/180.0)*M_PI); + cb_pos=ca.GetPos()+rot_mat*in_plane_v*bond_length; + return true; +} + }}} diff --git a/modules/qa/src/impl/reduced_impl.hh b/modules/qa/src/impl/reduced_impl.hh index e10ef2c380ac9eb5aee1093f9fd57a80256483b4..98651360bfdd1ef82994a7a2ce44ed15f7772b35 100644 --- a/modules/qa/src/impl/reduced_impl.hh +++ b/modules/qa/src/impl/reduced_impl.hh @@ -38,8 +38,9 @@ public: virtual bool VisitResidue(const mol::ResidueHandle& res); - bool GetCAlphaCBetaPos(const mol::ResidueHandle& res, geom::Vec3& ca_pos, - geom::Vec3& cb_pos); + static bool GetCAlphaCBetaPos(const mol::ResidueHandle& res, + geom::Vec3& ca_pos, + geom::Vec3& cb_pos); virtual void OnInteraction(AminoAcid aa_one, AminoAcid aa_two, Real dist, Real angle)=0; diff --git a/modules/qa/src/reduced_potential.cc b/modules/qa/src/reduced_potential.cc index e2bbc2bbd3cf06aff0e945a9fb229c0545120ed6..78df5c9022077f1f0a25108b56143c412dd6a785 100644 --- a/modules/qa/src/reduced_potential.cc +++ b/modules/qa/src/reduced_potential.cc @@ -61,6 +61,13 @@ private: } +bool ReducedPotential::GetCAlphaCBetaPos(const mol::ResidueHandle& res, + geom::Vec3& ca_pos, + geom::Vec3& cb_pos) +{ + return impl::ReducedPotentialImpl::GetCAlphaCBetaPos(res, ca_pos, cb_pos); +} + ReducedPotentialPtr ReducedPotential::Load(const String& filename) { std::ifstream stream(filename.c_str(), std::ios_base::binary); diff --git a/modules/qa/src/reduced_potential.hh b/modules/qa/src/reduced_potential.hh index a85698ffe57753bfa30f0ca246a9a8269eabc815..534892678bed5b84d10c36b43688ce7ce71479f5 100644 --- a/modules/qa/src/reduced_potential.hh +++ b/modules/qa/src/reduced_potential.hh @@ -49,6 +49,11 @@ public: Real GetTotalEnergy(ost::mol::EntityHandle ent, bool normalize=true); + + static bool GetCAlphaCBetaPos(const mol::ResidueHandle& res, + geom::Vec3& ca_pos, + geom::Vec3& cb_pos); + Real GetEnergy(AminoAcid aa_one, AminoAcid aa_two, Real ca_dist, Real angle) const {