[Git][java-team/openchemlib][master] 5 commits: Exclude mvnw.

Andrius Merkys (@merkys) gitlab at salsa.debian.org
Thu Apr 14 08:40:13 BST 2022



Andrius Merkys pushed to branch master at Debian Java Maintainers / openchemlib


Commits:
70529c83 by Andrius Merkys at 2022-04-14T02:53:42-04:00
Exclude mvnw.

- - - - -
b7b04036 by Andrius Merkys at 2022-04-14T02:54:07-04:00
New upstream version 2022.4.2+dfsg
- - - - -
bf2a7d86 by Andrius Merkys at 2022-04-14T02:54:14-04:00
Update upstream source from tag 'upstream/2022.4.2+dfsg'

Update to upstream version '2022.4.2+dfsg'
with Debian dir bc9af82ed9d624a1f9c1616a5486b482f8ac59af
- - - - -
4a0fef14 by Andrius Merkys at 2022-04-14T02:56:02-04:00
Refresh patches.

- - - - -
c520e82c by Andrius Merkys at 2022-04-14T02:56:19-04:00
Update changelog for 2022.4.2+dfsg-1 release

- - - - -


20 changed files:

- README.md
- debian/changelog
- debian/copyright
- debian/patches/javafx.patch
- debian/patches/libtablelayout-java.patch
- pom.xml
- src/main/java/com/actelion/research/chem/SmilesParser.java
- src/main/java/com/actelion/research/chem/alignment3d/PheSAAlignmentOptimizer.java
- src/main/java/com/actelion/research/chem/docking/DockingUtils.java
- + src/main/java/com/actelion/research/chem/hyperspace/SimpleCombinatorialHit.java
- + src/main/java/com/actelion/research/chem/hyperspace/SimpleSynthon.java
- src/main/java/com/actelion/research/chem/io/DWARFileParser.java
- src/main/java/com/actelion/research/chem/phesa/EvaluableOverlap.java
- src/main/java/com/actelion/research/chem/phesa/pharmacophore/PPTriangle.java
- src/main/java/com/actelion/research/chem/phesa/pharmacophore/PharmacophoreCalculator.java
- src/main/java/com/actelion/research/chem/phesa/pharmacophore/pp/PPGaussian.java
- src/main/java/com/actelion/research/chem/phesaflex/EvaluableFlexibleOverlap.java
- src/main/java/com/actelion/research/chem/reaction/Reactor.java
- src/main/java/com/actelion/research/gui/editor/AtomQueryFeatureDialogBuilder.java
- src/main/java/com/actelion/research/util/BrowserControl.java


Changes:

=====================================
README.md
=====================================
@@ -1,5 +1,4 @@
 ## OpenChemLib
-
 *OpenChemLib* is Java based framework providing cheminformatics core functionality and user interface components. Its main focus is on organics chemistry and small molecules. It is built around a StereoMolecule class, which represents a molecule using atom and bond tables, provides atom neighbours, ring and aromaticity information, and supports MDL's concept of enhanced stereo representation. Additional classes provide, 2D-depiction, descriptor calculation, molecular similarity and substructure search, reaction search, property prediction, conformer generation, support for molfile and SMILES formats, energy minimization, ligand-protein interactions, and more. *OpenChemLib's idcode* represents molecules, fragments or reactions as canonical, very compact string that includes stereo and query features.
 Different to other cheminformatics frameworks, *OpenChemLib* also provides user interface components that allow to easily embed chemical functionality into Java applications, e.g. to display or edit chemical structures or reactions.
 
@@ -7,8 +6,15 @@ Different to other cheminformatics frameworks, *OpenChemLib* also provides user
 *OpenChemLib* requires JRE 8 or newer including JavaFX. Otherwise, there are no dependencies.
 
 ### How to download the project
-
+```bash
 git clone https://github.com/Actelion/openchemlib.git
+```
+
+### Build the project
+To build the project run the following from within the project directory.
+```bash
+./mvnw package
+```
 
 ### Folder 'examples'
 Contains examples for working with the *OpenChemLib* library.


=====================================
debian/changelog
=====================================
@@ -1,3 +1,10 @@
+openchemlib (2022.4.2+dfsg-1) unstable; urgency=medium
+
+  * New upstream version 2022.4.2+dfsg
+  * Exclude mvnw.
+
+ -- Andrius Merkys <merkys at debian.org>  Thu, 14 Apr 2022 02:56:11 -0400
+
 openchemlib (2022.3.2+dfsg-1) unstable; urgency=medium
 
   * New upstream version 2022.3.2+dfsg


=====================================
debian/copyright
=====================================
@@ -2,6 +2,9 @@ Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
 Upstream-Name: OpenChemLib
 Source: https://github.com/Actelion/openchemlib
 Files-Excluded:
+ .mvn
+ mvnw
+ mvnw.cmd
  src/main/java/com/actelion/research/chem/descriptor/flexophore/MDHFeature.java
  src/main/java/info
 


=====================================
debian/patches/javafx.patch
=====================================
@@ -5,7 +5,7 @@ Author: Andrius Merkys <merkys at debian.org>
 Forwarded: not-needed
 --- a/pom.xml
 +++ b/pom.xml
-@@ -107,6 +107,21 @@
+@@ -111,6 +111,21 @@
              <version>4.13.1</version>
              <scope>test</scope>
          </dependency>


=====================================
debian/patches/libtablelayout-java.patch
=====================================
@@ -4,7 +4,7 @@ Author: Andrius Merkys <merkys at debian.org>
 Forwarded: not-needed
 --- a/pom.xml
 +++ b/pom.xml
-@@ -122,6 +122,10 @@
+@@ -126,6 +126,10 @@
              <artifactId>javafx-graphics</artifactId>
              <version>11</version>
          </dependency>


=====================================
pom.xml
=====================================
@@ -8,7 +8,7 @@
     Please follow the naming scheme YEAR.MONTH.RELEASE_NO_OF_MONTH
     (eg. 2016.4.1 for second release in Apr 2016)
     -->
-    <version>2022.3.2</version>
+    <version>2022.4.2</version>
 
     <name>OpenChemLib</name>
     <description>Open Source Chemistry Library</description>
@@ -47,6 +47,10 @@
 
     <packaging>jar</packaging>
 
+    <properties>
+        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+    </properties>
+
     <!-- Disable doclint for Java 8 -->
     <profiles>
         <profile>
@@ -118,6 +122,7 @@
                 <configuration>
                     <source>1.8</source>
                     <target>1.8</target>
+                    <encoding>UTF-8</encoding>
                 </configuration>
             </plugin>
             <plugin>
@@ -195,7 +200,7 @@
         <connection>scm:git:git at github.com:Actelion/openchemlib.git</connection>
         <developerConnection>scm:git:git at github.com:Actelion/openchemlib.git</developerConnection>
         <url>https://github.com/Actelion/openchemlib</url>
-      <tag>openchemlib-2022.3.2</tag>
+      <tag>openchemlib-2022.4.2</tag>
   </scm>
 
     <distributionManagement>


=====================================
src/main/java/com/actelion/research/chem/SmilesParser.java
=====================================
@@ -151,57 +151,51 @@ public class SmilesParser {
 		Reaction rxn = new Reaction();
 
 		int start = 0;
-		while (start < index1) {
-			int index = ArrayUtils.indexOf(smiles, (byte)'.', start+1);
-			if (index != -1 && index+2 < index1 && smiles[index+1] == '.') {
-				StereoMolecule reactant = new StereoMolecule();
-				parse(reactant, smiles, start, index);
-				rxn.addReactant(reactant);
-				start = index + 2;
-				continue;
+		for (int i=start; i<index1-1; i++) {
+			if (smiles[i] == '.' && smiles[i+1] == '.') {
+				if (i > start) {
+					StereoMolecule reactant = new StereoMolecule();
+					parse(reactant, smiles, start, i);
+					rxn.addReactant(reactant);
+					}
+				start = i + 2;
 				}
-
-			StereoMolecule reactants = new StereoMolecule();
-			parse(reactants, smiles, start, index1);
-			rxn.addReactant(reactants);
-			break;
 			}
+		StereoMolecule reactants = new StereoMolecule();
+		parse(reactants, smiles, start, index1);
+		rxn.addReactant(reactants);
 
 		if (index2 - index1 > 1) {
 			start = index1+1;
-			while (start < index2) {
-				int index = ArrayUtils.indexOf(smiles, (byte)'.', start+1);
-				if (index != -1 && index+2 < index2 && smiles[index+1] == '.') {
-					StereoMolecule catalyst = new StereoMolecule();
-					parse(catalyst, smiles, start, index);
-					rxn.addCatalyst(catalyst);
-					start = index + 2;
-					continue;
+			for (int i=start; i<index2-1; i++) {
+				if (smiles[i] == '.' && smiles[i+1] == '.') {
+					if (i > start) {
+						StereoMolecule catalyst = new StereoMolecule();
+						parse(catalyst, smiles, start, i);
+						rxn.addCatalyst(catalyst);
+						}
+					start = i + 2;
 					}
-
-				StereoMolecule catalysts = new StereoMolecule();
-				parse(catalysts, smiles, start, index2);
-				rxn.addCatalyst(catalysts);
-				break;
 				}
+			StereoMolecule catalysts = new StereoMolecule();
+			parse(catalysts, smiles, start, index2);
+			rxn.addCatalyst(catalysts);
 			}
 
 		start = index2+1;
-		while (start < smiles.length) {
-			int index = ArrayUtils.indexOf(smiles, (byte)'.', start+1);
-			if (index != -1 && index+2 < smiles.length && smiles[index+1] == '.') {
-				StereoMolecule product = new StereoMolecule();
-				parse(product, smiles, start, index);
-				rxn.addProduct(product);
-				start = index + 2;
-				continue;
+		for (int i=start; i<smiles.length-1; i++) {
+			if (smiles[i] == '.' && smiles[i+1] == '.') {
+				if (i > start) {
+					StereoMolecule product = new StereoMolecule();
+					parse(product, smiles, start, i);
+					rxn.addProduct(product);
+					}
+				start = i + 2;
 				}
-
-			StereoMolecule products = new StereoMolecule();
-			parse(products, smiles, start, smiles.length);
-			rxn.addProduct(products);
-			break;
 			}
+		StereoMolecule products = new StereoMolecule();
+		parse(products, smiles, start, smiles.length);
+		rxn.addProduct(products);
 
 		return rxn;
 		}


=====================================
src/main/java/com/actelion/research/chem/alignment3d/PheSAAlignmentOptimizer.java
=====================================
@@ -31,8 +31,8 @@ import com.actelion.research.chem.phesa.pharmacophore.pp.PPGaussian;
 
 public class PheSAAlignmentOptimizer {
 	
-	private static int TRIANGLE_OPTIMIZATIONS = 100;
-	private static int PMI_OPTIMIZATIONS = 20;
+	private static int TRIANGLE_OPTIMIZATIONS = 50;
+	private static int PMI_OPTIMIZATIONS = 10;
 	private static double EXIT_VECTOR_WEIGHT = 10.0;
 	private static final int BEST_RESULT_SIZE = 20;
 	
@@ -75,7 +75,7 @@ public class PheSAAlignmentOptimizer {
 		for(ShapeVolume shapeVol : fitVols) {
 			shapeVol.removeRings();
 		}
-		NavigableSet<AlignmentResult> alignmentSolutions = createAlignmentSolutions(Collections.singletonList(ref),fitVols,ppWeight,optimize,true,false); 
+		NavigableSet<AlignmentResult> alignmentSolutions = createAlignmentSolutions(Collections.singletonList(ref),fitVols,ppWeight,optimize,true,false,true); 
 		List<AlignmentResult> results = new ArrayList<>();
 		int counter = 0;
 		for(AlignmentResult solution : alignmentSolutions.descendingSet() ) {
@@ -87,11 +87,17 @@ public class PheSAAlignmentOptimizer {
 		}
 		return results;
 	}
-	
 	public static NavigableSet<AlignmentResult> createAlignmentSolutions(List<? extends ShapeVolume> refVols, List<? extends ShapeVolume> fitVols, double ppWeight, boolean optimize,
 			boolean tversky, boolean useDirectionality) {
+		return createAlignmentSolutions(refVols, fitVols, ppWeight, optimize,
+				tversky, useDirectionality, false);
+	}
+	
+	public static NavigableSet<AlignmentResult> createAlignmentSolutions(List<? extends ShapeVolume> refVols, List<? extends ShapeVolume> fitVols, double ppWeight, boolean optimize,
+			boolean tversky, boolean useDirectionality, boolean exhaustive) {
+		int triangleOpti = exhaustive ? 2*TRIANGLE_OPTIMIZATIONS : TRIANGLE_OPTIMIZATIONS;
+		int pmiOpti = exhaustive ? 2*PMI_OPTIMIZATIONS : PMI_OPTIMIZATIONS;
 		NavigableSet<AlignmentResult> alignmentSolutions = new TreeSet<AlignmentResult>();
-
 		for(ShapeVolume molVol : refVols) {
 			for(PPGaussian ppg : molVol.getPPGaussians()) {
 				if(ppg.getPharmacophorePoint().getFunctionalityIndex()==PharmacophoreCalculator.EXIT_VECTOR_ID) {
@@ -100,7 +106,7 @@ public class PheSAAlignmentOptimizer {
 			}
 		}
 
-		NavigableSet<AlignmentResult> triangleSolutions = getBestTriangleAlignments(refVols,fitVols,ppWeight,optimize,tversky,useDirectionality);
+		NavigableSet<AlignmentResult> triangleSolutions = getBestTriangleAlignments(refVols,fitVols,ppWeight,optimize,tversky,useDirectionality,triangleOpti);
 		alignmentSolutions.addAll(triangleSolutions);
 		NavigableSet<AlignmentResult> pmiSolutions = new TreeSet<AlignmentResult>();
 		for(int i=0;i<refVols.size();i++) {
@@ -121,7 +127,7 @@ public class PheSAAlignmentOptimizer {
 		//optimize best PMI alignments
 		int counter = 0;
 		for(AlignmentResult pmiAlignment : pmiSolutions.descendingSet()) {
-			if(counter++>PMI_OPTIMIZATIONS)
+			if(counter++>pmiOpti)
 				break;
 			ShapeVolume refVol = refVols.get(pmiAlignment.getRefConformerIndex());
 			ShapeVolume fitVol = new ShapeVolume(fitVols.get(pmiAlignment.getConformerIndex()));
@@ -172,7 +178,7 @@ public class PheSAAlignmentOptimizer {
 
 	
 	private static NavigableSet<AlignmentResult> getBestTriangleAlignments(List<? extends ShapeVolume> refVols, List<? extends ShapeVolume> fitVols, double ppWeight, 
-			boolean optimize, boolean tversky, boolean useDirectionality) {
+			boolean optimize, boolean tversky, boolean useDirectionality, int nrOptimizations) {
 		TreeSet<AlignmentResult> triangleResults = new TreeSet<AlignmentResult>();
 		for(int i=0;i<refVols.size();i++) {
 			ShapeVolume refVol = refVols.get(i);
@@ -189,7 +195,7 @@ public class PheSAAlignmentOptimizer {
 			double[][] alignments = PheSAAlignment.initialTransform(0);
 			int counter = 0;
 			for(AlignmentResult result: triangleResults.descendingSet()) {
-				if(counter++>TRIANGLE_OPTIMIZATIONS)
+				if(counter++>nrOptimizations)
 					break;
 				ShapeVolume refVol = refVols.get(result.getRefConformerIndex());
 				ShapeVolume fitVol = new ShapeVolume(fitVols.get(result.getConformerIndex()));


=====================================
src/main/java/com/actelion/research/chem/docking/DockingUtils.java
=====================================
@@ -111,7 +111,7 @@ public class DockingUtils {
 		lig.normalizeAmbiguousBonds();
 		repairQuaternaryNitrogen(lig);
 		repairCarboxylate(lig);
-		assignLikelyProtonationStates(lig);
+		addImplicitHydrogens(lig);
 	}
 	
 	private static void repairQuaternaryNitrogen(StereoMolecule mol){


=====================================
src/main/java/com/actelion/research/chem/hyperspace/SimpleCombinatorialHit.java
=====================================
@@ -0,0 +1,13 @@
+package com.actelion.research.chem.hyperspace;
+
+import java.io.Serializable;
+
+public class SimpleCombinatorialHit implements Serializable {
+    private static final long serialVersionUID = 1970031554026082875L;
+    public final String rxnId;
+    public final SimpleSynthon[][] synthons;
+    public SimpleCombinatorialHit(String rxnId, SimpleSynthon[][] synthons) {
+        this.rxnId = rxnId;
+        this.synthons = synthons;
+    }
+}
\ No newline at end of file


=====================================
src/main/java/com/actelion/research/chem/hyperspace/SimpleSynthon.java
=====================================
@@ -0,0 +1,18 @@
+package com.actelion.research.chem.hyperspace;
+
+import java.io.Serializable;
+
+public class SimpleSynthon implements Serializable {
+    private static final long serialVersionUID = 4625857679359578042L;
+    public final String idcode;
+    public final String synthonId;
+    public final String rxnId;
+    public final String synthonSet;
+    public SimpleSynthon(String idcode, String id, String rxn_id, String synthonSet) {
+        this.idcode     = idcode;
+        this.synthonId  = id;
+        this.rxnId      = rxn_id;
+        this.synthonSet = synthonSet;
+    }
+}
+


=====================================
src/main/java/com/actelion/research/chem/io/DWARFileParser.java
=====================================
@@ -238,8 +238,13 @@ public class DWARFileParser extends CompoundFileParser implements DescriptorCons
 
                 else if (line.startsWith("<"+cColumnProperty)) {
                     String[] property = extractValue(line).split("\\t");
-                    mColumnPropertyMap.get(columnName).setProperty(property[0], property[1]);
+                    if(property.length==1) {
+                    	mColumnPropertyMap.get(columnName).setProperty(property[0],"");
                     }
+                    else {
+                    	mColumnPropertyMap.get(columnName).setProperty(property[0], property[1]);
+                    }
+                }
 
                 line = readHeadOrTailLine();
                 }


=====================================
src/main/java/com/actelion/research/chem/phesa/EvaluableOverlap.java
=====================================
@@ -22,8 +22,7 @@ import com.actelion.research.chem.phesa.pharmacophore.pp.PPGaussian;
 
 public class EvaluableOverlap implements Evaluable  {
 
-	private static final int PENALTY = 80; 
-	
+
 	private double ppWeight;
 
 	private PheSAAlignment shapeAlign;
@@ -40,7 +39,6 @@ public class EvaluableOverlap implements Evaluable  {
     private double[][] results;
     private Coordinates[] fitAtGaussModCoords;
     private Coordinates[] fitPPGaussModCoords;
-    private Coordinates[] fitPPDirectionalityMod;
 
     
     public EvaluableOverlap(PheSAAlignment shapeAlign, double[] transform) {
@@ -59,7 +57,6 @@ public class EvaluableOverlap implements Evaluable  {
 	    this.dv0PP = new double[fitPPGaussModCoords.length][3];
 	    this.dv1PP = new double[fitPPGaussModCoords.length][3];
 	    this.dv2PP = new double[fitPPGaussModCoords.length][3];
-	    this.fitPPDirectionalityMod = new Coordinates[shapeAlign.getMolGauss().getPPGaussians().size()];
 		this.results = new double[shapeAlign.getRefMolGauss().getAtomicGaussians().size()][shapeAlign.getRefMolGauss().getAtomicGaussians().size()];
 		cachedCoords = new Coordinates[shapeAlign.getMolGauss().getAtomicGaussians().size()];
 		cachedCoordsPP = new Coordinates[shapeAlign.getMolGauss().getPPGaussians().size()];
@@ -160,7 +157,7 @@ public class EvaluableOverlap implements Evaluable  {
 		
 		double[] ppGrad = new double[grad.length];
 		value += ppWeight*this.getFGValueOverlapPP(ppGrad,refMolGauss.getPPGaussians(),fitMolGauss.getPPGaussians(),
-						dv0PP,dv1PP,dv2PP,fitPPGaussModCoords,fitPPDirectionalityMod);
+						dv0PP,dv1PP,dv2PP,fitPPGaussModCoords);
 
 		for(int i=0;i<grad.length;i++) 
 			grad[i] = (1.0-ppWeight)*atomGrad[i]+ ppWeight*ppGrad[i];
@@ -351,16 +348,12 @@ public class EvaluableOverlap implements Evaluable  {
 	
 	}
 	    
-	    
-	   private double getFGValueOverlapPP(double[] grad, List<PPGaussian> refMolGauss,List<PPGaussian> fitMolGauss, double[][] dRdv0, double[][] dRdv1, double[][] dRdv2, Coordinates[] fitGaussModCoords, Coordinates[] fitPPDirectionalityMod) {
+	   
+	   private double getFGValueOverlapPP(double[] grad, List<PPGaussian> refMolGauss,List<PPGaussian> fitMolGauss, double[][] dRdv0, double[][] dRdv1, double[][] dRdv2, Coordinates[] fitGaussModCoords) {
 		   	ExponentialMap eMap = new ExponentialMap(transform[0],transform[1],transform[2]);
 		    
 		    double[][] rotMatrix = eMap.toQuaternion().getRotMatrix().getArray();
 
-
-		    for(int k=0;k<fitMolGauss.size();k++) {
-		    	fitPPDirectionalityMod[k] = fitMolGauss.get(k).getRotatedDirectionality(rotMatrix, 1.0);
-		    }
 		    getTransformedCoordinates(fitGaussModCoords,fitMolGauss);
 
 		    this.getEMapGradient(dRdv0, dRdv1, dRdv2,cachedCoordsPP);
@@ -377,13 +370,9 @@ public class EvaluableOverlap implements Evaluable  {
 				PPGaussian refAt = refMolGauss.get(i);
 				for(int j=0; j<fitMolGauss.size();j++){
 					PPGaussian fitAt = fitMolGauss.get(j);
-					Coordinates fitPPDirectionalityVector = fitPPDirectionalityMod[j];
 					double atomOverlap = 0.0;
 					fitCenterModCoord = fitGaussModCoords[j];
 					double alphaSum = refAt.getWidth() + fitAt.getWidth();
-					double xi = refAt.getCenter().x;
-					double yi = refAt.getCenter().y;
-					double zi = refAt.getCenter().z;
 					double dx = refAt.getCenter().x-fitCenterModCoord.x;
 					double dy = refAt.getCenter().y-fitCenterModCoord.y;
 					double dz = refAt.getCenter().z-fitCenterModCoord.z;
@@ -396,7 +385,9 @@ public class EvaluableOverlap implements Evaluable  {
 					atomOverlap = refAt.getWeight()*refAt.getHeight()*fitAt.getHeight()*QuickMathCalculator.getInstance().quickExp(-( refAt.getWidth() * fitAt.getWidth()* Rij2)/alphaSum) *
 							QuickMathCalculator.getInstance().getPrefactor(refAt.getAtomicNo(),fitAt.getAtomicNo());
 					if (atomOverlap>0.0) {
-						double sim = refAt.getSimilarity(fitAt, fitPPDirectionalityVector);
+						double sim = refAt.getInteractionSimilarity(fitAt);
+						if(sim==0.0)
+							continue;
 						atomOverlap *= sim;
 						totalOverlap += atomOverlap;
 						double gradientPrefactor = atomOverlap*-2*refAt.getWidth()*fitAt.getWidth()/(refAt.getWidth()+fitAt.getWidth());
@@ -404,12 +395,12 @@ public class EvaluableOverlap implements Evaluable  {
 						double dv1 = dRdv1[j][0]*dx+dRdv1[j][1]*dy+dRdv1[j][2]*dz; 
 						double dv2 = dRdv2[j][0]*dx+dRdv2[j][1]*dy+dRdv2[j][2]*dz;   
 
-					    grad[0] += sim*gradientPrefactor*dv0+atomOverlap*(dRdv0[j][0]*xi+dRdv0[j][1]*yi+dRdv0[j][2]*zi)/3.0;
-					    grad[1] += sim*gradientPrefactor*dv1+atomOverlap*(dRdv1[j][0]*xi+dRdv1[j][1]*yi+dRdv1[j][2]*zi)/3.0;
-					    grad[2] += sim*gradientPrefactor*dv2+atomOverlap*(dRdv2[j][0]*xi+dRdv2[j][1]*yi+dRdv2[j][2]*zi)/3.0;
-					    grad[3] += sim*gradientPrefactor*dx+atomOverlap*xi/3.0;
-					    grad[4] += sim*gradientPrefactor*dy+atomOverlap*yi/3.0;
-					    grad[5] += sim*gradientPrefactor*dz+atomOverlap*zi/3.0;
+						grad[0] += gradientPrefactor*dv0;
+						grad[1] += gradientPrefactor*dv1;
+						grad[2] += gradientPrefactor*dv2;
+						grad[3] += gradientPrefactor*dx;
+						grad[4] += gradientPrefactor*dy;
+						grad[5] += gradientPrefactor*dz;
 								    	
 					    }
 					}
@@ -421,6 +412,7 @@ public class EvaluableOverlap implements Evaluable  {
 		}
 
 
+
 	public EvaluableOverlap clone() {
 		return new EvaluableOverlap(this);
 	}


=====================================
src/main/java/com/actelion/research/chem/phesa/pharmacophore/PPTriangle.java
=====================================
@@ -1,7 +1,5 @@
 package com.actelion.research.chem.phesa.pharmacophore;
 
-import java.util.Arrays;
-
 import com.actelion.research.calc.Matrix;
 import com.actelion.research.chem.Coordinates;
 import com.actelion.research.chem.alignment3d.transformation.Rotation;
@@ -38,6 +36,7 @@ public class PPTriangle {
 		dirs[2] = pp3.getDirectionality();
 		canonizeOrder();
 
+
 	}
 	
 	private void canonizeOrder() {
@@ -72,12 +71,12 @@ public class PPTriangle {
 			}	
 		}
 		else if(f[0]==f[1]) {
-			if(d[0]>d[1]) { //d12<=d13
+			if(d[1]>d[2]) { //d13>d23
 				swap(0,1);
 			}
 		}
 		else if(f[1]==f[2]) {
-			if(d[1]>d[2]) { //d12<=d13
+			if(d[0]>d[1]) { //d12>d13
 				swap(1,2);
 			}
 		}
@@ -85,31 +84,29 @@ public class PPTriangle {
 	
 	private void swap(int i, int j) {
 		int fiold = f[i];
-		double diold = d[i];
 		Coordinates dirold = new Coordinates(dirs[i]);
 		dirs[i] = new Coordinates(dirs[j]);
 		f[i] = f[j];
-		d[i] = d[j];
 		f[j] = fiold;
-		d[j] = diold;
 		dirs[j] = dirold;
+		Coordinates ciold = new Coordinates(c[i]);
+		c[i] = new Coordinates(c[j]); 
+		c[j] = new Coordinates(ciold); 
 		if(i==0 && j==1) {
-			Coordinates ciold = new Coordinates(c[1]);
-			c[1] = new Coordinates(c[2]); 
-			c[2] = new Coordinates(ciold); 
+			double dold=d[2];
+			d[2]=d[1];
+			d[1]=dold;
 		}
-		
 		else if(i==0 && j==2) {
-			Coordinates ciold = new Coordinates(c[0]);
-			c[0] = new Coordinates(c[2]); 
-			c[2] = new Coordinates(ciold); 
+			double dold=d[2];
+			d[2]=d[0];
+			d[0]=dold;
 		}
-		
 		else if(i==1 && j==2) {
-			Coordinates ciold = new Coordinates(c[0]);
-			c[0] = new Coordinates(c[1]); 
-			c[1] = new Coordinates(ciold); 
-		}
+			double dold=d[1];
+			d[1]=d[0];
+			d[0]=dold;
+		}	
 			
 
 	}


=====================================
src/main/java/com/actelion/research/chem/phesa/pharmacophore/PharmacophoreCalculator.java
=====================================
@@ -162,7 +162,7 @@ public class PharmacophoreCalculator {
 	public static boolean isDonorHydrogen(StereoMolecule mol, int h) {
 		if(mol.getAtomicNo(h)==1) {
 			int dh = mol.getConnAtom(h, 0);
-			if (mol.getAtomCharge(dh)>=0 && (mol.getAtomicNo(dh)==7 || mol.getAtomicNo(dh)==8) ) { //charge is not positive -> no acceptor
+			if (mol.getAtomCharge(dh)>=0 && (mol.getAtomicNo(dh)==7 || mol.getAtomicNo(dh)==8) ) { 
 				return true;
 			}
 			else return false;


=====================================
src/main/java/com/actelion/research/chem/phesa/pharmacophore/pp/PPGaussian.java
=====================================
@@ -86,7 +86,7 @@ public class PPGaussian extends Gaussian3D {
 	}
 
 	public double getSimilarity(PPGaussian ppGauss2, Coordinates directionality) {
-		double ppSimilarity = getInteractionSimilarity(ppGauss2);
+		double ppSimilarity = 1.0;
 		double vectorSim = getVectorSimilarity(ppGauss2,directionality);
 		double similarity = (Math.max(0, vectorSim)+2*ppSimilarity)/3.0;
 		return similarity;


=====================================
src/main/java/com/actelion/research/chem/phesaflex/EvaluableFlexibleOverlap.java
=====================================
@@ -382,13 +382,13 @@ public class EvaluableFlexibleOverlap implements Evaluable  {
 					
 					if (atomOverlap>0.0) {
 						totalOverlap += atomOverlap;
-						gradientPrefactor = atomOverlap*-refAt.getWidth()*fitAt.getWidth()/(refAt.getWidth()+fitAt.getWidth());
+						gradientPrefactor = atomOverlap*-2*refAt.getWidth()*fitAt.getWidth()/(refAt.getWidth()+fitAt.getWidth());
 					}
 
 				}
-				grad[3*a] += (2*xj-2*xi)*gradientPrefactor;
-				grad[3*a+1] += (2*yj-2*yi)*gradientPrefactor;
-				grad[3*a+2] += (2*zj-2*zi)*gradientPrefactor;
+				grad[3*a] += (xj-xi)*gradientPrefactor;
+				grad[3*a+1] += (yj-yi)*gradientPrefactor;
+				grad[3*a+2] += (zj-zi)*gradientPrefactor;
 				}
 
 		
@@ -420,9 +420,9 @@ public class EvaluableFlexibleOverlap implements Evaluable  {
 					}
 
 				}
-				grad[3*a] += (2*xj-2*xi)*gradientPrefactor;
-				grad[3*a+1] += (2*yj-2*yi)*gradientPrefactor;
-				grad[3*a+2] += (2*zj-2*zi)*gradientPrefactor;
+				grad[3*a] += (xj-xi)*gradientPrefactor;
+				grad[3*a+1] += (yj-yi)*gradientPrefactor;
+				grad[3*a+2] += (zj-zi)*gradientPrefactor;
 				}
 
 		
@@ -473,9 +473,9 @@ public class EvaluableFlexibleOverlap implements Evaluable  {
 						atomOverlap *= sim;
 						totalOverlap += atomOverlap;
 						gradientPrefactor = atomOverlap*-2*refPP.getWidth()*fitPP.getWidth()/(refPP.getWidth()+fitPP.getWidth());
-						grad[3*a] += (2*xj-2*xi)*gradientPrefactor*sim;
-						grad[3*a+1] += (2*yj-2*yi)*gradientPrefactor*sim;
-						grad[3*a+2] += (2*zj-2*zi)*gradientPrefactor*sim;
+						grad[3*a] += (xj-xi)*gradientPrefactor*sim;
+						grad[3*a+1] += (yj-yi)*gradientPrefactor*sim;
+						grad[3*a+2] += (zj-zi)*gradientPrefactor*sim;
 						fitPP.getPharmacophorePoint().getDirectionalityDerivativeCartesian(grad, coords, fitPP.getPharmacophorePoint().getDirectionality(), sim);					}
 
 				}


=====================================
src/main/java/com/actelion/research/chem/reaction/Reactor.java
=====================================
@@ -633,36 +633,6 @@ public class Reactor {
 				}
 			}
 
-		// copy corrected atom parities of generic product reaction center atoms
-		boolean esrGroupsChanged = false;
-		for (int j=0; j<genericProduct.getAtoms(); j++) {
-			// copy atom parities of unmapped generic product atoms and potentially convert them according to new neighbour order
-			if (genericProduct.getAtomMapNo(j) == 0) {
-				int parity = genericProduct.translateTHParity(j, newAtomNo);
-				product.setAtomParity(newAtomNo[j], parity, false);
-				}
-			// copy corrected atom parities of generic product reaction center atoms
-			else if (mIsReactionCenter[genericProductNo][j]) {
-				if ((genericProduct.getAtomQueryFeatures(j) & Molecule.cAtomQFRxnParityHint) == 0
-				 && useConfigurationFromGenericReaction(genericProduct, j)) {
-					int parity = genericProduct.translateTHParity(j, newAtomNo);
-					product.setAtomParity(newAtomNo[j], parity, false);
-					if (parity == Molecule.cAtomParity1
-					 || parity == Molecule.cAtomParity2) {
-						int esrType = genericProduct.getAtomESRType(j);
-						int esrGroup = genericProduct.getAtomESRGroup(j);
-						if (esrType == Molecule.cESRTypeAnd)
-							esrGroup += esrGroupCountAND;
-						else if (esrType == Molecule.cESRTypeOr)
-							esrGroup += esrGroupCountOR;
-
-						product.setAtomESR(newAtomNo[j], esrType, esrGroup);
-						esrGroupsChanged = true;
-						}
-					}
-				}
-			}
-
 		// copy all bonds of generic product, except for bridge bonds
 		for (int gpBond=0; gpBond<genericProduct.getBonds(); gpBond++) {
 			if (genericProduct.isBondBridge(gpBond))
@@ -722,11 +692,51 @@ public class Reactor {
 				}
 			}
 
+		product.ensureHelperArrays(Molecule.cHelperNeighbours);
+
+		// copy corrected atom parities of generic product reaction center atoms
+		boolean esrGroupsChanged = false;
+		for (int j=0; j<genericProduct.getAtoms(); j++) {
+			// copy atom parities of unmapped generic product atoms and potentially convert them according to new neighbour order
+			if (genericProduct.getAtomMapNo(j) == 0) {
+				int parity = genericProduct.translateTHParity(j, newAtomNo);
+				product.setAtomParity(newAtomNo[j], parity, false);
+				}
+			// copy corrected atom parities of generic product reaction center atoms
+			else if (mIsReactionCenter[genericProductNo][j]
+				  && copyConfigurationFromGenericProduct(genericProduct, j, product, newAtomNo[j])) {
+				int parity = genericProduct.translateTHParity(j, newAtomNo);
+				product.setAtomParity(newAtomNo[j], parity, false);
+				if (parity == Molecule.cAtomParity1
+						|| parity == Molecule.cAtomParity2) {
+					int esrType = genericProduct.getAtomESRType(j);
+					int esrGroup = genericProduct.getAtomESRGroup(j);
+					if (esrType == Molecule.cESRTypeAnd)
+						esrGroup += esrGroupCountAND;
+					else if (esrType == Molecule.cESRTypeOr)
+						esrGroup += esrGroupCountOR;
+
+					product.setAtomESR(newAtomNo[j], esrType, esrGroup);
+					esrGroupsChanged = true;
+					}
+				}
+			}
+
 		if (esrGroupsChanged) {
 			esrGroupCountAND = product.renumberESRGroups(Molecule.cESRTypeAnd);
 			esrGroupCountOR = product.renumberESRGroups(Molecule.cESRTypeOr);
 			}
 
+		// copy pseudo parities of generic product if there are no parity hints
+		boolean[] pseudoParityHandled = new boolean[genericProduct.getAllAtoms()];
+		for (int j=0; j<genericProduct.getAtoms(); j++)
+			if (mIsReactionCenter[genericProductNo][j]
+			 && !pseudoParityHandled[j]
+			 && genericProduct.isAtomParityPseudo(j)
+			 && (genericProduct.getAtomQueryFeatures(j) & Molecule.cAtomQFRxnParityHint) == 0
+			 && genericProduct.getConnAtoms(j) == product.getConnAtoms(newAtomNo[j]))
+				copyPseudoParitiesFromGenericProduct(genericProduct, j, product, newAtomNo, pseudoParityHandled);
+
 		// delete all fragments from product which are not connected to generic product
 		boolean[] includeAtom = new boolean[product.getAllAtoms()];
 		for (int i=0; i<newAtomNo.length; i++)
@@ -788,22 +798,101 @@ public class Reactor {
 //		return false;
 //		}
 
-	private boolean useConfigurationFromGenericReaction(StereoMolecule genericProduct, int productAtom) {
-		int mapNo = genericProduct.getAtomMapNo(productAtom);
-		if (mapNo != 0) {
-			for (int i = 0; i < mGenericReaction.getReactants(); i++) {
-				StereoMolecule reactant = mGenericReaction.getReactant(i);
-				for (int reactantAtom = 0; reactantAtom < reactant.getAtoms(); reactantAtom++) {
-					if (reactant.getAtomMapNo(reactantAtom) == mapNo) {
-						// If the reactant atom is explicitly set to match the stereo center,
-						// we assume that the product also contains a well specified stereo center to be copied.
-						if ((reactant.getAtomQueryFeatures(reactantAtom) & Molecule.cAtomQFMatchStereo) != 0)
-							return true;
-
-						// If we have an explicit change of the ESR type, we also assume that this is intentional
-						// and copy the stereo configuration from the product.
-						if (reactant.getAtomESRType(reactantAtom) != genericProduct.getAtomESRType(productAtom))
-							return true;
+	private void copyPseudoParitiesFromGenericProduct(StereoMolecule genericProduct, int firstPseudoParityAtom, StereoMolecule product, int[] newAtomNo, boolean[] pseudoParityHandled) {
+		int[] relatedAtom = new int[genericProduct.getAtoms()];
+		int relatedAtomCount = findRelatedPseudoParityAtoms(genericProduct, firstPseudoParityAtom, relatedAtom);
+
+		boolean matchingAbsParityFound = false;
+		boolean invertedAbsParityFound = false;
+		ArrayList<int[]> pseudoParityList = new ArrayList<>();
+
+		for (int i=0; i<relatedAtomCount; i++) {
+			if (genericProduct.isAtomParityPseudo(relatedAtom[i])) {
+				int pseudoParity = genericProduct.translateTHParity(relatedAtom[i], newAtomNo);
+				if (pseudoParity == Molecule.cAtomParity1
+				 || pseudoParity == Molecule.cAtomParity2) {
+					// Real product parities may not be pseudo if the real reactant has additional features.
+					// These are given and cannot be inverted because of pseudo parity requirements in the generic product.
+					// We check for compatibility and only apply relative pseudo parities, if possible.
+					int parity = product.getAtomParity(newAtomNo[relatedAtom[i]]);
+					if (parity == Molecule.cAtomParity1 || parity == Molecule.cAtomParity2) {
+						if (pseudoParity == parity)
+							matchingAbsParityFound = true;
+						else
+							invertedAbsParityFound = true;
+						}
+					}
+
+				// We collect a list of all pseudo parity atoms with their translated pseudo parities.
+				// If where we have existing real parities on the same atoms and if these
+				// - either match the required pseudo parities, then we can add pseudo parities to atoms without a real parity
+				// - or match the all inverted pseudo parities, then we can add inverted pseudo parities to atoms without a real parity
+				int[] ps = new int[2];
+				ps[0] = relatedAtom[i];
+				ps[1] = pseudoParity;
+				pseudoParityList.add(ps);
+				}
+			}
+
+		if (pseudoParityList != null && (!matchingAbsParityFound || !invertedAbsParityFound)) {
+			for (int[] pseudoParity : pseudoParityList) {
+				int ps = pseudoParity[1];
+				if ((ps == Molecule.cAtomParity1 || ps == Molecule.cAtomParity2) && invertedAbsParityFound)
+					ps = (ps == Molecule.cAtomParity1) ? Molecule.cAtomParity2 : Molecule.cAtomParity1;
+				product.setAtomParity(newAtomNo[pseudoParity[0]], ps, true);
+				}
+			}
+		}
+
+	private int findRelatedPseudoParityAtoms(StereoMolecule genericProduct, int firstAtom, int[] relatedAtom) {
+		boolean[] isRelated = new boolean[genericProduct.getAtoms()];
+		relatedAtom[0] = firstAtom;
+		int relatedAtoms = 1;
+		isRelated[firstAtom] = true;
+		for (int current=0; current<relatedAtoms; current++) {
+			for (int i=0; i<genericProduct.getConnAtoms(relatedAtom[current]); i++) {
+				int connBond = genericProduct.getConnBond(relatedAtom[current],i);
+				if (genericProduct.isRingBond(connBond) || genericProduct.getBondOrder(connBond) == 2 || genericProduct.isBINAPChiralityBond(connBond)) {
+					int connAtom = genericProduct.getConnAtom(relatedAtom[current],i);
+					if (!isRelated[connAtom]) {
+						relatedAtom[relatedAtoms++] = connAtom;
+						isRelated[connAtom] = true;
+						}
+					}
+				}
+			}
+		return relatedAtoms;
+		}
+
+	private boolean copyConfigurationFromGenericProduct(StereoMolecule genericProduct, int genericProductAtom, StereoMolecule product, int productAtom) {
+		// If we have a hint on the generic product atom, then we have already taken the generic reactant atom parity.
+		// Otherwise, if we have a stereo center on the generic product atom, we may consider copying that...
+		if (genericProduct.getAtomParity(genericProductAtom) != Molecule.cAtomParityNone
+		 && !genericProduct.isAtomParityPseudo(genericProductAtom)
+		 && (genericProduct.getAtomQueryFeatures(genericProductAtom) & Molecule.cAtomQFRxnParityHint) == 0) {
+			int mapNo = genericProduct.getAtomMapNo(genericProductAtom);
+			if (mapNo != 0) {
+				for (int i=0; i<mGenericReaction.getReactants(); i++) {
+					StereoMolecule genericReactant = mGenericReaction.getReactant(i);
+					for (int reactantAtom=0; reactantAtom<genericReactant.getAtoms(); reactantAtom++) {
+						if (genericReactant.getAtomMapNo(reactantAtom) == mapNo) {
+							// If the generic reactant atom is not even a pseudo stereo center,
+							// then we assume that any product configuration is intentional and correct
+							if (genericProduct.getConnAtoms(genericProductAtom) == product.getConnAtoms(productAtom))
+								return true;
+
+							// If the reactant atom is explicitly set to match the stereo center,
+							// we assume that the product also contains a well specified stereo center to be copied.
+							if ((genericReactant.getAtomQueryFeatures(reactantAtom) & Molecule.cAtomQFMatchStereo) != 0)
+								return true;
+
+							// If we have an explicit change of the ESR type, we also assume that this is intentional
+							// and copy the stereo configuration from the product.
+							if (genericReactant.getAtomESRType(reactantAtom) != genericProduct.getAtomESRType(genericProductAtom))
+								return true;
+
+							return false;
+							}
 						}
 					}
 				}


=====================================
src/main/java/com/actelion/research/gui/editor/AtomQueryFeatureDialogBuilder.java
=====================================
@@ -169,7 +169,7 @@ public class AtomQueryFeatureDialogBuilder implements DialogEventConsumer {
 		if (includeReactionHints) {
 			mDialog.add(mDialog.createLabel("Stereo center hint for product:"), 1,27,3,27);
 			mChoiceReactionParityHint = mDialog.createComboBox();
-			mChoiceReactionParityHint.addItem("Make unknown in product");
+			mChoiceReactionParityHint.addItem("Copy from generic product");
 			mChoiceReactionParityHint.addItem("Keep reactant configuration");
 			mChoiceReactionParityHint.addItem("Invert reactant configuration");
 			mChoiceReactionParityHint.addItem("Racemise configuration");


=====================================
src/main/java/com/actelion/research/util/BrowserControl.java
=====================================
@@ -1,6 +1,9 @@
 package com.actelion.research.util;
 
+import java.awt.*;
 import java.io.IOException;
+import java.net.URI;
+import java.net.URISyntaxException;
 
 public class BrowserControl {
 	/**
@@ -21,7 +24,19 @@ public class BrowserControl {
 				} else if (Platform.isMacintosh()) {
 					cmd = OSX_PATH + " " + url;
 					Runtime.getRuntime().exec(cmd);
-				} else {
+					}
+				else if (Desktop.isDesktopSupported()) {
+					Desktop desktop = Desktop.getDesktop();
+					if (desktop.isSupported(Desktop.Action.BROWSE)) {
+						try {
+							desktop.browse(new URI(url));
+							}
+						catch(URISyntaxException use) {
+							use.printStackTrace();
+							}
+						}
+					}
+/*				else {
 					// Under Unix, Netscape has to be running for the "-remote"
 					// command to work.  So, we try sending the command and
 					// check for an exit value.  If the exit command is 0,
@@ -44,7 +59,7 @@ public class BrowserControl {
 								+ "'");
 						System.err.println("Caught: " + x);
 					}
-				}
+				}*/
 			} catch (IOException x) {
 				// couldn't exec browser
 				System.err.println("Could not invoke browser, command=" + cmd);
@@ -70,8 +85,8 @@ public class BrowserControl {
 	private static final String UNIX_PATH = "firefox";
 
 	// The flag to display a url.
-	private static final String UNIX_PARAM_START = "-remote \"openURL(";
-    private static final String UNIX_PARAM_END = ")\"";
+//	private static final String UNIX_PARAM_START = "-remote \"openURL(";
+//  private static final String UNIX_PARAM_END = ")\"";
 
 	// The open command MacOSX.
 	private static final String OSX_PATH = "open";



View it on GitLab: https://salsa.debian.org/java-team/openchemlib/-/compare/3fd5daea1a2beecffbbf04c7bab1d290d5ff9dbb...c520e82c5c7fd14332840598114d7bea96ea5ebb

-- 
View it on GitLab: https://salsa.debian.org/java-team/openchemlib/-/compare/3fd5daea1a2beecffbbf04c7bab1d290d5ff9dbb...c520e82c5c7fd14332840598114d7bea96ea5ebb
You're receiving this email because of your account on salsa.debian.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/pkg-java-commits/attachments/20220414/54203eae/attachment.htm>


More information about the pkg-java-commits mailing list