mirror of
https://github.com/rdkit/rdkit.git
synced 2026-06-03 21:44:30 +08:00
Merge branch 'master' into fix/numpy-cleanup
This commit is contained in:
@@ -273,6 +273,12 @@ if(NOT RDK_INSTALL_INTREE)
|
||||
)
|
||||
endif(NOT RDK_INSTALL_INTREE)
|
||||
|
||||
if (RDK_SQUASH_MVC_SECURE_WARNINGS)
|
||||
MESSAGE("== Squashing MSVC Security warnings (do not use during development)")
|
||||
ADD_DEFINITIONS("-D_SCL_SECURE_NO_WARNINGS")
|
||||
ADD_DEFINITIONS("/wd4996")
|
||||
endif(RDK_SQUASH_MVC_SECURE_WARNINGS)
|
||||
|
||||
add_subdirectory(External)
|
||||
add_subdirectory(Code)
|
||||
|
||||
|
||||
@@ -210,7 +210,7 @@ void setHydrogenCoords(ROMol *mol, unsigned int hydIdx, unsigned int heavyIdx) {
|
||||
const Atom *tAtom = mol->getAtomWithIdx(*nbrIdx);
|
||||
int cip = 0;
|
||||
tAtom->getPropIfPresent<int>(common_properties::_CIPRank, cip);
|
||||
nbrs.push_back(std::make_pair(cip, *nbrIdx));
|
||||
nbrs.push_back(std::make_pair(cip, rdcast<int>(*nbrIdx)));
|
||||
}
|
||||
++nbrIdx;
|
||||
}
|
||||
@@ -611,7 +611,7 @@ void mergeQueryHs(RWMol &mol, bool mergeUnmappedOnly) {
|
||||
Atom &bgn = *mol.getAtomWithIdx(*begin);
|
||||
if (!mergeUnmappedOnly ||
|
||||
!bgn.hasProp(common_properties::molAtomMapNumber)) {
|
||||
atomsToRemove.push_back(*begin);
|
||||
atomsToRemove.push_back(rdcast<unsigned int>(*begin));
|
||||
++numHsToRemove;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -62,7 +62,7 @@ void pickFusedRings(int curr, const INT_INT_VECT_MAP &neighMap, INT_VECT &res,
|
||||
|
||||
bool checkFused(const INT_VECT &rids, INT_INT_VECT_MAP &ringNeighs) {
|
||||
INT_INT_VECT_MAP_CI nci;
|
||||
int nrings = ringNeighs.size();
|
||||
int nrings = rdcast<int>(ringNeighs.size());
|
||||
boost::dynamic_bitset<> done(nrings);
|
||||
int rid;
|
||||
INT_VECT fused;
|
||||
@@ -87,7 +87,7 @@ bool checkFused(const INT_VECT &rids, INT_INT_VECT_MAP &ringNeighs) {
|
||||
|
||||
void makeRingNeighborMap(const VECT_INT_VECT &brings,
|
||||
INT_INT_VECT_MAP &neighMap, unsigned int maxSize) {
|
||||
int nrings = brings.size();
|
||||
int nrings = rdcast<int>(brings.size());
|
||||
int i, j;
|
||||
INT_VECT ring1;
|
||||
for (i = 0; i < nrings; i++) {
|
||||
@@ -340,7 +340,7 @@ void applyHuckelToFused(
|
||||
|
||||
INT_VECT aromRings;
|
||||
aromRings.resize(0);
|
||||
unsigned int nrings = fused.size();
|
||||
unsigned int nrings = rdcast<unsigned int>(fused.size());
|
||||
INT_VECT curRs;
|
||||
INT_VECT_CI mri;
|
||||
curRs.push_back(fused.front());
|
||||
@@ -350,7 +350,7 @@ void applyHuckelToFused(
|
||||
pos = -1;
|
||||
INT_VECT unionAtms;
|
||||
Union(srings, unionAtms);
|
||||
unsigned int nAtms = unionAtms.size();
|
||||
unsigned int nAtms = rdcast<unsigned int>(unionAtms.size());
|
||||
std::set<unsigned int> doneAtoms;
|
||||
while (1) {
|
||||
if (pos == -1) {
|
||||
@@ -414,7 +414,7 @@ void applyHuckelToFused(
|
||||
}
|
||||
} // end check huckel rule
|
||||
} // end while(1)
|
||||
narom += aromRings.size();
|
||||
narom += rdcast<int>(aromRings.size());
|
||||
}
|
||||
|
||||
bool isAtomCandForArom(const Atom *at, const ElectronDonorType edon) {
|
||||
@@ -691,7 +691,7 @@ int setAromaticity(RWMol &mol) {
|
||||
// huckel rule - of course paying attention to fused systems.
|
||||
INT_VECT doneRs;
|
||||
int curr = 0;
|
||||
int cnrs = cRings.size();
|
||||
int cnrs = rdcast<int>(cRings.size());
|
||||
boost::dynamic_bitset<> fusDone(cnrs);
|
||||
INT_VECT fused;
|
||||
while (curr < cnrs) {
|
||||
|
||||
@@ -131,7 +131,9 @@ class Atom {
|
||||
- the index should be <tt>< this->getOwningMol()->getNumAtoms()</tt>
|
||||
*/
|
||||
void setIdx(unsigned int index) { d_index = index; };
|
||||
|
||||
//! overload
|
||||
template<class U>
|
||||
void setIdx(const U index) { setIdx(rdcast<unsigned int>(index)); }
|
||||
//! returns the explicit degree of the Atom (number of bonded
|
||||
//! neighbors in the graph)
|
||||
/*!
|
||||
|
||||
@@ -578,7 +578,7 @@ void dfsBuildStack(ROMol &mol, int atomIdx, int inBondIdx,
|
||||
|
||||
seenFromHere.set(atomIdx);
|
||||
molStack.push_back(MolStackElem(atom));
|
||||
atomOrders[atom->getIdx()] = molStack.size();
|
||||
atomOrders[atom->getIdx()] = rdcast<int>(molStack.size());
|
||||
colors[atomIdx] = GREY_NODE;
|
||||
|
||||
INT_LIST travList;
|
||||
@@ -601,7 +601,7 @@ void dfsBuildStack(ROMol &mol, int atomIdx, int inBondIdx,
|
||||
// this is end of the ring closure
|
||||
// we can just pull the ring index from the bond itself:
|
||||
molStack.push_back(MolStackElem(bond, atomIdx));
|
||||
bondVisitOrders[bIdx] = molStack.size();
|
||||
bondVisitOrders[bIdx] = rdcast<int>(molStack.size());
|
||||
molStack.push_back(MolStackElem(ringIdx));
|
||||
// don't make the ring digit immediately available again: we don't want
|
||||
// to have the same
|
||||
@@ -616,7 +616,7 @@ void dfsBuildStack(ROMol &mol, int atomIdx, int inBondIdx,
|
||||
throw ValueErrorException(
|
||||
"Too many rings open at once. SMILES cannot be generated.");
|
||||
}
|
||||
unsigned int lowestRingIdx = cAIt - cyclesAvailable.begin();
|
||||
unsigned int lowestRingIdx = rdcast<unsigned int>(cAIt - cyclesAvailable.begin());
|
||||
cyclesAvailable[lowestRingIdx] = 0;
|
||||
++lowestRingIdx;
|
||||
bond->setProp(common_properties::_TraversalRingClosureBond,
|
||||
@@ -710,16 +710,16 @@ void dfsBuildStack(ROMol &mol, int atomIdx, int inBondIdx,
|
||||
travList.push_back(bond->getIdx());
|
||||
if (possiblesIt + 1 != possibles.end()) {
|
||||
// we're branching
|
||||
molStack.push_back(MolStackElem("(", possiblesIt - possibles.begin()));
|
||||
molStack.push_back(MolStackElem("(", rdcast<int>(possiblesIt - possibles.begin())));
|
||||
}
|
||||
molStack.push_back(MolStackElem(bond, atomIdx));
|
||||
bondVisitOrders[bond->getIdx()] = molStack.size();
|
||||
bondVisitOrders[bond->getIdx()] = rdcast<int>(molStack.size());
|
||||
dfsBuildStack(mol, possibleIdx, bond->getIdx(), colors, cycles, ranks,
|
||||
cyclesAvailable, molStack, atomOrders, bondVisitOrders,
|
||||
atomRingClosures, atomTraversalBondOrder, bondsInPlay,
|
||||
bondSymbols);
|
||||
if (possiblesIt + 1 != possibles.end()) {
|
||||
molStack.push_back(MolStackElem(")", possiblesIt - possibles.begin()));
|
||||
molStack.push_back(MolStackElem(")", rdcast<int>(possiblesIt - possibles.begin())));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -238,7 +238,7 @@ void iterateCIPRanks(const ROMol &mol, DOUBLE_VECT &invars, UINT_VECT &ranks,
|
||||
cipEntries[*it].insert(cipEntries[*it].end(), localEntry.rbegin(),
|
||||
localEntry.rend());
|
||||
if (cipEntries[*it].size() > longestEntry) {
|
||||
longestEntry = cipEntries[*it].size();
|
||||
longestEntry = rdcast<unsigned int>(cipEntries[*it].size());
|
||||
}
|
||||
}
|
||||
// ----------------------------------------------------
|
||||
@@ -246,7 +246,7 @@ void iterateCIPRanks(const ROMol &mol, DOUBLE_VECT &invars, UINT_VECT &ranks,
|
||||
// pad the entries so that we compare rounds to themselves:
|
||||
//
|
||||
for (INT_LIST_I it = allIndices.begin(); it != allIndices.end(); ++it) {
|
||||
unsigned int sz = cipEntries[*it].size();
|
||||
unsigned int sz = rdcast<unsigned int>(cipEntries[*it].size());
|
||||
if (sz < longestEntry) {
|
||||
cipEntries[*it].insert(cipEntries[*it].end(), longestEntry - sz, -1);
|
||||
}
|
||||
|
||||
@@ -79,9 +79,19 @@ class Conformer {
|
||||
|
||||
//! Get the position of the specified atom
|
||||
const RDGeom::Point3D &getAtomPos(unsigned int atomId) const;
|
||||
//! overload
|
||||
template<class U>
|
||||
const RDGeom::Point3D &getAtomPos(U atomId) const {
|
||||
return getAtomPos(rdcast<unsigned int>(atomId));
|
||||
}
|
||||
|
||||
//! Get the position of the specified atom
|
||||
RDGeom::Point3D &getAtomPos(unsigned int atomId);
|
||||
//! overload
|
||||
template<class U>
|
||||
RDGeom::Point3D &getAtomPos(U atomId) {
|
||||
return getAtomPos(rdcast<unsigned int>(atomId));
|
||||
}
|
||||
|
||||
//! Set the position of the specified atom
|
||||
inline void setAtomPos(unsigned int atomId, const RDGeom::Point3D &position) {
|
||||
@@ -91,7 +101,11 @@ class Conformer {
|
||||
}
|
||||
d_positions[atomId] = position;
|
||||
}
|
||||
|
||||
//! overload
|
||||
template<class U>
|
||||
void setAtomPos(U atomId, const RDGeom::Point3D &position) {
|
||||
return setAtomPos(rdcast<unsigned int>(atomId), position);
|
||||
}
|
||||
//! get the ID of this conformer
|
||||
inline unsigned int getId() const { return d_id; }
|
||||
|
||||
@@ -99,7 +113,7 @@ class Conformer {
|
||||
inline void setId(unsigned int id) { d_id = id; }
|
||||
|
||||
//! Get the number of atoms
|
||||
inline unsigned int getNumAtoms() const { return d_positions.size(); }
|
||||
inline unsigned int getNumAtoms() const { return rdcast<unsigned int>(d_positions.size()); }
|
||||
|
||||
inline bool is3D() const { return df_is3D; }
|
||||
inline void set3D(bool v) { df_is3D = v; }
|
||||
|
||||
@@ -38,7 +38,7 @@ boost::uint32_t computeRingInvariant(INT_VECT ring, unsigned int nAtoms) {
|
||||
void convertToBonds(const VECT_INT_VECT &res, VECT_INT_VECT &brings,
|
||||
const ROMol &mol) {
|
||||
for (VECT_INT_VECT_CI ri = res.begin(); ri != res.end(); ++ri) {
|
||||
unsigned int rsiz = ri->size();
|
||||
unsigned int rsiz = rdcast<unsigned int>(ri->size());
|
||||
INT_VECT bring(rsiz);
|
||||
for (unsigned int i = 0; i < (rsiz - 1); i++) {
|
||||
const Bond *bnd = mol.getBondBetweenAtoms((*ri)[i], (*ri)[i + 1]);
|
||||
@@ -171,7 +171,7 @@ void findSSSRforDupCands(const ROMol &mol, VECT_INT_VECT &res,
|
||||
for (VECT_INT_VECT_CI sri = srings.begin(); sri != srings.end();
|
||||
++sri) {
|
||||
if (sri->size() < minSiz) {
|
||||
minSiz = sri->size();
|
||||
minSiz = rdcast<unsigned int>(sri->size());
|
||||
}
|
||||
nrings.push_back((*sri));
|
||||
}
|
||||
@@ -261,7 +261,7 @@ void removeExtraRings(VECT_INT_VECT &res, unsigned int nexpt,
|
||||
j < res.size() && bitBrings[j].count() == bitBrings[i].count();
|
||||
++j) {
|
||||
if (!consider[j] || !availRings[j]) continue;
|
||||
int overlap = (bitBrings[j] & munion).count();
|
||||
int overlap = rdcast<int>((bitBrings[j] & munion).count());
|
||||
if (overlap > bestOverlap) {
|
||||
bestOverlap = overlap;
|
||||
bestJ = j;
|
||||
@@ -710,18 +710,18 @@ int smallestRingsBfs(const ROMol &mol, int root, VECT_INT_VECT &rings,
|
||||
ring.insert(ring.end(), npath.begin(), npath.end());
|
||||
#endif
|
||||
if (ring.size() <= curSize) {
|
||||
curSize = ring.size();
|
||||
curSize = rdcast<unsigned int>(ring.size());
|
||||
rings.push_back(ring);
|
||||
} else {
|
||||
// we are done with the smallest rings
|
||||
return rings.size();
|
||||
return rdcast<unsigned int>(rings.size());
|
||||
}
|
||||
} // end of found a ring
|
||||
} // end of we have seen this neighbor before
|
||||
} // end of nbrIdx not part of current path and not a done atom
|
||||
} // end of loop over neighbors of current atom
|
||||
} // moving to the next node
|
||||
return rings.size(); // if we are here we should have found everything around
|
||||
return rdcast<unsigned int>(rings.size()); // if we are here we should have found everything around
|
||||
// the node
|
||||
}
|
||||
|
||||
@@ -745,7 +745,7 @@ bool _atomSearchBFS(const ROMol &tMol, unsigned int startAtomIdx,
|
||||
while (nbrIdx != endNbrs) {
|
||||
if (*nbrIdx == endAtomIdx) {
|
||||
if (currAtomIdx != startAtomIdx) {
|
||||
tv.push_back(*nbrIdx);
|
||||
tv.push_back(rdcast<unsigned int>(*nbrIdx));
|
||||
// make sure the ring we just found isn't already in our set
|
||||
// of rings (this was an extension of sf.net issue 249)
|
||||
boost::uint32_t invr =
|
||||
@@ -763,7 +763,7 @@ bool _atomSearchBFS(const ROMol &tMol, unsigned int startAtomIdx,
|
||||
std::find(tv.begin(), tv.end(), *nbrIdx) == tv.end()) {
|
||||
//} else if(ringAtoms[*nbrIdx]){
|
||||
INT_VECT nv(tv);
|
||||
nv.push_back(*nbrIdx);
|
||||
nv.push_back(rdcast<unsigned int>(*nbrIdx));
|
||||
bfsq.push_back(nv);
|
||||
}
|
||||
++nbrIdx;
|
||||
@@ -828,7 +828,7 @@ int findSSSR(const ROMol &mol, VECT_INT_VECT &res) {
|
||||
// check if SSSR's are already on the molecule
|
||||
if (mol.getRingInfo()->isInitialized()) {
|
||||
res = mol.getRingInfo()->atomRings();
|
||||
return res.size();
|
||||
return rdcast<int>(res.size());
|
||||
} else {
|
||||
mol.getRingInfo()->initialize();
|
||||
}
|
||||
@@ -985,8 +985,8 @@ int findSSSR(const ROMol &mol, VECT_INT_VECT &res) {
|
||||
std::cerr<<std::endl;
|
||||
}
|
||||
#endif
|
||||
int nexpt = (nbnds - curFrag.size() + 1);
|
||||
int ssiz = fragRes.size();
|
||||
int nexpt = rdcast<int>((nbnds - curFrag.size() + 1));
|
||||
int ssiz = rdcast<int>(fragRes.size());
|
||||
|
||||
// first check that we got at least the number of expected rings
|
||||
// std::cerr<<"EXPT: "<<ssiz<<" "<<nexpt<<std::endl;
|
||||
@@ -1025,7 +1025,7 @@ int findSSSR(const ROMol &mol, VECT_INT_VECT &res) {
|
||||
}
|
||||
}
|
||||
}
|
||||
ssiz = fragRes.size();
|
||||
ssiz = rdcast<int>(fragRes.size());
|
||||
if (ssiz < nexpt) {
|
||||
throw ValueErrorException("could not find number of expected rings.");
|
||||
}
|
||||
@@ -1058,7 +1058,7 @@ int findSSSR(const ROMol &mol, VECT_INT_VECT &res) {
|
||||
// update the ring memberships of atoms and bonds in the molecule:
|
||||
// store the SSSR rings on the the molecule as a property
|
||||
// we will ignore any existing SSSRs ont eh molecule - simply overwrite
|
||||
return res.size();
|
||||
return rdcast<int>(res.size());
|
||||
}
|
||||
|
||||
int symmetrizeSSSR(ROMol &mol) {
|
||||
@@ -1079,7 +1079,7 @@ int symmetrizeSSSR(ROMol &mol, VECT_INT_VECT &res) {
|
||||
nsssr = findSSSR(mol, sssrs);
|
||||
} else {
|
||||
sssrs = mol.getRingInfo()->atomRings();
|
||||
nsssr = sssrs.size();
|
||||
nsssr = rdcast<unsigned int>(sssrs.size());
|
||||
}
|
||||
|
||||
VECT_INT_VECT_CI srci;
|
||||
@@ -1092,7 +1092,7 @@ int symmetrizeSSSR(ROMol &mol, VECT_INT_VECT &res) {
|
||||
// now check if there are any extra rings on the molecule
|
||||
if (!mol.hasProp(common_properties::extraRings)) {
|
||||
// no extra rings nothign to be done
|
||||
return res.size();
|
||||
return rdcast<int>(res.size());
|
||||
}
|
||||
const VECT_INT_VECT &extras =
|
||||
mol.getProp<VECT_INT_VECT>(common_properties::extraRings);
|
||||
@@ -1107,7 +1107,7 @@ int symmetrizeSSSR(ROMol &mol, VECT_INT_VECT &res) {
|
||||
INT_VECT sr, exr;
|
||||
INT_VECT_CI eri;
|
||||
unsigned int eid, srid, ssiz;
|
||||
unsigned int next = bextra.size();
|
||||
unsigned int next = rdcast<unsigned int>(bextra.size());
|
||||
// now the trick is the following
|
||||
// we will replace each ring of size ssiz from the SSSR with
|
||||
// one of the same size rings in the extras. Compute the union of of the new
|
||||
@@ -1124,7 +1124,7 @@ int symmetrizeSSSR(ROMol &mol, VECT_INT_VECT &res) {
|
||||
std::cerr<<std::endl;
|
||||
std::cerr<<"------"<<std::endl;
|
||||
#endif
|
||||
ssiz = sr.size();
|
||||
ssiz = rdcast<unsigned int>(sr.size());
|
||||
INT_VECT exrid;
|
||||
exrid.push_back(srid);
|
||||
Union(bsrs, nunion, &exrid);
|
||||
@@ -1175,7 +1175,7 @@ int symmetrizeSSSR(ROMol &mol, VECT_INT_VECT &res) {
|
||||
if (mol.hasProp(common_properties::extraRings)) {
|
||||
mol.clearProp(common_properties::extraRings);
|
||||
}
|
||||
return res.size();
|
||||
return rdcast<int>(res.size());
|
||||
}
|
||||
|
||||
namespace {
|
||||
|
||||
@@ -271,7 +271,7 @@ bool kekulizeWorker(RWMol &mol, const INT_VECT &allAtms,
|
||||
// if the neighbor is not on the stack add it
|
||||
if (std::find(astack.begin(), astack.end(),
|
||||
static_cast<int>(*nbrIdx)) == astack.end()) {
|
||||
astack.push_back(*nbrIdx);
|
||||
astack.push_back(rdcast<int>(*nbrIdx));
|
||||
}
|
||||
|
||||
// check if the neighbor is also a candidate for a double bond
|
||||
@@ -287,7 +287,7 @@ bool kekulizeWorker(RWMol &mol, const INT_VECT &allAtms,
|
||||
(mol.getBondBetweenAtoms(curr, *nbrIdx)->getIsAromatic() ||
|
||||
mol.getAtomWithIdx(curr)->getAtomicNum() == 0 ||
|
||||
mol.getAtomWithIdx(*nbrIdx)->getAtomicNum() == 0)) {
|
||||
opts.push_back(*nbrIdx);
|
||||
opts.push_back(rdcast<int>(*nbrIdx));
|
||||
} // end of curr atoms can have a double bond
|
||||
++nbrIdx;
|
||||
} // end of looping over neighbors
|
||||
@@ -519,7 +519,7 @@ void Kekulize(RWMol &mol, bool markAtomsBonds, unsigned int maxBackTracks) {
|
||||
RingUtils::makeRingNeighborMap(brings, neighMap);
|
||||
|
||||
int curr = 0;
|
||||
int cnrs = arings.size();
|
||||
int cnrs = rdcast<int>(arings.size());
|
||||
boost::dynamic_bitset<> fusDone(cnrs);
|
||||
while (curr < cnrs) {
|
||||
INT_VECT fused;
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
if (MSVC)
|
||||
add_definitions( "/D_CRT_SECURE_NO_WARNINGS")
|
||||
endif(MSVC)
|
||||
|
||||
rdkit_library(MMPA
|
||||
MMPA.cpp
|
||||
LINK_LIBRARIES SubstructMatch Depictor FileParsers ChemTransforms GraphMol ${RDKit_THREAD_LIBS} )
|
||||
|
||||
@@ -234,7 +234,7 @@ double *getDistanceMat(const ROMol &mol, bool useBO, bool useAtomWts,
|
||||
double *getDistanceMat(const ROMol &mol, const std::vector<int> &activeAtoms,
|
||||
const std::vector<const Bond *> &bonds, bool useBO,
|
||||
bool useAtomWts) {
|
||||
const int nAts = activeAtoms.size();
|
||||
const int nAts = rdcast<int>(activeAtoms.size());
|
||||
|
||||
double *dMat = new double[nAts * nAts];
|
||||
int i, j;
|
||||
@@ -245,12 +245,12 @@ double *getDistanceMat(const ROMol &mol, const std::vector<int> &activeAtoms,
|
||||
for (std::vector<const Bond *>::const_iterator bi = bonds.begin();
|
||||
bi != bonds.end(); bi++) {
|
||||
const Bond *bond = *bi;
|
||||
i = std::find(activeAtoms.begin(), activeAtoms.end(),
|
||||
i = rdcast<int>(std::find(activeAtoms.begin(), activeAtoms.end(),
|
||||
static_cast<int>(bond->getBeginAtomIdx())) -
|
||||
activeAtoms.begin();
|
||||
j = std::find(activeAtoms.begin(), activeAtoms.end(),
|
||||
activeAtoms.begin());
|
||||
j = rdcast<int>(std::find(activeAtoms.begin(), activeAtoms.end(),
|
||||
static_cast<int>(bond->getEndAtomIdx())) -
|
||||
activeAtoms.begin();
|
||||
activeAtoms.begin());
|
||||
double contrib;
|
||||
if (useBO) {
|
||||
if (!bond->getIsAromatic()) {
|
||||
@@ -358,7 +358,7 @@ INT_LIST getShortestPath(const ROMol &mol, int aid1, int aid2) {
|
||||
done = true;
|
||||
break;
|
||||
}
|
||||
bfsQ.push_back(*nbrIdx);
|
||||
bfsQ.push_back(rdcast<int>(*nbrIdx));
|
||||
}
|
||||
nbrIdx++;
|
||||
}
|
||||
|
||||
@@ -93,8 +93,8 @@ double computeBalabanJ(const ROMol &mol, bool useBO, bool force,
|
||||
}
|
||||
beg++;
|
||||
}
|
||||
nb = bondPath->size();
|
||||
nAts = atomsInPath.size();
|
||||
nb = rdcast<int>(bondPath->size());
|
||||
nAts = rdcast<int>(atomsInPath.size());
|
||||
dMat = MolOps::getDistanceMat(mol, atomsInPath, bonds, true, true);
|
||||
res = computeBalabanJ(dMat, nb, nAts);
|
||||
delete[] dMat;
|
||||
|
||||
@@ -524,7 +524,7 @@ unsigned int getMolFrags(const ROMol &mol, VECT_INT_VECT &frags) {
|
||||
for (INT_INT_VECT_MAP_CI mci = comMap.begin(); mci != comMap.end(); mci++) {
|
||||
frags.push_back((*mci).second);
|
||||
}
|
||||
return frags.size();
|
||||
return rdcast<unsigned int>(frags.size());
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
|
||||
@@ -29,7 +29,7 @@ const int32_t MolPickler::versionPatch = 0;
|
||||
const int32_t MolPickler::endianId = 0xDEADBEEF;
|
||||
|
||||
void streamWrite(std::ostream &ss, const std::string &what) {
|
||||
unsigned int l = what.length();
|
||||
unsigned int l = rdcast<unsigned int>(what.length());
|
||||
ss.write((const char *)&l, sizeof(l));
|
||||
ss.write(what.c_str(), sizeof(char) * l);
|
||||
};
|
||||
@@ -145,7 +145,7 @@ void pickleQuery(std::ostream &ss, const Query<int, T const *, true> *query) {
|
||||
boost::tie(lowerOpen, upperOpen) =
|
||||
static_cast<const RangeQuery<int, T const *, true> *>(query)
|
||||
->getEndsOpen();
|
||||
ends = 0 | (lowerOpen << 1) | upperOpen;
|
||||
ends = 0 | (rdcast<int>(lowerOpen) << 1) | rdcast<int>(upperOpen);
|
||||
streamWrite(ss, ends);
|
||||
} else if (typeid(*query) == typeid(SetQuery<int, T const *, true>)) {
|
||||
streamWrite(ss, MolPickler::QUERY_SET);
|
||||
@@ -934,12 +934,12 @@ bool getAtomMapNumber(const Atom *atom, int &mapNum) {
|
||||
int tmpInt;
|
||||
try {
|
||||
atom->getProp(common_properties::molAtomMapNumber, tmpInt);
|
||||
} catch (boost::bad_any_cast &exc) {
|
||||
} catch (boost::bad_any_cast &) {
|
||||
const std::string &tmpSVal =
|
||||
atom->getProp<std::string>(common_properties::molAtomMapNumber);
|
||||
try {
|
||||
tmpInt = boost::lexical_cast<int>(tmpSVal);
|
||||
} catch (boost::bad_lexical_cast &lexc) {
|
||||
} catch (boost::bad_lexical_cast &) {
|
||||
res = false;
|
||||
}
|
||||
}
|
||||
@@ -1264,7 +1264,7 @@ Atom *MolPickler::_addAtomFromPickle(std::istream &ss, ROMol *mol,
|
||||
|
||||
if (version > 5000) {
|
||||
if (version < 6020) {
|
||||
unsigned int sPos = ss.tellg();
|
||||
unsigned int sPos = rdcast<unsigned int>(ss.tellg());
|
||||
Tags tag;
|
||||
streamRead(ss, tag, version);
|
||||
if (tag == ATOM_MAPNUMBER) {
|
||||
@@ -1356,7 +1356,7 @@ void MolPickler::_pickleBond(std::ostream &ss, const Bond *bond,
|
||||
tmpChar = static_cast<char>(bond->getStereo());
|
||||
streamWrite(ss, tmpChar);
|
||||
const INT_VECT &stereoAts = bond->getStereoAtoms();
|
||||
tmpChar = stereoAts.size();
|
||||
tmpChar = rdcast<unsigned int>(stereoAts.size());
|
||||
streamWrite(ss, tmpChar);
|
||||
for (INT_VECT_CI idxIt = stereoAts.begin(); idxIt != stereoAts.end();
|
||||
++idxIt) {
|
||||
|
||||
@@ -126,13 +126,13 @@ void ROMol::initMol() {
|
||||
}
|
||||
|
||||
unsigned int ROMol::getAtomDegree(const Atom *at) const {
|
||||
return (boost::out_degree(at->getIdx(), d_graph));
|
||||
return rdcast<unsigned int>(boost::out_degree(at->getIdx(), d_graph));
|
||||
};
|
||||
unsigned int ROMol::getAtomDegree(Atom::ATOM_SPTR at) const {
|
||||
return getAtomDegree(at.get());
|
||||
};
|
||||
unsigned int ROMol::getNumAtoms(bool onlyExplicit) const {
|
||||
int res = boost::num_vertices(d_graph);
|
||||
int res = rdcast<int>(boost::num_vertices(d_graph));
|
||||
if (!onlyExplicit) {
|
||||
// if we are interested in hydrogens as well add them up from
|
||||
// each
|
||||
@@ -238,7 +238,7 @@ void ROMol::clearBondBookmark(const int mark, const Bond *bond) {
|
||||
unsigned int ROMol::getNumBonds(bool onlyHeavy) const {
|
||||
// By default resturn the bonds that connect only the heavy atoms
|
||||
// hydrogen connecting bonds are ignores
|
||||
int res = boost::num_edges(d_graph);
|
||||
int res = rdcast<int>(boost::num_edges(d_graph));
|
||||
if (!onlyHeavy) {
|
||||
// If we need hydrogen connecting bonds add them up
|
||||
for (ConstAtomIterator ai = beginAtoms(); ai != endAtoms(); ++ai) {
|
||||
@@ -340,7 +340,7 @@ unsigned int ROMol::addAtom(Atom *atom_pin, bool updateLabel,
|
||||
cfi != this->endConformers(); ++cfi) {
|
||||
(*cfi)->setAtomPos(which, RDGeom::Point3D(0.0, 0.0, 0.0));
|
||||
}
|
||||
return which;
|
||||
return rdcast<unsigned int>(which);
|
||||
};
|
||||
unsigned int ROMol::addAtom(Atom::ATOM_SPTR atom_sp, bool updateLabel) {
|
||||
return addAtom(atom_sp.get(), updateLabel, false);
|
||||
@@ -368,7 +368,7 @@ unsigned int ROMol::addBond(Bond *bond_pin, bool takeOwnership) {
|
||||
bond_p->getEndAtomIdx(), d_graph);
|
||||
CHECK_INVARIANT(ok, "bond could not be added");
|
||||
d_graph[which].reset(bond_p);
|
||||
int res = boost::num_edges(d_graph);
|
||||
int res = rdcast<int>(boost::num_edges(d_graph));
|
||||
bond_p->setIdx(res - 1);
|
||||
return res;
|
||||
}
|
||||
|
||||
@@ -207,6 +207,16 @@ class ROMol {
|
||||
Atom *getAtomWithIdx(unsigned int idx);
|
||||
//! \overload
|
||||
const Atom *getAtomWithIdx(unsigned int idx) const;
|
||||
//! \overload
|
||||
template<class U>
|
||||
Atom *getAtomWithIdx(const U idx) {
|
||||
return getAtomWithIdx(rdcast<unsigned int>(idx));
|
||||
}
|
||||
//! \overload
|
||||
template<class U>
|
||||
const Atom *getAtomWithIdx(const U idx) const {
|
||||
return getAtomWithIdx(rdcast<unsigned int>(idx));
|
||||
}
|
||||
//! returns the degree (number of neighbors) of an Atom in the graph
|
||||
unsigned int getAtomDegree(const Atom *at) const;
|
||||
//! \overload
|
||||
@@ -222,10 +232,33 @@ class ROMol {
|
||||
Bond *getBondWithIdx(unsigned int idx);
|
||||
//! \overload
|
||||
const Bond *getBondWithIdx(unsigned int idx) const;
|
||||
//! \overload
|
||||
template <class U>
|
||||
Bond *getBondWithIdx(const U idx) {
|
||||
return getBondWithIdx(rdcast<unsigned int>(idx));
|
||||
}
|
||||
//! \overload
|
||||
template <class U>
|
||||
const Bond *getBondWithIdx(const U idx) const {
|
||||
return getBondWithIdx(rdcast<unsigned int>(idx));
|
||||
}
|
||||
//! returns a pointer to the bond between two atoms, Null on failure
|
||||
Bond *getBondBetweenAtoms(unsigned int idx1, unsigned int idx2);
|
||||
//! \overload
|
||||
const Bond *getBondBetweenAtoms(unsigned int idx1, unsigned int idx2) const;
|
||||
//! \overload
|
||||
template <class U, class V>
|
||||
Bond *getBondBetweenAtoms(const U idx1, const V idx2) {
|
||||
return getBondBetweenAtoms(rdcast<unsigned int>(idx1),
|
||||
rdcast<unsigned int>(idx2));
|
||||
}
|
||||
//! \overload
|
||||
template <class U, class V>
|
||||
const Bond *getBondBetweenAtoms(const U idx1, const V idx2) const {
|
||||
return getBondBetweenAtoms(rdcast<unsigned int>(idx1),
|
||||
rdcast<unsigned int>(idx2));
|
||||
}
|
||||
|
||||
//@}
|
||||
|
||||
//! \name Bookmarks
|
||||
@@ -326,7 +359,7 @@ class ROMol {
|
||||
*/
|
||||
unsigned int addConformer(Conformer *conf, bool assignId = false);
|
||||
|
||||
inline unsigned int getNumConformers() const { return d_confs.size(); }
|
||||
inline unsigned int getNumConformers() const { return rdcast<unsigned int>(d_confs.size()); }
|
||||
|
||||
//@}
|
||||
|
||||
|
||||
@@ -124,7 +124,7 @@ unsigned int RWMol::addAtom(bool updateLabel) {
|
||||
cfi != this->endConformers(); ++cfi) {
|
||||
(*cfi)->setAtomPos(which, RDGeom::Point3D(0.0, 0.0, 0.0));
|
||||
}
|
||||
return which;
|
||||
return rdcast<unsigned int>(which);
|
||||
}
|
||||
|
||||
void RWMol::replaceAtom(unsigned int idx, Atom *atom_pin, bool updateLabel) {
|
||||
@@ -182,7 +182,7 @@ void RWMol::removeAtom(Atom *atom) {
|
||||
ADJ_ITER b1, b2;
|
||||
boost::tie(b1, b2) = getAtomNeighbors(atom);
|
||||
while (b1 != b2) {
|
||||
nbrs.push_back(std::make_pair(atom->getIdx(), *b1));
|
||||
nbrs.push_back(std::make_pair(atom->getIdx(), rdcast<unsigned int>(*b1)));
|
||||
++b1;
|
||||
}
|
||||
for (unsigned int i = 0; i < nbrs.size(); ++i) {
|
||||
@@ -269,7 +269,7 @@ unsigned int RWMol::addBond(unsigned int atomIdx1, unsigned int atomIdx2,
|
||||
MolGraph::edge_descriptor which;
|
||||
boost::tie(which, ok) = boost::add_edge(atomIdx1, atomIdx2, d_graph);
|
||||
d_graph[which].reset(b);
|
||||
unsigned int res = boost::num_edges(d_graph);
|
||||
unsigned int res = rdcast<unsigned int>(boost::num_edges(d_graph));
|
||||
b->setIdx(res - 1);
|
||||
b->setBeginAtomIdx(atomIdx1);
|
||||
b->setEndAtomIdx(atomIdx2);
|
||||
@@ -322,7 +322,7 @@ void RWMol::removeBond(unsigned int aid1, unsigned int aid2) {
|
||||
ADJ_ITER a1, a2;
|
||||
boost::tie(a1, a2) = boost::adjacent_vertices(aid1, d_graph);
|
||||
while (a1 != a2) {
|
||||
unsigned int oIdx = *a1;
|
||||
unsigned int oIdx = rdcast<unsigned int>(*a1);
|
||||
++a1;
|
||||
if (oIdx == aid2) continue;
|
||||
Bond *obnd = getBondBetweenAtoms(aid1, oIdx);
|
||||
@@ -331,7 +331,7 @@ void RWMol::removeBond(unsigned int aid1, unsigned int aid2) {
|
||||
}
|
||||
boost::tie(a1, a2) = boost::adjacent_vertices(aid1, d_graph);
|
||||
while (a1 != a2) {
|
||||
unsigned int oIdx = *a1;
|
||||
unsigned int oIdx = rdcast<unsigned int>(*a1);
|
||||
++a1;
|
||||
if (oIdx == aid1) continue;
|
||||
Bond *obnd = getBondBetweenAtoms(aid2, oIdx);
|
||||
|
||||
@@ -19,8 +19,8 @@ class CEVect2 {
|
||||
public:
|
||||
CEVect2(CEMap &ceMap);
|
||||
ConjElectrons *getCE(unsigned int depth, unsigned int width);
|
||||
unsigned int ceCount() { return d_ceVect.size(); }
|
||||
unsigned int depth() { return d_degVect.size(); }
|
||||
unsigned int ceCount() { return rdcast<unsigned int>(d_ceVect.size()); }
|
||||
unsigned int depth() { return rdcast<unsigned int>(d_degVect.size()); }
|
||||
void resize(unsigned int size);
|
||||
void idxToDepthWidth(unsigned int idx, unsigned int &d, unsigned int &w);
|
||||
unsigned int ceCountAtDepth(unsigned int depth);
|
||||
@@ -527,8 +527,8 @@ bool ConjElectrons::storeFP(CEMap &ceMap, unsigned int flags) {
|
||||
boost::uint8_t byte;
|
||||
ConjFP fp;
|
||||
unsigned int fpSize = 0;
|
||||
if (flags & FP_ATOMS) fpSize += d_conjAtomMap.size();
|
||||
if (flags & FP_BONDS) fpSize += ((d_conjBondMap.size() - 1) / 4 + 1);
|
||||
if (flags & FP_ATOMS) fpSize += rdcast<unsigned int>(d_conjAtomMap.size());
|
||||
if (flags & FP_BONDS) fpSize += rdcast<unsigned int>((d_conjBondMap.size() - 1) / 4 + 1);
|
||||
fp.reserve(fpSize);
|
||||
if (flags & FP_ATOMS) {
|
||||
// for each atom, we push a byte to the FP vector whose
|
||||
@@ -737,7 +737,7 @@ void ConjElectrons::enumerateNonBonded(CEMap &ceMap) {
|
||||
// we compute the number of permutations (numComb) and a
|
||||
// binary code (v) which indicates which of the atom indices in
|
||||
// aiVec will be octet-unsatisfied for each permutation
|
||||
ResonanceUtils::getNumCombStartV(numCand, aiVec.size(), numComb, v);
|
||||
ResonanceUtils::getNumCombStartV(numCand, rdcast<unsigned int>(aiVec.size()), numComb, v);
|
||||
// if there are multiple permutations, make a copy of the original
|
||||
// ConjElectrons object, since the latter will be modified
|
||||
ConjElectrons *ceCopy = ((numComb > 1) ? new ConjElectrons(*ce) : NULL);
|
||||
@@ -809,8 +809,9 @@ void ConjElectrons::computeDistFormalCharges() {
|
||||
for (ConjAtomMap::const_iterator it2 = it1; it2 != d_conjAtomMap.end();
|
||||
++it2) {
|
||||
if ((it1 == it2) || !it2->second->fc()) continue;
|
||||
unsigned int dist = MolOps::getShortestPath(d_parent->mol(), it1->first,
|
||||
it2->first).size();
|
||||
unsigned int dist = rdcast<unsigned int>(
|
||||
MolOps::getShortestPath(d_parent->mol(), it1->first,
|
||||
it2->first).size());
|
||||
if ((it1->second->fc() * it2->second->fc()) > 0)
|
||||
d_ceMetrics.d_fcSameSignDist += dist;
|
||||
else
|
||||
|
||||
@@ -37,7 +37,7 @@ unsigned int RingInfo::numAtomRings(unsigned int idx) const {
|
||||
PRECONDITION(df_init, "RingInfo not initialized");
|
||||
|
||||
if (idx < d_atomMembers.size()) {
|
||||
return d_atomMembers[idx].size();
|
||||
return rdcast<unsigned int>(d_atomMembers[idx].size());
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
@@ -66,7 +66,7 @@ unsigned int RingInfo::numBondRings(unsigned int idx) const {
|
||||
PRECONDITION(df_init, "RingInfo not initialized");
|
||||
|
||||
if (idx < d_bondMembers.size()) {
|
||||
return d_bondMembers[idx].size();
|
||||
return rdcast<unsigned int>(d_bondMembers[idx].size());
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
@@ -75,14 +75,14 @@ unsigned int RingInfo::numBondRings(unsigned int idx) const {
|
||||
unsigned int RingInfo::numRings() const {
|
||||
PRECONDITION(df_init, "RingInfo not initialized");
|
||||
PRECONDITION(d_atomRings.size() == d_bondRings.size(), "length mismatch");
|
||||
return d_atomRings.size();
|
||||
return rdcast<unsigned int>(d_atomRings.size());
|
||||
}
|
||||
|
||||
unsigned int RingInfo::addRing(const INT_VECT &atomIndices,
|
||||
const INT_VECT &bondIndices) {
|
||||
PRECONDITION(df_init, "RingInfo not initialized");
|
||||
PRECONDITION(atomIndices.size() == bondIndices.size(), "length mismatch");
|
||||
int sz = atomIndices.size();
|
||||
int sz = rdcast<int>(atomIndices.size());
|
||||
for (INT_VECT::const_iterator i = atomIndices.begin(); i < atomIndices.end();
|
||||
i++) {
|
||||
if (*i >= static_cast<int>(d_atomMembers.size()))
|
||||
@@ -98,7 +98,7 @@ unsigned int RingInfo::addRing(const INT_VECT &atomIndices,
|
||||
d_atomRings.push_back(atomIndices);
|
||||
d_bondRings.push_back(bondIndices);
|
||||
POSTCONDITION(d_atomRings.size() == d_bondRings.size(), "length mismatch");
|
||||
return d_atomRings.size();
|
||||
return rdcast<unsigned int>(d_atomRings.size());
|
||||
}
|
||||
|
||||
void RingInfo::initialize() {
|
||||
|
||||
@@ -62,7 +62,8 @@ struct conformer_wrapper {
|
||||
|
||||
.def("SetAtomPosition", SetAtomPos,
|
||||
"Set the position of the specified atom\n")
|
||||
.def("SetAtomPosition", &Conformer::setAtomPos,
|
||||
.def("SetAtomPosition", (void (Conformer::*)(unsigned int, const RDGeom::Point3D&)) &
|
||||
Conformer::setAtomPos,
|
||||
"Set the position of the specified atom\n")
|
||||
|
||||
.def("Set3D", &Conformer::set3D, "Set the 3D flag of the conformer\n")
|
||||
|
||||
@@ -35,8 +35,6 @@ doublereal *disnn;
|
||||
logical *flag__;
|
||||
doublereal *diss;
|
||||
{
|
||||
(void)n;
|
||||
(void)len;
|
||||
/* Initialized data */
|
||||
|
||||
static doublereal inf = 1e20;
|
||||
@@ -282,7 +280,6 @@ L900:
|
||||
integer ioffset_(n, i__, j)
|
||||
integer *n, *i__, *j;
|
||||
{
|
||||
(void)n;
|
||||
/* System generated locals */
|
||||
integer ret_val;
|
||||
|
||||
|
||||
@@ -61,7 +61,7 @@ class SetQuery
|
||||
typename CONTAINER_TYPE::const_iterator endSet() const {
|
||||
return d_set.end();
|
||||
};
|
||||
unsigned int size() const { return d_set.size(); };
|
||||
unsigned int size() const { return rdcast<unsigned int>(d_set.size()); };
|
||||
|
||||
std::string getFullDescription() const {
|
||||
std::ostringstream res;
|
||||
|
||||
@@ -63,7 +63,7 @@ class argless : public std::binary_function<T, T, bool> {
|
||||
template <typename T1, typename T2>
|
||||
void rankVect(const std::vector<T1> &vect, T2 &res) {
|
||||
PRECONDITION(res.size() >= vect.size(), "vector size mismatch");
|
||||
unsigned int nEntries = vect.size();
|
||||
unsigned int nEntries = rdcast<unsigned int>(vect.size());
|
||||
|
||||
std::vector<unsigned int> indices(nEntries);
|
||||
for (unsigned int i = 0; i < nEntries; ++i) indices[i] = i;
|
||||
|
||||
@@ -17,6 +17,10 @@
|
||||
#include <cassert>
|
||||
#include <cstdlib>
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#pragma warning(push, 1)
|
||||
#pragma warning(disable: 4800)
|
||||
#endif
|
||||
namespace RDKit {
|
||||
template <typename CompareFunc>
|
||||
bool hanoi(int *base, int nel, int *temp, int *count, int *changed,
|
||||
@@ -144,4 +148,8 @@ void hanoisort(int *base, int nel, int *count, int *changed,
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
|
||||
#endif /* HANOISORT_H_ */
|
||||
|
||||
3
External/AvalonTools/CMakeLists.txt
vendored
3
External/AvalonTools/CMakeLists.txt
vendored
@@ -3,6 +3,9 @@ string(REGEX REPLACE "\\\\" "/" AVALONTOOLS_DIR ${AVALONTOOLS_DIR})
|
||||
set(AVALON_SRC_PATH ${AVALONTOOLS_DIR}/common)
|
||||
|
||||
add_definitions(-DBUILD_AVALON_SUPPORT)
|
||||
if (MSVC)
|
||||
add_definitions( "/D_CRT_SECURE_NO_WARNINGS /wd4224 /wd4101 /wd4018 /wd4996 /wd4244 /wd4305 /wd4013 /wd4146 /wd4334 /wd4715 /wd4715 /nologo" )
|
||||
endif(MSVC)
|
||||
|
||||
set(avalon_clib_srcs ${AVALON_SRC_PATH}/layout.c
|
||||
${AVALON_SRC_PATH}/symboltable.c
|
||||
|
||||
Reference in New Issue
Block a user