com.actelion.research.chem.conf.MolecularFlexibilityCalculator 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
/*
* Copyright (c) 1997 - 2016
* Actelion Pharmaceuticals Ltd.
* Gewerbestrasse 16
* CH-4123 Allschwil, Switzerland
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* 3. Neither the name of the the copyright holder nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* @author Thomas Sander
*/
package com.actelion.research.chem.conf;
import com.actelion.research.chem.Molecule;
import com.actelion.research.chem.StereoMolecule;
public class MolecularFlexibilityCalculator {
public MolecularFlexibilityCalculator() {
TorsionDB.initialize(TorsionDB.MODE_ANGLES);
}
/**
* Calculates a molecular flexibility as a value from 0.0 to 1.0 considering torsion statistics
* derived from the CSD database (torsion maxima, frequencies, and 50% intervals) of rotatable bonds.
* It also considers the effect that a specific torsion has on the overall geometry of the
* molecule, i.e. central bonds are weighted higher than those in the periphery.
* Currently it is assumed that the mol consists of one(!!!) fragment only.
*
* In more detail the following steps are done:
* -- relevant rotatable bonds are determined, i.e. single bonds, which are not in a ring with less than 6 members,
* where both atoms are sp2 or sp3 and carry at least one more non-hydrogen neighbor,
* which are not symmetrically redundant, and those where a torsion change modifies the relative location of atoms.
* For chains of conjugated triple bonds the following applies:
* If at least one terminal sp2/sp3 atom has no external neighbor, then no single bond is considered rotatable.
* Otherwise that terminal single bond connecting the smaller substituent is considered the only rotatable bond
* of the linear atom strand.
* -- the local environment of any rotatable bonds is characterized by its first and second shell of neighbours plus
* various properties as ring membership, aromaticity, stereo configuration, if applicable, etc.
* -- a bond specific flexibility value is calculated from the torsion angle histogram of equivalent bonds
* within any high-resolution x-ray structures of the CSD database. (in the rare cases with no CSD precedents
* the histogram is roughly predicted). Frequency distributions with wide and multiple distribution maxima of
* similar heights receive the local flexibility values around close to 1.0 while histograms with one narrow single
* peak are close to 0.0.
* -- a weighting factor is assigned to every rotatable bond as follows:
* - for ring bonds: factor=0.33, since ring bonds cannot be changed without affecting typically two other rings bonds
* - other bonds: factor=sqrt(2.0 * smallerSideNonHydrogenAtomCount / moleculeNonHydrogenAtomCount)
* -- from the number of all bonds, rotatabale bonds, their specific flexibility values and weighting factor an
* overall flexibility value is calculated with a non-linear incremental approach.
* @param mol one molecular fragment(!)
* @return
*/
public float calculateMolecularFlexibility(StereoMolecule mol) {
mol.ensureHelperArrays(Molecule.cHelperRings);
if (mol.getAtoms() == 0)
return 0f;
boolean[] isRotatableBond = new boolean[mol.getBonds()];
int rotatableBondCount = TorsionDB.findRotatableBonds(mol, false, isRotatableBond);
if (rotatableBondCount == 0)
return 0f;
// calculate flexibility values of individual rotatable bonds
float[] bondFlexibility = new float[mol.getBonds()];
for (int bond=0; bond