Skip to content

Commit

Permalink
fix: update OCL to 2024.7.1
Browse files Browse the repository at this point in the history
  • Loading branch information
targos committed Jul 18, 2024
1 parent b189a6e commit 567873e
Show file tree
Hide file tree
Showing 22 changed files with 2,339 additions and 953 deletions.
2 changes: 1 addition & 1 deletion openchemlib
Submodule openchemlib updated 64 files
+1 −0 buildOpenChemLib
+2 −2 pom.xml
+7 −8 src/main/java/com/actelion/research/chem/DrawingObjectList.java
+30 −13 src/main/java/com/actelion/research/chem/ExtendedMolecule.java
+28 −26 src/main/java/com/actelion/research/chem/IDCodeParserWithoutCoordinateInvention.java
+29 −22 src/main/java/com/actelion/research/chem/Molecule.java
+834 −0 src/main/java/com/actelion/research/chem/SmilesAtomParser.java
+128 −700 src/main/java/com/actelion/research/chem/SmilesParser.java
+4 −4 src/main/java/com/actelion/research/chem/chemicalspaces/ptree/search/FragmentPTreeSearch.java
+10 −1 src/main/java/com/actelion/research/chem/chemicalspaces/ptree/synthon/PharmTreeSynthonLibrary.java
+72 −69 src/main/java/com/actelion/research/chem/coords/CoordinateInventor.java
+0 −3 src/main/java/com/actelion/research/chem/descriptor/DescriptorHandlerFlexophore.java
+9 −0 src/main/java/com/actelion/research/chem/descriptor/flexophore/ConstantsFlexophore.java
+5 −3 src/main/java/com/actelion/research/chem/descriptor/flexophore/IMolDistHist.java
+0 −3 src/main/java/com/actelion/research/chem/descriptor/flexophore/MDHFeature.java
+6 −3 src/main/java/com/actelion/research/chem/descriptor/flexophore/MolDistHist.java
+51 −191 src/main/java/com/actelion/research/chem/descriptor/flexophore/MolDistHistViz.java
+1 −1 src/main/java/com/actelion/research/chem/descriptor/flexophore/MolDistHistVizEncoder.java
+27 −0 src/main/java/com/actelion/research/chem/descriptor/flexophore/MolDistHistVizHelper.java
+5 −5 src/main/java/com/actelion/research/chem/descriptor/flexophore/MolDistHistVizHiddenPPPoints.java
+57 −27 ...ion/research/chem/descriptor/flexophore/completegraphmatcher/ObjectiveBlurFlexophoreHardMatchUncovered.java
+9 −46 src/main/java/com/actelion/research/chem/descriptor/flexophore/generator/ConformerGeneratorStageTries.java
+18 −108 src/main/java/com/actelion/research/chem/descriptor/flexophore/generator/CreatorMolDistHistViz.java
+3 −3 src/main/java/com/actelion/research/chem/descriptor/flexophore/generator/SubFlexophoreGenerator.java
+0 −7 src/main/java/com/actelion/research/chem/descriptor/flexophore/redgraph/SubGraphExtractor.java
+73 −7 src/main/java/com/actelion/research/chem/descriptor/flexophore/redgraph/SubGraphIndices.java
+1 −2 src/main/java/com/actelion/research/chem/io/CompoundTableConstants.java
+32 −0 src/main/java/com/actelion/research/chem/io/DWARFileParser.java
+7 −4 src/main/java/com/actelion/research/chem/io/pdb/parser/PDBCoordEntryFile.java
+17 −18 src/main/java/com/actelion/research/chem/io/pdb/parser/PDBFileParser.java
+36 −49 src/main/java/com/actelion/research/chem/io/pdb/parser/StructureAssembler.java
+6 −3 src/main/java/com/actelion/research/chem/phesa/pharmacophore/pp/AcceptorPoint.java
+12 −2 src/main/java/com/actelion/research/chem/phesa/pharmacophore/pp/AliphaticPoint.java
+13 −3 src/main/java/com/actelion/research/chem/phesa/pharmacophore/pp/AromRingPoint.java
+8 −5 src/main/java/com/actelion/research/chem/phesa/pharmacophore/pp/ChargePoint.java
+11 −1 src/main/java/com/actelion/research/chem/phesa/pharmacophore/pp/DonorPoint.java
+10 −1 src/main/java/com/actelion/research/chem/phesa/pharmacophore/pp/ExitVectorPoint.java
+3 −7 src/main/java/com/actelion/research/chem/phesa/pharmacophore/pp/IPharmacophorePoint.java
+1 −7 src/main/java/com/actelion/research/chem/phesa/pharmacophore/pp/PPGaussian.java
+7 −1 src/main/java/com/actelion/research/chem/phesa/pharmacophore/pp/SimplePharmacophorePoint.java
+61 −31 src/main/java/com/actelion/research/chem/reaction/Reaction.java
+3 −1 src/main/java/com/actelion/research/chem/ugly/NastyFunctionDetector.java
+966 −0 src/main/java/com/actelion/research/chem/ugly/PainsDetector.java
+27 −25 src/main/java/com/actelion/research/gui/JPruningBar.java
+106 −14 src/main/java/com/actelion/research/gui/JStructureView.java
+5 −5 src/main/java/com/actelion/research/gui/PruningBarEvent.java
+2 −2 src/main/java/com/actelion/research/gui/dock/DockableHeader.java
+24 −22 src/main/java/com/actelion/research/gui/editor/AtomQueryFeatureDialogBuilder.java
+5 −5 src/main/java/com/actelion/research/gui/editor/GenericEditorArea.java
+43 −10 src/main/java/com/actelion/research/gui/hidpi/HiDPIHelper.java
+50 −38 src/main/java/com/actelion/research/gui/hidpi/HiDPIIcon.java
+7 −9 src/main/java/com/actelion/research/gui/hidpi/HiDPIIconButton.java
+3 −3 src/main/java/com/actelion/research/gui/hidpi/HiDPIToggleButton.java
+9 −9 src/main/java/com/actelion/research/gui/hidpi/JBrowseButtons.java
+15 −1 src/main/java/com/actelion/research/util/ArrayUtils.java
+11 −1 src/main/java/com/actelion/research/util/CommandLineParser.java
+2 −0 src/main/java/com/actelion/research/util/ConstantsDWAR.java
+26 −2 src/main/java/com/actelion/research/util/DateAnalysis.java
+0 −65 src/main/java/com/actelion/research/util/StringFunctions.java
+45 −17 src/main/java/org/openmolecules/chem/conf/gen/ConformerGenerator.java
+18 −2 src/main/java/org/openmolecules/chem/conf/gen/RigidFragmentCache.java
+14 −5 src/main/java/org/openmolecules/chem/conf/gen/RigidFragmentProvider.java
+22 −20 src/main/java/org/openmolecules/chem/conf/so/ConformationSelfOrganizer.java
+2 −2 src/main/java/smile/stat/distribution/GaussianDistribution.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,9 @@ public DrawingObjectList() {
public DrawingObjectList(DrawingObjectList l) {
super();
try {
if (l != null) {
for (int i = 0; i < l.size(); i++)
add((AbstractDrawingObject) l.get(i).clone());
}
if (l != null)
for (AbstractDrawingObject abstractDrawingObject : l)
add(abstractDrawingObject.clone());
} catch (Exception e) {
} finally {

Expand All @@ -57,7 +56,7 @@ public DrawingObjectList(DrawingObjectList l) {

public DrawingObjectList(String objectString) {
super();
if (objectString == null || objectString.length() == 0)
if (objectString == null || objectString.isEmpty())
return;

int index1 = 0;
Expand All @@ -72,9 +71,9 @@ public DrawingObjectList(String objectString) {
}

public String toString() {
StringBuffer objectString = new StringBuffer();
for (int i=0; i<size(); i++)
objectString.append(get(i).getDescriptor()+"\n");
StringBuilder objectString = new StringBuilder();
for (AbstractDrawingObject abstractDrawingObject : this)
objectString.append(abstractDrawingObject.getDescriptor()).append("\n");
return objectString.toString();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -538,21 +538,37 @@ public int getConnAtom(int atom, int i) {

/**
* The neighbours (connected atoms) of any atom are sorted by their relevance:<br>
* 1. non-hydrogen atoms (bond order 1 and above) and unusual hydrogen atoms (non natural abundance isotops, custom labelled hydrogen, etc.)<br>
* 1. non-hydrogen atoms (bond order 1 and above) and unusual hydrogen atoms (non-natural abundance isotops, custom labelled hydrogen, etc.)<br>
* 2. plain-hydrogen atoms (natural abundance, bond order 1)<br>
* 3. loosely connected atoms (bond order 0, i.e. metall ligand bond)<br>
* Only valid after calling ensureHelperArrays(cHelperNeighbours or higher);
* Note: This method includes neighbours marked as being part of an exclude group!
* @param atom
* @return count of category 1 neighbour atoms (excludes plain H and bond zero orders)
*/
public int getNotExcludedConnAtoms(int atom) {
return mConnAtoms[atom] - getExcludedNeighbourCount(atom);
}


/**
* The neighbours (connected atoms) of any atom are sorted by their relevance:<br>
* 1. non-hydrogen atoms (bond order 1 and above) and unusual hydrogen atoms (non-natural abundance isotops, custom labelled hydrogen, etc.)<br>
* 2. plain-hydrogen atoms (natural abundance, bond order 1)<br>
* 3. loosely connected atoms (bond order 0, i.e. metall ligand bond)<br>
* Only valid after calling ensureHelperArrays(cHelperNeighbours or higher);
* Note: This method includes neighbours marked as being part of an exclude group!
* @param atom
* @return count of category 1 neighbour atoms (excludes plain H and bond zero orders)
*/
public int getConnAtoms(int atom) {
return mConnAtoms[atom];
}
}


/**
* The neighbours (connected atoms) of any atom are sorted by their relevance:<br>
* 1. non-hydrogen atoms (bond order 1 and above) and unusual hydrogen atoms (non natural abundance isotops, custom labelled hydrogen, etc.)<br>
* 1. non-hydrogen atoms (bond order 1 and above) and unusual hydrogen atoms (non-natural abundance isotops, custom labelled hydrogen, etc.)<br>
* 2. plain-hydrogen atoms (natural abundance, bond order 1)<br>
* 3. loosely connected atoms (bond order 0, i.e. metall ligand bond)<br>
* Only valid after calling ensureHelperArrays(cHelperNeighbours or higher);
Expand All @@ -566,7 +582,7 @@ public int getAllConnAtomsPlusMetalBonds(int atom) {

/**
* The neighbours (connected atoms) of any atom are sorted by their relevance:<br>
* 1. non-hydrogen atoms (bond order 1 and above) and unusual hydrogen atoms (non natural abundance isotops, custom labelled hydrogen, etc.)<br>
* 1. non-hydrogen atoms (bond order 1 and above) and unusual hydrogen atoms (non-natural abundance isotops, custom labelled hydrogen, etc.)<br>
* 2. plain-hydrogen atoms (natural abundance, bond order 1)<br>
* 3. loosely connected atoms (bond order 0, i.e. metall ligand bond)<br>
* Only valid after calling ensureHelperArrays(cHelperNeighbours or higher);
Expand All @@ -581,7 +597,7 @@ public int getConnBond(int atom, int i) {

/**
* The neighbours (connected atoms) of any atom are sorted by their relevance:<br>
* 1. non-hydrogen atoms (bond order 1 and above) and unusual hydrogen atoms (non natural abundance isotops, custom labelled hydrogen, etc.)<br>
* 1. non-hydrogen atoms (bond order 1 and above) and unusual hydrogen atoms (non-natural abundance isotops, custom labelled hydrogen, etc.)<br>
* 2. plain-hydrogen atoms (natural abundance, bond order 1)<br>
* 3. loosely connected atoms (bond order 0, i.e. metall ligand bond)<br>
* Only valid after calling ensureHelperArrays(cHelperNeighbours or higher);
Expand Down Expand Up @@ -616,13 +632,14 @@ public int getNonHydrogenNeighbourCount(int atom) {
/**
* This method returns the count of atom neighbours which are marked as being an exclude group.
* @param atom
* @return the number of non-hydrogen neighbor atoms
* @return the number of non-hydrogen neighbor atoms marked as being part of an exclude group
*/
public int getExcludedNeighbourCount(int atom) {
int count = 0;
for (int i=0; i<mConnAtoms[atom]; i++)
if ((mAtomQueryFeatures[mConnAtom[atom][i]] & Molecule.cAtomQFExcludeGroup) != 0)
count++;
if (mIsFragment)
for (int i=0; i<mConnAtoms[atom]; i++)
if ((mAtomQueryFeatures[mConnAtom[atom][i]] & Molecule.cAtomQFExcludeGroup) != 0)
count++;
return count;
}

Expand Down Expand Up @@ -1736,17 +1753,17 @@ public boolean isHeteroAromaticAtom(int atom) {
* @return whether the atom is a member of a delocalized ring (subset of aromatic rings)
*/
public boolean isDelocalizedAtom(int atom) {
return (atom < mAtoms) ? mRingSet.isDelocalizedAtom(atom) : false;
return atom<mAtoms && mRingSet.isDelocalizedAtom(atom);
}


public boolean isAromaticBond(int bond) {
return (bond < mBonds) ? mRingSet.isAromaticBond(bond) : false;
return bond<mBonds && mRingSet.isAromaticBond(bond);
}


public boolean isHeteroAromaticBond(int bond) {
return (bond < mBonds) ? mRingSet.isHeteroAromaticBond(bond) : false;
return bond<mBonds && mRingSet.isHeteroAromaticBond(bond);
}


Expand Down Expand Up @@ -3482,12 +3499,12 @@ public void ensureHelperArrays(int required) {
if ((mValidHelperArrays & cHelperBitNeighbours) == 0) {
handleHydrogens();
calculateNeighbours();

mValidHelperArrays |= cHelperBitNeighbours;

if (convertHydrogenToQueryFeatures()) {
handleHydrogens();
calculateNeighbours();
mValidHelperArrays |= cHelperBitNeighbours;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public void neglectSpaceDelimitedCoordinates() {
* @return
*/
public StereoMolecule getCompactMolecule(String idcode) {
return (idcode == null || idcode.length() == 0) ? null : getCompactMolecule(idcode.getBytes(StandardCharsets.UTF_8), null);
return (idcode == null || idcode.isEmpty()) ? null : getCompactMolecule(idcode.getBytes(StandardCharsets.UTF_8), null);
}

/**
Expand Down Expand Up @@ -151,7 +151,7 @@ public StereoMolecule getCompactMolecule(byte[] idcode, byte[] coordinates, int
* @param idcode null or idcode, which may contain coordinates separated by a space character
*/
public void parse(StereoMolecule mol, String idcode) {
if (idcode == null || idcode.length() == 0) {
if (idcode == null || idcode.isEmpty()) {
parse(mol, (byte[])null, (byte[])null);
return;
}
Expand Down Expand Up @@ -437,9 +437,10 @@ public void parse(StereoMolecule mol, byte[] idcode, byte[] coordinates, int idc
int offset = 0;
while (decodeBits(1) == 1) {
int dataType = offset + decodeBits(4);
int no;
switch (dataType) {
case 0: // datatype 'AtomQFNoMoreNeighbours'
int no = decodeBits(abits);
no = decodeBits(abits);
for (int i=0; i<no; i++) {
int atom = decodeBits(abits);
mMol.setAtomQueryFeature(atom, Molecule.cAtomQFNoMoreNeighbours, true);
Expand Down Expand Up @@ -762,10 +763,10 @@ public void parse(StereoMolecule mol, byte[] idcode, byte[] coordinates, int idc
from = 0;
factor = 8.0;
}
mMol.setAtomX(atom, mMol.getAtomX(from) + factor * (decodeBits(resolutionBits) - binCount / 2));
mMol.setAtomY(atom, mMol.getAtomY(from) + factor * (decodeBits(resolutionBits) - binCount / 2));
mMol.setAtomX(atom, mMol.getAtomX(from) + factor * (decodeBits(resolutionBits) - binCount / 2.0));
mMol.setAtomY(atom, mMol.getAtomY(from) + factor * (decodeBits(resolutionBits) - binCount / 2.0));
if (coordsAre3D)
mMol.setAtomZ(atom, mMol.getAtomZ(from) + factor * (decodeBits(resolutionBits) - binCount / 2));
mMol.setAtomZ(atom, mMol.getAtomZ(from) + factor * (decodeBits(resolutionBits) - binCount / 2.0));
}

if (coordinates[coordsStart] == '#') { // we have 3D-coordinates that include implicit hydrogen coordinates
Expand All @@ -781,10 +782,10 @@ public void parse(StereoMolecule mol, byte[] idcode, byte[] coordinates, int idc
int hydrogen = mMol.addAtom(1);
mMol.addBond(atom, hydrogen, Molecule.cBondTypeSingle);

mMol.setAtomX(hydrogen, mMol.getAtomX(atom) + (decodeBits(resolutionBits) - binCount / 2));
mMol.setAtomY(hydrogen, mMol.getAtomY(atom) + (decodeBits(resolutionBits) - binCount / 2));
mMol.setAtomX(hydrogen, mMol.getAtomX(atom) + (decodeBits(resolutionBits) - binCount / 2.0));
mMol.setAtomY(hydrogen, mMol.getAtomY(atom) + (decodeBits(resolutionBits) - binCount / 2.0));
if (coordsAre3D)
mMol.setAtomZ(hydrogen, mMol.getAtomZ(atom) + (decodeBits(resolutionBits) - binCount / 2));
mMol.setAtomZ(hydrogen, mMol.getAtomZ(atom) + (decodeBits(resolutionBits) - binCount / 2.0));
}
}

Expand Down Expand Up @@ -935,10 +936,10 @@ public void parseCoordinates(byte[] encodedCoords, int coordsStart, StereoMolecu
from = 0;
factor = 8.0;
}
coords[atom].x = coords[from].x + factor * (decodeBits(resolutionBits) - binCount / 2);
coords[atom].y = coords[from].y + factor * (decodeBits(resolutionBits) - binCount / 2);
coords[atom].x = coords[from].x + factor * (decodeBits(resolutionBits) - binCount / 2.0);
coords[atom].y = coords[from].y + factor * (decodeBits(resolutionBits) - binCount / 2.0);
if (coordsAre3D)
coords[atom].z = coords[from].z + factor * (decodeBits(resolutionBits) - binCount / 2);
coords[atom].z = coords[from].z + factor * (decodeBits(resolutionBits) - binCount / 2.0);
}

double avbl = coordsAre3D ? 1.5 : Molecule.getDefaultAverageBondLength();
Expand All @@ -954,10 +955,10 @@ public void parseCoordinates(byte[] encodedCoords, int coordsStart, StereoMolecu
for (int atom = 0; atom < atomCount; atom++) {
int hCount = mol.getAllConnAtoms(atom) - mol.getConnAtoms(atom);
for (int i = 0; i < hCount; i++) {
coords[hydrogen].x = coords[atom].x + (decodeBits(resolutionBits) - binCount / 2);
coords[hydrogen].y = coords[atom].y + (decodeBits(resolutionBits) - binCount / 2);
coords[hydrogen].x = coords[atom].x + (decodeBits(resolutionBits) - binCount / 2.0);
coords[hydrogen].y = coords[atom].y + (decodeBits(resolutionBits) - binCount / 2.0);
if (coordsAre3D)
coords[hydrogen].z = coords[atom].z + (decodeBits(resolutionBits) - binCount / 2);
coords[hydrogen].z = coords[atom].z + (decodeBits(resolutionBits) - binCount / 2.0);

hydrogen++;
}
Expand Down Expand Up @@ -1072,7 +1073,7 @@ else if (coordinates[coordStart] == '!' || coordinates[coordStart] == '#') {
}

public int getIDCodeVersion(String idcode) {
if (idcode == null || idcode.length() == 0)
if (idcode == null || idcode.isEmpty())
return -1;

return getIDCodeVersion(idcode.getBytes(StandardCharsets.UTF_8));
Expand All @@ -1090,7 +1091,7 @@ public int getIDCodeVersion(byte[] idcode) {
}

public int getAtomCount(String idcode) {
if (idcode == null || idcode.length() == 0)
if (idcode == null || idcode.isEmpty())
return 0;

return getAtomCount(idcode.getBytes(StandardCharsets.UTF_8), 0);
Expand Down Expand Up @@ -1120,7 +1121,7 @@ public int getAtomCount(byte[] idcode, int offset) {
* @return int[] with atom and bond count as first and second values
*/
public int[] getAtomAndBondCounts(String idcode, int[] count) {
if (idcode == null || idcode.length() == 0)
if (idcode == null || idcode.isEmpty())
return null;

return getAtomAndBondCounts(idcode.getBytes(StandardCharsets.UTF_8), 0, count);
Expand Down Expand Up @@ -1192,7 +1193,7 @@ private double decodeShift(int value, int binCount) {
boolean isNegative = (value >= halfBinCount);
if (isNegative)
value -= halfBinCount;
double steepness = binCount/32;
double steepness = binCount/32.0;
double doubleValue = steepness * value / (halfBinCount - value);
return isNegative ? -doubleValue : doubleValue;
}
Expand Down Expand Up @@ -1366,9 +1367,10 @@ public void printContent(byte[] idcode, byte[] coordinates) {
int offset = 0;
while (decodeBits(1) == 1) {
int dataType = offset + decodeBits(4);
int no;
switch (dataType) {
case 0: // datatype 'AtomQFNoMoreNeighbours'
int no = decodeBits(abits);
no = decodeBits(abits);
System.out.print("noMoreNeighbours:");
for (int i = 0; i < no; i++)
System.out.print(" " + decodeBits(abits));
Expand Down Expand Up @@ -1675,12 +1677,12 @@ public void printContent(byte[] idcode, byte[] coordinates) {
factor = 8.0;
}
System.out.print(atom + " (");
coords[0][atom] = coords[0][from] + factor * (decodeBits(resolutionBits) - binCount / 2);
coords[0][atom] = coords[0][from] + factor * (decodeBits(resolutionBits) - binCount / 2.0);
System.out.print((int) coords[0][atom] + ",");
coords[1][atom] = coords[1][from] + factor * (decodeBits(resolutionBits) - binCount / 2);
coords[1][atom] = coords[1][from] + factor * (decodeBits(resolutionBits) - binCount / 2.0);
System.out.print((int) coords[1][atom]);
if (coordsAre3D) {
coords[2][atom] = coords[2][from] + factor * (decodeBits(resolutionBits) - binCount / 2);
coords[2][atom] = coords[2][from] + factor * (decodeBits(resolutionBits) - binCount / 2.0);
System.out.print("," + (int) coords[0][atom]);
}
System.out.print("), ");
Expand Down Expand Up @@ -1719,12 +1721,12 @@ public void printContent(byte[] idcode, byte[] coordinates) {
System.out.print(atom);
for (int i = 0; i < hCount[atom]; i++) {
System.out.print(" (");
coords[0][hydrogen] = coords[0][atom] + (decodeBits(resolutionBits) - binCount / 2);
coords[0][hydrogen] = coords[0][atom] + (decodeBits(resolutionBits) - binCount / 2.0);
System.out.print((int) coords[0][hydrogen] + ",");
coords[1][hydrogen] = coords[1][atom] + (decodeBits(resolutionBits) - binCount / 2);
coords[1][hydrogen] = coords[1][atom] + (decodeBits(resolutionBits) - binCount / 2.0);
System.out.print((int) coords[1][hydrogen]);
if (coordsAre3D) {
coords[2][hydrogen] = coords[2][atom] + (decodeBits(resolutionBits) - binCount / 2);
coords[2][hydrogen] = coords[2][atom] + (decodeBits(resolutionBits) - binCount / 2.0);
System.out.print("," + (int) coords[2][hydrogen]);
}
System.out.print("), ");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1179,23 +1179,43 @@ public int[] addMolecule(Molecule mol) {
* @return atom mapping from original mol to this molecule after incorporation of mol
*/
public int[] addMolecule(Molecule mol, int atoms, int bonds) {
return addMolecule(mol, 0, atoms, 0, bonds);
}


/**
* Copies first atoms and first bonds of mol to the end of this Molecule's atom and bond
* tables. If mol is a fragment then this Molecule's fragment flag is set to true
* and all query features of mol are also copied. Typically, this is used to add a
* molecule without explicit hydrogen atoms. If parities of copied molecules are valid,
* then you may call setParitiesValid() on this molecule after adding molecules.
* High level function for constructing a molecule. Does not require any helper arrays.
* @param mol
* @param atom1 first atom to be copied
* @param atom2 1+last atom to be copied
* @param bond1 first bond to be copied
* @param bond2 one+last bond to be copied
* @return atom mapping from original mol to this molecule after incorporation of mol
*/
public int[] addMolecule(Molecule mol, int atom1, int atom2, int bond1, int bond2) {
mIsFragment |= mol.mIsFragment;

int[] atomMap = new int[mol.mAllAtoms];
int esrGroupCountAND = renumberESRGroups(cESRTypeAnd);
int esrGroupCountOR = renumberESRGroups(cESRTypeOr);
for (int atom=0; atom<atoms; atom++) {
for (int atom=atom1; atom<atom2; atom++) {
atomMap[atom] = mol.copyAtom(this, atom, esrGroupCountAND, esrGroupCountOR);
}
for (int bond=0; bond<bonds; bond++) {
}
for (int bond=bond1; bond<bond2; bond++) {
mol.copyBond(this, bond, esrGroupCountAND, esrGroupCountOR, atomMap, false);
}
}

mIsRacemate = (mIsRacemate && mol.mIsRacemate);
mChirality = cChiralityUnknown;
mValidHelperArrays = cHelperNone;
return atomMap;
}
}


/**
* Adds and connects the substituent molecule to the rootAtom of this molecule.
Expand Down Expand Up @@ -1655,24 +1675,11 @@ public void swapBonds(int bond1, int bond2) {
* @param atom
*/
public void deleteAtom(int atom) {
for (int bnd=0; bnd<mAllBonds; bnd++) {
for (int i=0; i<2; i++) {
if (mBondAtom[i][bnd] == atom) {
for (int bnd=0; bnd<mAllBonds; bnd++)
for (int i=0; i<2; i++)
if (mBondAtom[i][bnd] == atom)
mBondType[bnd] = cBondTypeDeleted; // mark for delete
int bonds = 0;
for (int j=0; j<mAllBonds; j++) {
if (j == bnd) continue;
if ((mBondAtom[0][j] == mBondAtom[1-i][bnd])
|| (mBondAtom[1][j] == mBondAtom[1-i][bnd]))
bonds++;
}
if (bonds == 0) {
removeMappingNo(mAtomMapNo[mBondAtom[1-i][bnd]]);
mAtomicNo[mBondAtom[1-i][bnd]] = -1;
} // mark for delete
}
}
}

removeMappingNo(mAtomMapNo[atom]);
mAtomicNo[atom] = -1; // mark for delete
if (mAtomList != null)
Expand Down
Loading

0 comments on commit 567873e

Please sign in to comment.