diff --git a/examples/surf/test_rsurf.py b/examples/surf/test_rsurf.py index f1f2b9c2a17c7296b210343d9f22e69948430f7e..e8818bdac3f3b8338a53db871608c0871e72d880 100644 --- a/examples/surf/test_rsurf.py +++ b/examples/surf/test_rsurf.py @@ -15,7 +15,7 @@ scene.Add(gs) # for debug reasons rs=mol.RSurf(1.5) for a in ev.GetAtomList(): - rs.AddSphere(a.GetPos(),a.GetProp().Radius,str(a)) + rs.AddSphere(a.GetPos(),a.GetRadius(),str(a)) rs.Build() rs.Triangulate(60.0*3.1415/180.0) gr=gfx.RSurface("r",rs) diff --git a/modules/bindings/pymod/msms.py b/modules/bindings/pymod/msms.py index 6f36ab9fdf10a3ee70d86127e4c656ca48189ee5..5698652f4dc4d6bf479f657a8530c1e2ab8143dd 100644 --- a/modules/bindings/pymod/msms.py +++ b/modules/bindings/pymod/msms.py @@ -55,7 +55,7 @@ def _SetupFiles(entity, selection): for a in entity_view.GetAtomList(): position=a.GetPos() tmp_file_handle.write('%8.3f %8.3f %8.3f %4.2f\n' % (position[0], - position[1], position[2], a.GetProp().radius)) + position[1], position[2], a.GetAtomProps().radius)) tmp_file_handle.close() return (tmp_dir_name, tmp_file_name) diff --git a/modules/conop/src/builder.cc b/modules/conop/src/builder.cc index f82eede9bdbd91314f8808d3b6ca98c743363d49..14c103e55d29f8a69758663b38cefb99b498c06f 100644 --- a/modules/conop/src/builder.cc +++ b/modules/conop/src/builder.cc @@ -65,13 +65,13 @@ bool Builder::IsBondFeasible(const mol::AtomHandle& atom_a, { Real len=geom::Length2(atom_a.GetPos()-atom_b.GetPos()); Real radii=0.0; - if (atom_a.GetProp().radius>0.0) { - radii=atom_a.GetProp().radius; + if (atom_a.GetRadius()>0.0) { + radii=atom_a.GetRadius(); } else { return false; } - if (atom_b.GetProp().radius>0.0) { - radii+=atom_b.GetProp().radius; + if (atom_b.GetRadius()>0.0) { + radii+=atom_b.GetRadius(); } else { return false; } diff --git a/modules/conop/src/heuristic_builder.cc b/modules/conop/src/heuristic_builder.cc index 00e7f251bd58c2c7a145399e7917be61c619eddd..5c27610eaa153c19c58ff6b51c68bb0fa23871a4 100644 --- a/modules/conop/src/heuristic_builder.cc +++ b/modules/conop/src/heuristic_builder.cc @@ -458,10 +458,9 @@ bool HeuristicBuilder::IsResidueComplete(const mol::ResidueHandle& rh) void HeuristicBuilder::FillAtomProps(mol::AtomHandle atom) { - mol::AtomProp prop=atom.GetProp(); + mol::AtomProp prop=atom.GetAtomProps(); if (prop.element=="") { - prop.element=Builder::GuessAtomElement(atom.GetName(), - atom.GetProp().is_hetatm); + prop.element=Builder::GuessAtomElement(atom.GetName(), prop.is_hetatm); } Conopology& conop_inst=Conopology::Instance(); if (prop.radius==0.0) { @@ -470,7 +469,7 @@ void HeuristicBuilder::FillAtomProps(mol::AtomHandle atom) if (prop.mass==0.0) { prop.mass=conop_inst.GetDefaultAtomMass(prop.element); } - atom.SetProp(prop); + atom.SetAtomProps(prop); } }} // ns diff --git a/modules/conop/src/rule_based_builder.cc b/modules/conop/src/rule_based_builder.cc index 0f12cbc634f7d2a8d0200babc34d395a5e27687c..f2a8fd18f28672d36bf6f1e9a816f6b1c231ac9c 100644 --- a/modules/conop/src/rule_based_builder.cc +++ b/modules/conop/src/rule_based_builder.cc @@ -61,7 +61,7 @@ void RuleBasedBuilder::CheckResidueCompleteness(const mol::ResidueHandle& rh) { void RuleBasedBuilder::FillAtomProps(mol::AtomHandle atom, const AtomSpec& spec) { - mol::AtomProp props=atom.GetProp(); + mol::AtomProp props=atom.GetAtomProps(); if (props.element=="") { props.element=spec.element; } @@ -72,7 +72,7 @@ void RuleBasedBuilder::FillAtomProps(mol::AtomHandle atom, const AtomSpec& spec) if (props.mass==0.0) { props.mass=conop_inst.GetDefaultAtomMass(spec.element); } - atom.SetProp(props); + atom.SetAtomProps(props); } void RuleBasedBuilder::FillResidueProps(mol::ResidueHandle residue) { @@ -265,7 +265,7 @@ void RuleBasedBuilder::FillAtomProps(mol::AtomHandle atom) bool RuleBasedBuilder::OnUnknownAtom(mol::AtomHandle atom) { - mol::AtomProp props=atom.GetProp(); + mol::AtomProp props=atom.GetAtomProps(); if (props.element=="") { props.element=Builder::GuessAtomElement(atom.GetName(), props.is_hetatm); } @@ -276,7 +276,7 @@ bool RuleBasedBuilder::OnUnknownAtom(mol::AtomHandle atom) if (props.mass==0.0) { props.mass=conop_inst.GetDefaultAtomMass(props.element); } - atom.SetProp(props); + atom.SetAtomProps(props); return false; } diff --git a/modules/conop/src/sanitizer.cc b/modules/conop/src/sanitizer.cc index 17cf91874a925044fcba1bfe649b9a66d6bfb3b7..d7d8d42783840f49014d92e315dd9ed901360598 100644 --- a/modules/conop/src/sanitizer.cc +++ b/modules/conop/src/sanitizer.cc @@ -42,12 +42,12 @@ bool Sanitizer::VisitResidue(const mol::ResidueHandle& residue) { } void Sanitizer::FillAtomProps(mol::AtomHandle atom, const AtomSpec& spec) { - mol::AtomProp props=atom.GetProp(); + mol::AtomProp props=atom.GetAtomProps(); if (props.element!=spec.element) { props.element=spec.element; LOGN_MESSAGE("Correcting element for " << atom.GetQualifiedName() << " (now " << spec.element << ", was " << props.element << ")"); - atom.SetProp(props); + atom.SetAtomProps(props); } } diff --git a/modules/gfx/src/gl_include.hh b/modules/gfx/src/gl_include.hh index 10a682dee2d39ff49c1168684e909290b8a7ae82..2295ca6a336ad91753b2ce6bb95c252c1a0baf7e 100644 --- a/modules/gfx/src/gl_include.hh +++ b/modules/gfx/src/gl_include.hh @@ -29,7 +29,6 @@ #ifdef _MSC_VER #include <windows.h> -#undef GetProp # ifdef FindAtom # undef FindAtom # endif diff --git a/modules/gfx/src/impl/backbone_trace.cc b/modules/gfx/src/impl/backbone_trace.cc index 28ebb3842557e98b72eed9e6c9fb805d37cfad49..d4314bea8901f49678e55af9fa2cff6f791bfe1d 100644 --- a/modules/gfx/src/impl/backbone_trace.cc +++ b/modules/gfx/src/impl/backbone_trace.cc @@ -58,8 +58,8 @@ public: // determine atom to add to list mol::AtomHandle ca = res.GetCentralAtom(); if (ca) { - NodeEntry entry={ca, GfxObj::Ele2Color(ca.GetProp().element), - GfxObj::Ele2Color(ca.GetProp().element), + NodeEntry entry={ca, GfxObj::Ele2Color(ca.GetAtomProps().element), + GfxObj::Ele2Color(ca.GetAtomProps().element), geom::Vec3(0.0,0.0,0.0), // this will be set by the gfx trace obj res.GetCentralNormal(), 1.0, diff --git a/modules/gfx/src/impl/connect_renderer_base.cc b/modules/gfx/src/impl/connect_renderer_base.cc index 36df3b365b4a069c6fe4f6dc9a22ad226ac11c42..bc1dab565c98ebee107ca2787c7b841247d763e8 100644 --- a/modules/gfx/src/impl/connect_renderer_base.cc +++ b/modules/gfx/src/impl/connect_renderer_base.cc @@ -49,7 +49,7 @@ public: if(mode==SEL_ATOM) { float d=geom::Distance(line_,atom.GetPos()); if((fixed_radius && d<=dlim_) || - (!fixed_radius && d<=atom.GetProp().radius)) { + (!fixed_radius && d<=atom.GetRadius())) { geom::Vec3 v=Scene::Instance().Project(atom.GetPos()); if(v[2]>0.0 && v[2]<zmin_) { zmin_=v[2]; diff --git a/modules/gfx/src/impl/entity_detail.cc b/modules/gfx/src/impl/entity_detail.cc index 52f34fcabd25210c087216dfb34151bee7a9e917..1d5a3c226c70b674bf9076388272bea46de76fd1 100644 --- a/modules/gfx/src/impl/entity_detail.cc +++ b/modules/gfx/src/impl/entity_detail.cc @@ -41,8 +41,8 @@ void GfxView::AddAtom(const AtomView& av) { AtomHandle a=av.GetHandle(); AtomEntry ae(a,default_radius, - a.GetProp().radius, - GfxObj::Ele2Color(a.GetProp().element)); + a.GetRadius(), + GfxObj::Ele2Color(a.GetElement())); atom_map[a.GetHashCode()]=ae; if(av.GetBondCount()==0) { orphan_atom_list.push_back(a.GetHashCode()); @@ -70,16 +70,16 @@ void GfxView::AddBond(const BondHandle& b) if (ae1 && !ae2) { AtomHandle a=b.GetSecond(); AtomEntry ae(a,default_radius, - a.GetProp().radius, - GfxObj::Ele2Color(a.GetProp().element)); + a.GetRadius(), + GfxObj::Ele2Color(a.GetElement())); atom_map[a.GetHashCode()]=ae; ae2=&atom_map[a.GetHashCode()]; } if (!ae1 && ae2) { AtomHandle a=b.GetFirst(); AtomEntry ae(a,default_radius, - a.GetProp().radius, - GfxObj::Ele2Color(a.GetProp().element)); + a.GetRadius(), + GfxObj::Ele2Color(a.GetElement())); atom_map[a.GetHashCode()]=ae; ae1=&atom_map[a.GetHashCode()]; } diff --git a/modules/gfx/src/impl/entity_renderer.hh b/modules/gfx/src/impl/entity_renderer.hh index db0825dd59640d78b382d72ef592d69d615fc562..2fa91e110442b022a0c64d3ad0cc2963d10f1641 100644 --- a/modules/gfx/src/impl/entity_renderer.hh +++ b/modules/gfx/src/impl/entity_renderer.hh @@ -24,8 +24,8 @@ */ -#if defined(GetProp) -#undef GetProp +#if defined(GetAtomProps) +#undef GetAtomProps #endif #include <vector> @@ -185,7 +185,7 @@ protected: //Simplify color ops struct ByElementGetCol { Color ColorOfAtom(mol::AtomHandle& atom) const{ - return GfxObj::Ele2Color(atom.GetProp().element); + return GfxObj::Ele2Color(atom.GetElement()); } }; diff --git a/modules/io/src/mol/entity_io_crd_handler.cc b/modules/io/src/mol/entity_io_crd_handler.cc index e89b294f93f3f7d1f8d28240c1727766513bbd10..2fd39293ff0fe11c929e97915a59735edb034742 100644 --- a/modules/io/src/mol/entity_io_crd_handler.cc +++ b/modules/io/src/mol/entity_io_crd_handler.cc @@ -191,7 +191,7 @@ bool CRDWriter::VisitAtom(const mol::AtomHandle& atom) << format("%10.5f") % atom.GetPos().GetZ() << " " << format("%-4s") % e_name << " " << format("%-5i") % res.GetNumber() << " " - << format("%8.5f") % atom.GetProp().b_factor + << format("%8.5f") % atom.GetBFactor() << std::endl; return true; diff --git a/modules/io/src/mol/entity_io_sdf_handler.cc b/modules/io/src/mol/entity_io_sdf_handler.cc index bbd703bc1dd262cf49d98a9fca72aae1fd61bbb9..f9c49479ffbebaf52a4d03a18cafe4cb69a20c67 100644 --- a/modules/io/src/mol/entity_io_sdf_handler.cc +++ b/modules/io/src/mol/entity_io_sdf_handler.cc @@ -280,7 +280,7 @@ namespace { ostr_ << format("%10.4f") % atom.GetPos()[0] << format("%10.4f") % atom.GetPos()[1] << format("%10.4f ") % atom.GetPos()[2] - << format("%-3s") % atom.GetProp().element + << format("%-3s") % atom.GetElement() << " 0 0 0 0 0 0" << std::endl; return true; diff --git a/modules/io/src/mol/pdb_reader.cc b/modules/io/src/mol/pdb_reader.cc index 33de62cdd94f6242185b04d938cdbb704b4dd46e..f26e77672d2ff4aa62c49f8ead2c7d98544423bc 100644 --- a/modules/io/src/mol/pdb_reader.cc +++ b/modules/io/src/mol/pdb_reader.cc @@ -363,7 +363,7 @@ void PDBReader::ParseAnisou(const StringRef& line, int line_num, throw IOException(str(format(fmt_str) % line_num)); } //get properties which are already set and extend them by adding the ANISOU info - mol::AtomProp aprop=atom.GetProp(); + mol::AtomProp aprop=atom.GetAtomProps(); geom::Mat3 mat(anisou[0], anisou[3], anisou[4], anisou[3], anisou[1], anisou[5], anisou[4], anisou[5], anisou[2]); @@ -371,7 +371,7 @@ void PDBReader::ParseAnisou(const StringRef& line, int line_num, //divide by 10**4 to actually reflect the real values aprop.anisou/=10000; aprop.has_anisou=true; - atom.SetProp(aprop); + atom.SetAtomProps(aprop); return; } diff --git a/modules/io/src/mol/pdb_writer.cc b/modules/io/src/mol/pdb_writer.cc index 36f9ce9e2f8fae5081204e6546f4077022313b54..cc8cd4bf50d828ecd40c658a65aafee0aa9796f9 100644 --- a/modules/io/src/mol/pdb_writer.cc +++ b/modules/io/src/mol/pdb_writer.cc @@ -36,7 +36,7 @@ void write_atom(std::ostream& ostr, const mol::AtomHandle& atom, int atomnum, { mol::ResidueHandle res=atom.GetResidue(); char ins_code=res.GetNumber().GetInsCode(); - String record_name=atom.GetProp().is_hetatm ? "HETATM" : "ATOM "; + String record_name=atom.GetAtomProps().is_hetatm ? "HETATM" : "ATOM "; String aname_str=atom.GetName(); if(aname_str.length()<4) { aname_str=" "+aname_str; @@ -54,13 +54,13 @@ void write_atom(std::ostream& ostr, const mol::AtomHandle& atom, int atomnum, << " " << format("%8.3f%8.3f%8.3f") % p[0] % p[1] % p[2]; if(is_pqr) { - ostr << format("%6.2f") % atom.GetProp().charge - << format("%6.2f") % atom.GetProp().radius; + ostr << format("%6.2f") % atom.GetAtomProps().charge + << format("%6.2f") % atom.GetAtomProps().radius; } else { - ostr << format("%6.2f") % atom.GetProp().occupancy - << format("%6.2f") % atom.GetProp().b_factor; + ostr << format("%6.2f") % atom.GetAtomProps().occupancy + << format("%6.2f") % atom.GetAtomProps().b_factor; } - ostr << format("%10s%2s") % "" % atom.GetProp().element + ostr << format("%10s%2s") % "" % atom.GetAtomProps().element << std::endl ; } else { @@ -77,13 +77,13 @@ void write_atom(std::ostream& ostr, const mol::AtomHandle& atom, int atomnum, << " " << format("%8.3f%8.3f%8.3f") % p[0] % p[1] % p[2]; if(is_pqr) { - ostr << format("%6.2f") % atom.GetProp().charge - << format("%6.2f") % atom.GetProp().radius; + ostr << format("%6.2f") % atom.GetAtomProps().charge + << format("%6.2f") % atom.GetAtomProps().radius; } else { - ostr << format("%6.2f") % atom.GetProp().occupancy - << format("%6.2f") % atom.GetProp().b_factor; + ostr << format("%6.2f") % atom.GetAtomProps().occupancy + << format("%6.2f") % atom.GetAtomProps().b_factor; } - ostr << format("%10s%2s") % "" % atom.GetProp().element + ostr << format("%10s%2s") % "" % atom.GetAtomProps().element << std::endl ; } diff --git a/modules/io/tests/test_io_pdb.cc b/modules/io/tests/test_io_pdb.cc index 8086022d66d9ada41930b0c3ffb1edd82f3b55e0..811c459a891d1f08e8400242ef896979a3829fbb 100644 --- a/modules/io/tests/test_io_pdb.cc +++ b/modules/io/tests/test_io_pdb.cc @@ -64,10 +64,10 @@ BOOST_AUTO_TEST_CASE(atom_record) BOOST_CHECK_EQUAL(a1.GetResidue().GetChain().GetName(), "A"); BOOST_CHECK_EQUAL(a1.GetPos(), geom::Vec3(16.0, 64.0, 8.0)); - BOOST_CHECK_EQUAL(a1.GetProp().b_factor, 1.0); - BOOST_CHECK_EQUAL(a1.GetProp().occupancy, 0.5); - BOOST_CHECK_EQUAL(a1.GetProp().element, "N"); - BOOST_CHECK_EQUAL(a1.GetProp().is_hetatm, false); + BOOST_CHECK_EQUAL(a1.GetAtomProps().b_factor, 1.0); + BOOST_CHECK_EQUAL(a1.GetAtomProps().occupancy, 0.5); + BOOST_CHECK_EQUAL(a1.GetAtomProps().element, "N"); + BOOST_CHECK_EQUAL(a1.GetAtomProps().is_hetatm, false); mol::AtomHandle a2=ent.FindAtom(" ", mol::ResNum(1), "CA"); BOOST_REQUIRE(a2.IsValid()); BOOST_CHECK_EQUAL(a2.GetName(), "CA"); @@ -75,10 +75,10 @@ BOOST_AUTO_TEST_CASE(atom_record) BOOST_CHECK_EQUAL(a2.GetResidue().GetChain().GetName(), " "); BOOST_CHECK_EQUAL(a2.GetPos(), geom::Vec3(32.0, -128.0, -2.5)); - BOOST_CHECK_EQUAL(a2.GetProp().b_factor, 128.0); - BOOST_CHECK_EQUAL(a2.GetProp().occupancy, 1.0); - BOOST_CHECK_EQUAL(a2.GetProp().element, "C"); - BOOST_CHECK_EQUAL(a2.GetProp().is_hetatm, true); + BOOST_CHECK_EQUAL(a2.GetAtomProps().b_factor, 128.0); + BOOST_CHECK_EQUAL(a2.GetAtomProps().occupancy, 1.0); + BOOST_CHECK_EQUAL(a2.GetAtomProps().element, "C"); + BOOST_CHECK_EQUAL(a2.GetAtomProps().is_hetatm, true); } BOOST_AUTO_TEST_CASE(end_record) @@ -159,7 +159,7 @@ BOOST_AUTO_TEST_CASE(anisou_record) BOOST_REQUIRE(ent.GetAtomCount()==1); mol::AtomHandle a1=ent.FindAtom("A", mol::ResNum(7), "N"); BOOST_REQUIRE(a1.IsValid()); - mol::AtomProp props=a1.GetProp(); + mol::AtomProp props=a1.GetAtomProps(); BOOST_CHECK_CLOSE( 0.0100, props.anisou(0, 0), 1e-4); BOOST_CHECK_CLOSE(-0.0016, props.anisou(1, 0), 1e-4); BOOST_CHECK_CLOSE(-0.0026, props.anisou(2, 0), 1e-4); diff --git a/modules/mol/base/pymod/export_atom.cc b/modules/mol/base/pymod/export_atom.cc index bb8c9fe31afea70a0ff111b82de719df2c186ab0..83f2adc0648de4b6eaacccadfba7dbf0337d812b 100644 --- a/modules/mol/base/pymod/export_atom.cc +++ b/modules/mol/base/pymod/export_atom.cc @@ -44,12 +44,12 @@ void export_Atom() .def(self_ns::str(self)) .add_property("hash_code", &AtomBase::GetHashCode) .def("GetHashCode", &AtomBase::GetHashCode) - .def("GetProp", &AtomBase::GetProp, + .def("GetAtomProps", &AtomBase::GetAtomProps, return_value_policy<copy_const_reference>()) - .def("SetProp", &AtomBase::SetProp, args("prop")) + .def("SetAtomProps", &AtomBase::SetAtomProps, args("prop")) .def("GetIndex", &AtomBase::GetIndex) .add_property("prop", - make_function(&AtomBase::GetProp, + make_function(&AtomBase::GetAtomProps, return_value_policy<copy_const_reference>())) .add_property("pos", make_function(&AtomBase::GetPos, @@ -59,7 +59,19 @@ void export_Atom() return_value_policy<copy_const_reference>()), &AtomBase::SetName) .add_property("index",&AtomBase::GetIndex) - + + .def("GetRadius", &AtomBase::GetRadius) + .def("GetElement", &AtomBase::GetElement, + return_value_policy<copy_const_reference>()) + .def("GetCharge", &AtomBase::GetCharge) + .def("GetMass", &AtomBase::GetMass) + .def("IsHetAtom", &AtomBase::IsHetAtom) + .add_property("radius", &AtomBase::GetRadius) + .add_property("element", make_function(&AtomBase::GetElement, + return_value_policy<copy_const_reference>())) + .add_property("is_hetatom", &AtomBase::IsHetAtom) + .add_property("charge", &AtomBase::GetCharge) + .add_property("mass", &AtomBase::GetMass) ; generic_prop_def<AtomBase>(atom_base); diff --git a/modules/mol/base/src/atom_base.cc b/modules/mol/base/src/atom_base.cc index ac0a63e731e88d33e355e1669f03c4469d5a2f6d..8eaff3164a27365f42b981a80495e6eb1c9f93f1 100644 --- a/modules/mol/base/src/atom_base.cc +++ b/modules/mol/base/src/atom_base.cc @@ -76,16 +76,16 @@ std::vector<String> AtomBase::GetAltGroupNames() const } -const AtomProp& AtomBase::GetProp() const +const AtomProp& AtomBase::GetAtomProps() const { this->CheckValidity(); - return impl_->GetProp(); + return impl_->GetAtomProps(); } -void AtomBase::SetProp(const AtomProp& prop) +void AtomBase::SetAtomProps(const AtomProp& prop) { this->CheckValidity(); - impl_->GetProp()=prop; + impl_->GetAtomProps()=prop; } impl::AtomImplPtr& AtomBase::Impl() @@ -137,6 +137,51 @@ std::ostream& operator<<(std::ostream& os, const AtomBase& atom) } +Real AtomBase::GetRadius() const +{ + this->CheckValidity(); + return Impl()->GetAtomProps().radius; +} + + +const String& AtomBase::GetElement() const +{ + this->CheckValidity(); + return Impl()->GetAtomProps().element; +} + + +bool AtomBase::IsHetAtom() const +{ + this->CheckValidity(); + return Impl()->GetAtomProps().is_hetatm; +} + +Real AtomBase::GetBFactor() const +{ + this->CheckValidity(); + return Impl()->GetAtomProps().b_factor; +} + +Real AtomBase::GetMass() const +{ + this->CheckValidity(); + return Impl()->GetAtomProps().mass; +} + +Real AtomBase::GetCharge() const +{ + this->CheckValidity(); + return Impl()->GetAtomProps().charge; +} + +Real AtomBase::GetOccupancy() const +{ + this->CheckValidity(); + return Impl()->GetAtomProps().occupancy; +} + + String AtomBase::GetStringProperty(Prop::ID prop_id) const { this->CheckValidity(); diff --git a/modules/mol/base/src/atom_base.hh b/modules/mol/base/src/atom_base.hh index 9744f00f8b06f87ab192c4ac9a293369b4d789a6..142f1a9db2acab1949bef593ff7a99b5715230c1 100644 --- a/modules/mol/base/src/atom_base.hh +++ b/modules/mol/base/src/atom_base.hh @@ -33,7 +33,7 @@ namespace ost { namespace mol { /// Groups common functionality for AtomView and AtomHandle. /// /// Most of the atom properties such as temperature factor, element, radius -/// and charge can be accessed with #GetProp() that returns an object of +/// and charge can be accessed with #GetAtomProps() that returns an object of /// type AtomProp. /// /// Like \ref ResidueBase residues, \ref ChainBase "chains" and @@ -80,11 +80,11 @@ public: /// \brief Get atom properties such as element name, radius crystallographic /// occupancy and temperature factors. /// - /// \sa #SetProp - const AtomProp& GetProp() const; + /// \sa #SetAtomProps + const AtomProp& GetAtomProps() const; /// \brief Set atom properties. - void SetProp(const AtomProp& prop); + void SetAtomProps(const AtomProp& prop); //@} /// \name Handle validity @@ -120,11 +120,36 @@ public: /// \brief Get the internal index unsigned long GetIndex() const; + /// \brief returns the van-der-Waals radius of the atom + Real GetRadius() const; + + /// \brief returns the element name of the atom + const String& GetElement() const; + + /// \brief whether the atom is a hetatm + bool IsHetAtom() const; + + /// \brief Get isotropic temperature factor of atom + /// + /// The returned value may be zero for some structures + Real GetBFactor() const; + + /// \brief get mass of atom + /// + /// The returned value may be zero + Real GetMass() const; + + /// \brief get charge + Real GetCharge() const; + + /// \brief get atom occupancy + Real GetOccupancy() const; + /// \brief get atom implementation. /// /// Intended for internal use. const impl::AtomImplPtr& Impl() const; - + /// \brief get atom implementation impl::AtomImplPtr& Impl(); diff --git a/modules/mol/base/src/chain_view.cc b/modules/mol/base/src/chain_view.cc index dff4e770e074e261a0d3f60fcaa5c052a6c7f70b..87fd218701569abd1cf15260b93b8a09bcc081cb 100644 --- a/modules/mol/base/src/chain_view.cc +++ b/modules/mol/base/src/chain_view.cc @@ -313,7 +313,7 @@ Real ChainView::GetMass() const { ResidueView r=*i; for (AtomViewList::const_iterator j=r.GetAtomList().begin(), e2=r.GetAtomList().end(); j!=e2; ++j) { - mass+=j->GetProp().mass; + mass+=j->GetMass(); } } return mass; @@ -388,7 +388,7 @@ geom::Vec3 ChainView::GetCenterOfMass() const ResidueView r=*i; for (AtomViewList::const_iterator j=r.GetAtomList().begin(), e2=r.GetAtomList().end(); j!=e2; ++j) { - center+=j->GetPos() * j->GetProp().mass; + center+=j->GetPos() * j->GetAtomProps().mass; } } center/=mass; diff --git a/modules/mol/base/src/entity_view.cc b/modules/mol/base/src/entity_view.cc index 6616e3b985921427e5319d7c1b10176980339e0a..34f7d506421cef9b32aeaec3c46a0470d89c3f2c 100644 --- a/modules/mol/base/src/entity_view.cc +++ b/modules/mol/base/src/entity_view.cc @@ -185,7 +185,7 @@ geom::Vec3 EntityView::GetCenterOfMass() const if (this->GetAtomCount()>0 && mass>0) { AtomViewIter it=this->AtomsBegin(); for(; it!=this->AtomsEnd(); ++it) { - center+=(*it).GetPos()*(*it).GetProp().mass; + center+=(*it).GetPos()*(*it).GetMass(); } center/=mass; } @@ -197,7 +197,7 @@ Real EntityView::GetMass() const Real mass = 0; AtomViewIter it=this->AtomsBegin(); for(; it!=this->AtomsEnd(); ++it) { - mass+=(*it).GetProp().mass; + mass+=(*it).GetMass(); } return mass; } diff --git a/modules/mol/base/src/impl/atom_impl.hh b/modules/mol/base/src/impl/atom_impl.hh index b24abc85c7d55e9f5eed8bca31cb1d3ee785ac94..9fcbbf77636a50e0871bf6b01ea70bc28c8a157d 100644 --- a/modules/mol/base/src/impl/atom_impl.hh +++ b/modules/mol/base/src/impl/atom_impl.hh @@ -71,9 +71,9 @@ public: void SetOriginalPos(const geom::Vec3& pos) { pos_=pos; } - const AtomProp& GetProp() const {return prop_;} + const AtomProp& GetAtomProps() const {return prop_;} - AtomProp& GetProp() {return prop_;} + AtomProp& GetAtomProps() {return prop_;} ResidueImplPtr GetResidue() const; diff --git a/modules/mol/base/src/impl/chain_impl.cc b/modules/mol/base/src/impl/chain_impl.cc index 72b1303772f9541ffe13038980fb58f47a63d462..02f4636c1cc5e60865ad92b5e7ddcd3901a23ed0 100644 --- a/modules/mol/base/src/impl/chain_impl.cc +++ b/modules/mol/base/src/impl/chain_impl.cc @@ -357,7 +357,7 @@ Real ChainImpl::GetMass() const ResidueImplPtr r=*i; for (AtomImplList::iterator j=r->GetAtomList().begin(); j!=r->GetAtomList().end(); ++j) { - mass+=(*j)->GetProp().mass; + mass+=(*j)->GetAtomProps().mass; } } return mass; @@ -426,7 +426,7 @@ geom::Vec3 ChainImpl::GetCenterOfMass() const ResidueImplPtr r=*i; for (AtomImplList::iterator j=r->GetAtomList().begin(); j!=r->GetAtomList().end(); ++j) { - center+=(*j)->GetPos() * (*j)->GetProp().mass; + center+=(*j)->GetPos() * (*j)->GetAtomProps().mass; } } center/=mass; diff --git a/modules/mol/base/src/impl/entity_impl.cc b/modules/mol/base/src/impl/entity_impl.cc index 2a271f341946116568f34fb9fff8ca1a96e481d9..29fdad970ebddf5f8a8a49e54a436182bbc1c068 100644 --- a/modules/mol/base/src/impl/entity_impl.cc +++ b/modules/mol/base/src/impl/entity_impl.cc @@ -328,7 +328,7 @@ geom::Vec3 EntityImpl::GetCenterOfMass() const { Real mass = this->GetMass(); if (this->GetAtomCount()>0 && mass>0) { for(AtomImplMap::const_iterator it = atom_map_.begin();it!=atom_map_.end();++it) { - center+=it->second->GetPos()*it->second->GetProp().mass; + center+=it->second->GetPos()*it->second->GetAtomProps().mass; } center/=mass; } @@ -339,7 +339,7 @@ Real EntityImpl::GetMass() const { Real mass=0.0; for (AtomImplMap::const_iterator it = atom_map_.begin(); it!=atom_map_.end();++it) { - mass+=it->second->GetProp().mass; + mass+=it->second->GetAtomProps().mass; } return mass; } diff --git a/modules/mol/base/src/impl/query_ast.hh b/modules/mol/base/src/impl/query_ast.hh index abdcbe1e582c060324b04c569bd8d50bcb074c5e..3abedd805027476c33c012d4dbab46cd2a338962 100644 --- a/modules/mol/base/src/impl/query_ast.hh +++ b/modules/mol/base/src/impl/query_ast.hh @@ -121,7 +121,7 @@ public: virtual void Dump(int level=0) const; - const Prop& GetProp() const { + const Prop& GetAtomProps() const { return sel_; } CompOP GetCompOP() const { diff --git a/modules/mol/base/src/impl/query_impl.cc b/modules/mol/base/src/impl/query_impl.cc index 411f1d9bc18f3df563730a8551885a7a75a86343..312b38d6db7e483d0e419c2991919e1189997e1f 100644 --- a/modules/mol/base/src/impl/query_impl.cc +++ b/modules/mol/base/src/impl/query_impl.cc @@ -280,7 +280,7 @@ bool QueryImpl::IsAlwaysUndef(const Node* ast, else { const SelNode* sel_node = dynamic_cast<const SelNode*>(ast); assert(sel_node); - if ((int)target_level > (int)sel_node->GetProp().level) { + if ((int)target_level > (int)sel_node->GetAtomProps().level) { return true; } } @@ -296,7 +296,7 @@ void QueryImpl::ExtractSelStmts(const Node* ast) { else { const SelNode* sel_node = dynamic_cast<const SelNode*>(ast); assert(sel_node); - SelStmt val(sel_node->GetProp().id, + SelStmt val(sel_node->GetAtomProps().id, sel_node->GetCompOP(), sel_node->GetParm()); std::vector<SelStmt>::iterator i = std::find(sel_values_.begin(), @@ -304,7 +304,7 @@ void QueryImpl::ExtractSelStmts(const Node* ast) { if (i==sel_values_.end()) { size_t idx = sel_values_.size(); sel_values_.push_back(val); - indices_[(int)sel_node->GetProp().level].insert(idx); + indices_[(int)sel_node->GetAtomProps().level].insert(idx); } } } @@ -361,8 +361,8 @@ void QueryImpl::ASTToSelStack(const Node* src_ast, } else { const SelNode* sel_node = dynamic_cast<const SelNode*>(src_ast); - assert((int)target_level <= (int)sel_node->GetProp().level); - SelStmt val(sel_node->GetProp().id,sel_node->GetCompOP(), + assert((int)target_level <= (int)sel_node->GetAtomProps().level); + SelStmt val(sel_node->GetAtomProps().id,sel_node->GetCompOP(), sel_node->GetParm()); std::vector<SelStmt>::iterator i = std::find(sel_values_.begin(), sel_values_.end(),val); diff --git a/modules/mol/base/src/impl/residue_impl.cc b/modules/mol/base/src/impl/residue_impl.cc index b45dae81083563c2d43c643bc61f4ee41534a445..bfee304770bcb5ec53443cda276127dc1458b074 100644 --- a/modules/mol/base/src/impl/residue_impl.cc +++ b/modules/mol/base/src/impl/residue_impl.cc @@ -59,7 +59,7 @@ AtomImplPtr ResidueImpl::InsertAtom(const AtomImplPtr& atom) { AtomImplPtr dst_atom=this->InsertAtom(atom->GetName(), atom->GetPos(), - atom->GetProp()); + atom->GetAtomProps()); dst_atom->Assign(*atom.get()); dst_atom->SetState(atom->GetState()); return dst_atom; @@ -70,7 +70,7 @@ Real ResidueImpl::GetAverageBFactor() const Real sum=0; for (AtomImplList::const_iterator i=atom_list_.begin(), e=atom_list_.end(); i!=e; ++i) { - sum+=(*i)->GetProp().b_factor; + sum+=(*i)->GetAtomProps().b_factor; } return atom_list_.size()>0 ? sum/atom_list_.size() : 0.0; } @@ -422,7 +422,7 @@ Real ResidueImpl::GetMass() const Real mass = 0; for (AtomImplList::const_iterator i=atom_list_.begin(); i!=atom_list_.end(); ++i) { - mass+=(*i)->GetProp().mass; + mass+=(*i)->GetAtomProps().mass; } return mass; } @@ -474,7 +474,7 @@ geom::Vec3 ResidueImpl::GetCenterOfMass() const if (this->GetAtomCount() > 0 && mass > 0) { for (AtomImplList::const_iterator i=atom_list_.begin(); i!=atom_list_.end(); ++i) { - center+=(*i)->GetPos()*(*i)->GetProp().mass; + center+=(*i)->GetPos()*(*i)->GetAtomProps().mass; } } return center/mass; diff --git a/modules/mol/base/src/query_state.cc b/modules/mol/base/src/query_state.cc index 004af514f0c573ff6d180a7fe09b25a50789bbb0..c3e68560b175d21de8ad6591161e273a4b50f149 100644 --- a/modules/mol/base/src/query_state.cc +++ b/modules/mol/base/src/query_state.cc @@ -326,17 +326,17 @@ boost::logic::tribool QueryState::EvalAtom(const impl::AtomImplPtr& a) { boost::get<float>(ss.param)); break; case Prop::OCC: - float_value=a->GetProp().occupancy; + float_value=a->GetAtomProps().occupancy; s_[*i]=cmp_num<Real>(ss.comp_op, float_value, boost::get<float>(ss.param)); break; case Prop::ELE: - str_value = a->GetProp().element; + str_value = a->GetAtomProps().element; s_[*i] = cmp_string(ss.comp_op,str_value, boost::get<String>(ss.param)); break; case Prop::ABFAC: - float_value=a->GetProp().b_factor; + float_value=a->GetAtomProps().b_factor; s_[*i]=cmp_num<Real>(ss.comp_op, float_value, boost::get<float>(ss.param)); break; @@ -346,11 +346,11 @@ boost::logic::tribool QueryState::EvalAtom(const impl::AtomImplPtr& a) { ss.comp_op); break; case Prop::ISHETATM: - int_value = a->GetProp().is_hetatm; + int_value = a->GetAtomProps().is_hetatm; s_[*i] = cmp_num<int>(ss.comp_op,int_value,boost::get<int>(ss.param)); break; case Prop::ACHARGE: - float_value=a->GetProp().charge; + float_value=a->GetAtomProps().charge; s_[*i]=cmp_num<Real>(ss.comp_op, float_value, boost::get<float>(ss.param)); break; diff --git a/modules/mol/base/src/residue_view.cc b/modules/mol/base/src/residue_view.cc index 29585678e9656899c480bf6eb22b5f6ff5f40407..e976652449b8cc15bf0d780c58f3fa8521e6f4c0 100644 --- a/modules/mol/base/src/residue_view.cc +++ b/modules/mol/base/src/residue_view.cc @@ -194,7 +194,7 @@ double ResidueView::GetMass() const double mass = 0; AtomViewList::const_iterator i; for (i=data_->atoms.begin(); i!=data_->atoms.end(); ++i) { - mass+=(*i).GetProp().mass; + mass+=(*i).GetAtomProps().mass; } return mass; } @@ -239,7 +239,7 @@ geom::Vec3 ResidueView::GetCenterOfMass() const if (!data_->atoms.empty() && mass > 0) { AtomViewList::const_iterator i; for (i=data_->atoms.begin(); i!=data_->atoms.end(); ++i) { - center+=(*i).GetPos()*(*i).GetProp().mass; + center+=(*i).GetPos()*(*i).GetAtomProps().mass; } center/=mass; } diff --git a/modules/mol/base/src/surface_builder.cc b/modules/mol/base/src/surface_builder.cc index b989c7382b3364d3b6044e5ccd43ed0f275927c0..75214f3de4d24f215c1d93ac7260fa97f7422d49 100644 --- a/modules/mol/base/src/surface_builder.cc +++ b/modules/mol/base/src/surface_builder.cc @@ -32,7 +32,7 @@ SurfaceHandle BuildSurface(const EntityView& ev, Real probe_radius, Real patch_s rsurf::RSurf rsurf(probe_radius); for(AtomViewIter it=ev.AtomsBegin();it!=ev.AtomsEnd();++it) { - rsurf.AddSphere((*it).GetPos(),(*it).GetProp().radius,(*it).GetQualifiedName()); + rsurf.AddSphere((*it).GetPos(),(*it).GetAtomProps().radius,(*it).GetQualifiedName()); } rsurf.Build(); diff --git a/modules/qa/src/clash_score.cc b/modules/qa/src/clash_score.cc index 7ccfaafac069c36c09bea79da196c7f1872a5809..66b95c09635eefd8fbf2fdbde5db2e78cf5bf501 100644 --- a/modules/qa/src/clash_score.cc +++ b/modules/qa/src/clash_score.cc @@ -48,12 +48,12 @@ Real do_clash_score(const T& ent_a, const mol::EntityView& ent_b) for (I i=ent_a.AtomsBegin(), e=ent_a.AtomsEnd(); i!=e; ++i) { mol::AtomViewList clashees=ent_b.FindWithin((*i).GetPos(), - (*i).GetProp().radius+1.7); + (*i).GetAtomProps().radius+1.7); for (mol::AtomViewList::iterator j=clashees.begin(), e2=clashees.end(); j!=e2; ++j) { - energy+=StericEnergy((*j).GetPos(), (*j).GetProp().radius-0.25, - (*i).GetPos(), (*i).GetProp().radius-0.25); + energy+=StericEnergy((*j).GetPos(), (*j).GetAtomProps().radius-0.25, + (*i).GetPos(), (*i).GetAtomProps().radius-0.25); } } return energy; @@ -75,11 +75,11 @@ Real ClashScore(const mol::AtomHandle& atom, const mol::EntityView& ent_b) { Real energy=0.0; mol::AtomViewList clashees=ent_b.FindWithin(atom.GetPos(), - atom.GetProp().radius+2.0); + atom.GetAtomProps().radius+2.0); for (mol::AtomViewList::iterator j=clashees.begin(), e2=clashees.end(); j!=e2; ++j) { - energy+=StericEnergy((*j).GetPos(), (*j).GetProp().radius, - atom.GetPos(), atom.GetProp().radius); + energy+=StericEnergy((*j).GetPos(), (*j).GetAtomProps().radius, + atom.GetPos(), atom.GetAtomProps().radius); } return energy; }