mirror of
https://github.com/rdkit/rdkit.git
synced 2026-06-03 21:44:30 +08:00
committed by
Brian Kelley
parent
4d14a819e6
commit
8524652a86
@@ -1,6 +1,5 @@
|
||||
// $Id$
|
||||
//
|
||||
// Copyright (C) 2004-2008 Greg Landrum and Rational Discovery LLC
|
||||
// Copyright (C) 2004-2019 Greg Landrum and Rational Discovery LLC
|
||||
//
|
||||
// @@ All Rights Reserved @@
|
||||
// This file is part of the RDKit.
|
||||
@@ -182,7 +181,8 @@ bool computeRandomCoords(RDGeom::PointPtrVect &positions, double boxSize,
|
||||
ForceFields::ForceField *constructForceField(
|
||||
const BoundsMatrix &mmat, RDGeom::PointPtrVect &positions,
|
||||
const VECT_CHIRALSET &csets, double weightChiral, double weightFourthDim,
|
||||
std::map<std::pair<int, int>, double> *extraWeights, double basinSizeTol) {
|
||||
std::map<std::pair<int, int>, double> *extraWeights, double basinSizeTol,
|
||||
boost::dynamic_bitset<> *fixedPts) {
|
||||
unsigned int N = mmat.numRows();
|
||||
CHECK_INVARIANT(N == positions.size(), "");
|
||||
auto *field = new ForceFields::ForceField(positions[0]->dimension());
|
||||
@@ -192,6 +192,9 @@ ForceFields::ForceField *constructForceField(
|
||||
|
||||
for (unsigned int i = 1; i < N; i++) {
|
||||
for (unsigned int j = 0; j < i; j++) {
|
||||
if (fixedPts != nullptr && (*fixedPts)[i] && (*fixedPts)[j]) {
|
||||
continue;
|
||||
}
|
||||
double w = 1.0;
|
||||
double l = mmat.getLowerBound(i, j);
|
||||
double u = mmat.getUpperBound(i, j);
|
||||
@@ -225,7 +228,7 @@ ForceFields::ForceField *constructForceField(
|
||||
|
||||
// finally the contribution from the fourth dimension if we need to
|
||||
if ((field->dimension() == 4) && (weightFourthDim > 1.e-8)) {
|
||||
for (unsigned int i = 1; i < N; i++) {
|
||||
for (unsigned int i = 0; i < N; i++) {
|
||||
auto *contrib = new FourthDimContrib(field, i, weightFourthDim);
|
||||
field->contribs().push_back(ForceFields::ContribPtr(contrib));
|
||||
}
|
||||
@@ -238,7 +241,9 @@ ForceFields::ForceField *construct3DForceField(
|
||||
const ForceFields::CrystalFF::CrystalFFDetails &etkdgDetails) {
|
||||
unsigned int N = mmat.numRows();
|
||||
CHECK_INVARIANT(N == positions.size(), "");
|
||||
CHECK_INVARIANT(etkdgDetails.expTorsionAtoms.size() == etkdgDetails.expTorsionAngles.size(), "");
|
||||
CHECK_INVARIANT(etkdgDetails.expTorsionAtoms.size() ==
|
||||
etkdgDetails.expTorsionAngles.size(),
|
||||
"");
|
||||
auto *field = new ForceFields::ForceField(positions[0]->dimension());
|
||||
for (unsigned int i = 0; i < N; ++i) {
|
||||
field->positions().push_back(positions[i]);
|
||||
@@ -291,8 +296,8 @@ ForceFields::ForceField *construct3DForceField(
|
||||
}
|
||||
auto *contrib = new ForceFields::UFF::InversionContrib(
|
||||
field, improperAtom[n[0]], improperAtom[n[1]], improperAtom[n[2]],
|
||||
improperAtom[n[3]], improperAtom[4], static_cast<bool>(improperAtom[5]),
|
||||
oobForceScalingFactor);
|
||||
improperAtom[n[3]], improperAtom[4],
|
||||
static_cast<bool>(improperAtom[5]), oobForceScalingFactor);
|
||||
field->contribs().push_back(ForceFields::ContribPtr(contrib));
|
||||
}
|
||||
}
|
||||
@@ -360,7 +365,9 @@ ForceFields::ForceField *constructPlain3DForceField(
|
||||
const ForceFields::CrystalFF::CrystalFFDetails &etkdgDetails) {
|
||||
unsigned int N = mmat.numRows();
|
||||
CHECK_INVARIANT(N == positions.size(), "");
|
||||
CHECK_INVARIANT(etkdgDetails.expTorsionAtoms.size() == etkdgDetails.expTorsionAngles.size(), "");
|
||||
CHECK_INVARIANT(etkdgDetails.expTorsionAtoms.size() ==
|
||||
etkdgDetails.expTorsionAngles.size(),
|
||||
"");
|
||||
auto *field = new ForceFields::ForceField(positions[0]->dimension());
|
||||
for (unsigned int i = 0; i < N; ++i) {
|
||||
field->positions().push_back(positions[i]);
|
||||
@@ -438,7 +445,7 @@ ForceFields::ForceField *constructPlain3DForceField(
|
||||
|
||||
ForceFields::ForceField *construct3DImproperForceField(
|
||||
const BoundsMatrix &mmat, RDGeom::Point3DPtrVect &positions,
|
||||
const std::vector<std::vector<int> > &improperAtoms,
|
||||
const std::vector<std::vector<int>> &improperAtoms,
|
||||
const std::vector<int> &atomNums) {
|
||||
(void)atomNums;
|
||||
unsigned int N = mmat.numRows();
|
||||
@@ -475,13 +482,13 @@ ForceFields::ForceField *construct3DImproperForceField(
|
||||
}
|
||||
auto *contrib = new ForceFields::UFF::InversionContrib(
|
||||
field, improperAtom[n[0]], improperAtom[n[1]], improperAtom[n[2]],
|
||||
improperAtom[n[3]], improperAtom[4], static_cast<bool>(improperAtom[5]),
|
||||
oobForceScalingFactor);
|
||||
improperAtom[n[3]], improperAtom[4],
|
||||
static_cast<bool>(improperAtom[5]), oobForceScalingFactor);
|
||||
field->contribs().push_back(ForceFields::ContribPtr(contrib));
|
||||
}
|
||||
}
|
||||
|
||||
return field;
|
||||
|
||||
} // construct3DImproperForceField
|
||||
}
|
||||
} // construct3DImproperForceField
|
||||
} // namespace DistGeom
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// Copyright (C) 2004-2007 Greg Landrum and Rational Discovery LLC
|
||||
// Copyright (C) 2004-2019 Greg Landrum and Rational Discovery LLC
|
||||
//
|
||||
// @@ All Rights Reserved @@
|
||||
// This file is part of the RDKit.
|
||||
@@ -17,13 +17,14 @@
|
||||
#include <Geometry/point.h>
|
||||
#include "ChiralSet.h"
|
||||
#include <RDGeneral/utils.h>
|
||||
#include <boost/dynamic_bitset.hpp>
|
||||
|
||||
namespace ForceFields {
|
||||
class ForceField;
|
||||
namespace CrystalFF {
|
||||
struct CrystalFFDetails;
|
||||
}
|
||||
struct CrystalFFDetails;
|
||||
}
|
||||
} // namespace ForceFields
|
||||
|
||||
namespace DistGeom {
|
||||
|
||||
@@ -36,12 +37,13 @@ namespace DistGeom {
|
||||
|
||||
\return the largest element of the distance matrix
|
||||
*/
|
||||
RDKIT_DISTGEOMETRY_EXPORT double pickRandomDistMat(const BoundsMatrix &mmat,
|
||||
RDNumeric::SymmMatrix<double> &distmat, int seed = -1);
|
||||
RDKIT_DISTGEOMETRY_EXPORT double pickRandomDistMat(
|
||||
const BoundsMatrix &mmat, RDNumeric::SymmMatrix<double> &distmat,
|
||||
int seed = -1);
|
||||
//! \overload
|
||||
RDKIT_DISTGEOMETRY_EXPORT double pickRandomDistMat(const BoundsMatrix &mmat,
|
||||
RDNumeric::SymmMatrix<double> &distmat,
|
||||
RDKit::double_source_type &rng);
|
||||
RDKIT_DISTGEOMETRY_EXPORT double pickRandomDistMat(
|
||||
const BoundsMatrix &mmat, RDNumeric::SymmMatrix<double> &distmat,
|
||||
RDKit::double_source_type &rng);
|
||||
|
||||
//! Compute an initial embedded in 3D based on a distance matrix
|
||||
/*!
|
||||
@@ -62,16 +64,15 @@ RDKIT_DISTGEOMETRY_EXPORT double pickRandomDistMat(const BoundsMatrix &mmat,
|
||||
|
||||
\return true if the embedding was successful
|
||||
*/
|
||||
RDKIT_DISTGEOMETRY_EXPORT bool computeInitialCoords(const RDNumeric::SymmMatrix<double> &distmat,
|
||||
RDGeom::PointPtrVect &positions,
|
||||
bool randNegEig = false, unsigned int numZeroFail = 2,
|
||||
int seed = -1);
|
||||
RDKIT_DISTGEOMETRY_EXPORT bool computeInitialCoords(
|
||||
const RDNumeric::SymmMatrix<double> &distmat,
|
||||
RDGeom::PointPtrVect &positions, bool randNegEig = false,
|
||||
unsigned int numZeroFail = 2, int seed = -1);
|
||||
//! \overload
|
||||
RDKIT_DISTGEOMETRY_EXPORT bool computeInitialCoords(const RDNumeric::SymmMatrix<double> &distmat,
|
||||
RDGeom::PointPtrVect &positions,
|
||||
RDKit::double_source_type &rng,
|
||||
bool randNegEig = false,
|
||||
unsigned int numZeroFail = 2);
|
||||
RDKIT_DISTGEOMETRY_EXPORT bool computeInitialCoords(
|
||||
const RDNumeric::SymmMatrix<double> &distmat,
|
||||
RDGeom::PointPtrVect &positions, RDKit::double_source_type &rng,
|
||||
bool randNegEig = false, unsigned int numZeroFail = 2);
|
||||
|
||||
//! places atoms randomly in a box
|
||||
/*!
|
||||
@@ -82,11 +83,12 @@ RDKIT_DISTGEOMETRY_EXPORT bool computeInitialCoords(const RDNumeric::SymmMatrix<
|
||||
|
||||
\return true if the coordinate generation was successful
|
||||
*/
|
||||
RDKIT_DISTGEOMETRY_EXPORT bool computeRandomCoords(RDGeom::PointPtrVect &positions, double boxSize,
|
||||
int seed = -1);
|
||||
RDKIT_DISTGEOMETRY_EXPORT bool computeRandomCoords(
|
||||
RDGeom::PointPtrVect &positions, double boxSize, int seed = -1);
|
||||
//! \overload
|
||||
RDKIT_DISTGEOMETRY_EXPORT bool computeRandomCoords(RDGeom::PointPtrVect &positions, double boxSize,
|
||||
RDKit::double_source_type &rng);
|
||||
RDKIT_DISTGEOMETRY_EXPORT bool computeRandomCoords(
|
||||
RDGeom::PointPtrVect &positions, double boxSize,
|
||||
RDKit::double_source_type &rng);
|
||||
|
||||
//! Setup the error function for violation of distance bounds as a forcefield
|
||||
/*!
|
||||
@@ -118,10 +120,10 @@ RDKIT_DISTGEOMETRY_EXPORT ForceFields::ForceField *constructForceField(
|
||||
const VECT_CHIRALSET &csets, double weightChiral = 1.0,
|
||||
double weightFourthDim = 0.1,
|
||||
std::map<std::pair<int, int>, double> *extraWeights = 0,
|
||||
double basinSizeTol = 5.0);
|
||||
double basinSizeTol = 5.0, boost::dynamic_bitset<> *fixedPts = nullptr);
|
||||
|
||||
//! Force field with experimental torsion angle preferences and 1-2/1-3 distance
|
||||
//constraints
|
||||
// constraints
|
||||
/*!
|
||||
|
||||
\param mmat Distance bounds matrix
|
||||
@@ -136,7 +138,7 @@ RDKIT_DISTGEOMETRY_EXPORT ForceFields::ForceField *construct3DForceField(
|
||||
const BoundsMatrix &mmat, RDGeom::Point3DPtrVect &positions,
|
||||
const ForceFields::CrystalFF::CrystalFFDetails &etkdgDetails);
|
||||
//! Force field with experimental torsion angle preferences and 1-2/1-3 distance
|
||||
//constraints
|
||||
// constraints
|
||||
/*!
|
||||
|
||||
\param mmat Distance bounds matrix
|
||||
@@ -155,19 +157,21 @@ RDKIT_DISTGEOMETRY_EXPORT ForceFields::ForceField *constructPlain3DForceField(
|
||||
/*!
|
||||
|
||||
\param mmat Distance bounds matrix
|
||||
\param positions A vector of pointers to 3D Points to write out the resulting coordinates
|
||||
\param improperAtoms A list of groups of 4 atom indices for inversion terms
|
||||
\param atomNums A list of atomic numbers for all atoms in the molecule
|
||||
\param positions A vector of pointers to 3D Points to write out the
|
||||
resulting coordinates \param improperAtoms A list of groups of 4 atom
|
||||
indices for inversion terms \param atomNums A list of atomic numbers
|
||||
for all atoms in the molecule
|
||||
|
||||
\return a pointer to a ForceField with improper terms
|
||||
<b>NOTE:</b> the caller is responsible for deleting this force field.
|
||||
|
||||
*/
|
||||
RDKIT_DISTGEOMETRY_EXPORT ForceFields::ForceField *construct3DImproperForceField(
|
||||
RDKIT_DISTGEOMETRY_EXPORT ForceFields::ForceField *
|
||||
construct3DImproperForceField(
|
||||
const BoundsMatrix &mmat, RDGeom::Point3DPtrVect &positions,
|
||||
const std::vector<std::vector<int> > &improperAtoms,
|
||||
const std::vector<std::vector<int>> &improperAtoms,
|
||||
const std::vector<int> &atomNums);
|
||||
|
||||
}
|
||||
} // namespace DistGeom
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user