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

fix rule-based conop with strict_hydrogens=false

parent 07ad0998
Branches
Tags
No related merge requests found
...@@ -290,15 +290,6 @@ void Processor::ConnectAtomsOfResidue(mol::ResidueHandle rh, ...@@ -290,15 +290,6 @@ void Processor::ConnectAtomsOfResidue(mol::ResidueHandle rh,
CompoundPtr compound, CompoundPtr compound,
bool strict_hydrogens) const 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); mol::XCSEditor e=rh.GetEntity().EditXCS(mol::BUFFERED_EDIT);
BondSpecList::const_iterator j=compound->GetBondSpecs().begin(); BondSpecList::const_iterator j=compound->GetBondSpecs().begin();
mol::AtomHandleList atoms=rh.GetAtomList(); mol::AtomHandleList atoms=rh.GetAtomList();
...@@ -307,18 +298,16 @@ void Processor::ConnectAtomsOfResidue(mol::ResidueHandle rh, ...@@ -307,18 +298,16 @@ void Processor::ConnectAtomsOfResidue(mol::ResidueHandle rh,
mol::AtomHandle a1=this->LocateAtom(atoms, bond.atom_one); mol::AtomHandle a1=this->LocateAtom(atoms, bond.atom_one);
mol::AtomHandle a2=this->LocateAtom(atoms, bond.atom_two); mol::AtomHandle a2=this->LocateAtom(atoms, bond.atom_two);
if (a1.IsValid() && a2.IsValid()) { 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 (!this->GetCheckBondFeasibility()) {
if (strict_hydrogens && (a1.GetElement()=="H" ||
a2.GetElement()=="D")) {
continue;
}
e.Connect(a1, a2, bond.order); e.Connect(a1, a2, bond.order);
} else { } else {
if (IsBondFeasible(a1, a2)) { if (IsBondFeasible(a1, a2)) {
if (strict_hydrogens && (a1.GetElement()=="H" ||
a2.GetElement()=="D")) {
continue;
}
e.Connect(a1, a2, bond.order); e.Connect(a1, a2, bond.order);
} }
} }
...@@ -405,8 +394,8 @@ void Processor::DistanceBasedConnect(mol::AtomHandle atom) const ...@@ -405,8 +394,8 @@ void Processor::DistanceBasedConnect(mol::AtomHandle atom) const
e=alist.end();it!=e;++it) { e=alist.end();it!=e;++it) {
if (*it!=atom) { if (*it!=atom) {
if (IsBondFeasible(atom, *it)) { if (IsBondFeasible(atom, *it)) {
if (Processor::AreResiduesConsecutive(res_a, it->GetResidue()) || if (it->GetResidue()==res_a ||
it->GetResidue()==res_a) { Processor::AreResiduesConsecutive(res_a, it->GetResidue())) {
editor.Connect(*it, atom); editor.Connect(*it, atom);
} }
} }
......
...@@ -47,7 +47,7 @@ void RuleBasedProcessor::DoProcess(DiagnosticsPtr diags, ...@@ -47,7 +47,7 @@ void RuleBasedProcessor::DoProcess(DiagnosticsPtr diags,
mol::ResidueHandle residue = *j; mol::ResidueHandle residue = *j;
mol::AtomHandleList atoms_to_connect; mol::AtomHandleList atoms_to_connect;
CompoundPtr compound = lib_->FindCompound(residue.GetName(), Compound::PDB); CompoundPtr compound = lib_->FindCompound(residue.GetName(), Compound::PDB);
if (!compound) { if (!compound && this->GetConnect()) {
// process unknown residue... // process unknown residue...
this->ProcessUnkResidue(diags, residue, atoms_to_connect); this->ProcessUnkResidue(diags, residue, atoms_to_connect);
for (mol::AtomHandleList::iterator k = atoms_to_connect.begin(), for (mol::AtomHandleList::iterator k = atoms_to_connect.begin(),
...@@ -79,6 +79,16 @@ void RuleBasedProcessor::DoProcess(DiagnosticsPtr diags, ...@@ -79,6 +79,16 @@ void RuleBasedProcessor::DoProcess(DiagnosticsPtr diags,
e3=atoms_to_connect.end(); k!= e3; ++k) { e3=atoms_to_connect.end(); k!= e3; ++k) {
this->DistanceBasedConnect(*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; prev = residue;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment