openchemlib 8.16.0 → 8.17.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.
- package/dist/openchemlib-core.js +144 -144
- package/dist/openchemlib-full.js +164 -164
- package/dist/openchemlib-full.pretty.js +173 -154
- package/dist/openchemlib-minimal.js +110 -110
- package/lib/canvas_editor/init/canvas_editor.js +0 -6
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* openchemlib - Manipulate molecules
|
|
3
|
-
* @version v8.
|
|
4
|
-
* @date 2024-
|
|
3
|
+
* @version v8.17.0
|
|
4
|
+
* @date 2024-11-06T15:08:55.165Z
|
|
5
5
|
* @link https://github.com/cheminfo/openchemlib-js
|
|
6
6
|
* @license BSD-3-Clause
|
|
7
7
|
*/
|
|
@@ -6364,11 +6364,11 @@ _.mpDrawAtom = function mpDrawAtom(atom, esrGroupMemberCount){
|
|
|
6364
6364
|
if ((this.mDisplayMode & 8192) == 0) {
|
|
6365
6365
|
if (this.mMol.isFragment_0()) {
|
|
6366
6366
|
if (neq(and_0(this.mMol.getAtomQueryFeatures(atom), 2048), 0))
|
|
6367
|
-
hydrogensToAdd = this.mMol.
|
|
6367
|
+
hydrogensToAdd = this.mMol.getImplicitHydrogens_1(atom);
|
|
6368
6368
|
}
|
|
6369
6369
|
else {
|
|
6370
6370
|
if (this.mMol.getAtomicNo_0(atom) != 6 || this.mMol.getAtomMass_0(atom) != 0 || !this.mAtomIsConnected[atom] || this.mMol.getAtomRadical_0(atom) != 0)
|
|
6371
|
-
hydrogensToAdd = this.mMol.
|
|
6371
|
+
hydrogensToAdd = this.mMol.getImplicitHydrogens_1(atom);
|
|
6372
6372
|
}
|
|
6373
6373
|
}
|
|
6374
6374
|
largeIsoString = false;
|
|
@@ -8896,7 +8896,6 @@ carc2.Canonizer = function Canonizer(mol){
|
|
|
8896
8896
|
;
|
|
8897
8897
|
carc2.Canonizer_0 = function Canonizer_0(mol, mode){
|
|
8898
8898
|
carc2.$clinit_Canonizer();
|
|
8899
|
-
var i;
|
|
8900
8899
|
Object_0.call(this);
|
|
8901
8900
|
this.$init_6();
|
|
8902
8901
|
this.mMol = mol;
|
|
@@ -8906,16 +8905,7 @@ carc2.Canonizer_0 = function Canonizer_0(mol, mode){
|
|
|
8906
8905
|
if ((this.mMode & 2048) == 0)
|
|
8907
8906
|
this.canFindNitrogenQualifyingForParity();
|
|
8908
8907
|
this.mZCoordinatesAvailable = (mode & 64) != 0 || this.mMol.is3D_0();
|
|
8909
|
-
this.mAllHydrogensAreExplicit =
|
|
8910
|
-
if (this.mMol.getAllAtoms_0() > this.mMol.getAtoms_0() && !this.mMol.isFragment_0()) {
|
|
8911
|
-
this.mAllHydrogensAreExplicit = true;
|
|
8912
|
-
for (i = 0; i < this.mMol.getAtoms_0(); i++) {
|
|
8913
|
-
if (this.mMol.getImplicitHydrogens_0(i) != 0) {
|
|
8914
|
-
this.mAllHydrogensAreExplicit = false;
|
|
8915
|
-
break;
|
|
8916
|
-
}
|
|
8917
|
-
}
|
|
8918
|
-
}
|
|
8908
|
+
this.mAllHydrogensAreExplicit = this.mMol.getImplicitHydrogens_0() == 0;
|
|
8919
8909
|
if ((this.mMode & 2048) == 0) {
|
|
8920
8910
|
this.mTHParity = initUnidimensionalArray(cggl.B_classLit, {8:1, 4:1, 1:1}, 5, this.mMol.getAtoms_0(), 15, 1);
|
|
8921
8911
|
this.mTHParityIsPseudo = initUnidimensionalArray(cggl.Z_classLit, {13:1, 4:1, 1:1}, 5, this.mMol.getAtoms_0(), 16, 1);
|
|
@@ -9041,7 +9031,7 @@ _.canBreakTiesRandomly = function canBreakTiesRandomly(){
|
|
|
9041
9031
|
var atom, atom0, atom1, rank, rankCount;
|
|
9042
9032
|
for (atom0 = 0; atom0 < this.mMol.getAtoms_0(); atom0++) {
|
|
9043
9033
|
this.mCanBase[atom0].init_0(atom0);
|
|
9044
|
-
this.mCanBase[atom0].add_0(this.mAtomBits + 1, fromInt_0(2
|
|
9034
|
+
this.mCanBase[atom0].add_0(this.mAtomBits + 1, mul_0(fromInt_0(2), fromInt_0(this.mCanRank[atom0])));
|
|
9045
9035
|
}
|
|
9046
9036
|
rankCount = initUnidimensionalArray(cggl.I_classLit, {6:1, 4:1, 1:1}, 5, this.mNoOfRanks + 1, 15, 1);
|
|
9047
9037
|
for (atom1 = 0; atom1 < this.mMol.getAtoms_0(); atom1++)
|
|
@@ -10205,7 +10195,7 @@ _.canRecursivelyFindAllParities = function canRecursivelyFindAllParities(){
|
|
|
10205
10195
|
thParityInfo |= this.mTHESRType[atom] << 5;
|
|
10206
10196
|
thParityInfo |= this.mTHESRGroup[atom];
|
|
10207
10197
|
}
|
|
10208
|
-
this.mCanBase[atom].add_0(2 * 9, fromInt_0(thParityInfo
|
|
10198
|
+
this.mCanBase[atom].add_0(2 * 9, shl_0(fromInt_0(thParityInfo), 9));
|
|
10209
10199
|
}
|
|
10210
10200
|
for (bond = 0; bond < this.mMol.getBonds_0(); bond++) {
|
|
10211
10201
|
ezParityInfo = this.mEZParity[bond] << 2 + 5;
|
|
@@ -10822,7 +10812,7 @@ _.encodeCoordinates = function encodeCoordinates(keepPositionAndScale, coords){
|
|
|
10822
10812
|
this.mEncodingBuffer.append_4(includeHydrogenCoordinates?35:33);
|
|
10823
10813
|
this.encodeBits(fromInt_0(this.mZCoordinatesAvailable?1:0), 1);
|
|
10824
10814
|
this.encodeBits(fromInt_0(keepPositionAndScale?1:0), 1);
|
|
10825
|
-
this.encodeBits(fromInt_0(
|
|
10815
|
+
this.encodeBits(fromInt_0(resolutionBits >> 1), 4);
|
|
10826
10816
|
maxDelta = 0;
|
|
10827
10817
|
for (i0 = 1; i0 < this.mMol.getAtoms_0(); i0++)
|
|
10828
10818
|
maxDelta = this.getMaxDelta(this.mGraphAtom[i0], this.mGraphFrom[i0] == -1?-1:this.mGraphAtom[this.mGraphFrom[i0]], maxDelta, coords);
|
|
@@ -10838,8 +10828,8 @@ _.encodeCoordinates = function encodeCoordinates(keepPositionAndScale, coords){
|
|
|
10838
10828
|
return;
|
|
10839
10829
|
}
|
|
10840
10830
|
binCount = 1 << resolutionBits;
|
|
10841
|
-
increment = maxDelta / (binCount
|
|
10842
|
-
maxDeltaPlusHalfIncrement = maxDelta +
|
|
10831
|
+
increment = maxDelta / ((binCount >> 1) - 1);
|
|
10832
|
+
maxDeltaPlusHalfIncrement = maxDelta + 0.5 * increment;
|
|
10843
10833
|
for (i2 = 1; i2 < this.mMol.getAtoms_0(); i2++)
|
|
10844
10834
|
this.encodeCoords(this.mGraphAtom[i2], this.mGraphFrom[i2] == -1?-1:this.mGraphAtom[this.mGraphFrom[i2]], maxDeltaPlusHalfIncrement, increment, resolutionBits, coords);
|
|
10845
10835
|
if (includeHydrogenCoordinates) {
|
|
@@ -17561,7 +17551,7 @@ _.canonizeCharge_1 = function canonizeCharge_0(allowUnbalancedCharge, doNeutrali
|
|
|
17561
17551
|
continue;
|
|
17562
17552
|
if (this.mAtomicNo[atom1] < 9 && this.getOccupiedValence_0(atom1) > 3 || this.mAtomicNo[atom2] < 9 && this.getOccupiedValence_0(atom2) > 3)
|
|
17563
17553
|
continue;
|
|
17564
|
-
hasImplicitHydrogen = this.
|
|
17554
|
+
hasImplicitHydrogen = this.getImplicitHydrogens_1(atom1) != 0;
|
|
17565
17555
|
this.mAtomCharge[atom1] -= 1;
|
|
17566
17556
|
this.mAtomCharge[atom2] += 1;
|
|
17567
17557
|
if (!hasImplicitHydrogen) {
|
|
@@ -17601,7 +17591,7 @@ _.canonizeCharge_1 = function canonizeCharge_0(allowUnbalancedCharge, doNeutrali
|
|
|
17601
17591
|
for (atom3 = 0; atom3 < this.mAllAtoms; atom3++) {
|
|
17602
17592
|
if (this.mAtomCharge[atom3] > 0) {
|
|
17603
17593
|
if (!this.hasNegativeNeighbour(atom3) && this.isElectronegative_0(atom3)) {
|
|
17604
|
-
chargeReduction = $wnd.Math.min(this.
|
|
17594
|
+
chargeReduction = $wnd.Math.min(this.getImplicitHydrogens_1(atom3), this.mAtomCharge[atom3]);
|
|
17605
17595
|
if (chargeReduction != 0 && positiveChargeForRemoval >= chargeReduction) {
|
|
17606
17596
|
overallCharge -= chargeReduction;
|
|
17607
17597
|
overallChargeChange -= chargeReduction;
|
|
@@ -18045,7 +18035,7 @@ _.getAllConnAtomsPlusMetalBonds_0 = function getAllConnAtomsPlusMetalBonds(atom)
|
|
|
18045
18035
|
}
|
|
18046
18036
|
;
|
|
18047
18037
|
_.getAllHydrogens_0 = function getAllHydrogens(atom){
|
|
18048
|
-
return this.mAllConnAtoms[atom] - this.getNonHydrogenNeighbourCount_0(atom) + this.
|
|
18038
|
+
return this.mAllConnAtoms[atom] - this.getNonHydrogenNeighbourCount_0(atom) + this.getImplicitHydrogens_1(atom);
|
|
18049
18039
|
}
|
|
18050
18040
|
;
|
|
18051
18041
|
_.getAromaticRingCount_0 = function getAromaticRingCount(){
|
|
@@ -18427,14 +18417,25 @@ _.getImplicitHigherValence_0 = function getImplicitHigherValence(atom, neglectEx
|
|
|
18427
18417
|
return occupiedValence;
|
|
18428
18418
|
}
|
|
18429
18419
|
;
|
|
18430
|
-
_.getImplicitHydrogens_0 = function getImplicitHydrogens(
|
|
18420
|
+
_.getImplicitHydrogens_0 = function getImplicitHydrogens(){
|
|
18421
|
+
var atom, implicitHydrogens;
|
|
18422
|
+
if (this.mIsFragment)
|
|
18423
|
+
return 0;
|
|
18424
|
+
this.ensureHelperArrays_0(1);
|
|
18425
|
+
implicitHydrogens = 0;
|
|
18426
|
+
for (atom = 0; atom < this.mAtoms; atom++)
|
|
18427
|
+
implicitHydrogens += this.getImplicitHydrogens_1(atom);
|
|
18428
|
+
return implicitHydrogens;
|
|
18429
|
+
}
|
|
18430
|
+
;
|
|
18431
|
+
_.getImplicitHydrogens_1 = function getImplicitHydrogens_0(atom){
|
|
18431
18432
|
var delocalizedBonds, i, i0, maxValence, occupiedValence, valenceList;
|
|
18432
18433
|
if (this.mIsFragment && eq_0(and_0(this.mAtomQueryFeatures[atom], 2048), 0))
|
|
18433
18434
|
return 0;
|
|
18434
18435
|
if (!this.supportsImplicitHydrogen_0(atom))
|
|
18435
18436
|
return 0;
|
|
18436
|
-
if (jl.equals_Ljava_lang_Object__Z__devirtual$_2('*', this.getAtomCustomLabel_0(atom)))
|
|
18437
|
-
return 0;
|
|
18437
|
+
if (this.mAtomicNo[atom] == 0 || jl.equals_Ljava_lang_Object__Z__devirtual$_2('*', this.getAtomCustomLabel_0(atom)))
|
|
18438
|
+
return this.mAllConnAtoms[atom] == 0?1:0;
|
|
18438
18439
|
this.ensureHelperArrays_0(1);
|
|
18439
18440
|
occupiedValence = 0;
|
|
18440
18441
|
for (i0 = 0; i0 < this.mAllConnAtoms[atom]; i0++)
|
|
@@ -18494,7 +18495,7 @@ _.getMolweight_0 = function getMolweight(){
|
|
|
18494
18495
|
molweight = 0;
|
|
18495
18496
|
for (atom = 0; atom < this.mAllAtoms; atom++) {
|
|
18496
18497
|
mass = this.mAtomMass[atom] != 0?this.mAtomMass[atom]:(carc2.$clinit_Molecule() , carc2.cRoundedMass)[this.mAtomicNo[atom]];
|
|
18497
|
-
molweight += mass + this.
|
|
18498
|
+
molweight += mass + this.getImplicitHydrogens_1(atom) * (carc2.$clinit_Molecule() , carc2.cRoundedMass)[1];
|
|
18498
18499
|
if (this.mAtomicNo[atom] >= 171 && this.mAtomicNo[atom] <= 190) {
|
|
18499
18500
|
connAtoms = this.mAllConnAtoms[atom];
|
|
18500
18501
|
if (connAtoms > 2)
|
|
@@ -18661,7 +18662,7 @@ _.getPathLength_1 = function getPathLength_0(atom1, atom2, maxLength, neglectAto
|
|
|
18661
18662
|
}
|
|
18662
18663
|
;
|
|
18663
18664
|
_.getPlainHydrogens = function getPlainHydrogens(atom){
|
|
18664
|
-
return this.getExplicitHydrogens_0(atom) + this.
|
|
18665
|
+
return this.getExplicitHydrogens_0(atom) + this.getImplicitHydrogens_1(atom);
|
|
18665
18666
|
}
|
|
18666
18667
|
;
|
|
18667
18668
|
_.getPreferredDoubleBondSide = function getPreferredDoubleBondSide(bond){
|
|
@@ -20113,7 +20114,7 @@ _.parse_2 = function parse_2(mol, idcode, coordinates){
|
|
|
20113
20114
|
}
|
|
20114
20115
|
;
|
|
20115
20116
|
_.parse_3 = function parse_3(mol, idcode, coordinates, idcodeStart, coordsStart){
|
|
20116
|
-
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, 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, version, xInt, xOffset, yInt, yOffset, zInt, zOffset;
|
|
20117
|
+
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, version, xInt, xOffset, yInt, yOffset, zInt, zOffset;
|
|
20117
20118
|
mol.clear_0();
|
|
20118
20119
|
if (jsEquals(idcode, null) || idcodeStart < 0 || idcodeStart >= idcode.length)
|
|
20119
20120
|
return;
|
|
@@ -20652,24 +20653,26 @@ _.parse_3 = function parse_3(mol, idcode, coordinates, idcodeStart, coordsStart)
|
|
|
20652
20653
|
from = 0;
|
|
20653
20654
|
factor = 8;
|
|
20654
20655
|
}
|
|
20655
|
-
|
|
20656
|
-
|
|
20656
|
+
decodedDX = factor * (this.decodeBits(resolutionBits) + 1 - (binCount >> 1));
|
|
20657
|
+
decodedDY = factor * (this.decodeBits(resolutionBits) + 1 - (binCount >> 1));
|
|
20658
|
+
this.mMol.setAtomX_0(atom1, this.mMol.getAtomX_0(from) + decodedDX);
|
|
20659
|
+
this.mMol.setAtomY_0(atom1, this.mMol.getAtomY_0(from) + decodedDY);
|
|
20657
20660
|
if (coordsAre3D)
|
|
20658
|
-
this.mMol.setAtomZ_0(atom1, this.mMol.getAtomZ_0(from) + factor * (this.decodeBits(resolutionBits) - binCount
|
|
20661
|
+
this.mMol.setAtomZ_0(atom1, this.mMol.getAtomZ_0(from) + factor * (this.decodeBits(resolutionBits) + 1 - (binCount >> 1)));
|
|
20659
20662
|
}
|
|
20660
20663
|
if (coordinates[coordsStart] == 35) {
|
|
20661
20664
|
hydrogenCount = 0;
|
|
20662
20665
|
hCount = initUnidimensionalArray(cggl.I_classLit, {6:1, 4:1, 1:1}, 5, allAtoms, 15, 1);
|
|
20663
20666
|
for (atom2 = 0; atom2 < allAtoms; atom2++)
|
|
20664
|
-
hydrogenCount += hCount[atom2] = this.mMol.
|
|
20667
|
+
hydrogenCount += hCount[atom2] = this.mMol.getImplicitHydrogens_1(atom2);
|
|
20665
20668
|
for (atom = 0; atom < allAtoms; atom++) {
|
|
20666
20669
|
for (i = 0; i < hCount[atom]; i++) {
|
|
20667
20670
|
hydrogen = this.mMol.addAtom_2(1);
|
|
20668
20671
|
this.mMol.addBond_1(atom, hydrogen, 1);
|
|
20669
|
-
this.mMol.setAtomX_0(hydrogen, this.mMol.getAtomX_0(atom) + (this.decodeBits(resolutionBits) - binCount
|
|
20670
|
-
this.mMol.setAtomY_0(hydrogen, this.mMol.getAtomY_0(atom) + (this.decodeBits(resolutionBits) - binCount
|
|
20672
|
+
this.mMol.setAtomX_0(hydrogen, this.mMol.getAtomX_0(atom) + (this.decodeBits(resolutionBits) + 1 - (binCount >> 1)));
|
|
20673
|
+
this.mMol.setAtomY_0(hydrogen, this.mMol.getAtomY_0(atom) + (this.decodeBits(resolutionBits) + 1 - (binCount >> 1)));
|
|
20671
20674
|
if (coordsAre3D)
|
|
20672
|
-
this.mMol.setAtomZ_0(hydrogen, this.mMol.getAtomZ_0(atom) + (this.decodeBits(resolutionBits) - binCount
|
|
20675
|
+
this.mMol.setAtomZ_0(hydrogen, this.mMol.getAtomZ_0(atom) + (this.decodeBits(resolutionBits) + 1 - (binCount >> 1)));
|
|
20673
20676
|
if (jsNotEquals(selectedHydrogenBits, null) && (selectedHydrogenBits[atom] & 1 << i) != 0)
|
|
20674
20677
|
this.mMol.setAtomSelection_0(hydrogen, true);
|
|
20675
20678
|
}
|
|
@@ -20981,7 +20984,7 @@ _.appendBondOrderSymbol = function appendBondOrderSymbol(bond, parentAtom, build
|
|
|
20981
20984
|
if (this.mEZHalfParity[bond] != 0)
|
|
20982
20985
|
builder.append_4(this.mEZHalfParity[bond] == 1?47:92);
|
|
20983
20986
|
if (this.mMode == 1) {
|
|
20984
|
-
bondTypes = this.mMol.getBondQueryFeatures_0(31 | 96);
|
|
20987
|
+
bondTypes = this.mMol.getBondQueryFeatures_0(bond) & (31 | 96);
|
|
20985
20988
|
if (bondTypes != 0) {
|
|
20986
20989
|
if ((bondTypes & 1) != 0 && this.mEZHalfParity[bond] == 0) {
|
|
20987
20990
|
builder.append_4(45);
|
|
@@ -21367,7 +21370,7 @@ _.getAtomParitySymbol = function getAtomParitySymbol(atom, parent_0){
|
|
|
21367
21370
|
neighborAtom[index_0] = parent_0;
|
|
21368
21371
|
neighborRank[index_0++] = 8 * this.mSmilesIndex[parent_0];
|
|
21369
21372
|
}
|
|
21370
|
-
if (this.mMol.
|
|
21373
|
+
if (this.mMol.getImplicitHydrogens_1(atom) != 0) {
|
|
21371
21374
|
neighborAtom[index_0] = 2147483647;
|
|
21372
21375
|
neighborRank[index_0++] = 8 * this.mSmilesIndex[atom];
|
|
21373
21376
|
}
|
|
@@ -21877,7 +21880,7 @@ carc2.MolecularFormula = function MolecularFormula(mol){
|
|
|
21877
21880
|
if (mol.getAtomicNo_0(atom1) >= 171 && mol.getAtomicNo_0(atom1) <= 190)
|
|
21878
21881
|
atomCount[1] += 2 - mol.getOccupiedValence_0(atom1);
|
|
21879
21882
|
else {
|
|
21880
|
-
atomCount[1] += mol.
|
|
21883
|
+
atomCount[1] += mol.getImplicitHydrogens_1(atom1);
|
|
21881
21884
|
}
|
|
21882
21885
|
atomicNoCount = 0;
|
|
21883
21886
|
for (i0 = 1; i0 <= 190; i0++)
|
|
@@ -22136,7 +22139,7 @@ carc2.removeAcidicHydrogens = function removeAcidicHydrogens(mol, maxHydrogens){
|
|
|
22136
22139
|
found = false;
|
|
22137
22140
|
for (i = 0; i < mol.getConnAtoms_0(atom); i++) {
|
|
22138
22141
|
connAtom = mol.getConnAtom_0(atom, i);
|
|
22139
|
-
if (mol.getAtomCharge_0(connAtom) == 0 && mol.isElectronegative_0(connAtom) && mol.
|
|
22142
|
+
if (mol.getAtomCharge_0(connAtom) == 0 && mol.isElectronegative_0(connAtom) && mol.getImplicitHydrogens_1(connAtom) > 0) {
|
|
22140
22143
|
mol.setAtomCharge_0(connAtom, -1);
|
|
22141
22144
|
maxHydrogens--;
|
|
22142
22145
|
if (maxHydrogens == 0)
|
|
@@ -22164,7 +22167,7 @@ carc2.removeAcidicHydrogens = function removeAcidicHydrogens(mol, maxHydrogens){
|
|
|
22164
22167
|
carc2.removeAcidicHydrogensFromAcid = function removeAcidicHydrogensFromAcid(mol, maxHydrogens, atomicNo, centralAtomicNo){
|
|
22165
22168
|
var atom, centralAtom, connAtom, deprotonated, deprotonatedFound, i, j, oxoFound;
|
|
22166
22169
|
for (atom = 0; atom < mol.getAtoms_0(); atom++) {
|
|
22167
|
-
if (mol.getAtomicNo_0(atom) == atomicNo && mol.getAtomCharge_0(atom) == 0 && mol.
|
|
22170
|
+
if (mol.getAtomicNo_0(atom) == atomicNo && mol.getAtomCharge_0(atom) == 0 && mol.getImplicitHydrogens_1(atom) > 0) {
|
|
22168
22171
|
deprotonated = false;
|
|
22169
22172
|
for (i = 0; i < mol.getConnAtoms_0(atom); i++) {
|
|
22170
22173
|
if (mol.getConnBondOrder_0(atom, i) == 1) {
|
|
@@ -25046,7 +25049,7 @@ _.areAtomsSimilar = function areAtomsSimilar(moleculeAtom, fragmentAtom){
|
|
|
25046
25049
|
}
|
|
25047
25050
|
;
|
|
25048
25051
|
_.areBondsSimilar = function areBondsSimilar(moleculeBond, fragmentBond){
|
|
25049
|
-
var found, frgBondType, frgBondTypes, frgDefaults, i, molBondType, molDefaults, ringSet, ringSize;
|
|
25052
|
+
var found, frgBondType, frgBondTypes, frgDefaults, i, molBondType, molDefaults, moleculeRingSize, ringSet, ringSize;
|
|
25050
25053
|
molDefaults = this.mMoleculeBondFeatures[moleculeBond];
|
|
25051
25054
|
frgDefaults = this.mFragmentBondFeatures[fragmentBond];
|
|
25052
25055
|
if ((this.mFragment.getBondQueryFeatures_0(fragmentBond) & 8388608) != 0) {
|
|
@@ -25064,6 +25067,13 @@ _.areBondsSimilar = function areBondsSimilar(moleculeBond, fragmentBond){
|
|
|
25064
25067
|
if (ringSize != 0) {
|
|
25065
25068
|
if (this.mMolecule.isFragment_0() && ringSize == (this.mMolecule.getBondQueryFeatures_0(fragmentBond) & 917504) >> 17)
|
|
25066
25069
|
return true;
|
|
25070
|
+
if (ringSize <= 2) {
|
|
25071
|
+
moleculeRingSize = this.mMolecule.getBondRingSize_0(moleculeBond);
|
|
25072
|
+
if (ringSize == 1)
|
|
25073
|
+
return moleculeRingSize >= 8 && moleculeRingSize <= 12;
|
|
25074
|
+
else
|
|
25075
|
+
return moleculeRingSize >= 12;
|
|
25076
|
+
}
|
|
25067
25077
|
found = false;
|
|
25068
25078
|
ringSet = this.mMolecule.getRingSet_0();
|
|
25069
25079
|
for (i = 0; i < ringSet.getSize_0(); i++) {
|
|
@@ -27386,7 +27396,7 @@ _.visitMolAtom = function visitMolAtom(molAtom, molBond){
|
|
|
27386
27396
|
this.mSmiAtomStr[currentSmiAtom] += '' + jl.toString_49(atomIsotope);
|
|
27387
27397
|
this.mSmiAtomStr[currentSmiAtom] += '' + atomLabel;
|
|
27388
27398
|
if (addBracket == true) {
|
|
27389
|
-
if (0 < (implicitHs = this.mMol.
|
|
27399
|
+
if (0 < (implicitHs = this.mMol.getImplicitHydrogens_1(molAtom))) {
|
|
27390
27400
|
this.mSmiAtomStr[currentSmiAtom] += 'H';
|
|
27391
27401
|
if (1 < implicitHs)
|
|
27392
27402
|
this.mSmiAtomStr[currentSmiAtom] += implicitHs;
|
|
@@ -27811,7 +27821,7 @@ _.locateAromaticDoubleBonds = function locateAromaticDoubleBonds(allowSmartsFeat
|
|
|
27811
27821
|
}
|
|
27812
27822
|
else {
|
|
27813
27823
|
for (atom = 0; atom < this.mMol.getAtoms_0(); atom++) {
|
|
27814
|
-
if (this.mMol.isMarkedAtom_0(atom) && this.mMol.
|
|
27824
|
+
if (this.mMol.isMarkedAtom_0(atom) && this.mMol.getImplicitHydrogens_1(atom) != 0) {
|
|
27815
27825
|
this.mMol.setAtomMarker_0(atom, false);
|
|
27816
27826
|
this.mMol.setAtomRadical_0(atom, 32);
|
|
27817
27827
|
this.mAromaticAtoms--;
|
|
@@ -32254,7 +32264,7 @@ carcc2.isCsp3 = function isCsp3(mol, atomID){
|
|
|
32254
32264
|
return false;
|
|
32255
32265
|
if (mol.getAtomCharge_0(atomID) != 0)
|
|
32256
32266
|
return false;
|
|
32257
|
-
if (mol.
|
|
32267
|
+
if (mol.getImplicitHydrogens_1(atomID) + mol.getConnAtoms_0(atomID) != 4)
|
|
32258
32268
|
return false;
|
|
32259
32269
|
return true;
|
|
32260
32270
|
}
|
|
@@ -32295,7 +32305,7 @@ carcc2.addImplicitHydrogens_0 = function addImplicitHydrogens_0(molecule, iAtom)
|
|
|
32295
32305
|
carcc2.$clinit_HydrogenHandler();
|
|
32296
32306
|
var angle1, angle2, angle3, atom, atomicNo, averageLength, bond, currentDistance, distance, dx, dx1, dx2, dy, dy1, dy2, i, i0, iHydrogen, iNew, length_0, length1, length2, nHydrogens, nNeighbours, nNeighbours0, normal, stereoAtom1, stereoAtom2, stereoBond, x_0, y_0;
|
|
32297
32307
|
atomicNo = 1;
|
|
32298
|
-
nHydrogens = molecule.
|
|
32308
|
+
nHydrogens = molecule.getImplicitHydrogens_1(iAtom);
|
|
32299
32309
|
x_0 = molecule.getAtomX_0(iAtom);
|
|
32300
32310
|
y_0 = molecule.getAtomY_0(iAtom);
|
|
32301
32311
|
switch (nHydrogens) {
|
|
@@ -34923,7 +34933,7 @@ carcf.AbstractForceField = function AbstractForceField(mol){
|
|
|
34923
34933
|
this.$init_79();
|
|
34924
34934
|
implicitHydrogens = 0;
|
|
34925
34935
|
for (at = 0; at < mol.getAtoms_0(); at++) {
|
|
34926
|
-
implicitHydrogens += mol.
|
|
34936
|
+
implicitHydrogens += mol.getImplicitHydrogens_1(at);
|
|
34927
34937
|
}
|
|
34928
34938
|
if (implicitHydrogens > 0) {
|
|
34929
34939
|
throw toJs(new jl.IllegalArgumentException_0('molecule needs explicit hydrogen atoms for force field calculations'));
|
|
@@ -37530,7 +37540,7 @@ carcfmt2.$clinit_Atom_0 = function $clinit_Atom_0(){
|
|
|
37530
37540
|
}
|
|
37531
37541
|
;
|
|
37532
37542
|
carcfmt2.degree = function degree(mol, atom){
|
|
37533
|
-
return mol.getAllConnAtoms_0(atom) + mol.
|
|
37543
|
+
return mol.getAllConnAtoms_0(atom) + mol.getImplicitHydrogens_1(atom);
|
|
37534
37544
|
}
|
|
37535
37545
|
;
|
|
37536
37546
|
carcfmt2.getHeavyType = function getHeavyType(mol, atom){
|
|
@@ -37730,7 +37740,7 @@ carcfmt2.getHeavyType = function getHeavyType(mol, atom){
|
|
|
37730
37740
|
nbr = mol.getConnAtom_0(atom, i1);
|
|
37731
37741
|
if (mol.getAtomicNo_0(nbr) == 8 && carcfmt2.degree(mol, nbr) == 1)
|
|
37732
37742
|
nTermOtoN++;
|
|
37733
|
-
if (mol.getOccupiedValence_0(atom) + mol.
|
|
37743
|
+
if (mol.getOccupiedValence_0(atom) + mol.getImplicitHydrogens_1(atom) >= 3 && (mol.getAtomicNo_0(nbr) == 15 || mol.getAtomicNo_0(nbr) == 16)) {
|
|
37734
37744
|
nOtoSP = 0;
|
|
37735
37745
|
for (j = 0; j < mol.getAllConnAtoms_0(nbr); j++) {
|
|
37736
37746
|
nbr2 = mol.getConnAtom_0(nbr, j);
|
|
@@ -37749,7 +37759,7 @@ carcfmt2.getHeavyType = function getHeavyType(mol, atom){
|
|
|
37749
37759
|
}
|
|
37750
37760
|
|
|
37751
37761
|
if (carcfmt2.degree(mol, atom) == 3) {
|
|
37752
|
-
if (mol.getOccupiedValence_0(atom) + mol.
|
|
37762
|
+
if (mol.getOccupiedValence_0(atom) + mol.getImplicitHydrogens_1(atom) >= 4) {
|
|
37753
37763
|
doubleCN = false;
|
|
37754
37764
|
for (i = 0; i < mol.getAllConnAtoms_0(atom); i++) {
|
|
37755
37765
|
nbr = mol.getConnAtom_0(atom, i);
|
|
@@ -37772,7 +37782,7 @@ carcfmt2.getHeavyType = function getHeavyType(mol, atom){
|
|
|
37772
37782
|
if (doubleCN)
|
|
37773
37783
|
return 54;
|
|
37774
37784
|
}
|
|
37775
|
-
if (mol.getOccupiedValence_0(atom) + mol.
|
|
37785
|
+
if (mol.getOccupiedValence_0(atom) + mol.getImplicitHydrogens_1(atom) >= 3) {
|
|
37776
37786
|
isNCOorNCS = false;
|
|
37777
37787
|
isNCNplus = false;
|
|
37778
37788
|
isNGDplus = false;
|
|
@@ -37881,7 +37891,7 @@ carcfmt2.getHeavyType = function getHeavyType(mol, atom){
|
|
|
37881
37891
|
}
|
|
37882
37892
|
|
|
37883
37893
|
if (carcfmt2.degree(mol, atom) == 2) {
|
|
37884
|
-
if (mol.getOccupiedValence_0(atom) + mol.
|
|
37894
|
+
if (mol.getOccupiedValence_0(atom) + mol.getImplicitHydrogens_1(atom) == 4) {
|
|
37885
37895
|
isIsonitrile = false;
|
|
37886
37896
|
for (i = 0; !isIsonitrile && i < mol.getAllConnAtoms_0(atom); i++) {
|
|
37887
37897
|
nbr = mol.getConnAtom_0(atom, i);
|
|
@@ -37891,7 +37901,7 @@ carcfmt2.getHeavyType = function getHeavyType(mol, atom){
|
|
|
37891
37901
|
return 61;
|
|
37892
37902
|
return 53;
|
|
37893
37903
|
}
|
|
37894
|
-
if (mol.getOccupiedValence_0(atom) + mol.
|
|
37904
|
+
if (mol.getOccupiedValence_0(atom) + mol.getImplicitHydrogens_1(atom) == 3) {
|
|
37895
37905
|
isNitroso = false;
|
|
37896
37906
|
isImineOrAzo = false;
|
|
37897
37907
|
for (i = 0; i < mol.getAllConnAtoms_0(atom); i++) {
|
|
@@ -37906,7 +37916,7 @@ carcfmt2.getHeavyType = function getHeavyType(mol, atom){
|
|
|
37906
37916
|
if (isImineOrAzo)
|
|
37907
37917
|
return 9;
|
|
37908
37918
|
}
|
|
37909
|
-
if (mol.getOccupiedValence_0(atom) + mol.
|
|
37919
|
+
if (mol.getOccupiedValence_0(atom) + mol.getImplicitHydrogens_1(atom) >= 2) {
|
|
37910
37920
|
isNSO = false;
|
|
37911
37921
|
for (i = 0; i < mol.getAllConnAtoms_0(atom); i++) {
|
|
37912
37922
|
nbr = mol.getConnAtom_0(atom, i);
|
|
@@ -37953,7 +37963,7 @@ carcfmt2.getHeavyType = function getHeavyType(mol, atom){
|
|
|
37953
37963
|
if (carcfmt2.degree(mol, atom) == 3)
|
|
37954
37964
|
return 49;
|
|
37955
37965
|
if (carcfmt2.degree(mol, atom) == 2) {
|
|
37956
|
-
if (mol.getOccupiedValence_0(atom) + mol.
|
|
37966
|
+
if (mol.getOccupiedValence_0(atom) + mol.getImplicitHydrogens_1(atom) == 3)
|
|
37957
37967
|
return 51;
|
|
37958
37968
|
nHtoO = 0;
|
|
37959
37969
|
for (i = 0; i < mol.getAllConnAtoms_0(atom); i++) {
|
|
@@ -37961,7 +37971,7 @@ carcfmt2.getHeavyType = function getHeavyType(mol, atom){
|
|
|
37961
37971
|
if (mol.getAtomicNo_0(nbr) == 1)
|
|
37962
37972
|
nHtoO++;
|
|
37963
37973
|
}
|
|
37964
|
-
if (nHtoO + mol.
|
|
37974
|
+
if (nHtoO + mol.getImplicitHydrogens_1(atom) == 2)
|
|
37965
37975
|
return 70;
|
|
37966
37976
|
return 6;
|
|
37967
37977
|
}
|
|
@@ -37970,7 +37980,7 @@ carcfmt2.getHeavyType = function getHeavyType(mol, atom){
|
|
|
37970
37980
|
nNtoS = 0;
|
|
37971
37981
|
nOtoS = 0;
|
|
37972
37982
|
nStoS = 0;
|
|
37973
|
-
isOxideOtoH = mol.getAllConnAtoms_0(atom) - mol.getConnAtoms_0(atom) + mol.
|
|
37983
|
+
isOxideOtoH = mol.getAllConnAtoms_0(atom) - mol.getConnAtoms_0(atom) + mol.getImplicitHydrogens_1(atom) > 0?true:false;
|
|
37974
37984
|
isCarboxylateO = false;
|
|
37975
37985
|
isCarbonylO = false;
|
|
37976
37986
|
isOxideOtoC = false;
|
|
@@ -38028,8 +38038,8 @@ carcfmt2.getHeavyType = function getHeavyType(mol, atom){
|
|
|
38028
38038
|
if (mol.getAtomicNo_0(nbr) == 7) {
|
|
38029
38039
|
isNitrosoO = mol.getBondOrder_0(mol.getBond_0(atom, nbr)) == 2;
|
|
38030
38040
|
if (mol.getBondOrder_0(mol.getBond_0(atom, nbr)) == 1 && nOtoS == 1) {
|
|
38031
|
-
isOxideOtoN = carcfmt2.degree(mol, nbr) == 2 || mol.getOccupiedValence_0(nbr) + mol.
|
|
38032
|
-
isNOxideO = mol.getOccupiedValence_0(nbr) + mol.
|
|
38041
|
+
isOxideOtoN = carcfmt2.degree(mol, nbr) == 2 || mol.getOccupiedValence_0(nbr) + mol.getImplicitHydrogens_1(nbr) == 3;
|
|
38042
|
+
isNOxideO = mol.getOccupiedValence_0(nbr) + mol.getImplicitHydrogens_1(nbr) == 4;
|
|
38033
38043
|
}
|
|
38034
38044
|
isNitroO = nOtoS >= 2;
|
|
38035
38045
|
}
|
|
@@ -38343,7 +38353,7 @@ carcfmt2.ringIsMMFFAromatic_0 = function ringIsMMFFAromatic_0(mol, r){
|
|
|
38343
38353
|
if (rings.getRingSize_0(r) == 6) {
|
|
38344
38354
|
for (a$array = rings.getRingAtoms_0(r) , a$index = 0 , a$max = a$array.length; a$index < a$max; ++a$index) {
|
|
38345
38355
|
a = a$array[a$index];
|
|
38346
|
-
if (mol.getOccupiedValence_0(a) + mol.
|
|
38356
|
+
if (mol.getOccupiedValence_0(a) + mol.getImplicitHydrogens_1(a) != carcfmt2.degree(mol, a) + 1)
|
|
38347
38357
|
return carcfm.$clinit_RingBoolean() , carcfm.FALSE;
|
|
38348
38358
|
}
|
|
38349
38359
|
for (b$array = rings.getRingBonds_0(r) , b$index = 0 , b$max = b$array.length; b$index < b$max; ++b$index) {
|
|
@@ -38375,11 +38385,11 @@ carcfmt2.ringIsMMFFAromatic_0 = function ringIsMMFFAromatic_0(mol, r){
|
|
|
38375
38385
|
passes = 1;
|
|
38376
38386
|
for (a$array = rings.getRingAtoms_0(r) , a$index = 0 , a$max = a$array.length; a$index < a$max; ++a$index) {
|
|
38377
38387
|
a = a$array[a$index];
|
|
38378
|
-
if (mol.getOccupiedValence_0(a) + mol.
|
|
38388
|
+
if (mol.getOccupiedValence_0(a) + mol.getImplicitHydrogens_1(a) == carcfmt2.degree(mol, a) && passes > 0) {
|
|
38379
38389
|
passes--;
|
|
38380
38390
|
continue;
|
|
38381
38391
|
}
|
|
38382
|
-
if (mol.getOccupiedValence_0(a) + mol.
|
|
38392
|
+
if (mol.getOccupiedValence_0(a) + mol.getImplicitHydrogens_1(a) != carcfmt2.degree(mol, a) + 1) {
|
|
38383
38393
|
return carcfm.$clinit_RingBoolean() , carcfm.FALSE;
|
|
38384
38394
|
}
|
|
38385
38395
|
}
|
|
@@ -38427,7 +38437,7 @@ carcfmt2.$clinit_Charge_0 = function $clinit_Charge_0(){
|
|
|
38427
38437
|
}
|
|
38428
38438
|
;
|
|
38429
38439
|
carcfmt2.degree_0 = function degree_0(mol, atom){
|
|
38430
|
-
return mol.getAllConnAtoms_0(atom) + mol.
|
|
38440
|
+
return mol.getAllConnAtoms_0(atom) + mol.getImplicitHydrogens_1(atom);
|
|
38431
38441
|
}
|
|
38432
38442
|
;
|
|
38433
38443
|
carcfmt2.getCharges = function getCharges(table, mol){
|
|
@@ -43621,6 +43631,8 @@ _.build_0 = function build_0(mol, bond){
|
|
|
43621
43631
|
this.mComboBoxRingSize.addItem_0('is in 5-membered ring');
|
|
43622
43632
|
this.mComboBoxRingSize.addItem_0('is in 6-membered ring');
|
|
43623
43633
|
this.mComboBoxRingSize.addItem_0('is in 7-membered ring');
|
|
43634
|
+
this.mComboBoxRingSize.addItem_0('smallest ring 8 to 11');
|
|
43635
|
+
this.mComboBoxRingSize.addItem_0('smallest ring >= 12');
|
|
43624
43636
|
this.mDialog.add_9(this.mComboBoxRingSize, 1, 13, 3, 13);
|
|
43625
43637
|
this.mCBMatchFormalOrder = this.mDialog.createCheckBox_0('Match formal bond order');
|
|
43626
43638
|
this.mCBMatchFormalOrder.setSelected_0((mol.getBondQueryFeatures_0(bond) & 8388608) != 0);
|
|
@@ -43746,7 +43758,7 @@ _.setInitialStates_0 = function setInitialStates_0(){
|
|
|
43746
43758
|
else
|
|
43747
43759
|
this.mComboBoxRing.setSelectedIndex_0(0);
|
|
43748
43760
|
ringSize = (queryFeatures & 917504) >> 17;
|
|
43749
|
-
this.mComboBoxRingSize.setSelectedIndex_0(ringSize == 0?0:ringSize - 2);
|
|
43761
|
+
this.mComboBoxRingSize.setSelectedIndex_0(ringSize == 0?0:ringSize <= 2?ringSize + 5:ringSize - 2);
|
|
43750
43762
|
if ((queryFeatures & 130560) != 0) {
|
|
43751
43763
|
this.mCBIsBridge.setSelected_0(true);
|
|
43752
43764
|
minAtoms = (queryFeatures & 7680) >> 9;
|
|
@@ -43846,9 +43858,12 @@ _.setQueryFeatures_2 = function setQueryFeatures_2(bond){
|
|
|
43846
43858
|
}
|
|
43847
43859
|
if (this.mComboBoxRingSize.getSelectedIndex_0() != 0) {
|
|
43848
43860
|
ringSize = this.mComboBoxRingSize.getSelectedIndex_0() + 2;
|
|
43861
|
+
if (ringSize > 7)
|
|
43862
|
+
ringSize -= 7;
|
|
43849
43863
|
implicitSize = this.mMol.getBondRingSize_0(bond);
|
|
43850
|
-
if (ringSize != implicitSize)
|
|
43864
|
+
if (ringSize <= 2 || ringSize != implicitSize) {
|
|
43851
43865
|
queryFeatures |= ringSize << 17;
|
|
43866
|
+
}
|
|
43852
43867
|
}
|
|
43853
43868
|
}
|
|
43854
43869
|
this.mMol.setBondQueryFeature_0(bond, 16777215, false);
|
|
@@ -44989,7 +45004,7 @@ _.eventHappened_2 = function eventHappened_7(e){
|
|
|
44989
45004
|
}
|
|
44990
45005
|
;
|
|
44991
45006
|
_.eventHappened_3 = function eventHappened_8(e){
|
|
44992
|
-
var angleChange, atom,
|
|
45007
|
+
var angleChange, atom, drawingObject, drawingObject$iterator, i, i0, i1, isSelected, magnification, object, repaintNeeded, selectedAtomsFound, selectedObjectsFound, selectedOnly, selectedShape, x_0, y_0;
|
|
44993
45008
|
if (e.getWhat() == 1) {
|
|
44994
45009
|
if (this.mCurrentHiliteAtom != -1 && this.mAtomKeyStrokeBuffer.length_0() != 0)
|
|
44995
45010
|
this.expandAtomKeyStrokes(this.mAtomKeyStrokeBuffer.toString_0());
|
|
@@ -45046,79 +45061,8 @@ _.eventHappened_3 = function eventHappened_8(e){
|
|
|
45046
45061
|
repaintNeeded = this.trackHiliting(this.mX2, this.mY2, true);
|
|
45047
45062
|
switch (this.mPendingRequest) {
|
|
45048
45063
|
case 2:
|
|
45049
|
-
if (this.
|
|
45050
|
-
lastX = this.mChainAtomX[this.mChainAtoms - 1];
|
|
45051
|
-
lastY = this.mChainAtomY[this.mChainAtoms - 1];
|
|
45052
|
-
}
|
|
45053
|
-
else {
|
|
45054
|
-
lastX = 0;
|
|
45055
|
-
lastY = 0;
|
|
45056
|
-
}
|
|
45057
|
-
|
|
45058
|
-
avbl = this.getScaledAVBL();
|
|
45059
|
-
s0 = round_int(avbl);
|
|
45060
|
-
s1 = round_int(0.866 * avbl);
|
|
45061
|
-
s2 = round_int(0.5 * avbl);
|
|
45062
|
-
dx = this.mX2 - this.mX1;
|
|
45063
|
-
dy = this.mY2 - this.mY1;
|
|
45064
|
-
if ($wnd.Math.abs(dy) > $wnd.Math.abs(dx)) {
|
|
45065
|
-
this.mChainAtoms = round_int(2 * $wnd.Math.abs(dy) / (s0 + s2));
|
|
45066
|
-
if ($wnd.Math.abs(dy) % (s0 + s2) > s0) {
|
|
45067
|
-
this.mChainAtoms++;
|
|
45068
|
-
}
|
|
45069
|
-
this.mChainAtomX = initUnidimensionalArray(cggl.D_classLit, {12:1, 4:1, 1:1}, 5, this.mChainAtoms, 15, 1);
|
|
45070
|
-
this.mChainAtomY = initUnidimensionalArray(cggl.D_classLit, {12:1, 4:1, 1:1}, 5, this.mChainAtoms, 15, 1);
|
|
45071
|
-
if (this.mX2 < this.mX1) {
|
|
45072
|
-
s1 = -s1;
|
|
45073
|
-
}
|
|
45074
|
-
if (this.mY2 < this.mY1) {
|
|
45075
|
-
s0 = -s0;
|
|
45076
|
-
s2 = -s2;
|
|
45077
|
-
}
|
|
45078
|
-
for (i0 = 0; i0 < this.mChainAtoms; i0++) {
|
|
45079
|
-
this.mChainAtomX[i0] = this.mX1 + 0.5 * (i0 + 1) * s1;
|
|
45080
|
-
this.mChainAtomY[i0] = this.mY1 + 0.5 * (i0 + 1) * (s0 + s2);
|
|
45081
|
-
if ((i0 & 1) == 0) {
|
|
45082
|
-
this.mChainAtomY[i0] += s0;
|
|
45083
|
-
}
|
|
45084
|
-
}
|
|
45085
|
-
}
|
|
45086
|
-
else {
|
|
45087
|
-
this.mChainAtoms = round_int($wnd.Math.abs(dx) / s1);
|
|
45088
|
-
this.mChainAtomX = initUnidimensionalArray(cggl.D_classLit, {12:1, 4:1, 1:1}, 5, this.mChainAtoms, 15, 1);
|
|
45089
|
-
this.mChainAtomY = initUnidimensionalArray(cggl.D_classLit, {12:1, 4:1, 1:1}, 5, this.mChainAtoms, 15, 1);
|
|
45090
|
-
if (this.mX2 < this.mX1) {
|
|
45091
|
-
s1 = -s1;
|
|
45092
|
-
}
|
|
45093
|
-
if (this.mY2 < this.mY1) {
|
|
45094
|
-
s2 = -s2;
|
|
45095
|
-
}
|
|
45096
|
-
for (i0 = 0; i0 < this.mChainAtoms; i0++) {
|
|
45097
|
-
this.mChainAtomX[i0] = this.mX1 + (i0 + 1) * s1;
|
|
45098
|
-
this.mChainAtomY[i0] = this.mY1;
|
|
45099
|
-
if ((i0 & 1) == 0) {
|
|
45100
|
-
this.mChainAtomY[i0] += s2;
|
|
45101
|
-
}
|
|
45102
|
-
}
|
|
45103
|
-
}
|
|
45104
|
-
|
|
45105
|
-
if (this.mChainAtoms > 0) {
|
|
45106
|
-
this.mChainAtom = initUnidimensionalArray(cggl.I_classLit, {6:1, 4:1, 1:1}, 5, this.mChainAtoms, 15, 1);
|
|
45107
|
-
for (i0 = 0; i0 < this.mChainAtoms; i0++) {
|
|
45108
|
-
this.mChainAtom[i0] = this.mMol.findAtom_0(this.mChainAtomX[i0], this.mChainAtomY[i0]);
|
|
45109
|
-
if (this.mChainAtom[i0] != -1) {
|
|
45110
|
-
this.mChainAtomX[i0] = this.mMol.getAtomX_0(this.mChainAtom[i0]);
|
|
45111
|
-
this.mChainAtomY[i0] = this.mMol.getAtomY_0(this.mChainAtom[i0]);
|
|
45112
|
-
}
|
|
45113
|
-
}
|
|
45114
|
-
if (this.mChainAtomX[this.mChainAtoms - 1] != lastX || this.mChainAtomY[this.mChainAtoms - 1] != lastY) {
|
|
45115
|
-
repaintNeeded = true;
|
|
45116
|
-
}
|
|
45117
|
-
}
|
|
45118
|
-
else if (lastX != 0 || lastY != 0) {
|
|
45064
|
+
if (this.suggestNewChain())
|
|
45119
45065
|
repaintNeeded = true;
|
|
45120
|
-
}
|
|
45121
|
-
|
|
45122
45066
|
break;
|
|
45123
45067
|
case 1:
|
|
45124
45068
|
if ((this.mX2 - this.mX1) * (this.mX2 - this.mX1) + (this.mY2 - this.mY1) * (this.mY2 - this.mY1) < 100) {
|
|
@@ -45150,10 +45094,10 @@ _.eventHappened_3 = function eventHappened_8(e){
|
|
|
45150
45094
|
}
|
|
45151
45095
|
}
|
|
45152
45096
|
|
|
45153
|
-
for (
|
|
45154
|
-
if (this.mMol.isSelectedAtom_0(
|
|
45155
|
-
this.mMol.setAtomX_0(
|
|
45156
|
-
this.mMol.setAtomY_0(
|
|
45097
|
+
for (i0 = 0; i0 < this.mMol.getAllAtoms_0(); i0++) {
|
|
45098
|
+
if (this.mMol.isSelectedAtom_0(i0)) {
|
|
45099
|
+
this.mMol.setAtomX_0(i0, this.mX[i0] + this.mX2 - this.mX1);
|
|
45100
|
+
this.mMol.setAtomY_0(i0, this.mY[i0] + this.mY2 - this.mY1);
|
|
45157
45101
|
}
|
|
45158
45102
|
}
|
|
45159
45103
|
|
|
@@ -45174,8 +45118,8 @@ _.eventHappened_3 = function eventHappened_8(e){
|
|
|
45174
45118
|
|
|
45175
45119
|
selectedObjectsFound = false;
|
|
45176
45120
|
if (isNotNull(this.mDrawingObjectList)) {
|
|
45177
|
-
for (
|
|
45178
|
-
selectedObjectsFound = castTo(this.mDrawingObjectList.getAtIndex(
|
|
45121
|
+
for (i1 = 0; i1 < this.mDrawingObjectList.size() && !selectedObjectsFound; i1++) {
|
|
45122
|
+
selectedObjectsFound = castTo(this.mDrawingObjectList.getAtIndex(i1), 47).isSelected_0();
|
|
45179
45123
|
}
|
|
45180
45124
|
}
|
|
45181
45125
|
|
|
@@ -45183,9 +45127,9 @@ _.eventHappened_3 = function eventHappened_8(e){
|
|
|
45183
45127
|
angleChange = $wnd.Math.abs(this.mX2 - this.mX1) < 20?0:(this.mX2 - this.mX1) / 50;
|
|
45184
45128
|
selectedOnly = selectedAtomsFound || selectedObjectsFound;
|
|
45185
45129
|
if (isNotNull(this.mDrawingObjectList) && (!selectedOnly || selectedObjectsFound)) {
|
|
45186
|
-
for (
|
|
45187
|
-
if (!selectedOnly || castTo(this.mDrawingObjectList.getAtIndex(
|
|
45188
|
-
castTo(this.mDrawingObjectList.getAtIndex(
|
|
45130
|
+
for (i1 = 0; i1 < this.mDrawingObjectList.size(); i1++) {
|
|
45131
|
+
if (!selectedOnly || castTo(this.mDrawingObjectList.getAtIndex(i1), 47).isSelected_0()) {
|
|
45132
|
+
castTo(this.mDrawingObjectList.getAtIndex(i1), 47).zoomAndRotate_0(magnification, angleChange);
|
|
45189
45133
|
}
|
|
45190
45134
|
}
|
|
45191
45135
|
this.update(2);
|
|
@@ -45213,10 +45157,10 @@ _.eventHappened_3 = function eventHappened_8(e){
|
|
|
45213
45157
|
}
|
|
45214
45158
|
|
|
45215
45159
|
if (isNotNull(this.mDrawingObjectList)) {
|
|
45216
|
-
for (
|
|
45217
|
-
object = castTo(this.mDrawingObjectList.getAtIndex(
|
|
45160
|
+
for (i1 = 0; i1 < this.mDrawingObjectList.size(); i1++) {
|
|
45161
|
+
object = castTo(this.mDrawingObjectList.getAtIndex(i1), 47);
|
|
45218
45162
|
isSelected = object.isSurroundedBy(selectedShape);
|
|
45219
|
-
if ((!this.mIsAddingToSelection || !this.mIsSelectedObject[
|
|
45163
|
+
if ((!this.mIsAddingToSelection || !this.mIsSelectedObject[i1]) && isSelected != object.isSelected_0()) {
|
|
45220
45164
|
object.setSelected_0(isSelected);
|
|
45221
45165
|
this.mUpdateMode = $wnd.Math.max(this.mUpdateMode, 1);
|
|
45222
45166
|
}
|
|
@@ -46720,6 +46664,81 @@ _.storeState = function storeState(){
|
|
|
46720
46664
|
this.mUndoDrawingObjectList = isNull(this.mDrawingObjectList)?null:new carc2.DrawingObjectList_0(this.mDrawingObjectList);
|
|
46721
46665
|
}
|
|
46722
46666
|
;
|
|
46667
|
+
_.suggestNewChain = function suggestNewChain(){
|
|
46668
|
+
var avbl, bondAngle, candidate1, candidate2, connAngle, dx, dy, exitAngle, i, i0, lastChainAtoms, lastX1, lastX2, lastY1, lastY2, leftAngle, mdx, mdy, mouseAngle, nextAngle;
|
|
46669
|
+
mouseAngle = carc2.getAngle_0(this.mX1, this.mY1, this.mX2, this.mY2);
|
|
46670
|
+
mdx = this.mX2 - this.mX1;
|
|
46671
|
+
mdy = this.mY2 - this.mY1;
|
|
46672
|
+
lastChainAtoms = this.mChainAtoms;
|
|
46673
|
+
lastX1 = 0;
|
|
46674
|
+
lastY1 = 0;
|
|
46675
|
+
lastX2 = 0;
|
|
46676
|
+
lastY2 = 0;
|
|
46677
|
+
if (lastChainAtoms > 0) {
|
|
46678
|
+
lastX1 = toInt_0(jl.round_1(this.mChainAtomX[0]));
|
|
46679
|
+
lastY1 = toInt_0(jl.round_1(this.mChainAtomY[0]));
|
|
46680
|
+
}
|
|
46681
|
+
if (lastChainAtoms > 1) {
|
|
46682
|
+
lastX2 = toInt_0(jl.round_1(this.mChainAtomX[1]));
|
|
46683
|
+
lastY2 = toInt_0(jl.round_1(this.mChainAtomY[1]));
|
|
46684
|
+
}
|
|
46685
|
+
exitAngle = 0;
|
|
46686
|
+
if (this.mAtom1 == -1 || this.mMol.getAllConnAtomsPlusMetalBonds_0(this.mAtom1) == 0) {
|
|
46687
|
+
exitAngle = 3.141592653589793 / 3 * toDouble_0(jl.round_1(mouseAngle * 3 / 3.141592653589793));
|
|
46688
|
+
}
|
|
46689
|
+
else if (this.mMol.getAllConnAtomsPlusMetalBonds_0(this.mAtom1) == 1) {
|
|
46690
|
+
bondAngle = this.mMol.getBondAngle_0(this.mMol.getConnAtom_0(this.mAtom1, 0), this.mAtom1);
|
|
46691
|
+
candidate1 = bondAngle - 3.141592653589793 / 3;
|
|
46692
|
+
candidate2 = bondAngle + 3.141592653589793 / 3;
|
|
46693
|
+
exitAngle = $wnd.Math.abs(carc2.getAngleDif(mouseAngle, candidate1)) < $wnd.Math.abs(carc2.getAngleDif(mouseAngle, candidate2))?candidate1:candidate2;
|
|
46694
|
+
}
|
|
46695
|
+
else {
|
|
46696
|
+
connAngle = initUnidimensionalArray(cggl.D_classLit, {12:1, 4:1, 1:1}, 5, this.mMol.getAllConnAtomsPlusMetalBonds_0(this.mAtom1), 15, 1);
|
|
46697
|
+
for (i0 = 0; i0 < this.mMol.getAllConnAtomsPlusMetalBonds_0(this.mAtom1); i0++)
|
|
46698
|
+
connAngle[i0] = this.mMol.getBondAngle_0(this.mAtom1, this.mMol.getConnAtom_0(this.mAtom1, i0));
|
|
46699
|
+
ju.sort_2(connAngle);
|
|
46700
|
+
for (i = 0; i < connAngle.length; i++) {
|
|
46701
|
+
leftAngle = i == 0?connAngle[connAngle.length - 1] - 2 * 3.141592653589793:connAngle[i - 1];
|
|
46702
|
+
if (leftAngle < mouseAngle && mouseAngle < connAngle[i]) {
|
|
46703
|
+
exitAngle = (connAngle[i] + leftAngle) / 2;
|
|
46704
|
+
break;
|
|
46705
|
+
}
|
|
46706
|
+
if (leftAngle < mouseAngle - 2 * 3.141592653589793 && mouseAngle - 2 * 3.141592653589793 < connAngle[i]) {
|
|
46707
|
+
exitAngle = (connAngle[i] + leftAngle) / 2;
|
|
46708
|
+
break;
|
|
46709
|
+
}
|
|
46710
|
+
}
|
|
46711
|
+
}
|
|
46712
|
+
avbl = this.getScaledAVBL();
|
|
46713
|
+
this.mChainAtoms = $wnd.Math.abs(carc2.getAngleDif(mouseAngle, exitAngle)) > 3.141592653589793 / 3?0:round_int($wnd.Math.sqrt(mdx * mdx + mdy * mdy) / avbl);
|
|
46714
|
+
if (this.mChainAtoms > 0) {
|
|
46715
|
+
if (jsEquals(this.mChainAtomX, null) || this.mChainAtomX.length < this.mChainAtoms) {
|
|
46716
|
+
this.mChainAtomX = initUnidimensionalArray(cggl.D_classLit, {12:1, 4:1, 1:1}, 5, this.mChainAtoms, 15, 1);
|
|
46717
|
+
this.mChainAtomY = initUnidimensionalArray(cggl.D_classLit, {12:1, 4:1, 1:1}, 5, this.mChainAtoms, 15, 1);
|
|
46718
|
+
}
|
|
46719
|
+
dx = initUnidimensionalArray(cggl.D_classLit, {12:1, 4:1, 1:1}, 5, 2, 15, 1);
|
|
46720
|
+
dy = initUnidimensionalArray(cggl.D_classLit, {12:1, 4:1, 1:1}, 5, 2, 15, 1);
|
|
46721
|
+
nextAngle = carc2.getAngleDif(mouseAngle, exitAngle) < 0?exitAngle - 3.141592653589793 / 3:exitAngle + 3.141592653589793 / 3;
|
|
46722
|
+
dx[0] = avbl * $wnd.Math.sin(exitAngle);
|
|
46723
|
+
dy[0] = avbl * $wnd.Math.cos(exitAngle);
|
|
46724
|
+
dx[1] = avbl * $wnd.Math.sin(nextAngle);
|
|
46725
|
+
dy[1] = avbl * $wnd.Math.cos(nextAngle);
|
|
46726
|
+
for (i0 = 0; i0 < this.mChainAtoms; i0++) {
|
|
46727
|
+
this.mChainAtomX[i0] = (i0 == 0?this.mX1:this.mChainAtomX[i0 - 1]) + dx[i0 & 1];
|
|
46728
|
+
this.mChainAtomY[i0] = (i0 == 0?this.mY1:this.mChainAtomY[i0 - 1]) + dy[i0 & 1];
|
|
46729
|
+
}
|
|
46730
|
+
this.mChainAtom = initUnidimensionalArray(cggl.I_classLit, {6:1, 4:1, 1:1}, 5, this.mChainAtoms, 15, 1);
|
|
46731
|
+
for (i = 0; i < this.mChainAtoms; i++) {
|
|
46732
|
+
this.mChainAtom[i] = this.mMol.findAtom_0(this.mChainAtomX[i], this.mChainAtomY[i]);
|
|
46733
|
+
if (this.mChainAtom[i] != -1) {
|
|
46734
|
+
this.mChainAtomX[i] = this.mMol.getAtomX_0(this.mChainAtom[i]);
|
|
46735
|
+
this.mChainAtomY[i] = this.mMol.getAtomY_0(this.mChainAtom[i]);
|
|
46736
|
+
}
|
|
46737
|
+
}
|
|
46738
|
+
}
|
|
46739
|
+
return lastChainAtoms != this.mChainAtoms || this.mChainAtoms != 0 && (lastX1 != toInt_0(jl.round_1(this.mChainAtomX[0])) || lastY1 != toInt_0(jl.round_1(this.mChainAtomY[0]))) || this.mChainAtoms > 1 && (lastX2 != toInt_0(jl.round_1(this.mChainAtomX[1])) || lastY2 != toInt_0(jl.round_1(this.mChainAtomY[1])));
|
|
46740
|
+
}
|
|
46741
|
+
;
|
|
46723
46742
|
_.suggestNewX2AndY2 = function suggestNewX2AndY2(atom){
|
|
46724
46743
|
var angle, angleDiff, avbl, i, i0, i1, j, largestDiff, largestNo, newAngle, temp;
|
|
46725
46744
|
newAngle = 3.141592653589793 * 2 / 3;
|
|
@@ -59616,8 +59635,8 @@ _.getImplicitHigherValence = function getImplicitHigherValence_0(atom, neglectEx
|
|
|
59616
59635
|
return this.oclMolecule.getImplicitHigherValence_0(atom, neglectExplicitHydrogen);
|
|
59617
59636
|
}
|
|
59618
59637
|
;
|
|
59619
|
-
_.getImplicitHydrogens = function
|
|
59620
|
-
return this.oclMolecule.
|
|
59638
|
+
_.getImplicitHydrogens = function getImplicitHydrogens_1(atom){
|
|
59639
|
+
return this.oclMolecule.getImplicitHydrogens_1(atom);
|
|
59621
59640
|
}
|
|
59622
59641
|
;
|
|
59623
59642
|
_.getIndex = function getIndex(){
|
|
@@ -94375,7 +94394,7 @@ ooccg.addHydrogenAtoms = function addHydrogenAtoms(mol){
|
|
|
94375
94394
|
mol.ensureHelperArrays_0(1);
|
|
94376
94395
|
implicitHydrogen = initUnidimensionalArray(cggl.I_classLit, {6:1, 4:1, 1:1}, 5, mol.getAtoms_0(), 15, 1);
|
|
94377
94396
|
for (atom0 = 0; atom0 < mol.getAtoms_0(); atom0++)
|
|
94378
|
-
implicitHydrogen[atom0] = mol.
|
|
94397
|
+
implicitHydrogen[atom0] = mol.getImplicitHydrogens_1(atom0);
|
|
94379
94398
|
hydrogenBondLength = 0.8 * mol.getAverageBondLength_0();
|
|
94380
94399
|
for (atom1 = 0; atom1 < implicitHydrogen.length; atom1++)
|
|
94381
94400
|
if (implicitHydrogen[atom1] != 0)
|
|
@@ -99723,7 +99742,7 @@ $gwt && $gwt.permProps && __gwtModuleFunction.__moduleStartupDone($gwt.permProps
|
|
|
99723
99742
|
|
|
99724
99743
|
var toReturn = $wnd["OCL"];
|
|
99725
99744
|
|
|
99726
|
-
toReturn.version = '8.
|
|
99745
|
+
toReturn.version = '8.17.0';
|
|
99727
99746
|
|
|
99728
99747
|
return toReturn;
|
|
99729
99748
|
}
|