![JAR search and dependency download from the Maven repository](/logo.png)
com.actelion.research.chem.shredder.Fragmenter3D Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of openchemlib Show documentation
Show all versions of openchemlib Show documentation
Open Source Chemistry Library
package com.actelion.research.chem.shredder;
import com.actelion.research.chem.Canonizer;
import com.actelion.research.chem.StereoMolecule;
import com.actelion.research.chem.conf.*;
import com.actelion.research.util.IntArrayComparator;
import java.util.ArrayList;
import java.util.TreeSet;
public class Fragmenter3D {
private final int mMinAtoms,mMaxAtoms,mMaxBondFlexibilitySum,mMinExits,mMaxExits;
private final ArrayList mFragmentList;
/**
*
* @param minAtoms
* @param maxAtoms
* @param maxBondFlexibilitySum
* @param minExits
* @param maxExits
*/
public Fragmenter3D(int minAtoms, int maxAtoms, int maxBondFlexibilitySum, int minExits, int maxExits) {
mMinAtoms = minAtoms;
mMaxAtoms = maxAtoms;
mMaxBondFlexibilitySum = maxBondFlexibilitySum;
mMinExits = minExits;
mMaxExits = maxExits;
mFragmentList = new ArrayList<>();
}
/**
* Applying the constraints passed to the Fragmenter3D constructor, this method shredders
* the given 3D-molecule and returns all generated 3D-fragments as an ArrayList.
* The list is re-used by subsequent calls to this nethod. Thus, process/consume the
* fragment list before calling this method again.
* @param mol
* @param withHydrogen whether built fragments shall include hydrogen atoms
* @return Fragment3D list of given molecule
*/
public ArrayList buildFragments(StereoMolecule mol, boolean withHydrogen) {
mFragmentList.clear();
mol.stripSmallFragments();
if (withHydrogen)
new AtomAssembler(mol).addImplicitHydrogens();
else
mol.removeExplicitHydrogens(false, true);
boolean[] isRotatableBond = new boolean[mol.getAllBonds()];
TorsionDB.findRotatableBonds(mol, true, isRotatableBond);
float[] bondFlexibility = new MolecularFlexibilityCalculator().calculateBondFlexibilities(mol, isRotatableBond);
int[] fragmentNo = new int[mol.getAllAtoms()];
int fragmentCount = mol.getFragmentNumbers(fragmentNo, isRotatableBond, true);
int[] atomCount = new int[fragmentCount];
for (int atom=0; atom baseFragmentCombinationSet = new TreeSet<>(new IntArrayComparator());
boolean[] isMemberFragment = new boolean[fragmentCount];
for (int i=0; i baseFragmentCombinationSet, BaseFragmentInfo[] baseFragmentInfo) {
if (atomCount > mMaxAtoms)
return;
int[] baseFragmentList = new int[usedBaseFragmentCount];
int index = 0;
for (int i=0; i= mMinAtoms)
addFragment(mol, fragmentNo, isMemberFragment);
BaseFragmentInfo previousBaseFragmentInfo = baseFragmentInfo[previousBaseFragment];
for (int i=0; i mMaxExits)
return;
int bondCount = 0;
for (int bond=0; bond
© 2015 - 2025 Weber Informatics LLC | Privacy Policy