openchemlib 9.0.0 → 9.1.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.
@@ -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
@@ -62,6 +62,7 @@ var DrawContext = class {
62
62
  this.ctx.font = this.currentFont;
63
63
  this.currentColor = "#000000";
64
64
  this.currentLineWidth = 1;
65
+ this.canvasCache = /* @__PURE__ */ new Map();
65
66
  }
66
67
  clearRect(x, y, w, h) {
67
68
  this.ctx.clearRect(x, y, w, h);
@@ -157,13 +158,17 @@ var DrawContext = class {
157
158
  `drawImage call with ${arguments.length} arguments unimplemented`
158
159
  );
159
160
  }
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);
161
+ let fullScaleCanvas = this.canvasCache.get(image);
162
+ if (!fullScaleCanvas) {
163
+ fullScaleCanvas = document.createElement("canvas");
164
+ const imageData = image.imageData;
165
+ fullScaleCanvas.width = imageData.width;
166
+ fullScaleCanvas.height = imageData.height;
167
+ const fullScaleContext = fullScaleCanvas.getContext("2d");
168
+ fullScaleContext.globalAlpha = 0;
169
+ fullScaleContext.putImageData(imageData, 0, 0);
170
+ this.canvasCache.set(image, fullScaleCanvas);
171
+ }
167
172
  this.ctx.drawImage(fullScaleCanvas, sx, sy, sw, sh, dx, dy, dw, dh);
168
173
  }
169
174
  isDarkBackground() {
@@ -176,6 +181,7 @@ var EditorArea = class {
176
181
  constructor(canvasElement, onChange) {
177
182
  this.canvasElement = canvasElement;
178
183
  this.changeListener = onChange;
184
+ this.drawContext = new DrawContext(this.canvasElement.getContext("2d"));
179
185
  }
180
186
  getBackgroundRGB() {
181
187
  return 16777215;
@@ -187,7 +193,7 @@ var EditorArea = class {
187
193
  return this.canvasElement.height;
188
194
  }
189
195
  getDrawContext() {
190
- return new DrawContext(this.canvasElement.getContext("2d"));
196
+ return this.drawContext;
191
197
  }
192
198
  onChange(what, isUserEvent) {
193
199
  this.changeListener?.({ what, isUserEvent });
@@ -324,13 +330,14 @@ function getKeyFromEvent(ev, JavaEditorArea) {
324
330
  var Toolbar = class {
325
331
  constructor(canvasElement) {
326
332
  this.canvasElement = canvasElement;
333
+ this.drawContext = new DrawContext(this.canvasElement.getContext("2d"));
327
334
  }
328
335
  setDimensions(width, height) {
329
336
  this.canvasElement.width = width;
330
337
  this.canvasElement.height = height;
331
338
  }
332
339
  getDrawContext() {
333
- return new DrawContext(this.canvasElement.getContext("2d"));
340
+ return this.drawContext;
334
341
  }
335
342
  getBackgroundRGB() {
336
343
  return 16777215;
@@ -714,7 +721,7 @@ function createEditor(parentElement, options, onChange, JavaEditorArea, JavaEdit
714
721
  userSelect: "none",
715
722
  webkitUserSelect: "none"
716
723
  });
717
- const shadowRoot = rootElement.attachShadow({ mode: "closed" });
724
+ const shadowRoot = rootElement.attachShadow({ mode: "open" });
718
725
  shadowRoot.adoptedStyleSheets = [getEditorStylesheet()];
719
726
  let toolbarCanvas = null;
720
727
  if (!readOnly) {
@@ -11418,7 +11425,7 @@ function getExports($wnd) {
11418
11425
  return aromaticPi > 1;
11419
11426
  };
11420
11427
  _.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;
11428
+ 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
11429
  this.encodeBitsStart(false);
11423
11430
  this.encodeBits(9, 4);
11424
11431
  nbits = $wnd.Math.max(carc2.getNeededBits(this.mMol.getAtoms_0()), carc2.getNeededBits(this.mMol.getBonds_0()));
@@ -11721,12 +11728,11 @@ function getExports($wnd) {
11721
11728
  if (this.mAllHydrogensAreExplicit && (this.mMode & 16) != 0) {
11722
11729
  count = 0;
11723
11730
  connBits = 0;
11724
- for (i1 = 0; i1 < this.mMol.getAtoms_0(); i1++) {
11725
- atom = this.mGraphAtom[i1];
11731
+ for (atom7 = 0; atom7 < this.mMol.getAtoms_0(); atom7++) {
11726
11732
  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);
11733
+ for (j = this.mMol.getConnAtoms_0(this.mGraphAtom[atom7]); j < this.mMol.getAllConnAtoms_0(this.mGraphAtom[atom7]); j++) {
11734
+ if (this.mMol.isSelectedAtom_0(this.mMol.getConnAtom_0(this.mGraphAtom[atom7], j))) {
11735
+ hIndex = j - this.mMol.getConnAtoms_0(this.mGraphAtom[atom7]);
11730
11736
  conns |= 1 << hIndex;
11731
11737
  connBits = $wnd.Math.max(connBits, hIndex + 1);
11732
11738
  }
@@ -11738,12 +11744,11 @@ function getExports($wnd) {
11738
11744
  this.encodeFeatureNo(38);
11739
11745
  this.encodeBits(fromInt_0(count), nbits);
11740
11746
  this.encodeBits(fromInt_0(connBits), 3);
11741
- for (i = 0; i < this.mMol.getAtoms_0(); i++) {
11742
- atom = this.mGraphAtom[i];
11747
+ for (atom = 0; atom < this.mMol.getAtoms_0(); atom++) {
11743
11748
  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);
11749
+ for (j = this.mMol.getConnAtoms_0(this.mGraphAtom[atom]); j < this.mMol.getAllConnAtoms_0(this.mGraphAtom[atom]); j++) {
11750
+ if (this.mMol.isSelectedAtom_0(this.mMol.getConnAtom_0(this.mGraphAtom[atom], j))) {
11751
+ hIndex = j - this.mMol.getConnAtoms_0(this.mGraphAtom[atom]);
11747
11752
  conns |= 1 << hIndex;
11748
11753
  }
11749
11754
  }
@@ -16028,7 +16033,7 @@ function getExports($wnd) {
16028
16033
  _.invalidateHelperArrays_0 = function invalidateHelperArrays(helperBits) {
16029
16034
  this.mValidHelperArrays &= ~helperBits;
16030
16035
  };
16031
- _.is3D_0 = function is3D_0() {
16036
+ _.is3D_0 = function is3D() {
16032
16037
  var atom;
16033
16038
  for (atom = 0; atom < this.mAllAtoms; atom++)
16034
16039
  if (this.mCoordinates[atom].z_0 != 0)
@@ -19067,10 +19072,7 @@ function getExports($wnd) {
19067
19072
  }
19068
19073
  return preferredBond;
19069
19074
  };
19070
- _.removeExplicitHydrogens_0 = function removeExplicitHydrogens() {
19071
- this.removeExplicitHydrogens_1(true, false);
19072
- };
19073
- _.removeExplicitHydrogens_1 = function removeExplicitHydrogens_0(hasValid2DCoords, hasValid3DCoords) {
19075
+ _.removeExplicitHydrogens_0 = function removeExplicitHydrogens(hasValid2DCoords) {
19074
19076
  var abnormalValence, atom, explicitAbnormalValence, newAbnormalValence;
19075
19077
  this.ensureHelperArrays_0(hasValid2DCoords ? 15 : 1);
19076
19078
  this.mAllAtoms = this.mAtoms;
@@ -19711,7 +19713,7 @@ function getExports($wnd) {
19711
19713
  this.parse_2(mol, idcode, coordinates, 0, 0);
19712
19714
  };
19713
19715
  _.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;
19716
+ 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
19717
  mol.clear_0();
19716
19718
  if (jsEquals(idcode, null) || idcodeStart < 0 || idcodeStart >= idcode.length)
19717
19719
  return;
@@ -20182,8 +20184,11 @@ function getExports($wnd) {
20182
20184
  no = this.decodeBits(abits);
20183
20185
  connBits = this.decodeBits(3);
20184
20186
  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);
20187
+ for (i = 0; i < no; i++) {
20188
+ atom = this.decodeBits(abits);
20189
+ conns = this.decodeBits(connBits);
20190
+ selectedHydrogenBits[atom] = conns;
20191
+ }
20187
20192
  break;
20188
20193
  }
20189
20194
  }
@@ -27342,7 +27347,7 @@ function getExports($wnd) {
27342
27347
  }
27343
27348
  }
27344
27349
  if (!this.mMakeHydrogenExplicit && (this.mSmartsFeatureFound || this.mSmartsMode == 2))
27345
- this.mMol.removeExplicitHydrogens_0();
27350
+ this.mMol.removeExplicitHydrogens_0(false);
27346
27351
  this.mMol.ensureHelperArrays_0(1);
27347
27352
  this.correctValenceExceededNitrogen();
27348
27353
  this.locateAromaticDoubleBonds(allowSmarts, this.mSmartsFeatureFound);
@@ -32202,7 +32207,7 @@ function getExports($wnd) {
32202
32207
  if (isNull(this.mRandom))
32203
32208
  this.mRandom = new ju.Random();
32204
32209
  if ((this.mMode & 2) != 0)
32205
- mol.removeExplicitHydrogens_1(false, false);
32210
+ mol.removeExplicitHydrogens_0(false);
32206
32211
  this.mMol = mol;
32207
32212
  this.mMol.ensureHelperArrays_0(7);
32208
32213
  this.mFFP = ffp;
@@ -33990,15 +33995,16 @@ function getExports($wnd) {
33990
33995
  defineClass(430, 1, { 117: 1, 1: 1 }, carcfm.AngleBend);
33991
33996
  _.$init_80 = function $init_80() {
33992
33997
  };
33993
- _.getEnergy_0 = function getEnergy_0(pos) {
33994
- var angle, c2, cb, theta;
33998
+ _.getEnergy_0 = function getEnergy_0(pos, detail) {
33999
+ var angle, c2, cb, e, theta;
33995
34000
  theta = new carcfm.Vector3_4(pos, this.a2, this.a1).angle_0(new carcfm.Vector3_4(pos, this.a2, this.a3));
33996
34001
  angle = jl.toDegrees(theta) - this.theta0;
33997
34002
  cb = -6981317e-9;
33998
34003
  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);
34004
+ e = this.isLinear ? 143.9325 * this.ka * (1 + $wnd.Math.cos(theta)) : 0.5 * 0.043844346773450435 * this.ka * angle * angle * (1 + -6981317e-9 * angle);
34005
+ if (isNotNull(detail))
34006
+ 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");
34007
+ return e;
34002
34008
  };
34003
34009
  _.getGradient = function getGradient(pos, grad) {
34004
34010
  var angleTerm, c2, cb, cosTheta, dCos_dS, dE_dTheta, dist0, dist1, r0, r1, sinTheta, sinThetaSq;
@@ -34087,14 +34093,17 @@ function getExports($wnd) {
34087
34093
  defineClass(256, 1, { 117: 1, 1: 1 }, carcfm.BondStretch);
34088
34094
  _.$init_86 = function $init_86() {
34089
34095
  };
34090
- _.getEnergy_0 = function getEnergy_1(pos) {
34091
- var c1, c3, cs, diff, dist;
34096
+ _.getEnergy_0 = function getEnergy_1(pos, detail) {
34097
+ var c1, c3, cs, diff, dist, e;
34092
34098
  c1 = 143.9325;
34093
34099
  cs = -2;
34094
34100
  c3 = 7 / 12;
34095
34101
  dist = new carcfm.Vector3_3(pos, this.a1).distance_0(new carcfm.Vector3_3(pos, this.a2));
34096
34102
  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);
34103
+ e = 0.5 * 143.9325 * this.kb * diff * (1 + -2 * (dist - this.r0) + 0.5833333333333334 * -2 * -2 * diff);
34104
+ if (isNotNull(detail))
34105
+ detail.append_9("bondStretch " + caru.toString_20(dist) + " " + caru.toString_20(this.r0) + " " + this.a1 + "," + this.a2 + " " + caru.toString_20(e) + "\n");
34106
+ return e;
34098
34107
  };
34099
34108
  _.getGradient = function getGradient_0(pos, grad) {
34100
34109
  var c1, c3, cs, dE_dr, dist, distTerm, i;
@@ -34219,14 +34228,17 @@ function getExports($wnd) {
34219
34228
  defineClass(431, 1, { 117: 1, 1: 1 }, carcfm.Electrostatic);
34220
34229
  _.$init_87 = function $init_87() {
34221
34230
  };
34222
- _.getEnergy_0 = function getEnergy_2(pos) {
34223
- var corr_dist, diel, dist;
34231
+ _.getEnergy_0 = function getEnergy_2(pos, detail) {
34232
+ var corr_dist, diel, dist, e;
34224
34233
  dist = new carcfm.Vector3_4(pos, this.a1, this.a2).length_2();
34225
34234
  corr_dist = dist + 0.05;
34226
34235
  diel = 332.0716;
34227
34236
  if (this.distModel)
34228
34237
  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);
34238
+ e = diel * this.charge_term / corr_dist * (jsEquals(this.rel_0, (carcfm.$clinit_Separation$Relation(), carcfm.ONE_FOUR)) ? 0.75 : 1);
34239
+ if (isNotNull(detail))
34240
+ detail.append_9("electrostatic " + caru.toString_20(dist) + " " + this.a1 + "," + this.a2 + " " + caru.toString_20(e) + "\n");
34241
+ return e;
34230
34242
  };
34231
34243
  _.getGradient = function getGradient_1(pos, grad) {
34232
34244
  var corr_dist, dE_dr, dGrad, dist, i;
@@ -34296,14 +34308,22 @@ function getExports($wnd) {
34296
34308
  this.mEnergies = new ju.ArrayList();
34297
34309
  };
34298
34310
  _.getTotalEnergy_0 = function getTotalEnergy() {
34299
- return this.getTotalEnergy_1(this.mPos);
34311
+ return this.getTotalEnergy_2(this.mPos, null);
34300
34312
  };
34301
34313
  _.getTotalEnergy_1 = function getTotalEnergy_0(pos) {
34302
- var term, term$iterator, total;
34314
+ return this.getTotalEnergy_2(pos, null);
34315
+ };
34316
+ _.getTotalEnergy_2 = function getTotalEnergy_1(pos, detail) {
34317
+ var no, term, term$iterator, total;
34318
+ if (isNotNull(detail))
34319
+ detail.append_9("no type is_property opt_property atoms energy\n");
34303
34320
  total = 0;
34321
+ no = 0;
34304
34322
  for (term$iterator = this.mEnergies.iterator(); term$iterator.hasNext_0(); ) {
34305
34323
  term = castTo(term$iterator.next_3(), 117);
34306
- total += term.getEnergy_0(pos);
34324
+ if (isNotNull(detail))
34325
+ detail.append_5(++no).append_9(" ");
34326
+ total += term.getEnergy_0(pos, detail);
34307
34327
  }
34308
34328
  return total;
34309
34329
  };
@@ -34435,15 +34455,18 @@ function getExports($wnd) {
34435
34455
  defineClass(212, 1, { 117: 1, 1: 1 }, carcfm.OutOfPlane);
34436
34456
  _.$init_90 = function $init_90() {
34437
34457
  };
34438
- _.getEnergy_0 = function getEnergy_3(pos) {
34439
- var c2, chi, n, rji, rjk, rjl;
34458
+ _.getEnergy_0 = function getEnergy_3(pos, detail) {
34459
+ var c2, chi, e, n, rji, rjk, rjl;
34440
34460
  rji = new carcfm.Vector3_4(pos, this.ac, this.a1).normalise();
34441
34461
  rjk = new carcfm.Vector3_4(pos, this.ac, this.a2).normalise();
34442
34462
  rjl = new carcfm.Vector3_4(pos, this.ac, this.a3).normalise();
34443
34463
  n = rji.cross_0(rjk).normalise();
34444
34464
  chi = 57.29577951308232 * $wnd.Math.asin(n.dot_0(rjl));
34445
34465
  c2 = 143.9325 * 0.017453292519943295 * 0.017453292519943295;
34446
- return 0.5 * c2 * this.koop * chi * chi;
34466
+ e = 0.5 * c2 * this.koop * chi * chi;
34467
+ if (isNotNull(detail))
34468
+ detail.append_9("outOfPlane " + caru.toString_20(chi) + " " + this.a1 + "," + this.a2 + "," + this.a3 + " " + caru.toString_20(e) + "\n");
34469
+ return e;
34447
34470
  };
34448
34471
  _.getGradient = function getGradient_2(pos, grad) {
34449
34472
  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 +34808,16 @@ function getExports($wnd) {
34785
34808
  defineClass(432, 1, { 117: 1, 1: 1 }, carcfm.StretchBend);
34786
34809
  _.$init_95 = function $init_95() {
34787
34810
  };
34788
- _.getEnergy_0 = function getEnergy_4(pos) {
34789
- var dist1, dist2, factor, theta;
34811
+ _.getEnergy_0 = function getEnergy_4(pos, detail) {
34812
+ var dist1, dist2, e, factor, theta;
34790
34813
  dist1 = new carcfm.Vector3_4(pos, this.a2, this.a1).length_2();
34791
34814
  dist2 = new carcfm.Vector3_4(pos, this.a2, this.a3).length_2();
34792
34815
  theta = new carcfm.Vector3_4(pos, this.a2, this.a1).angle_0(new carcfm.Vector3_4(pos, this.a2, this.a3));
34793
34816
  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;
34817
+ e = factor * (dist1 - this.r0i) * this.kba_ijk + factor * (dist2 - this.r0k) * this.kba_kji;
34818
+ if (isNotNull(detail))
34819
+ 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");
34820
+ return e;
34795
34821
  };
34796
34822
  _.getGradient = function getGradient_3(pos, grad) {
34797
34823
  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 +34936,8 @@ function getExports($wnd) {
34910
34936
  defineClass(433, 1, { 117: 1, 1: 1 }, carcfm.TorsionAngle);
34911
34937
  _.$init_97 = function $init_97() {
34912
34938
  };
34913
- _.getEnergy_0 = function getEnergy_5(pos) {
34914
- var cos2Phi, cos3Phi, cosPhi, r1, r2, r3, r4, t1, t2;
34939
+ _.getEnergy_0 = function getEnergy_5(pos, detail) {
34940
+ var cos2Phi, cos3Phi, cosPhi, e, r1, r2, r3, r4, t1, t2;
34915
34941
  r1 = new carcfm.Vector3_4(pos, this.a1, this.a2);
34916
34942
  r2 = new carcfm.Vector3_4(pos, this.a3, this.a2);
34917
34943
  r3 = new carcfm.Vector3_4(pos, this.a2, this.a3);
@@ -34921,7 +34947,10 @@ function getExports($wnd) {
34921
34947
  cosPhi = t1.cosAngle(t2);
34922
34948
  cos2Phi = 2 * cosPhi * cosPhi - 1;
34923
34949
  cos3Phi = cosPhi * (2 * cos2Phi - 1);
34924
- return 0.5 * (this.v1 * (1 + cosPhi) + this.v2 * (1 - cos2Phi) + this.v3 * (1 + cos3Phi));
34950
+ e = 0.5 * (this.v1 * (1 + cosPhi) + this.v2 * (1 - cos2Phi) + this.v3 * (1 + cos3Phi));
34951
+ if (isNotNull(detail))
34952
+ 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");
34953
+ return e;
34925
34954
  };
34926
34955
  _.getGradient = function getGradient_4(pos, grad) {
34927
34956
  var cosPhi, d, dCos_dT, dE_dPhi, r, sin2Phi, sin3Phi, sinPhi, sinPhiSq, sinTerm, t;
@@ -35009,8 +35038,8 @@ function getExports($wnd) {
35009
35038
  defineClass(434, 1, { 117: 1, 1: 1 }, carcfm.VanDerWaals);
35010
35039
  _.$init_98 = function $init_98() {
35011
35040
  };
35012
- _.getEnergy_0 = function getEnergy_6(pos) {
35013
- var aTerm, aTerm2, aTerm7, bTerm, dist, dist2, dist7, rstar_ij2, rstar_ij7, vdw1, vdw1m1, vdw2, vdw2m1;
35041
+ _.getEnergy_0 = function getEnergy_6(pos, detail) {
35042
+ var aTerm, aTerm2, aTerm7, bTerm, dist, dist2, dist7, e, rstar_ij2, rstar_ij7, vdw1, vdw1m1, vdw2, vdw2m1;
35014
35043
  dist = new carcfm.Vector3_4(pos, this.a1, this.a2).length_2();
35015
35044
  vdw1 = 1.07;
35016
35045
  vdw1m1 = 1.07 - 1;
@@ -35024,7 +35053,10 @@ function getExports($wnd) {
35024
35053
  rstar_ij2 = this.rstar_ij * this.rstar_ij;
35025
35054
  rstar_ij7 = rstar_ij2 * rstar_ij2 * rstar_ij2 * this.rstar_ij;
35026
35055
  bTerm = 1.12 * rstar_ij7 / (dist7 + 0.1200000000000001 * rstar_ij7) - 2;
35027
- return aTerm7 * bTerm * this.well_depth;
35056
+ e = aTerm7 * bTerm * this.well_depth;
35057
+ if (isNotNull(detail))
35058
+ detail.append_9("vanDerWaals " + caru.toString_20(dist) + " " + this.a1 + "," + this.a2 + " " + caru.toString_20(e) + "\n");
35059
+ return e;
35028
35060
  };
35029
35061
  _.getGradient = function getGradient_5(pos, grad) {
35030
35062
  var dE_dr, dGrad, dist, i, q, q2, q6, q7, q7pvdw2m1, t, t2, t7, vdw1, vdw1m1, vdw2, vdw2m1, vdw2t7;
@@ -46835,7 +46867,7 @@ function getExports($wnd) {
46835
46867
  _._minimise = function _minimise(maxIts, gradTol, funcTol) {
46836
46868
  return this.oclMmff.minimise_0(maxIts, gradTol, funcTol);
46837
46869
  };
46838
- _.getTotalEnergy = function getTotalEnergy_1() {
46870
+ _.getTotalEnergy = function getTotalEnergy_2() {
46839
46871
  return this.oclMmff.getTotalEnergy_0();
46840
46872
  };
46841
46873
  _.size = function size_4() {
@@ -47499,7 +47531,7 @@ function getExports($wnd) {
47499
47531
  inventor.invent(this.oclMolecule);
47500
47532
  this.oclMolecule.setStereoBondsFromParity_0();
47501
47533
  };
47502
- _.is3D = function is3D_1() {
47534
+ _.is3D = function is3D_0() {
47503
47535
  return this.oclMolecule.is3D_0();
47504
47536
  };
47505
47537
  _.isAlkaliMetal = function isAlkaliMetal_0(atom) {
@@ -47649,8 +47681,8 @@ function getExports($wnd) {
47649
47681
  _.removeBondHiliting = function removeBondHiliting_0() {
47650
47682
  this.oclMolecule.removeBondHiliting_0();
47651
47683
  };
47652
- _.removeExplicitHydrogens = function removeExplicitHydrogens_1(is3D) {
47653
- this.oclMolecule.removeExplicitHydrogens_1(true, is3D);
47684
+ _.removeExplicitHydrogens = function removeExplicitHydrogens_0() {
47685
+ this.oclMolecule.removeExplicitHydrogens_0(true);
47654
47686
  };
47655
47687
  _.removeQueryFeatures = function removeQueryFeatures_0() {
47656
47688
  return this.oclMolecule.removeQueryFeatures_0();
@@ -64774,21 +64806,21 @@ function getExports($wnd) {
64774
64806
  };
64775
64807
  ooccg.addHydrogenAtoms = function addHydrogenAtoms(mol) {
64776
64808
  ooccg.$clinit_ConformerGenerator();
64777
- var atom, atom0, atom1, hydrogenBondLength, i, implicitHydrogen, oldStereoHelperBits;
64809
+ var atom, atom0, atom1, bondLength, i, implicitHydrogen, oldStereoHelperBits;
64778
64810
  oldStereoHelperBits = mol.getHelperArrayStatus_0() & 248;
64779
64811
  mol.ensureHelperArrays_0(1);
64780
64812
  implicitHydrogen = initUnidimensionalArray(cggl.I_classLit, { 6: 1, 4: 1, 1: 1 }, 5, mol.getAtoms_0(), 15, 1);
64781
64813
  for (atom0 = 0; atom0 < mol.getAtoms_0(); atom0++)
64782
64814
  implicitHydrogen[atom0] = mol.getImplicitHydrogens_1(atom0);
64783
- hydrogenBondLength = 0.8 * mol.getAverageBondLength_0();
64784
64815
  for (atom1 = 0; atom1 < implicitHydrogen.length; atom1++)
64785
64816
  if (implicitHydrogen[atom1] != 0)
64786
64817
  for (i = 0; i < implicitHydrogen[atom1]; i++)
64787
64818
  mol.addBond_1(atom1, mol.addAtom_2(1), 1);
64788
64819
  mol.ensureHelperArrays_0(1);
64820
+ bondLength = 0.8 * mol.getAverageBondLength_0();
64789
64821
  for (atom = 0; atom < implicitHydrogen.length; atom++)
64790
64822
  if (implicitHydrogen[atom] != 0)
64791
- ooccg.setHydrogenLocations(mol, atom, implicitHydrogen[atom], hydrogenBondLength);
64823
+ ooccg.setHydrogenLocations(mol, atom, implicitHydrogen[atom], bondLength);
64792
64824
  if ((oldStereoHelperBits & 8) != 0)
64793
64825
  mol.setParitiesValid_0(oldStereoHelperBits);
64794
64826
  };
@@ -64802,7 +64834,7 @@ function getExports($wnd) {
64802
64834
  ooccg.$clinit_ConformerGenerator();
64803
64835
  return compare_25(b2_1.getSmallerSideAtoms().length, b1_0.getSmallerSideAtoms().length);
64804
64836
  };
64805
- ooccg.setHydrogenLocations = function setHydrogenLocations(mol, atom, newHydrogenCount, avbl) {
64837
+ ooccg.setHydrogenLocations = function setHydrogenLocations(mol, atom, newHydrogenCount, bondLength) {
64806
64838
  var a1, a2, angle, angleIncrement, biggestAngleDif, bond, dif, firstNewHydrogenConnIndex, hydrogenAngle, i, i0, i1, newHydrogen, startAngle, stereoBondAngle, stereoBondCount, stereoBondIndex;
64807
64839
  firstNewHydrogenConnIndex = mol.getAllConnAtoms_0(atom) - newHydrogenCount;
64808
64840
  stereoBondIndex = -1;
@@ -64855,8 +64887,8 @@ function getExports($wnd) {
64855
64887
  }
64856
64888
  }
64857
64889
  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));
64890
+ mol.setAtomX_0(newHydrogen, mol.getAtomX_0(atom) + bondLength * $wnd.Math.sin(hydrogenAngle));
64891
+ mol.setAtomY_0(newHydrogen, mol.getAtomY_0(atom) + bondLength * $wnd.Math.cos(hydrogenAngle));
64860
64892
  }
64861
64893
  };
64862
64894
  defineClass(230, 1, { 1: 1 }, ooccg.ConformerGenerator_0);
@@ -67287,7 +67319,7 @@ function getExports($wnd) {
67287
67319
  this.$init_419();
67288
67320
  this.mMol = mol;
67289
67321
  if (!keepHydrogen)
67290
- this.mMol.removeExplicitHydrogens_0();
67322
+ this.mMol.removeExplicitHydrogens_0(true);
67291
67323
  this.mMol.ensureHelperArrays_0(15);
67292
67324
  this.mRuleList = new ju.ArrayList();
67293
67325
  this.mSkipRule = initUnidimensionalArray(cggl.Z_classLit, { 9: 1, 4: 1, 1: 1 }, 5, (ooccs.$clinit_ConformationRule(), ooccs.RULE_NAME).length, 16, 1);
@@ -69752,7 +69784,7 @@ function getExports($wnd) {
69752
69784
  $sendStats("moduleStartup", "end");
69753
69785
  $gwt && $gwt.permProps && __gwtModuleFunction.__moduleStartupDone($gwt.permProps);
69754
69786
  const toReturn = $wnd["OCL"];
69755
- toReturn.version = "9.0.0";
69787
+ toReturn.version = "9.1.0";
69756
69788
  return toReturn;
69757
69789
  }
69758
69790
  var isBrowserWindow = typeof window !== "undefined" && typeof window.document !== "undefined";
@@ -69801,7 +69833,14 @@ function addRegisterResources(OCL) {
69801
69833
  OCL.Resources.registerFromUrl = async function registerFromUrl(url = getDefaultResourcesUrl()) {
69802
69834
  const request = await fetch(url);
69803
69835
  const resources = await request.json();
69804
- _register(resources);
69836
+ const textEncoder = new TextEncoder();
69837
+ const resourcesAsUint8 = Object.fromEntries(
69838
+ Object.entries(resources).map(([file, contents]) => [
69839
+ file,
69840
+ textEncoder.encode(contents)
69841
+ ])
69842
+ );
69843
+ _register(resourcesAsUint8);
69805
69844
  };
69806
69845
  if (typeof process !== "undefined") {
69807
69846
  let getDefaultResourcesPath2 = function() {
@@ -69887,8 +69926,8 @@ export {
69887
69926
  };
69888
69927
  /**
69889
69928
  * openchemlib - Manipulate molecules
69890
- * @version v9.0.0
69891
- * @date 2025-04-17T15:48:28.546Z
69929
+ * @version v9.1.0
69930
+ * @date 2025-04-30T14:40:58.380Z
69892
69931
  * @link https://github.com/cheminfo/openchemlib-js
69893
69932
  * @license BSD-3-Clause
69894
69933
  */