Skip to content

Commit

Permalink
Correct valence
Browse files Browse the repository at this point in the history
  • Loading branch information
johnmay committed Mar 16, 2017
1 parent 57cd683 commit 5db4119
Showing 1 changed file with 7 additions and 2 deletions.
Expand Up @@ -2511,8 +2511,13 @@ private boolean isAcceptable(IAtom atom, IAtomContainer container, IAtomType typ
}

// confirm correct valency
if (type.getValency() != CDKConstants.UNSET && container.getBondOrderSum(atom) > type.getValency())
return false;
if (type.getValency() != CDKConstants.UNSET) {
double valence = container.getBondOrderSum(atom);
if (atom.getImplicitHydrogenCount() != 0)
valence += atom.getImplicitHydrogenCount();
if (valence > type.getValency())
return false;
}

// confirm correct formal charge
if (atom.getFormalCharge() != CDKConstants.UNSET && !atom.getFormalCharge().equals(type.getFormalCharge()))
Expand Down

0 comments on commit 5db4119

Please sign in to comment.