openchemlib 9.0.1 → 9.1.1

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.
@@ -2591,9 +2591,9 @@ export declare class Molecule {
2591
2591
  * stereo bond to indicate the proper configuration.
2592
2592
  * If the removal of a hydrogen atom would change an atom's implicit valence,
2593
2593
  * the atom's abnormal valence is set accordingly.
2594
- * @param is3D pass true, if atom coordinates are three dimensional
2594
+ * @param is3D Deprecated: this parameter is unused and has no effect.
2595
2595
  */
2596
- removeExplicitHydrogens(is3D: boolean): void;
2596
+ removeExplicitHydrogens(is3D?: boolean): void;
2597
2597
 
2598
2598
  /**
2599
2599
  * Separates all disconnected fragments of this Molecule into individual
@@ -46,6 +46,7 @@ function decodeBase64(base64) {
46
46
  function toHex(v) {
47
47
  return v.toString(16).padStart(2, "0");
48
48
  }
49
+ var hidpiScaleFactor = globalThis.devicePixelRatio || 1;
49
50
 
50
51
  // lib/canvas_editor/draw_context.js
51
52
  var DrawContext = class {
@@ -62,6 +63,7 @@ var DrawContext = class {
62
63
  this.ctx.font = this.currentFont;
63
64
  this.currentColor = "#000000";
64
65
  this.currentLineWidth = 1;
66
+ this.canvasCache = /* @__PURE__ */ new Map();
65
67
  }
66
68
  clearRect(x, y, w, h) {
67
69
  this.ctx.clearRect(x, y, w, h);
@@ -157,13 +159,17 @@ var DrawContext = class {
157
159
  `drawImage call with ${arguments.length} arguments unimplemented`
158
160
  );
159
161
  }
160
- const fullScaleCanvas = document.createElement("canvas");
161
- const imageData = image.imageData;
162
- fullScaleCanvas.width = imageData.width;
163
- fullScaleCanvas.height = imageData.height;
164
- const fullScaleContext = fullScaleCanvas.getContext("2d");
165
- fullScaleContext.globalAlpha = 0;
166
- fullScaleContext.putImageData(imageData, 0, 0);
162
+ let fullScaleCanvas = this.canvasCache.get(image);
163
+ if (!fullScaleCanvas) {
164
+ fullScaleCanvas = document.createElement("canvas");
165
+ const imageData = image.imageData;
166
+ fullScaleCanvas.width = imageData.width;
167
+ fullScaleCanvas.height = imageData.height;
168
+ const fullScaleContext = fullScaleCanvas.getContext("2d");
169
+ fullScaleContext.globalAlpha = 0;
170
+ fullScaleContext.putImageData(imageData, 0, 0);
171
+ this.canvasCache.set(image, fullScaleCanvas);
172
+ }
167
173
  this.ctx.drawImage(fullScaleCanvas, sx, sy, sw, sh, dx, dy, dw, dh);
168
174
  }
169
175
  isDarkBackground() {
@@ -176,6 +182,7 @@ var EditorArea = class {
176
182
  constructor(canvasElement, onChange) {
177
183
  this.canvasElement = canvasElement;
178
184
  this.changeListener = onChange;
185
+ this.drawContext = new DrawContext(this.canvasElement.getContext("2d"));
179
186
  }
180
187
  getBackgroundRGB() {
181
188
  return 16777215;
@@ -187,7 +194,7 @@ var EditorArea = class {
187
194
  return this.canvasElement.height;
188
195
  }
189
196
  getDrawContext() {
190
- return new DrawContext(this.canvasElement.getContext("2d"));
197
+ return this.drawContext;
191
198
  }
192
199
  onChange(what, isUserEvent) {
193
200
  this.changeListener?.({ what, isUserEvent });
@@ -223,8 +230,8 @@ function addPointerListeners(canvasElement, drawArea, JavaEditorArea) {
223
230
  what,
224
231
  ev.button + 1,
225
232
  clickCount,
226
- Math.round(ev.offsetX),
227
- Math.round(ev.offsetY),
233
+ Math.round(ev.offsetX * hidpiScaleFactor),
234
+ Math.round(ev.offsetY * hidpiScaleFactor),
228
235
  ev.shiftKey,
229
236
  ev.ctrlKey,
230
237
  ev.altKey,
@@ -324,13 +331,16 @@ function getKeyFromEvent(ev, JavaEditorArea) {
324
331
  var Toolbar = class {
325
332
  constructor(canvasElement) {
326
333
  this.canvasElement = canvasElement;
334
+ this.drawContext = new DrawContext(this.canvasElement.getContext("2d"));
327
335
  }
328
336
  setDimensions(width, height) {
329
337
  this.canvasElement.width = width;
338
+ this.canvasElement.style.width = `${width / hidpiScaleFactor}px`;
330
339
  this.canvasElement.height = height;
340
+ this.canvasElement.style.height = `${height / hidpiScaleFactor}px`;
331
341
  }
332
342
  getDrawContext() {
333
- return new DrawContext(this.canvasElement.getContext("2d"));
343
+ return this.drawContext;
334
344
  }
335
345
  getBackgroundRGB() {
336
346
  return 16777215;
@@ -714,7 +724,7 @@ function createEditor(parentElement, options, onChange, JavaEditorArea, JavaEdit
714
724
  userSelect: "none",
715
725
  webkitUserSelect: "none"
716
726
  });
717
- const shadowRoot = rootElement.attachShadow({ mode: "closed" });
727
+ const shadowRoot = rootElement.attachShadow({ mode: "open" });
718
728
  shadowRoot.adoptedStyleSheets = [getEditorStylesheet()];
719
729
  let toolbarCanvas = null;
720
730
  if (!readOnly) {
@@ -755,14 +765,17 @@ function createEditor(parentElement, options, onChange, JavaEditorArea, JavaEdit
755
765
  }
756
766
  uiHelper.setEditorArea(editorArea);
757
767
  const toolbar = readOnly ? null : new JavaEditorToolbar(editorArea, new Toolbar(toolbarCanvas), uiHelper);
768
+ function updateCanvasDimensions(containerSize2) {
769
+ editorCanvas.style.width = `${containerSize2.width}px`;
770
+ editorCanvas.width = Math.floor(containerSize2.width * hidpiScaleFactor);
771
+ editorCanvas.style.height = `${containerSize2.height}px`;
772
+ editorCanvas.height = Math.floor(containerSize2.height * hidpiScaleFactor);
773
+ editorArea.repaint();
774
+ }
758
775
  const containerSize = editorContainer.getBoundingClientRect();
759
- editorCanvas.width = containerSize.width;
760
- editorCanvas.height = containerSize.height;
761
- editorArea.repaint();
776
+ updateCanvasDimensions(containerSize);
762
777
  const resizeObserver = new ResizeObserver(([entry]) => {
763
- editorCanvas.width = entry.contentRect.width;
764
- editorCanvas.height = entry.contentRect.height;
765
- editorArea.repaint();
778
+ updateCanvasDimensions(entry.contentRect);
766
779
  });
767
780
  resizeObserver.observe(editorContainer);
768
781
  let removePointerListeners = null;
@@ -11418,7 +11431,7 @@ function getExports($wnd) {
11418
11431
  return aromaticPi > 1;
11419
11432
  };
11420
11433
  _.idCodeCreate = function idCodeCreate() {
11421
- var EZCount, THCount, a, a$array, a$index, a$max, atom, atom0, atom1, atom10, atom11, atom2, atom3, atom4, atom5, atom6, atom7, atom8, atom9, atomList, base, bond, bond0, bond1, bond2, bond3, bond4, bondOrder, chargedAtoms, connBits, conns, count, customLabel, dbits, dif, hIndex, i, i0, i1, isAromaticSPBond, j, label_0, lbits, maxLength, maxdif, nbits, nitrogens, otherAtoms, oxygens, parity;
11434
+ var EZCount, THCount, a, a$array, a$index, a$max, atom, atom0, atom1, atom10, atom11, atom2, atom3, atom4, atom5, atom6, atom7, atom8, atom9, atomList, base, bond, bond0, bond1, bond2, bond3, bond4, bondOrder, chargedAtoms, connBits, conns, count, customLabel, dbits, dif, hIndex, i, i0, isAromaticSPBond, j, label_0, lbits, maxLength, maxdif, nbits, nitrogens, otherAtoms, oxygens, parity;
11422
11435
  this.encodeBitsStart(false);
11423
11436
  this.encodeBits(9, 4);
11424
11437
  nbits = $wnd.Math.max(carc2.getNeededBits(this.mMol.getAtoms_0()), carc2.getNeededBits(this.mMol.getBonds_0()));
@@ -11721,12 +11734,11 @@ function getExports($wnd) {
11721
11734
  if (this.mAllHydrogensAreExplicit && (this.mMode & 16) != 0) {
11722
11735
  count = 0;
11723
11736
  connBits = 0;
11724
- for (i1 = 0; i1 < this.mMol.getAtoms_0(); i1++) {
11725
- atom = this.mGraphAtom[i1];
11737
+ for (atom7 = 0; atom7 < this.mMol.getAtoms_0(); atom7++) {
11726
11738
  conns = 0;
11727
- for (j = this.mMol.getConnAtoms_0(atom); j < this.mMol.getAllConnAtoms_0(atom); j++) {
11728
- if (this.mMol.isSelectedAtom_0(this.mMol.getConnAtom_0(atom, j))) {
11729
- hIndex = j - this.mMol.getConnAtoms_0(atom);
11739
+ for (j = this.mMol.getConnAtoms_0(this.mGraphAtom[atom7]); j < this.mMol.getAllConnAtoms_0(this.mGraphAtom[atom7]); j++) {
11740
+ if (this.mMol.isSelectedAtom_0(this.mMol.getConnAtom_0(this.mGraphAtom[atom7], j))) {
11741
+ hIndex = j - this.mMol.getConnAtoms_0(this.mGraphAtom[atom7]);
11730
11742
  conns |= 1 << hIndex;
11731
11743
  connBits = $wnd.Math.max(connBits, hIndex + 1);
11732
11744
  }
@@ -11738,12 +11750,11 @@ function getExports($wnd) {
11738
11750
  this.encodeFeatureNo(38);
11739
11751
  this.encodeBits(fromInt_0(count), nbits);
11740
11752
  this.encodeBits(fromInt_0(connBits), 3);
11741
- for (i = 0; i < this.mMol.getAtoms_0(); i++) {
11742
- atom = this.mGraphAtom[i];
11753
+ for (atom = 0; atom < this.mMol.getAtoms_0(); atom++) {
11743
11754
  conns = 0;
11744
- for (j = this.mMol.getConnAtoms_0(atom); j < this.mMol.getAllConnAtoms_0(atom); j++) {
11745
- if (this.mMol.isSelectedAtom_0(this.mMol.getConnAtom_0(atom, j))) {
11746
- hIndex = j - this.mMol.getConnAtoms_0(atom);
11755
+ for (j = this.mMol.getConnAtoms_0(this.mGraphAtom[atom]); j < this.mMol.getAllConnAtoms_0(this.mGraphAtom[atom]); j++) {
11756
+ if (this.mMol.isSelectedAtom_0(this.mMol.getConnAtom_0(this.mGraphAtom[atom], j))) {
11757
+ hIndex = j - this.mMol.getConnAtoms_0(this.mGraphAtom[atom]);
11747
11758
  conns |= 1 << hIndex;
11748
11759
  }
11749
11760
  }
@@ -16028,7 +16039,7 @@ function getExports($wnd) {
16028
16039
  _.invalidateHelperArrays_0 = function invalidateHelperArrays(helperBits) {
16029
16040
  this.mValidHelperArrays &= ~helperBits;
16030
16041
  };
16031
- _.is3D_0 = function is3D_0() {
16042
+ _.is3D_0 = function is3D() {
16032
16043
  var atom;
16033
16044
  for (atom = 0; atom < this.mAllAtoms; atom++)
16034
16045
  if (this.mCoordinates[atom].z_0 != 0)
@@ -19067,10 +19078,7 @@ function getExports($wnd) {
19067
19078
  }
19068
19079
  return preferredBond;
19069
19080
  };
19070
- _.removeExplicitHydrogens_0 = function removeExplicitHydrogens() {
19071
- this.removeExplicitHydrogens_1(true, false);
19072
- };
19073
- _.removeExplicitHydrogens_1 = function removeExplicitHydrogens_0(hasValid2DCoords, hasValid3DCoords) {
19081
+ _.removeExplicitHydrogens_0 = function removeExplicitHydrogens(hasValid2DCoords) {
19074
19082
  var abnormalValence, atom, explicitAbnormalValence, newAbnormalValence;
19075
19083
  this.ensureHelperArrays_0(hasValid2DCoords ? 15 : 1);
19076
19084
  this.mAllAtoms = this.mAtoms;
@@ -19711,7 +19719,7 @@ function getExports($wnd) {
19711
19719
  this.parse_2(mol, idcode, coordinates, 0, 0);
19712
19720
  };
19713
19721
  _.parse_2 = function parse_2(mol, idcode, coordinates, idcodeStart, coordsStart) {
19714
- var EZCount, THCount, abits, allAtoms, allBonds, aromState, aromaticSPBond, atom, atom0, atom1, atom2, atomList, atomicNo, atoms, avbl, avblDefault, avblInt, base, bbits, binCount, bond, bond$array, bond$index, bond$max, bond0, bondOrder, bondType, bondTypes, bridgeData, charge, chargedAtoms, closureBonds, connBits, coords2DAvailable, coordsAre3D, coordsAreAbsolute, count, dataType, dbits, decodeOldCoordinates, decodedDX, decodedDY, dif, dx, dy, dz, e, eNeighbours, f, factor, from, hCount, hint, hydrogen, hydrogenCount, i, i0, i1, i10, i11, i12, i13, i14, i15, i16, i17, i18, i19, i2, i20, i21, i22, i23, i24, i25, i26, i27, i28, i29, i3, i30, i31, i32, i33, i34, i35, i36, i37, i38, i39, i4, i40, i41, i42, i43, i5, i6, i7, i8, i9, index_0, isDelocalizedBond, j, label_0, lbits, mass, neighbours, nitrogens, no, offset, otherAtoms, oxygens, parity, piElectrons, resolutionBits, ringSize, ringState, selectedHydrogenBits, stereoState, targetAVBL, version2, xInt, xOffset, yInt, yOffset, zInt, zOffset;
19722
+ var EZCount, THCount, abits, allAtoms, allBonds, aromState, aromaticSPBond, atom, atom0, atom1, atom2, atomList, atomicNo, atoms, avbl, avblDefault, avblInt, base, bbits, binCount, bond, bond$array, bond$index, bond$max, bond0, bondOrder, bondType, bondTypes, bridgeData, charge, chargedAtoms, closureBonds, connBits, conns, coords2DAvailable, coordsAre3D, coordsAreAbsolute, count, dataType, dbits, decodeOldCoordinates, decodedDX, decodedDY, dif, dx, dy, dz, e, eNeighbours, f, factor, from, hCount, hint, hydrogen, hydrogenCount, i, i0, i1, i10, i11, i12, i13, i14, i15, i16, i17, i18, i19, i2, i20, i21, i22, i23, i24, i25, i26, i27, i28, i29, i3, i30, i31, i32, i33, i34, i35, i36, i37, i38, i39, i4, i40, i41, i42, i43, i5, i6, i7, i8, i9, index_0, isDelocalizedBond, j, label_0, lbits, mass, neighbours, nitrogens, no, offset, otherAtoms, oxygens, parity, piElectrons, resolutionBits, ringSize, ringState, selectedHydrogenBits, stereoState, targetAVBL, version2, xInt, xOffset, yInt, yOffset, zInt, zOffset;
19715
19723
  mol.clear_0();
19716
19724
  if (jsEquals(idcode, null) || idcodeStart < 0 || idcodeStart >= idcode.length)
19717
19725
  return;
@@ -20182,8 +20190,11 @@ function getExports($wnd) {
20182
20190
  no = this.decodeBits(abits);
20183
20191
  connBits = this.decodeBits(3);
20184
20192
  selectedHydrogenBits = initUnidimensionalArray(cggl.I_classLit, { 6: 1, 4: 1, 1: 1 }, 5, allAtoms, 15, 1);
20185
- for (i = 0; i < no; i++)
20186
- selectedHydrogenBits[this.decodeBits(abits)] = this.decodeBits(connBits);
20193
+ for (i = 0; i < no; i++) {
20194
+ atom = this.decodeBits(abits);
20195
+ conns = this.decodeBits(connBits);
20196
+ selectedHydrogenBits[atom] = conns;
20197
+ }
20187
20198
  break;
20188
20199
  }
20189
20200
  }
@@ -27342,7 +27353,7 @@ function getExports($wnd) {
27342
27353
  }
27343
27354
  }
27344
27355
  if (!this.mMakeHydrogenExplicit && (this.mSmartsFeatureFound || this.mSmartsMode == 2))
27345
- this.mMol.removeExplicitHydrogens_0();
27356
+ this.mMol.removeExplicitHydrogens_0(false);
27346
27357
  this.mMol.ensureHelperArrays_0(1);
27347
27358
  this.correctValenceExceededNitrogen();
27348
27359
  this.locateAromaticDoubleBonds(allowSmarts, this.mSmartsFeatureFound);
@@ -32202,7 +32213,7 @@ function getExports($wnd) {
32202
32213
  if (isNull(this.mRandom))
32203
32214
  this.mRandom = new ju.Random();
32204
32215
  if ((this.mMode & 2) != 0)
32205
- mol.removeExplicitHydrogens_1(false, false);
32216
+ mol.removeExplicitHydrogens_0(false);
32206
32217
  this.mMol = mol;
32207
32218
  this.mMol.ensureHelperArrays_0(7);
32208
32219
  this.mFFP = ffp;
@@ -33990,15 +34001,16 @@ function getExports($wnd) {
33990
34001
  defineClass(430, 1, { 117: 1, 1: 1 }, carcfm.AngleBend);
33991
34002
  _.$init_80 = function $init_80() {
33992
34003
  };
33993
- _.getEnergy_0 = function getEnergy_0(pos) {
33994
- var angle, c2, cb, theta;
34004
+ _.getEnergy_0 = function getEnergy_0(pos, detail) {
34005
+ var angle, c2, cb, e, theta;
33995
34006
  theta = new carcfm.Vector3_4(pos, this.a2, this.a1).angle_0(new carcfm.Vector3_4(pos, this.a2, this.a3));
33996
34007
  angle = jl.toDegrees(theta) - this.theta0;
33997
34008
  cb = -6981317e-9;
33998
34009
  c2 = 143.9325 * 0.017453292519943295 * 0.017453292519943295;
33999
- if (this.isLinear)
34000
- return 143.9325 * this.ka * (1 + $wnd.Math.cos(theta));
34001
- return 0.5 * 0.043844346773450435 * this.ka * angle * angle * (1 + -6981317e-9 * angle);
34010
+ e = this.isLinear ? 143.9325 * this.ka * (1 + $wnd.Math.cos(theta)) : 0.5 * 0.043844346773450435 * this.ka * angle * angle * (1 + -6981317e-9 * angle);
34011
+ if (isNotNull(detail))
34012
+ detail.append_9("angleBend " + caru.toString_20(jl.toDegrees(theta)) + " " + caru.toString_20(this.theta0) + " " + this.a1 + "," + this.a2 + "," + this.a3 + " " + caru.toString_20(e) + "\n");
34013
+ return e;
34002
34014
  };
34003
34015
  _.getGradient = function getGradient(pos, grad) {
34004
34016
  var angleTerm, c2, cb, cosTheta, dCos_dS, dE_dTheta, dist0, dist1, r0, r1, sinTheta, sinThetaSq;
@@ -34087,14 +34099,17 @@ function getExports($wnd) {
34087
34099
  defineClass(256, 1, { 117: 1, 1: 1 }, carcfm.BondStretch);
34088
34100
  _.$init_86 = function $init_86() {
34089
34101
  };
34090
- _.getEnergy_0 = function getEnergy_1(pos) {
34091
- var c1, c3, cs, diff, dist;
34102
+ _.getEnergy_0 = function getEnergy_1(pos, detail) {
34103
+ var c1, c3, cs, diff, dist, e;
34092
34104
  c1 = 143.9325;
34093
34105
  cs = -2;
34094
34106
  c3 = 7 / 12;
34095
34107
  dist = new carcfm.Vector3_3(pos, this.a1).distance_0(new carcfm.Vector3_3(pos, this.a2));
34096
34108
  diff = (dist - this.r0) * (dist - this.r0);
34097
- return 0.5 * 143.9325 * this.kb * diff * (1 + -2 * (dist - this.r0) + 0.5833333333333334 * -2 * -2 * diff);
34109
+ e = 0.5 * 143.9325 * this.kb * diff * (1 + -2 * (dist - this.r0) + 0.5833333333333334 * -2 * -2 * diff);
34110
+ if (isNotNull(detail))
34111
+ detail.append_9("bondStretch " + caru.toString_20(dist) + " " + caru.toString_20(this.r0) + " " + this.a1 + "," + this.a2 + " " + caru.toString_20(e) + "\n");
34112
+ return e;
34098
34113
  };
34099
34114
  _.getGradient = function getGradient_0(pos, grad) {
34100
34115
  var c1, c3, cs, dE_dr, dist, distTerm, i;
@@ -34219,14 +34234,17 @@ function getExports($wnd) {
34219
34234
  defineClass(431, 1, { 117: 1, 1: 1 }, carcfm.Electrostatic);
34220
34235
  _.$init_87 = function $init_87() {
34221
34236
  };
34222
- _.getEnergy_0 = function getEnergy_2(pos) {
34223
- var corr_dist, diel, dist;
34237
+ _.getEnergy_0 = function getEnergy_2(pos, detail) {
34238
+ var corr_dist, diel, dist, e;
34224
34239
  dist = new carcfm.Vector3_4(pos, this.a1, this.a2).length_2();
34225
34240
  corr_dist = dist + 0.05;
34226
34241
  diel = 332.0716;
34227
34242
  if (this.distModel)
34228
34243
  corr_dist *= corr_dist;
34229
- return diel * this.charge_term / corr_dist * (jsEquals(this.rel_0, (carcfm.$clinit_Separation$Relation(), carcfm.ONE_FOUR)) ? 0.75 : 1);
34244
+ e = diel * this.charge_term / corr_dist * (jsEquals(this.rel_0, (carcfm.$clinit_Separation$Relation(), carcfm.ONE_FOUR)) ? 0.75 : 1);
34245
+ if (isNotNull(detail))
34246
+ detail.append_9("electrostatic " + caru.toString_20(dist) + " " + this.a1 + "," + this.a2 + " " + caru.toString_20(e) + "\n");
34247
+ return e;
34230
34248
  };
34231
34249
  _.getGradient = function getGradient_1(pos, grad) {
34232
34250
  var corr_dist, dE_dr, dGrad, dist, i;
@@ -34296,14 +34314,22 @@ function getExports($wnd) {
34296
34314
  this.mEnergies = new ju.ArrayList();
34297
34315
  };
34298
34316
  _.getTotalEnergy_0 = function getTotalEnergy() {
34299
- return this.getTotalEnergy_1(this.mPos);
34317
+ return this.getTotalEnergy_2(this.mPos, null);
34300
34318
  };
34301
34319
  _.getTotalEnergy_1 = function getTotalEnergy_0(pos) {
34302
- var term, term$iterator, total;
34320
+ return this.getTotalEnergy_2(pos, null);
34321
+ };
34322
+ _.getTotalEnergy_2 = function getTotalEnergy_1(pos, detail) {
34323
+ var no, term, term$iterator, total;
34324
+ if (isNotNull(detail))
34325
+ detail.append_9("no type is_property opt_property atoms energy\n");
34303
34326
  total = 0;
34327
+ no = 0;
34304
34328
  for (term$iterator = this.mEnergies.iterator(); term$iterator.hasNext_0(); ) {
34305
34329
  term = castTo(term$iterator.next_3(), 117);
34306
- total += term.getEnergy_0(pos);
34330
+ if (isNotNull(detail))
34331
+ detail.append_5(++no).append_9(" ");
34332
+ total += term.getEnergy_0(pos, detail);
34307
34333
  }
34308
34334
  return total;
34309
34335
  };
@@ -34435,15 +34461,18 @@ function getExports($wnd) {
34435
34461
  defineClass(212, 1, { 117: 1, 1: 1 }, carcfm.OutOfPlane);
34436
34462
  _.$init_90 = function $init_90() {
34437
34463
  };
34438
- _.getEnergy_0 = function getEnergy_3(pos) {
34439
- var c2, chi, n, rji, rjk, rjl;
34464
+ _.getEnergy_0 = function getEnergy_3(pos, detail) {
34465
+ var c2, chi, e, n, rji, rjk, rjl;
34440
34466
  rji = new carcfm.Vector3_4(pos, this.ac, this.a1).normalise();
34441
34467
  rjk = new carcfm.Vector3_4(pos, this.ac, this.a2).normalise();
34442
34468
  rjl = new carcfm.Vector3_4(pos, this.ac, this.a3).normalise();
34443
34469
  n = rji.cross_0(rjk).normalise();
34444
34470
  chi = 57.29577951308232 * $wnd.Math.asin(n.dot_0(rjl));
34445
34471
  c2 = 143.9325 * 0.017453292519943295 * 0.017453292519943295;
34446
- return 0.5 * c2 * this.koop * chi * chi;
34472
+ e = 0.5 * c2 * this.koop * chi * chi;
34473
+ if (isNotNull(detail))
34474
+ detail.append_9("outOfPlane " + caru.toString_20(chi) + " " + this.a1 + "," + this.a2 + "," + this.a3 + " " + caru.toString_20(e) + "\n");
34475
+ return e;
34447
34476
  };
34448
34477
  _.getGradient = function getGradient_2(pos, grad) {
34449
34478
  var c2, chi, cosChi, cosChiSq, cosTheta, dE_dChi, dji, djk, djl, i, n, rji, rjk, rjl, sinChi, sinTheta, sinThetaSq, t1, t2, t3, term1, term2, tg1, tg3, tg4;
@@ -34785,13 +34814,16 @@ function getExports($wnd) {
34785
34814
  defineClass(432, 1, { 117: 1, 1: 1 }, carcfm.StretchBend);
34786
34815
  _.$init_95 = function $init_95() {
34787
34816
  };
34788
- _.getEnergy_0 = function getEnergy_4(pos) {
34789
- var dist1, dist2, factor, theta;
34817
+ _.getEnergy_0 = function getEnergy_4(pos, detail) {
34818
+ var dist1, dist2, e, factor, theta;
34790
34819
  dist1 = new carcfm.Vector3_4(pos, this.a2, this.a1).length_2();
34791
34820
  dist2 = new carcfm.Vector3_4(pos, this.a2, this.a3).length_2();
34792
34821
  theta = new carcfm.Vector3_4(pos, this.a2, this.a1).angle_0(new carcfm.Vector3_4(pos, this.a2, this.a3));
34793
34822
  factor = 143.9325 * 0.017453292519943295 * (jl.toDegrees(theta) - this.theta0);
34794
- return factor * (dist1 - this.r0i) * this.kba_ijk + factor * (dist2 - this.r0k) * this.kba_kji;
34823
+ e = factor * (dist1 - this.r0i) * this.kba_ijk + factor * (dist2 - this.r0k) * this.kba_kji;
34824
+ if (isNotNull(detail))
34825
+ detail.append_9("stretchBend " + caru.toString_20(dist1) + "," + caru.toString_20(dist2) + "," + caru.toString_20(jl.toDegrees(theta)) + " " + caru.toString_20(this.r0i) + "," + caru.toString_20(this.r0k) + "," + caru.toString_20(this.theta0) + " " + this.a1 + "," + this.a2 + "," + this.a3 + " " + caru.toString_20(e) + "\n");
34826
+ return e;
34795
34827
  };
34796
34828
  _.getGradient = function getGradient_3(pos, grad) {
34797
34829
  var angleTerm, c5, cosTheta, dCos_dS1, dCos_dS2, dCos_dS3, dCos_dS4, dCos_dS5, dCos_dS6, dist1, dist2, distTerm, p12, p32, sinTheta, sinThetaSq;
@@ -34910,8 +34942,8 @@ function getExports($wnd) {
34910
34942
  defineClass(433, 1, { 117: 1, 1: 1 }, carcfm.TorsionAngle);
34911
34943
  _.$init_97 = function $init_97() {
34912
34944
  };
34913
- _.getEnergy_0 = function getEnergy_5(pos) {
34914
- var cos2Phi, cos3Phi, cosPhi, r1, r2, r3, r4, t1, t2;
34945
+ _.getEnergy_0 = function getEnergy_5(pos, detail) {
34946
+ var cos2Phi, cos3Phi, cosPhi, e, r1, r2, r3, r4, t1, t2;
34915
34947
  r1 = new carcfm.Vector3_4(pos, this.a1, this.a2);
34916
34948
  r2 = new carcfm.Vector3_4(pos, this.a3, this.a2);
34917
34949
  r3 = new carcfm.Vector3_4(pos, this.a2, this.a3);
@@ -34921,7 +34953,10 @@ function getExports($wnd) {
34921
34953
  cosPhi = t1.cosAngle(t2);
34922
34954
  cos2Phi = 2 * cosPhi * cosPhi - 1;
34923
34955
  cos3Phi = cosPhi * (2 * cos2Phi - 1);
34924
- return 0.5 * (this.v1 * (1 + cosPhi) + this.v2 * (1 - cos2Phi) + this.v3 * (1 + cos3Phi));
34956
+ e = 0.5 * (this.v1 * (1 + cosPhi) + this.v2 * (1 - cos2Phi) + this.v3 * (1 + cos3Phi));
34957
+ if (isNotNull(detail))
34958
+ detail.append_9("torsion " + caru.toString_20(jl.toDegrees(t1.angle_0(t2))) + " " + this.a1 + "," + this.a2 + "," + this.a3 + "," + this.a4 + " " + caru.toString_20(e) + "\n");
34959
+ return e;
34925
34960
  };
34926
34961
  _.getGradient = function getGradient_4(pos, grad) {
34927
34962
  var cosPhi, d, dCos_dT, dE_dPhi, r, sin2Phi, sin3Phi, sinPhi, sinPhiSq, sinTerm, t;
@@ -35009,8 +35044,8 @@ function getExports($wnd) {
35009
35044
  defineClass(434, 1, { 117: 1, 1: 1 }, carcfm.VanDerWaals);
35010
35045
  _.$init_98 = function $init_98() {
35011
35046
  };
35012
- _.getEnergy_0 = function getEnergy_6(pos) {
35013
- var aTerm, aTerm2, aTerm7, bTerm, dist, dist2, dist7, rstar_ij2, rstar_ij7, vdw1, vdw1m1, vdw2, vdw2m1;
35047
+ _.getEnergy_0 = function getEnergy_6(pos, detail) {
35048
+ var aTerm, aTerm2, aTerm7, bTerm, dist, dist2, dist7, e, rstar_ij2, rstar_ij7, vdw1, vdw1m1, vdw2, vdw2m1;
35014
35049
  dist = new carcfm.Vector3_4(pos, this.a1, this.a2).length_2();
35015
35050
  vdw1 = 1.07;
35016
35051
  vdw1m1 = 1.07 - 1;
@@ -35024,7 +35059,10 @@ function getExports($wnd) {
35024
35059
  rstar_ij2 = this.rstar_ij * this.rstar_ij;
35025
35060
  rstar_ij7 = rstar_ij2 * rstar_ij2 * rstar_ij2 * this.rstar_ij;
35026
35061
  bTerm = 1.12 * rstar_ij7 / (dist7 + 0.1200000000000001 * rstar_ij7) - 2;
35027
- return aTerm7 * bTerm * this.well_depth;
35062
+ e = aTerm7 * bTerm * this.well_depth;
35063
+ if (isNotNull(detail))
35064
+ detail.append_9("vanDerWaals " + caru.toString_20(dist) + " " + this.a1 + "," + this.a2 + " " + caru.toString_20(e) + "\n");
35065
+ return e;
35028
35066
  };
35029
35067
  _.getGradient = function getGradient_5(pos, grad) {
35030
35068
  var dE_dr, dGrad, dist, i, q, q2, q6, q7, q7pvdw2m1, t, t2, t7, vdw1, vdw1m1, vdw2, vdw2m1, vdw2t7;
@@ -46590,6 +46628,7 @@ function getExports($wnd) {
46590
46628
  cargh.$clinit_HiDPIHelper = function $clinit_HiDPIHelper() {
46591
46629
  cargh.$clinit_HiDPIHelper = emptyMethod;
46592
46630
  jl.$clinit_Object();
46631
+ cargh.sUIScaleFactor = -1;
46593
46632
  };
46594
46633
  cargh.disableImage = function disableImage(image) {
46595
46634
  cargh.$clinit_HiDPIHelper();
@@ -46603,15 +46642,22 @@ function getExports($wnd) {
46603
46642
  }
46604
46643
  }
46605
46644
  };
46645
+ cargh.getDevicePixelRatio = function getDevicePixelRatio() {
46646
+ return globalThis.devicePixelRatio || 1;
46647
+ };
46606
46648
  cargh.getUIScaleFactor = function getUIScaleFactor() {
46607
46649
  cargh.$clinit_HiDPIHelper();
46608
- return 1;
46650
+ if (cargh.sUIScaleFactor == -1) {
46651
+ cargh.sUIScaleFactor = cargh.getDevicePixelRatio();
46652
+ }
46653
+ return cargh.sUIScaleFactor;
46609
46654
  };
46610
46655
  cargh.scale_3 = function scale_3(value_0) {
46611
46656
  cargh.$clinit_HiDPIHelper();
46612
46657
  return jl.round_2(cargh.getUIScaleFactor() * value_0);
46613
46658
  };
46614
46659
  defineClass(740, 1, { 1: 1 });
46660
+ cargh.sUIScaleFactor = 0;
46615
46661
  cggl.Lcom_actelion_research_gui_hidpi_HiDPIHelper_2_classLit = createForClass("com.actelion.research.gui.hidpi", "HiDPIHelper", 740, cggl.Ljava_lang_Object_2_classLit);
46616
46662
  cargh.$clinit_HiDPIIcon = function $clinit_HiDPIIcon() {
46617
46663
  cargh.$clinit_HiDPIIcon = emptyMethod;
@@ -46835,7 +46881,7 @@ function getExports($wnd) {
46835
46881
  _._minimise = function _minimise(maxIts, gradTol, funcTol) {
46836
46882
  return this.oclMmff.minimise_0(maxIts, gradTol, funcTol);
46837
46883
  };
46838
- _.getTotalEnergy = function getTotalEnergy_1() {
46884
+ _.getTotalEnergy = function getTotalEnergy_2() {
46839
46885
  return this.oclMmff.getTotalEnergy_0();
46840
46886
  };
46841
46887
  _.size = function size_4() {
@@ -47499,7 +47545,7 @@ function getExports($wnd) {
47499
47545
  inventor.invent(this.oclMolecule);
47500
47546
  this.oclMolecule.setStereoBondsFromParity_0();
47501
47547
  };
47502
- _.is3D = function is3D_1() {
47548
+ _.is3D = function is3D_0() {
47503
47549
  return this.oclMolecule.is3D_0();
47504
47550
  };
47505
47551
  _.isAlkaliMetal = function isAlkaliMetal_0(atom) {
@@ -47649,8 +47695,8 @@ function getExports($wnd) {
47649
47695
  _.removeBondHiliting = function removeBondHiliting_0() {
47650
47696
  this.oclMolecule.removeBondHiliting_0();
47651
47697
  };
47652
- _.removeExplicitHydrogens = function removeExplicitHydrogens_1(is3D) {
47653
- this.oclMolecule.removeExplicitHydrogens_1(true, is3D);
47698
+ _.removeExplicitHydrogens = function removeExplicitHydrogens_0() {
47699
+ this.oclMolecule.removeExplicitHydrogens_0(true);
47654
47700
  };
47655
47701
  _.removeQueryFeatures = function removeQueryFeatures_0() {
47656
47702
  return this.oclMolecule.removeQueryFeatures_0();
@@ -64774,21 +64820,21 @@ function getExports($wnd) {
64774
64820
  };
64775
64821
  ooccg.addHydrogenAtoms = function addHydrogenAtoms(mol) {
64776
64822
  ooccg.$clinit_ConformerGenerator();
64777
- var atom, atom0, atom1, hydrogenBondLength, i, implicitHydrogen, oldStereoHelperBits;
64823
+ var atom, atom0, atom1, bondLength, i, implicitHydrogen, oldStereoHelperBits;
64778
64824
  oldStereoHelperBits = mol.getHelperArrayStatus_0() & 248;
64779
64825
  mol.ensureHelperArrays_0(1);
64780
64826
  implicitHydrogen = initUnidimensionalArray(cggl.I_classLit, { 6: 1, 4: 1, 1: 1 }, 5, mol.getAtoms_0(), 15, 1);
64781
64827
  for (atom0 = 0; atom0 < mol.getAtoms_0(); atom0++)
64782
64828
  implicitHydrogen[atom0] = mol.getImplicitHydrogens_1(atom0);
64783
- hydrogenBondLength = 0.8 * mol.getAverageBondLength_0();
64784
64829
  for (atom1 = 0; atom1 < implicitHydrogen.length; atom1++)
64785
64830
  if (implicitHydrogen[atom1] != 0)
64786
64831
  for (i = 0; i < implicitHydrogen[atom1]; i++)
64787
64832
  mol.addBond_1(atom1, mol.addAtom_2(1), 1);
64788
64833
  mol.ensureHelperArrays_0(1);
64834
+ bondLength = 0.8 * mol.getAverageBondLength_0();
64789
64835
  for (atom = 0; atom < implicitHydrogen.length; atom++)
64790
64836
  if (implicitHydrogen[atom] != 0)
64791
- ooccg.setHydrogenLocations(mol, atom, implicitHydrogen[atom], hydrogenBondLength);
64837
+ ooccg.setHydrogenLocations(mol, atom, implicitHydrogen[atom], bondLength);
64792
64838
  if ((oldStereoHelperBits & 8) != 0)
64793
64839
  mol.setParitiesValid_0(oldStereoHelperBits);
64794
64840
  };
@@ -64802,7 +64848,7 @@ function getExports($wnd) {
64802
64848
  ooccg.$clinit_ConformerGenerator();
64803
64849
  return compare_25(b2_1.getSmallerSideAtoms().length, b1_0.getSmallerSideAtoms().length);
64804
64850
  };
64805
- ooccg.setHydrogenLocations = function setHydrogenLocations(mol, atom, newHydrogenCount, avbl) {
64851
+ ooccg.setHydrogenLocations = function setHydrogenLocations(mol, atom, newHydrogenCount, bondLength) {
64806
64852
  var a1, a2, angle, angleIncrement, biggestAngleDif, bond, dif, firstNewHydrogenConnIndex, hydrogenAngle, i, i0, i1, newHydrogen, startAngle, stereoBondAngle, stereoBondCount, stereoBondIndex;
64807
64853
  firstNewHydrogenConnIndex = mol.getAllConnAtoms_0(atom) - newHydrogenCount;
64808
64854
  stereoBondIndex = -1;
@@ -64855,8 +64901,8 @@ function getExports($wnd) {
64855
64901
  }
64856
64902
  }
64857
64903
  newHydrogen = mol.getConnAtom_0(atom, firstNewHydrogenConnIndex + i);
64858
- mol.setAtomX_0(newHydrogen, mol.getAtomX_0(atom) + avbl * $wnd.Math.sin(hydrogenAngle));
64859
- mol.setAtomY_0(newHydrogen, mol.getAtomY_0(atom) + avbl * $wnd.Math.cos(hydrogenAngle));
64904
+ mol.setAtomX_0(newHydrogen, mol.getAtomX_0(atom) + bondLength * $wnd.Math.sin(hydrogenAngle));
64905
+ mol.setAtomY_0(newHydrogen, mol.getAtomY_0(atom) + bondLength * $wnd.Math.cos(hydrogenAngle));
64860
64906
  }
64861
64907
  };
64862
64908
  defineClass(230, 1, { 1: 1 }, ooccg.ConformerGenerator_0);
@@ -67287,7 +67333,7 @@ function getExports($wnd) {
67287
67333
  this.$init_419();
67288
67334
  this.mMol = mol;
67289
67335
  if (!keepHydrogen)
67290
- this.mMol.removeExplicitHydrogens_0();
67336
+ this.mMol.removeExplicitHydrogens_0(true);
67291
67337
  this.mMol.ensureHelperArrays_0(15);
67292
67338
  this.mRuleList = new ju.ArrayList();
67293
67339
  this.mSkipRule = initUnidimensionalArray(cggl.Z_classLit, { 9: 1, 4: 1, 1: 1 }, 5, (ooccs.$clinit_ConformationRule(), ooccs.RULE_NAME).length, 16, 1);
@@ -69752,7 +69798,7 @@ function getExports($wnd) {
69752
69798
  $sendStats("moduleStartup", "end");
69753
69799
  $gwt && $gwt.permProps && __gwtModuleFunction.__moduleStartupDone($gwt.permProps);
69754
69800
  const toReturn = $wnd["OCL"];
69755
- toReturn.version = "9.0.1";
69801
+ toReturn.version = "9.1.1";
69756
69802
  return toReturn;
69757
69803
  }
69758
69804
  var isBrowserWindow = typeof window !== "undefined" && typeof window.document !== "undefined";
@@ -69894,8 +69940,8 @@ export {
69894
69940
  };
69895
69941
  /**
69896
69942
  * openchemlib - Manipulate molecules
69897
- * @version v9.0.1
69898
- * @date 2025-04-28T14:22:13.313Z
69943
+ * @version v9.1.1
69944
+ * @date 2025-05-01T15:21:26.910Z
69899
69945
  * @link https://github.com/cheminfo/openchemlib-js
69900
69946
  * @license BSD-3-Clause
69901
69947
  */