Package org.openmolecules.chem.conf.gen
Class TorsionSetStrategy
- java.lang.Object
-
- org.openmolecules.chem.conf.gen.TorsionSetStrategy
-
- Direct Known Subclasses:
TorsionSetStrategyLikelySystematic
,TorsionSetStrategyRandom
public abstract class TorsionSetStrategy extends java.lang.Object
Knowing all rotatable bonds of an underlying molecule and knowing those rigid fragments that are connected by them, the TorsionSetStrategy provides a mechanism to deliver valid and unique torsion sets, each effectively defining an individual conformer. While the strategies of the implementing classes differ (random, biased random, systematic, ...) this parent class provides the following common functionality:
- maintains a history of already delivered torsion sets.
- provides a novelty check for torsion sets suggested by derived classes.
- check new torsion sets for atom collisions.
- maintains a list of torsion set subsets that cause atom collisions.
- provides a quick check, whether a new torsion set contains a subset causing collisions.
A TorsionSetStrategy is employed by a ConformerGenerator, which repeatedly calls getNextTorsionIndexes(), creates the conformer, checks for atom collisions and reports back, whether and how serious atom collisions occurred.
-
-
Field Summary
Fields Modifier and Type Field Description static double
MAX_ALLOWED_COLLISION_INTENSITY
protected RigidFragment[]
mRigidFragment
protected RotatableBond[]
mRotatableBond
-
Constructor Summary
Constructors Constructor Description TorsionSetStrategy(RotatableBond[] rotatableBond, RigidFragment[] fragment)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description double
calculateCollisionTolerance()
protected TorsionSet
createTorsionSet(int[] torsionIndex, int[] conformerIndex)
Creates a new TorsionSet object from a torsion index array.abstract TorsionSet
createTorsionSet(TorsionSet previousTorsionSet)
Provide the next set of torsion angles using a specific strategy and considering, which angle combinations were already tried, which had failed, and (depending on the strategy) considering the likelyhoods of particular torsions.java.lang.String
eliminationRuleString(TorsionSetEliminationRule rule)
TorsionSet
getBestCollidingTorsionIndexes()
If no collision free torsion set can be constructed, this method is called to get the torsion set with the least atom collision strain.protected double[]
getBondAndFragmentCollisionIntensities(TorsionSet collidingTorsionSet)
Calculates for every rotatable bond and for every rigid fragment a collision intensity sum for the given torsion/conformer state from the collision rules already known.int[]
getBondsBetweenFragments(int f1, int f2)
double
getContribution(TorsionSet torsionSet)
With best current knowledge about colliding torsion combinations and based on the individual frequencies of currently active torsions this method returns the conformers's overall contribution to the total set of non colliding conformers.java.util.ArrayList<TorsionSetEliminationRule>
getEliminationRuleList()
int
getFailureCount()
TorsionSet
getNextTorsionSet(TorsionSet previousTorsionSet)
Creates the next set of torsion indexes to be tried by the ConformerGenerator.int
getPermutationCount()
int
getTorsionSetCount()
protected boolean
isNewTorsionSet(TorsionSet ts)
void
setMaxTotalCount(int maxTotalCount)
-
-
-
Field Detail
-
MAX_ALLOWED_COLLISION_INTENSITY
public static final double MAX_ALLOWED_COLLISION_INTENSITY
- See Also:
- Constant Field Values
-
mRotatableBond
protected RotatableBond[] mRotatableBond
-
mRigidFragment
protected RigidFragment[] mRigidFragment
-
-
Constructor Detail
-
TorsionSetStrategy
public TorsionSetStrategy(RotatableBond[] rotatableBond, RigidFragment[] fragment)
-
-
Method Detail
-
getBondsBetweenFragments
public int[] getBondsBetweenFragments(int f1, int f2)
-
setMaxTotalCount
public void setMaxTotalCount(int maxTotalCount)
-
getPermutationCount
public int getPermutationCount()
- Returns:
- pre-calculated number of all possible torsion index permutations
-
getFailureCount
public int getFailureCount()
- Returns:
- number of generated torsion sets that resulted in collisions
-
getTorsionSetCount
public int getTorsionSetCount()
- Returns:
- number of generated torsion sets till now
-
createTorsionSet
protected TorsionSet createTorsionSet(int[] torsionIndex, int[] conformerIndex)
Creates a new TorsionSet object from a torsion index array. An overall likelihood of the new torsion set is calculated by multiplying individual likelihoods of the specific torsion angles of all underlying RotatableBonds.- Parameters:
torsionIndex
-conformerIndex
- null or conformer index for every rigid fragment- Returns:
-
isNewTorsionSet
protected boolean isNewTorsionSet(TorsionSet ts)
-
getNextTorsionSet
public final TorsionSet getNextTorsionSet(TorsionSet previousTorsionSet)
Creates the next set of torsion indexes to be tried by the ConformerGenerator. If the previous set obtained by this method resulted in an atom collision, then the collision intensity matrix among all rigid fragments and the overall collision intensity sum must have been reported to the torsion set. Torsion sets returned by this method are guaranteed to avoid torsion sequences that had previously caused collisions. To achieve this goal, TorsionSetStrategy repeatedly requests new TorsionSets from the strategy implementation and returns the first set that is not in conflict with the collision rules already collected or until no further set exists.- Parameters:
previousTorsionSet
- delivered by this method (or null if it is the first call)- Returns:
- torsion index set that adheres to already known collision rules
-
getBestCollidingTorsionIndexes
public TorsionSet getBestCollidingTorsionIndexes()
If no collision free torsion set can be constructed, this method is called to get the torsion set with the least atom collision strain.- Returns:
-
createTorsionSet
public abstract TorsionSet createTorsionSet(TorsionSet previousTorsionSet)
Provide the next set of torsion angles using a specific strategy and considering, which angle combinations were already tried, which had failed, and (depending on the strategy) considering the likelyhoods of particular torsions. The implementation must not return the same torsion set multiple times, either by using a systematic strategy or by calling isNewTorsionSet() to sort out redundant ones.- Parameters:
previousTorsionSet
- previous torsion set which may or may not be used by strategy- Returns:
-
getBondAndFragmentCollisionIntensities
protected double[] getBondAndFragmentCollisionIntensities(TorsionSet collidingTorsionSet)
Calculates for every rotatable bond and for every rigid fragment a collision intensity sum for the given torsion/conformer state from the collision rules already known. If the given torsion or conformer index of the collidingTorsionSet is covered by a rule then the rule's collision intensity is added to all involved bond's intensity sums. Strategies may focus on those bond torsions or conformers first that have the highest collision intensity sums.- Parameters:
collidingTorsionSet
-- Returns:
- collision intensity sum for every rotatable bond and rigid fragment
-
getContribution
public double getContribution(TorsionSet torsionSet)
With best current knowledge about colliding torsion combinations and based on the individual frequencies of currently active torsions this method returns the conformers's overall contribution to the total set of non colliding conformers.- Returns:
- this conformer's contribution to all conformers
-
calculateCollisionTolerance
public double calculateCollisionTolerance()
-
eliminationRuleString
public java.lang.String eliminationRuleString(TorsionSetEliminationRule rule)
-
getEliminationRuleList
public java.util.ArrayList<TorsionSetEliminationRule> getEliminationRuleList()
-
-