diff --git a/modules/conop/src/processor.cc b/modules/conop/src/processor.cc index a2e32c0bf56ddf041d57c56ef3ed4ed00afbc98c..141003c654d1008070bd1700fd2b5f613ecb8df0 100644 --- a/modules/conop/src/processor.cc +++ b/modules/conop/src/processor.cc @@ -290,15 +290,6 @@ void Processor::ConnectAtomsOfResidue(mol::ResidueHandle rh, CompoundPtr compound, bool strict_hydrogens) const { - - //if (!compound) { - // dist_connect(this, rh.GetAtomList()); - // return; - //} - //if (unknown_atoms_) { - // dist_connect(this, rh.GetAtomList()); - // return; - //} mol::XCSEditor e=rh.GetEntity().EditXCS(mol::BUFFERED_EDIT); BondSpecList::const_iterator j=compound->GetBondSpecs().begin(); mol::AtomHandleList atoms=rh.GetAtomList(); @@ -307,18 +298,16 @@ void Processor::ConnectAtomsOfResidue(mol::ResidueHandle rh, mol::AtomHandle a1=this->LocateAtom(atoms, bond.atom_one); mol::AtomHandle a2=this->LocateAtom(atoms, bond.atom_two); if (a1.IsValid() && a2.IsValid()) { + if (!strict_hydrogens && (a1.GetElement()=="H" || + a1.GetElement()=="D" || + a2.GetElement()=="H" || + a2.GetElement()=="D")) { + continue; + } if (!this->GetCheckBondFeasibility()) { - if (strict_hydrogens && (a1.GetElement()=="H" || - a2.GetElement()=="D")) { - continue; - } e.Connect(a1, a2, bond.order); } else { if (IsBondFeasible(a1, a2)) { - if (strict_hydrogens && (a1.GetElement()=="H" || - a2.GetElement()=="D")) { - continue; - } e.Connect(a1, a2, bond.order); } } @@ -405,8 +394,8 @@ void Processor::DistanceBasedConnect(mol::AtomHandle atom) const e=alist.end();it!=e;++it) { if (*it!=atom) { if (IsBondFeasible(atom, *it)) { - if (Processor::AreResiduesConsecutive(res_a, it->GetResidue()) || - it->GetResidue()==res_a) { + if (it->GetResidue()==res_a || + Processor::AreResiduesConsecutive(res_a, it->GetResidue())) { editor.Connect(*it, atom); } } diff --git a/modules/conop/src/rule_based.cc b/modules/conop/src/rule_based.cc index 902aec33d9860e5432aedb966e4793d48a86c6db..6e8b712fe63fdff02fec5836fd39316583dacc35 100644 --- a/modules/conop/src/rule_based.cc +++ b/modules/conop/src/rule_based.cc @@ -47,7 +47,7 @@ void RuleBasedProcessor::DoProcess(DiagnosticsPtr diags, mol::ResidueHandle residue = *j; mol::AtomHandleList atoms_to_connect; CompoundPtr compound = lib_->FindCompound(residue.GetName(), Compound::PDB); - if (!compound) { + if (!compound && this->GetConnect()) { // process unknown residue... this->ProcessUnkResidue(diags, residue, atoms_to_connect); for (mol::AtomHandleList::iterator k = atoms_to_connect.begin(), @@ -79,6 +79,16 @@ void RuleBasedProcessor::DoProcess(DiagnosticsPtr diags, e3=atoms_to_connect.end(); k!= e3; ++k) { this->DistanceBasedConnect(*k); } + if (!this->GetStrictHydrogens()) { + mol::AtomHandleList atoms = residue.GetAtomList(); + for (mol::AtomHandleList::iterator k = atoms.begin(), + e3 = atoms.end(); k != e3; ++k) { + const String& ele = k->GetElement(); + if ((ele == "D" || ele == "H") && k->GetBondCount() == 0) { + this->DistanceBasedConnect(*k); + } + } + } } prev = residue; }