diff --git a/openchemlib b/openchemlib index 6cb49c86..371e35aa 160000 --- a/openchemlib +++ b/openchemlib @@ -1 +1 @@ -Subproject commit 6cb49c868a3e03c6b91343be10cb80279112077c +Subproject commit 371e35aaeec16e3b7eeda4087580f0b95e52f87d diff --git a/src/com/actelion/research/gwt/chemlib/com/actelion/research/chem/Canonizer.java b/src/com/actelion/research/gwt/chemlib/com/actelion/research/chem/Canonizer.java index 6beda750..dff79598 100644 --- a/src/com/actelion/research/gwt/chemlib/com/actelion/research/chem/Canonizer.java +++ b/src/com/actelion/research/gwt/chemlib/com/actelion/research/chem/Canonizer.java @@ -3417,7 +3417,7 @@ private void encodeCoordinates(boolean keepPositionAndScale, Coordinates[] coord mEncodingBuffer.append(includeHydrogenCoordinates ? '#' : '!'); encodeBits(mZCoordinatesAvailable ? 1 : 0, 1); encodeBits(keepPositionAndScale ? 1 : 0, 1); - encodeBits(resolutionBits/2, 4); // resolution bits devided by 2 + encodeBits(resolutionBits >> 1, 4); // resolution bits divided by 2 double maxDelta = 0.0; for (int i=1; i> 1) - 1); + double maxDeltaPlusHalfIncrement = maxDelta + 0.5 * increment; for (int i=1; i> 1)); + double decodedDY = factor * (decodeBits(resolutionBits) + 1 - (binCount >> 1)); + mMol.setAtomX(atom, mMol.getAtomX(from) + decodedDX); + mMol.setAtomY(atom, mMol.getAtomY(from) + decodedDY); if (coordsAre3D) - mMol.setAtomZ(atom, mMol.getAtomZ(from) + factor * (decodeBits(resolutionBits) - binCount / 2.0)); + mMol.setAtomZ(atom, mMol.getAtomZ(from) + factor * (decodeBits(resolutionBits) + 1 - (binCount >> 1))); } if (coordinates[coordsStart] == '#') { // we have 3D-coordinates that include implicit hydrogen coordinates @@ -790,10 +793,10 @@ public void parse(StereoMolecule mol, byte[] idcode, byte[] coordinates, int idc int hydrogen = mMol.addAtom(1); mMol.addBond(atom, hydrogen, Molecule.cBondTypeSingle); - mMol.setAtomX(hydrogen, mMol.getAtomX(atom) + (decodeBits(resolutionBits) - binCount / 2.0)); - mMol.setAtomY(hydrogen, mMol.getAtomY(atom) + (decodeBits(resolutionBits) - binCount / 2.0)); + mMol.setAtomX(hydrogen, mMol.getAtomX(atom) + (decodeBits(resolutionBits) + 1 - (binCount >> 1))); + mMol.setAtomY(hydrogen, mMol.getAtomY(atom) + (decodeBits(resolutionBits) + 1 - (binCount >> 1))); if (coordsAre3D) - mMol.setAtomZ(hydrogen, mMol.getAtomZ(atom) + (decodeBits(resolutionBits) - binCount / 2.0)); + mMol.setAtomZ(hydrogen, mMol.getAtomZ(atom) + (decodeBits(resolutionBits) + 1 - (binCount >> 1))); if (selectedHydrogenBits != null && (selectedHydrogenBits[atom] & (1 << i)) != 0) mMol.setAtomSelection(hydrogen, true);