Skip to content

Instantly share code, notes, and snippets.

@mojaie
Last active December 10, 2015 01:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mojaie/4359213 to your computer and use it in GitHub Desktop.
Save mojaie/4359213 to your computer and use it in GitHub Desktop.
// 水素原子の削除
molecule = (IMolecule) AtomContainerManipulator.removeHydrogens((IAtomContainer) molecule);
// 末端、ヘテロ原子上の水素のみ表示
CDKAtomTypeMatcher matcher = CDKAtomTypeMatcher.getInstance(molecule.getBuilder());
for (IAtom atom : molecule.atoms()) {
try {
IAtomType type = matcher.findMatchingAtomType(molecule, atom);
atom.setImplicitHydrogenCount(
type.getFormalNeighbourCount() - molecule.getConnectedAtomsCount(atom));
} catch (CDKException e) {
e.printStackTrace();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment