Skip to content
Snippets Groups Projects
Commit 5ccfb4e9 authored by Tobias Schmidt's avatar Tobias Schmidt
Browse files

fixed builder.GetUnknownAtoms for calling it multiple times with the same residue

parent 75582ce3
No related branches found
No related tags found
No related merge requests found
...@@ -89,9 +89,10 @@ mol::AtomHandleList RuleBasedBuilder::GetUnknownAtoms(mol::ResidueHandle res) ...@@ -89,9 +89,10 @@ mol::AtomHandleList RuleBasedBuilder::GetUnknownAtoms(mol::ResidueHandle res)
if (!last_compound_) { if (!last_compound_) {
return unknown; return unknown;
} }
mol::AtomHandleList atoms=res.GetAtomList();
last_residue_=mol::ResidueHandle();
this->ReorderAtoms(res, last_compound_); this->ReorderAtoms(res, last_compound_);
AtomSpecList::const_iterator j=last_compound_->GetAtomSpecs().begin(); AtomSpecList::const_iterator j=last_compound_->GetAtomSpecs().begin();
mol::AtomHandleList atoms=res.GetAtomList();
mol::AtomHandleList::iterator i=atoms.begin(); mol::AtomHandleList::iterator i=atoms.begin();
for (mol::AtomHandleList::iterator for (mol::AtomHandleList::iterator
i=atoms.begin(), e=atoms.end(); i!=e; ++i) { i=atoms.begin(), e=atoms.end(); i!=e; ++i) {
...@@ -153,6 +154,7 @@ void RuleBasedBuilder::ReorderAtoms(mol::ResidueHandle residue, ...@@ -153,6 +154,7 @@ void RuleBasedBuilder::ReorderAtoms(mol::ResidueHandle residue,
mol::impl::AtomImplList::iterator i=impl->GetAtomList().begin(); mol::impl::AtomImplList::iterator i=impl->GetAtomList().begin();
for (; i!=impl->GetAtomList().end(); ++i) { for (; i!=impl->GetAtomList().end(); ++i) {
mol::impl::AtomImplPtr atom=*i; mol::impl::AtomImplPtr atom=*i;
atom->SetState(std::numeric_limits<unsigned int>::max());
int index=compound->GetAtomSpecIndex(atom->GetName()); int index=compound->GetAtomSpecIndex(atom->GetName());
if (index==-1) { if (index==-1) {
if (!this->OnUnknownAtom(mol::AtomHandle(atom))) { if (!this->OnUnknownAtom(mol::AtomHandle(atom))) {
......
...@@ -116,9 +116,6 @@ public: ...@@ -116,9 +116,6 @@ public:
/// \brief Set residue properties such as chemical class /// \brief Set residue properties such as chemical class
virtual void FillResidueProps(mol::ResidueHandle residue); virtual void FillResidueProps(mol::ResidueHandle residue);
/// \brief whether the residue has unknown atoms
bool HasUnknownAtoms(mol::ResidueHandle res);
mol::AtomHandleList GetUnknownAtoms(mol::ResidueHandle res); mol::AtomHandleList GetUnknownAtoms(mol::ResidueHandle res);
/// \brief Check whether the residue has all required atoms. This does not /// \brief Check whether the residue has all required atoms. This does not
...@@ -131,6 +128,9 @@ private: ...@@ -131,6 +128,9 @@ private:
CompoundPtr last_compound_; CompoundPtr last_compound_;
mol::ResidueHandle last_residue_; mol::ResidueHandle last_residue_;
bool unknown_atoms_; bool unknown_atoms_;
/// \brief whether the residue has unknown atoms
bool HasUnknownAtoms(mol::ResidueHandle res);
void LookupCompound(const mol::ResidueHandle& rh); void LookupCompound(const mol::ResidueHandle& rh);
/// Change internal order of atoms in residue to the order given by compound /// Change internal order of atoms in residue to the order given by compound
void ReorderAtoms(mol::ResidueHandle residue, CompoundPtr compound); void ReorderAtoms(mol::ResidueHandle residue, CompoundPtr compound);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment