Commit c104a08e by Maarten L. Hekkelman

fixed Atom::charge to pick more sensible default

parent dd0f6ca1
......@@ -140,11 +140,18 @@ int Atom::AtomImpl::charge() const
{
auto formalCharge = mRow["pdbx_formal_charge"].as<std::optional<int>>();
if (not formalCharge.has_value() and AtomTypeTraits(mType).isMetal())
if (not formalCharge.has_value())
{
auto &compound = comp();
formalCharge = compound.formalCharge();
for (auto cAtom : compound.atoms())
{
if (cAtom.id != mAtomID)
continue;
formalCharge = cAtom.charge;
break;
}
}
return formalCharge.value_or(0);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment