Skip to content

Commit

Permalink
Merge pull request #269 from cdk/patch/newatom
Browse files Browse the repository at this point in the history
Well, it makes PseudoAtom less important... so, yes, a functional change. As long as it is a conscious choice, I had my chance to express my mild concern. Downstream code/algorithms will now have to take into account that an IAtom implementation that is not an IPseudoAtom can still not have a valid atom number...

I won't block :)
  • Loading branch information
egonw committed Feb 19, 2017
2 parents c3f55ae + 8eb60ae commit f1e1e2c
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
4 changes: 4 additions & 0 deletions base/data/src/main/java/org/openscience/cdk/Atom.java
Expand Up @@ -536,6 +536,10 @@ private static boolean parseAtomSymbol(IAtom atom, String str) {
atom.setAtomicNumber(0);
atom.setSymbol("R");
return true;
} else if ("*".equals(str)) {
atom.setAtomicNumber(0);
atom.setSymbol("*");
return true;
} else if ("D".equals(str)) {
atom.setAtomicNumber(1);
atom.setMassNumber(2);
Expand Down
Expand Up @@ -513,7 +513,6 @@ private static boolean isDigit(char c) {
}

private static boolean parseAtomSymbol(IAtom atom, String str) {

Elements elem = Elements.ofString(str);
if (elem != Elements.Unknown) {
atom.setAtomicNumber(elem.number());
Expand All @@ -523,6 +522,10 @@ private static boolean parseAtomSymbol(IAtom atom, String str) {
atom.setAtomicNumber(0);
atom.setSymbol("R");
return true;
} else if ("*".equals(str)) {
atom.setAtomicNumber(0);
atom.setSymbol("*");
return true;
} else if ("D".equals(str)) {
atom.setAtomicNumber(1);
atom.setMassNumber(2);
Expand Down
Expand Up @@ -1344,7 +1344,7 @@ public static IAtomContainer skeleton(IAtomContainer src) {
IBond[] bonds = new IBond[src.getBondCount()];

for (int i = 0; i < atoms.length; i++) {
atoms[i] = builder.newInstance(IAtom.class, src.getAtom(i).getSymbol());
atoms[i] = builder.newInstance(IAtom.class, src.getAtom(i).getAtomicNumber());
}
for (int i = 0; i < bonds.length; i++) {
IBond bond = src.getBond(i);
Expand Down

0 comments on commit f1e1e2c

Please sign in to comment.