openchemlib 9.5.1 → 9.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -718,6 +718,7 @@ function createEditor(parentElement, options, onChange, JavaEditorArea, JavaEdit
718
718
  initialFragment = false
719
719
  } = options;
720
720
  const rootElement = document.createElement("div");
721
+ rootElement.dataset.openchemlibCanvasEditor = "true";
721
722
  Object.assign(rootElement.style, {
722
723
  width: "100%",
723
724
  height: "100%",
@@ -8257,7 +8258,6 @@ function getExports($wnd) {
8257
8258
  _.connectSeparatedSingletons = function connectSeparatedSingletons() {
8258
8259
  var atom, bond, candidate, current, currentAtom, found, graphAtom, graphLevel, highest, i, isCompatibleBond, j, parent_0, parentAtom;
8259
8260
  for (atom = 0; atom < this.mMol.getAtoms_0(); atom++) {
8260
- this.mMol.ensureHelperArrays_0(1);
8261
8261
  if (this.mIsDelocalizedAtom[atom]) {
8262
8262
  found = false;
8263
8263
  graphAtom = initUnidimensionalArray(cggl.I_classLit, { 6: 1, 4: 1, 1: 1 }, 5, this.mMol.getAtoms_0(), 15, 1);
@@ -8367,6 +8367,18 @@ function getExports($wnd) {
8367
8367
  }
8368
8368
  this.mPiElectronsAdded = 0;
8369
8369
  };
8370
+ _.isAmineOxid = function isAmineOxid(atom, mayChangeAtomCharges) {
8371
+ var connAtom, i;
8372
+ for (i = 0; i < this.mMol.getConnAtoms_0(atom); i++) {
8373
+ connAtom = this.mMol.getConnAtom_0(atom, i);
8374
+ if (this.mMol.getAtomicNo_0(connAtom) == 8 && this.mMol.getConnAtoms_0(connAtom) == 1) {
8375
+ if (mayChangeAtomCharges && this.mMol.getAtomCharge_0(connAtom) == 0)
8376
+ this.mMol.setAtomCharge_0(connAtom, -1);
8377
+ return true;
8378
+ }
8379
+ }
8380
+ return false;
8381
+ };
8370
8382
  _.locateDelocalizedDoubleBonds = function locateDelocalizedDoubleBonds(isAromaticBond) {
8371
8383
  return this.locateDelocalizedDoubleBonds_0(isAromaticBond, false, false);
8372
8384
  };
@@ -8392,7 +8404,7 @@ function getExports($wnd) {
8392
8404
  this.promoteObviousBonds();
8393
8405
  while (this.promoteOuterShellDelocalizedRingSystems(ringSet, mayChangeAtomCharges))
8394
8406
  this.promoteObviousBonds();
8395
- if (this.promoteSixMemberedAromaticRings(ringSet, mayChangeAtomCharges))
8407
+ while (this.promoteSixMemberedAromaticRings(ringSet, mayChangeAtomCharges))
8396
8408
  this.promoteObviousBonds();
8397
8409
  while (this.promoteOneDelocalizationLeak(ringSet, mayChangeAtomCharges))
8398
8410
  this.promoteObviousBonds();
@@ -8405,7 +8417,7 @@ function getExports($wnd) {
8405
8417
  }
8406
8418
  }
8407
8419
  if (mayChangeAtomCharges)
8408
- this.unchargeImmoniumNHChains();
8420
+ this.unchargeImmoniumNHChains(mayChangeAtomCharges);
8409
8421
  if (this.mDelocalizedAtoms - this.mPiElectronsAdded >= 2)
8410
8422
  this.connectSeparatedSingletons();
8411
8423
  for (atom = 0; atom < this.mMol.getAtoms_0(); atom++) {
@@ -8532,14 +8544,14 @@ function getExports($wnd) {
8532
8544
  ringAtom = ringSet.getRingAtoms_0(ring);
8533
8545
  for (i = 0; i < ringAtom.length; i++) {
8534
8546
  atom = ringAtom[i];
8547
+ bondLengthSum = jsEquals(this.mBondLength, null) ? 0 : this.mBondLength[ringBond[i]] + this.mBondLength[ringBond[(i == 0 ? ringAtom.length : i) - 1]];
8535
8548
  priority = this.mIsDelocalizedFiveRingMember[atom] ? this.checkAtomTypeLeak5(atom, false) : this.checkAtomTypeLeak7(atom, false);
8536
8549
  if (bestDelocalizationLeakPriority < priority) {
8537
8550
  bestDelocalizationLeakPriority = priority;
8538
8551
  bestDelocalizationLeakIndex = i;
8539
8552
  if (jsNotEquals(this.mBondLength, null))
8540
- bestBondLengthSum = this.mBondLength[(i == 0 ? ringAtom.length : i) - 1] + this.mBondLength[i];
8553
+ bestBondLengthSum = bondLengthSum;
8541
8554
  } else if (bestDelocalizationLeakPriority == priority && jsNotEquals(this.mBondLength, null)) {
8542
- bondLengthSum = this.mBondLength[(i == 0 ? ringAtom.length : i) - 1] + this.mBondLength[i];
8543
8555
  if (bestBondLengthSum < bondLengthSum) {
8544
8556
  bestDelocalizationLeakIndex = i;
8545
8557
  bestBondLengthSum = bondLengthSum;
@@ -8800,11 +8812,11 @@ function getExports($wnd) {
8800
8812
  }
8801
8813
  }
8802
8814
  };
8803
- _.unchargeImmoniumNHChains = function unchargeImmoniumNHChains() {
8815
+ _.unchargeImmoniumNHChains = function unchargeImmoniumNHChains(mayChangeAtomCharges) {
8804
8816
  var atom, bond, candidate, current, currentAtom, found, graphAtom, graphLevel, highest, i, isCompatibleBond, j, parent_0, parentAtom;
8805
8817
  for (atom = 0; atom < this.mMol.getAtoms_0(); atom++) {
8806
8818
  this.mMol.ensureHelperArrays_0(1);
8807
- if (this.mMol.getAtomicNo_0(atom) == 7 && this.mMol.getAtomCharge_0(atom) == 1 && this.mMol.getAtomPi_0(atom) == 1) {
8819
+ if (this.mMol.getAtomicNo_0(atom) == 7 && this.mMol.getAtomCharge_0(atom) == 1 && this.mMol.getAtomPi_0(atom) == 1 && !this.isAmineOxid(atom, mayChangeAtomCharges)) {
8808
8820
  found = false;
8809
8821
  graphAtom = initUnidimensionalArray(cggl.I_classLit, { 6: 1, 4: 1, 1: 1 }, 5, this.mMol.getAtoms_0(), 15, 1);
8810
8822
  parentAtom = initUnidimensionalArray(cggl.I_classLit, { 6: 1, 4: 1, 1: 1 }, 5, this.mMol.getAtoms_0(), 15, 1);
@@ -17508,7 +17520,7 @@ function getExports($wnd) {
17508
17520
  newStereoBond = this.preferredTHStereoBond(stereoCenter, false);
17509
17521
  if (this.mBondAtom[0][newStereoBond] != stereoCenter) {
17510
17522
  this.mBondAtom[1][newStereoBond] = this.mBondAtom[0][newStereoBond];
17511
- this.mBondAtom[1][newStereoBond] = stereoCenter;
17523
+ this.mBondAtom[0][newStereoBond] = stereoCenter;
17512
17524
  }
17513
17525
  }
17514
17526
  }
@@ -24543,19 +24555,21 @@ function getExports($wnd) {
24543
24555
  return (this.mBondRingFeatures[bond] & 65536) != 0;
24544
24556
  };
24545
24557
  _.isAtomMember_0 = function isAtomMember(ringNo, atom) {
24546
- var i, ringAtom;
24547
- ringAtom = castTo(this.mRingAtomSet.getAtIndex(ringNo), 6);
24548
- for (i = 0; i < ringAtom.length; i++)
24549
- if (atom == ringAtom[i])
24558
+ var ringAtom, ringAtom$array, ringAtom$index, ringAtom$max;
24559
+ for (ringAtom$array = castTo(this.mRingAtomSet.getAtIndex(ringNo), 6), ringAtom$index = 0, ringAtom$max = ringAtom$array.length; ringAtom$index < ringAtom$max; ++ringAtom$index) {
24560
+ ringAtom = ringAtom$array[ringAtom$index];
24561
+ if (atom == ringAtom)
24550
24562
  return true;
24563
+ }
24551
24564
  return false;
24552
24565
  };
24553
24566
  _.isBondMember_0 = function isBondMember(ringNo, bond) {
24554
- var i, ringBond;
24555
- ringBond = castTo(this.mRingBondSet.getAtIndex(ringNo), 6);
24556
- for (i = 0; i < ringBond.length; i++)
24557
- if (bond == ringBond[i])
24567
+ var ringBond, ringBond$array, ringBond$index, ringBond$max;
24568
+ for (ringBond$array = castTo(this.mRingBondSet.getAtIndex(ringNo), 6), ringBond$index = 0, ringBond$max = ringBond$array.length; ringBond$index < ringBond$max; ++ringBond$index) {
24569
+ ringBond = ringBond$array[ringBond$index];
24570
+ if (bond == ringBond)
24558
24571
  return true;
24572
+ }
24559
24573
  return false;
24560
24574
  };
24561
24575
  _.isDelocalized_0 = function isDelocalized_0(ringNo) {
@@ -24666,20 +24680,22 @@ function getExports($wnd) {
24666
24680
  }
24667
24681
  };
24668
24682
  _.updateRingSize = function updateRingSize(ringAtom, ringBond) {
24669
- var currentSize, i, i0, ringSize;
24683
+ var atom, atom$array, atom$index, atom$max, bond, bond$array, bond$index, bond$max, currentSize, ringSize;
24670
24684
  ringSize = ringAtom.length;
24671
- for (i0 = 0; i0 < ringSize; i0++) {
24672
- currentSize = this.mAtomRingFeatures[ringAtom[i0]] & 65535;
24685
+ for (atom$array = ringAtom, atom$index = 0, atom$max = atom$array.length; atom$index < atom$max; ++atom$index) {
24686
+ atom = atom$array[atom$index];
24687
+ currentSize = this.mAtomRingFeatures[atom] & 65535;
24673
24688
  if (currentSize == 0 || currentSize > ringSize) {
24674
- this.mAtomRingFeatures[ringAtom[i0]] &= ~65535;
24675
- this.mAtomRingFeatures[ringAtom[i0]] |= ringSize;
24689
+ this.mAtomRingFeatures[atom] &= ~65535;
24690
+ this.mAtomRingFeatures[atom] |= ringSize;
24676
24691
  }
24677
24692
  }
24678
- for (i = 0; i < ringSize; i++) {
24679
- currentSize = this.mBondRingFeatures[ringBond[i]] & 65535;
24693
+ for (bond$array = ringBond, bond$index = 0, bond$max = bond$array.length; bond$index < bond$max; ++bond$index) {
24694
+ bond = bond$array[bond$index];
24695
+ currentSize = this.mBondRingFeatures[bond] & 65535;
24680
24696
  if (currentSize == 0 || currentSize > ringSize) {
24681
- this.mBondRingFeatures[ringBond[i]] &= ~65535;
24682
- this.mBondRingFeatures[ringBond[i]] |= ringSize;
24697
+ this.mBondRingFeatures[bond] &= ~65535;
24698
+ this.mBondRingFeatures[bond] |= ringSize;
24683
24699
  }
24684
24700
  }
24685
24701
  };
@@ -43967,6 +43983,10 @@ function getExports($wnd) {
43967
43983
  queryFeatures |= ringSize << 17;
43968
43984
  }
43969
43985
  }
43986
+ if (this.mCBMatchFormalOrder.isSelected_0())
43987
+ queryFeatures |= 8388608;
43988
+ if (this.mCBMatchStereo.isSelected_0())
43989
+ queryFeatures |= 1048576;
43970
43990
  }
43971
43991
  this.mMol.setBondQueryFeature_0(bond, 16777215, false);
43972
43992
  this.mMol.setBondQueryFeature_0(bond, queryFeatures, true);
@@ -71022,7 +71042,7 @@ function getExports($wnd) {
71022
71042
  $sendStats("moduleStartup", "end");
71023
71043
  $gwt && $gwt.permProps && __gwtModuleFunction.__moduleStartupDone($gwt.permProps);
71024
71044
  const toReturn = $wnd["OCL"];
71025
- toReturn.version = "9.5.1";
71045
+ toReturn.version = "9.7.0";
71026
71046
  return toReturn;
71027
71047
  }
71028
71048
  var isBrowserWindow = typeof window !== "undefined" && typeof window.document !== "undefined";
@@ -71166,8 +71186,8 @@ export {
71166
71186
  };
71167
71187
  /**
71168
71188
  * openchemlib - Manipulate molecules
71169
- * @version v9.5.1
71170
- * @date 2025-07-14T08:56:48.567Z
71189
+ * @version v9.7.0
71190
+ * @date 2025-08-13T10:05:12.842Z
71171
71191
  * @link https://github.com/cheminfo/openchemlib-js
71172
71192
  * @license BSD-3-Clause
71173
71193
  */