Skip to content

Commit

Permalink
feat: update OCL to v2024.1.1 (#186)
Browse files Browse the repository at this point in the history
  • Loading branch information
targos authored Jan 19, 2024
1 parent 4002461 commit 3e8ac2e
Show file tree
Hide file tree
Showing 56 changed files with 2,595 additions and 430 deletions.
60 changes: 30 additions & 30 deletions __tests__/__snapshots__/conformers.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,21 @@ exports[`ConformerGenerator should generate conformers 1`] = `
Actelion Java MolfileCreator 1.0
15 14 0 0 0 0 0 0 0 0999 V2000
-4.5770 2.5000 -2.1185 C 0 0 0 0 0 0 0 0 0 0 0 0
-3.9333 3.2322 -3.4776 O 0 0 0 0 0 0 0 0 0 0 0 0
-2.8935 2.1799 -4.2575 C 0 0 0 0 0 0 0 0 0 0 0 0
-1.2507 2.2660 -3.4812 C 0 0 0 0 0 0 0 0 0 0 0 0
-1.3324 1.6314 -1.9352 O 0 0 0 0 0 0 0 0 0 0 0 0
-1.4253 -0.0302 -2.0151 N 0 0 0 0 0 0 0 0 0 0 0 0
-5.2007 1.5768 -2.4320 H 0 0 0 0 0 0 0 0 0 0 0 0
-3.7235 2.1678 -1.4110 H 0 0 0 0 0 0 0 0 0 0 0 0
-5.2609 3.2524 -1.5646 H 0 0 0 0 0 0 0 0 0 0 0 0
-2.8052 2.4732 -5.3736 H 0 0 0 0 0 0 0 0 0 0 0 0
-3.3008 1.1001 -4.1756 H 0 0 0 0 0 0 0 0 0 0 0 0
-0.9084 3.3711 -3.4304 H 0 0 0 0 0 0 0 0 0 0 0 0
-0.4952 1.6598 -4.1123 H 0 0 0 0 0 0 0 0 0 0 0 0
-1.7255 -0.4000 -1.1042 H 0 0 0 0 0 0 0 0 0 0 0 0
-0.5034 -0.4157 -2.2514 H 0 0 0 0 0 0 0 0 0 0 0 0
1.6038 1.1775 -1.7436 C 0 0 0 0 0 0 0 0 0 0 0 0
2.6164 -0.1245 -1.4739 O 0 0 0 0 0 0 0 0 0 0 0 0
1.7449 -1.4436 -0.9286 C 0 0 0 0 0 0 0 0 0 0 0 0
1.5103 -1.3101 0.8709 C 0 0 0 0 0 0 0 0 0 0 0 0
0.4916 -0.0258 1.2038 O 0 0 0 0 0 0 0 0 0 0 0 0
-1.0764 -0.4433 0.8311 N 0 0 0 0 0 0 0 0 0 0 0 0
0.8502 0.9124 -2.5818 H 0 0 0 0 0 0 0 0 0 0 0 0
2.2308 2.0933 -2.0679 H 0 0 0 0 0 0 0 0 0 0 0 0
1.0263 1.4325 -0.7736 H 0 0 0 0 0 0 0 0 0 0 0 0
2.3222 -2.4184 -1.1672 H 0 0 0 0 0 0 0 0 0 0 0 0
0.7122 -1.4701 -1.4491 H 0 0 0 0 0 0 0 0 0 0 0 0
2.5348 -1.1378 1.3795 H 0 0 0 0 0 0 0 0 0 0 0 0
1.0432 -2.2915 1.2686 H 0 0 0 0 0 0 0 0 0 0 0 0
-1.6645 0.3987 0.8315 H 0 0 0 0 0 0 0 0 0 0 0 0
-1.4292 -1.1042 1.5348 H 0 0 0 0 0 0 0 0 0 0 0 0
1 2 1 0 0 0 0
2 3 1 0 0 0 0
3 4 1 0 0 0 0
Expand All @@ -43,21 +43,21 @@ exports[`ConformerGenerator should generate conformers 2`] = `
Actelion Java MolfileCreator 1.0
15 14 0 0 0 0 0 0 0 0999 V2000
-5.4499 3.1652 -4.1799 C 0 0 0 0 0 0 0 0 0 0 0 0
-3.9333 3.2322 -3.4776 O 0 0 0 0 0 0 0 0 0 0 0 0
-2.8935 2.1799 -4.2575 C 0 0 0 0 0 0 0 0 0 0 0 0
-1.2507 2.2660 -3.4812 C 0 0 0 0 0 0 0 0 0 0 0 0
-0.5676 3.7618 -3.7899 O 0 0 0 0 0 0 0 0 0 0 0 0
0.9379 3.8478 -3.0815 N 0 0 0 0 0 0 0 0 0 0 0 0
-5.3836 3.5091 -5.2830 H 0 0 0 0 0 0 0 0 0 0 0 0
-5.8544 2.0819 -4.1363 H 0 0 0 0 0 0 0 0 0 0 0 0
-6.1706 3.8654 -3.6045 H 0 0 0 0 0 0 0 0 0 0 0 0
-2.8052 2.4732 -5.3736 H 0 0 0 0 0 0 0 0 0 0 0 0
-3.3008 1.1001 -4.1756 H 0 0 0 0 0 0 0 0 0 0 0 0
-0.5761 1.4326 -3.9186 H 0 0 0 0 0 0 0 0 0 0 0 0
-1.3564 2.1134 -2.3401 H 0 0 0 0 0 0 0 0 0 0 0 0
1.2462 4.8280 -3.0515 H 0 0 0 0 0 0 0 0 0 0 0 0
1.6088 3.2972 -3.6302 H 0 0 0 0 0 0 0 0 0 0 0 0
2.8495 -0.2172 -3.1263 C 0 0 0 0 0 0 0 0 0 0 0 0
2.6164 -0.1245 -1.4739 O 0 0 0 0 0 0 0 0 0 0 0 0
1.7449 -1.4436 -0.9286 C 0 0 0 0 0 0 0 0 0 0 0 0
1.5103 -1.3101 0.8709 C 0 0 0 0 0 0 0 0 0 0 0 0
2.9853 -1.4939 1.6379 O 0 0 0 0 0 0 0 0 0 0 0 0
2.7789 -1.3729 3.2856 N 0 0 0 0 0 0 0 0 0 0 0 0
3.4828 -1.1545 -3.3742 H 0 0 0 0 0 0 0 0 0 0 0 0
3.4061 0.7284 -3.4912 H 0 0 0 0 0 0 0 0 0 0 0 0
1.8269 -0.2910 -3.6630 H 0 0 0 0 0 0 0 0 0 0 0 0
2.3222 -2.4184 -1.1672 H 0 0 0 0 0 0 0 0 0 0 0 0
0.7122 -1.4701 -1.4491 H 0 0 0 0 0 0 0 0 0 0 0 0
0.7806 -2.1350 1.2247 H 0 0 0 0 0 0 0 0 0 0 0 0
1.0672 -0.2707 1.1218 H 0 0 0 0 0 0 0 0 0 0 0 0
3.6949 -1.2726 3.7391 H 0 0 0 0 0 0 0 0 0 0 0 0
2.3186 -2.2231 3.6343 H 0 0 0 0 0 0 0 0 0 0 0 0
1 2 1 0 0 0 0
2 3 1 0 0 0 0
3 4 1 0 0 0 0
Expand Down
30 changes: 15 additions & 15 deletions __tests__/__snapshots__/force-field-mmff94.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,21 @@ exports[`ForceFieldMMFF94 should generate force field 1`] = `
Actelion Java MolfileCreator 1.0
15 14 0 0 0 0 0 0 0 0999 V2000
-4.3423 2.6153 -2.3397 C 0 0 0 0 0 0 0 0 0 0 0 0
-3.8783 2.9630 -3.6364 O 0 0 0 0 0 0 0 0 0 0 0 0
-2.8566 2.0874 -4.1292 C 0 0 0 0 0 0 0 0 0 0 0 0
-1.4746 2.4010 -3.5536 C 0 0 0 0 0 0 0 0 0 0 0 0
-1.0233 3.6899 -3.9928 O 0 0 0 0 0 0 0 0 0 0 0 0
-0.2808 3.5370 -5.2408 N 0 0 0 0 0 0 0 0 0 0 0 0
-4.7361 1.5945 -2.3324 H 0 0 0 0 0 0 0 0 0 0 0 0
-3.5480 2.7187 -1.5962 H 0 0 0 0 0 0 0 0 0 0 0 0
-5.1522 3.2997 -2.0724 H 0 0 0 0 0 0 0 0 0 0 0 0
-2.8395 2.2197 -5.2160 H 0 0 0 0 0 0 0 0 0 0 0 0
-3.1330 1.0464 -3.9263 H 0 0 0 0 0 0 0 0 0 0 0 0
-0.7528 1.6241 -3.8346 H 0 0 0 0 0 0 0 0 0 0 0 0
-1.5055 2.4375 -2.4612 H 0 0 0 0 0 0 0 0 0 0 0 0
0.5834 4.0318 -5.0129 H 0 0 0 0 0 0 0 0 0 0 0 0
-0.8047 4.1683 -5.8509 H 0 0 0 0 0 0 0 0 0 0 0 0
1.7685 0.9053 -1.5976 C 0 0 0 0 0 0 0 0 0 0 0 0
2.4013 -0.3647 -1.5301 O 0 0 0 0 0 0 0 0 0 0 0 0
1.6128 -1.3588 -0.8641 C 0 0 0 0 0 0 0 0 0 0 0 0
1.6782 -1.2484 0.6601 C 0 0 0 0 0 0 0 0 0 0 0 0
3.0034 -1.5294 1.1322 O 0 0 0 0 0 0 0 0 0 0 0 0
3.1221 -2.9596 1.4011 N 0 0 0 0 0 0 0 0 0 0 0 0
0.8075 0.8298 -2.1152 H 0 0 0 0 0 0 0 0 0 0 0 0
2.4153 1.5787 -2.1667 H 0 0 0 0 0 0 0 0 0 0 0 0
1.6276 1.3287 -0.5999 H 0 0 0 0 0 0 0 0 0 0 0 0
2.0142 -2.3277 -1.1788 H 0 0 0 0 0 0 0 0 0 0 0 0
0.5751 -1.3011 -1.2119 H 0 0 0 0 0 0 0 0 0 0 0 0
0.9515 -1.9235 1.1286 H 0 0 0 0 0 0 0 0 0 0 0 0
1.4393 -0.2333 0.9888 H 0 0 0 0 0 0 0 0 0 0 0 0
3.4846 -2.9468 2.3562 H 0 0 0 0 0 0 0 0 0 0 0 0
3.9205 -3.1978 0.8087 H 0 0 0 0 0 0 0 0 0 0 0 0
1 2 1 0 0 0 0
2 3 1 0 0 0 0
3 4 1 0 0 0 0
Expand Down
1 change: 1 addition & 0 deletions __tests__/__snapshots__/library.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -650,6 +650,7 @@ exports[`static properties of Molecule 1`] = `
"cESRTypeAbs",
"cESRTypeAnd",
"cESRTypeOr",
"cHelperAll",
"cHelperBitCIP",
"cHelperBitIncludeNitrogenParities",
"cHelperBitNeighbours",
Expand Down
2 changes: 1 addition & 1 deletion openchemlib
Submodule openchemlib updated 104 files
2 changes: 1 addition & 1 deletion scripts/openchemlib/classes.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ const changed = [
changeSelfOrganizedConformer,
],
['@org/openmolecules/chem/conf/gen/RigidFragmentCache', removeCacheIO],
['chem/ChemistryHelper', removePrintf],
['chem/Coordinates', removeToStringSpaceDelimited],
['chem/coords/InventorFragment', changeInventorFragment],
['chem/conf/BondLengthSet', changeBondLengthSet],
Expand All @@ -53,6 +52,7 @@ const changed = [
['chem/TextDrawingObject', changeTextDrawingObject],
['gui/editor/GenericEditorArea', changeGenericEditorArea],
['gui/editor/CustomAtomDialogBuilder', changeCustomAtomDialogBuilder],
['share/gui/ChemistryGeometryHelper', removePrintf],
['share/gui/editor/Model', removePrintf],
['util/ArrayUtils', changeArrayUtils],
['util/datamodel/IntVec', changeIntVec],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ public abstract class AbstractDepictor<T> {
private boolean[] mAtomIsConnected;
private boolean[] mAtomLabelDisplayed;
private double mpBondSpacing,mpDotDiameter,mpLineWidth,mpQFDiameter,mpBondHiliteRadius,
mFactorTextSize,mpExcludeGroupRadius,mChiralTextSize;
mFactorTextSize,mpExcludeGroupRadius,mChiralTextSize,mAtomLabelAVBL;
private int mpLabelSize,mStandardForegroundColor,mDisplayMode,mCurrentColor,mPreviousColor;
private boolean mIsValidatingView;
private ArrayList<GenericRectangle> mpTabuZone;
Expand Down Expand Up @@ -274,6 +274,19 @@ public void setTransformation(DepictorTransformation t) {
}


/**
* Per default the size of the atom label font depends on the average bond length,
* which usually is determined before a molecule is drawn.
* This method allows to override the mechanism and to define an artificial
* "average bond length" that is used instead if the real one to serve as basis
* for the scale of atom labels, double bond distance, chiral text, etc...
* @param avbl
*/
public void setAtomLabelAVBL(double avbl) {
mAtomLabelAVBL = avbl / mTransformation.getScaling();
}


/**
* Sets a multiplication factor to the text size of all labels. The default is 1.0.
* @param factor text size factor
Expand Down Expand Up @@ -403,8 +416,12 @@ public DepictorTransformation validateView(T context, GenericRectangle viewRect,
}


/**
* @param viewRect
* @param mode
* @return incremental transformation that moves/scales already transformed molecule into viewRect
*/
public DepictorTransformation simpleValidateView(GenericRectangle viewRect, int mode) {
// returns incremental transformation that moves/scales already transformed molecule into viewRect
if (mMol.getAllAtoms() == 0)
return null;

Expand Down Expand Up @@ -576,12 +593,12 @@ private void updateBondHiliteColor() {


private void calculateParameters() {
double averageBondLength = mTransformation.getScaling() * mMol.getAverageBondLength();
double averageBondLength = mTransformation.getScaling() * (mAtomLabelAVBL != 0 ? mAtomLabelAVBL : mMol.getAverageBondLength());
mpLineWidth = averageBondLength * cFactorLineWidth;
mpBondSpacing = averageBondLength * cFactorBondSpacing;
mpBondHiliteRadius = averageBondLength * cFactorBondHiliteRadius;
mpExcludeGroupRadius = averageBondLength * cFactorExcludeGroupRadius;
mpLabelSize = (int)(averageBondLength * mFactorTextSize * cFactorTextSize + 0.5);
mpLabelSize = (int)(averageBondLength * mFactorTextSize * cFactorTextSize + 0.5);
mpDotDiameter = averageBondLength * cFactorDotDiameter;
mpQFDiameter = averageBondLength * cFactorQFDiameter;
mChiralTextSize = averageBondLength * cFactorChiralTextSize + 0.5f;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2424,6 +2424,10 @@ public StereoMolecule getCanMolecule() {
}


/**
* @param includeExplicitHydrogen
* @return canonical copy of this molecule
*/
public StereoMolecule getCanMolecule(boolean includeExplicitHydrogen) {
generateGraph();

Expand Down Expand Up @@ -2467,7 +2471,7 @@ else if (mol.getBondType(bond) == Molecule.cBondTypeDown)
}

mMol.copyMoleculeProperties(mol);
mMol.invalidateHelperArrays(Molecule.cHelperBitParities);
mol.invalidateHelperArrays(Molecule.cHelperBitParities);

return mol;
}
Expand Down Expand Up @@ -3961,7 +3965,7 @@ private void cipCalcTHParity(int atom) {
|| mTHParity[atom] == Molecule.cAtomParity2)) {
boolean invertedOrder = false;

if (mMol.getAtomPi(atom) == 2) { // allene
if (mMol.getAtomPi(atom) == 2 && mMol.getConnAtoms(atom) == 2) { // allene
try {
for (int i=0; i<2; i++) {
int alleneAtom = mMol.getConnAtom(atom,i);
Expand Down Expand Up @@ -4132,7 +4136,7 @@ private boolean cipComparePriority(int rootAtom, int atom1, int atom2) throws Ex
delocalizedBondCount++;
delocalizedMeanAtomicNo += mMol.getAtomicNo(candidate);
}
else {
else if (candidate != rootAtom) { // treat double bond at rootAtom stereo center as single bond
// add pseudo atoms for double and triple bonds
for (int j=1; j<mMol.getConnBondOrder(currentAtom, i); j++) {
highest++;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -267,8 +267,10 @@ public void paintFragmentNumbers(GenericDrawContext context) {

public void paintStructures(GenericDrawContext context) {
if (mDepictor != null) {
double avbl = calculateAverageBondLength() / mTransformation.getScaling(); // this still contains individual depictor scaling
for (GenericDepictor d:mDepictor) {
d.setDisplayMode(mDisplayMode);
d.setAtomLabelAVBL(avbl);
d.paint(context);
/*
Rectangle2D.Float r = mDepictor[i].getBoundingRect();
Expand Down Expand Up @@ -310,7 +312,7 @@ public DepictorTransformation updateCoords(GenericDrawContext context, GenericRe
// returns full transformation that moves/scales original molecules/objects into viewRect
validateView(context, viewRect, mode);

if (mTransformation.isVoidTransformation()) {
if (mTransformation.isVoidTransformation()) {
return null;
}
else {
Expand Down Expand Up @@ -374,7 +376,7 @@ public DepictorTransformation validateView(GenericDrawContext context, GenericRe

if (mDepictor != null)
for (GenericDepictor d:mDepictor)
d.applyTransformation(t);
d.applyTransformation(t);

if (mCatalystDepictor != null)
for (GenericDepictor d:mCatalystDepictor)
Expand Down
Loading

0 comments on commit 3e8ac2e

Please sign in to comment.