本文整理汇总了C++中OBMol::NumConformers方法的典型用法代码示例。如果您正苦于以下问题:C++ OBMol::NumConformers方法的具体用法?C++ OBMol::NumConformers怎么用?C++ OBMol::NumConformers使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OBMol
的用法示例。
在下文中一共展示了OBMol::NumConformers方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Run
void OpConfab::Run(OBConversion* pConv, OBMol* pmol)
{
OBMol mol = *pmol;
N++;
cout << "**Molecule " << N << endl << "..title = " << mol.GetTitle() << endl;
cout << "..number of rotatable bonds = " << mol.NumRotors() << endl;
mol.AddHydrogens();
bool success = pff->Setup(mol);
if (!success) {
cout << "!!Cannot set up forcefield for this molecule\n"
<< "!!Skipping\n" << endl;
return;
}
pff->DiverseConfGen(rmsd_cutoff, conf_cutoff, energy_cutoff, verbose);
pff->GetConformers(mol);
int nconfs = include_original ? mol.NumConformers() : mol.NumConformers() - 1;
unsigned int c = include_original ? 0 : 1;
// If mol.NumRotors is 0 and originals have not been included, then nconfs
// may be 0. Here, if nconfs is 0, we include the original input conformer
if (nconfs == 0) {
nconfs = mol.NumConformers();
c = 0;
}
cout << "..generated " << nconfs << " conformers" << endl;
for (; c < mol.NumConformers(); ++c) {
mol.SetConformer(c);
if(!pConv->GetOutFormat()->WriteMolecule(&mol, pConv))
break;
}
cout << endl;
}
示例2: runConformerComparisons
void runConformerComparisons(OBMol &moleculeA, OBMol &moleculeB, bool verbose=false) { // A is the target and B is the reference
vector< vector<double> > coordAs, coordBs, comAs, comBs, eVectAs, eVectBs;
vector<double> VDWsA, VDWsB, massesA, massesB, currentPCACoordA, currentSDCoordA, bestCoordsA;
vector< vector<double> > atomMatchScoringTable;
double molecularWeightA = moleculeA.GetMolWt(), molecularWeightB = moleculeB.GetMolWt();
double bestVolumeOverlap = -(numeric_limits<double>::max)();
int bestJ = -1, bestI = -1, stepCount = 0;
generateVDWRadiusListFromMolecule(VDWsA, moleculeA);
generateVDWRadiusListFromMolecule(VDWsB, moleculeB);
generateAtomicMassesListFromMolecule(massesA, moleculeA);
generateAtomicMassesListFromMolecule(massesB, moleculeB);
generateCoordsMatrixFromMoleculeConformers(coordAs, moleculeA);
generateCoordsMatrixFromMoleculeConformers(coordBs, moleculeB);
getMoleculeConformerCenterCoords(comAs, moleculeA);
getMoleculeConformerCenterCoords(comBs, moleculeB);
generateAtomMatchScoringTableFromTwoMolecules(atomMatchScoringTable, moleculeA, moleculeB);
eVectAs.resize( moleculeA.NumConformers() ), eVectBs.resize( moleculeB.NumConformers() );
for (unsigned int k=0; k < moleculeA.NumConformers(); k++) getPCAEigenMatrix(eVectAs[k], coordAs[k], massesA, molecularWeightA);
for (unsigned int k=0; k < moleculeB.NumConformers(); k++) getPCAEigenMatrix(eVectBs[k], coordBs[k], massesB, molecularWeightB);
cout << "Finished setting up data; running search...\n";
for (unsigned int j=0; j < moleculeB.NumConformers(); j++) {
for (unsigned int i=0; i < moleculeA.NumConformers(); i++) {
PCAEngine(currentPCACoordA, coordAs[i], coordBs[j], eVectAs[i], eVectBs[j], comAs[i], comBs[j], VDWsA, VDWsB, atomMatchScoringTable);
double currentVolumeOverlap = steepestDescentEngine(currentSDCoordA, currentPCACoordA, coordBs[j], VDWsA, VDWsB, comAs[i], atomMatchScoringTable, 1.0, 10.0 * M_PI / 180.0);
if (currentVolumeOverlap > bestVolumeOverlap) {
bestVolumeOverlap = currentVolumeOverlap;
bestCoordsA = currentSDCoordA;
bestI = i;
bestJ = j;
}
RANKS_AND_COORDS.push_back(RanksAndCoords(currentVolumeOverlap, i, j, currentSDCoordA));
cout << "ROUND " << ++stepCount << " A#" << i << " and B#" << j << " = " << currentVolumeOverlap << endl;
}
}
cout << "\nThe best overlap is between conformer A#" << bestI << " and B#" << bestJ << ", which, after PCA followed by Steepest Descent, produces a volume overlap of " << bestVolumeOverlap << endl;
//saveCoordsMatrixToMolecule(moleculeA, bestCoordsA);
addConformerToMolecule(moleculeA, bestCoordsA);
moleculeA.SetConformer(moleculeA.NumConformers() - 1);
moleculeB.SetConformer(bestJ);
MOLECULE_CONFORMER = bestJ;
}
示例3: DoOutputOptions
bool OBMoleculeFormat::DoOutputOptions(OBBase* pOb, OBConversion* pConv)
{
if(pConv->IsOption("addoutindex", OBConversion::GENOPTIONS)) {
stringstream ss;
ss << pOb->GetTitle() << " " << pConv->GetOutputIndex();
pOb->SetTitle(ss.str().c_str());
}
OBMol* pmol = dynamic_cast<OBMol*> (pOb);
if(pmol) {
if(pConv->IsOption("writeconformers", OBConversion::GENOPTIONS)) {
//The last conformer is written in the calling function
unsigned int c = 0;
for (; c < pmol->NumConformers()-1; ++c) {
pmol->SetConformer(c);
if(!pConv->GetOutFormat()->WriteMolecule(pmol, pConv))
break;
}
pmol->SetConformer(c);
}
}
return true;
}
示例4: main
//.........这里部分代码省略.........
// A third file is created to store information on the memory allocation of data structures
// from the MMFF94 calculation routines. breakdown of memory allocated for each calculation type
char filepath3[1100];
std::ofstream output3;
sprintf(filepath3, "%s/%s_%s_t%d_malloc.mat", cwd, statsfile, ff.c_str(), nthreads);
std::cout << "Writing memory allocation breakdown detail file to: " << filepath3 << std::endl;
output3.open(filepath3, ios::out | ios::app ); // The file is open in append mode
// 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
output3 << "#METHOD: " << ff << " THREADS: " << nthreads << " DATASET: " << filename.c_str() << std::endl;
output3 << "#ATOMS M_BOND M_ANGLE M_STRBND M_TORSION M_OOP M_VDW M_ELEC C_BOND C_ANGLE C_STRBND C_TORSION C_OOP C_VDW C_ELEC" << std::endl;
double bondCalcTime, angleCalcTime, strbndCalcTime, torsionCalcTime, oopCalcTime, vdwCalcTime, electrostaticCalcTime;
int numPairsVDW, numPairsElectrostatic;
OBMol mol;
double energy;
for (c=1;;c++) {
mol.Clear();
totalTimer.start();
readTimer.start();
if (!conv.Read(&mol, &ifs))
break;
if (mol.Empty())
break;
if (hydrogens)
mol.AddHydrogens();
readTime = readTimer.get();
setupTimer.start();
if (!pFF->Setup(mol)) {
cerr << program_name << ": could not setup force field." << endl;
exit (-1);
}
setupTime = setupTimer.get();
computeTimer.start();
energy = pFF->Energy(false);
computeTime = computeTimer.get();
totalTime = totalTimer.get();
// THREADS ENERGY MOL_MASS NUM_ATOMS NUM_ROTORS NUM_CONF TOT_TIME TIME_READ TIME_SETUP TIME_COMPUTE STEPS #MOL_NAME
output << nthreads << " " << energy << " " << mol.GetExactMass() << " " << mol.NumAtoms()
<< " " << mol.NumRotors() << " " << mol.NumConformers() << " "
<< totalTime << " " << readTime << " " << " " << setupTime << " " << computeTime << " "
<< totalSteps << " #" << mol.GetTitle() // comment added to avoid errors when reading matrix in Octave
<< std::endl;
map<string, double> timings = pFF->getTimings();
map<string, size_t> memalloc = pFF->getAllocatedMemory();
MapKeys mk;
// 1 2 3 4 5 6 7 8 9 10 11 12
// E_BOND E_ANGLE E_STRBND E_TORSION E_OOP E_VDW E_ELEC N_ATOMS PAIRS_VDW PAIRS_ELEC MEM_VDW MEM_ELEC
output2 << timings[mk.TIME_BOND_CALCULATIONS] << " " // 1
<< timings[mk.TIME_ANGLE_CALCULATIONS] << " " // 2
<< timings[mk.TIME_STRBND_CALCULATIONS] << " " // 3
<< timings[mk.TIME_TORSION_CALCULATIONS] << " " // 4
<< timings[mk.TIME_OOP_CALCULATIONS] << " " // 5
<< timings[mk.TIME_VDW_CALCULATIONS] << " " // 6
<< timings[mk.TIME_ELECTROSTATIC_CALCULATIONS] << " " // 7
<< mol.NumAtoms() << " " // 8
<< timings[mk.TOTAL_VDW_CALCULATIONS] << " " // 9
<< timings[mk.TOTAL_ELECTROSTATIC_CALCULATIONS] << " " // 10
<< memalloc[mk.MEM_VDW_CALCULATIONS] << " " // 11
<< memalloc[mk.MEM_ELECTROSTATIC_CALCULATIONS] << std::endl; // 12
// 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
// ATOMS M_BOND M_ANGLE M_STRBND M_TORSION M_OOP M_VDW M_ELEC C_BOND C_ANGLE C_STRBND C_TORSION C_OOP C_VDW C_ELEC
output3 << mol.NumAtoms() << " " // 1
<< memalloc[mk.MEM_BOND_CALCULATIONS] << " " // 2
<< memalloc[mk.MEM_ANGLE_CALCULATIONS] << " " // 3
<< memalloc[mk.MEM_STRBND_CALCULATIONS] << " " // 4
<< memalloc[mk.MEM_TORSION_CALCULATIONS] << " " // 5
<< memalloc[mk.MEM_OOP_CALCULATIONS] << " " // 6
<< memalloc[mk.MEM_VDW_CALCULATIONS] << " " // 7
<< memalloc[mk.MEM_ELECTROSTATIC_CALCULATIONS] << " " // 8
<< timings[mk.TOTAL_BOND_CALCULATIONS] << " " // 9
<< timings[mk.TOTAL_ANGLE_CALCULATIONS] << " " // 10
<< timings[mk.TOTAL_STRBND_CALCULATIONS] << " " // 11
<< timings[mk.TOTAL_TORSION_CALCULATIONS] << " " // 12
<< timings[mk.TOTAL_OOP_CALCULATIONS] << " " // 13
<< timings[mk.TOTAL_VDW_CALCULATIONS] << " " // 14
<< timings[mk.TOTAL_ELECTROSTATIC_CALCULATIONS] << " " // 15
<< std::endl;
if (!isfinite(energy)) {
cerr << " Title: " << mol.GetTitle() << endl;
FOR_ATOMS_OF_MOL(atom, mol) {
cerr << " x: " << atom->x() << " y: " << atom->y() << " z: " << atom->z() << endl;
}
}
} // end for loop
示例5: main
//.........这里部分代码省略.........
cout << "error while initializing the force field for this molecule." <<endl;
continue;
}
continue;
}
if (EQn(commandline, "delH", 4)) {
int num1, num2;
num1 = mol.NumAtoms();
mol.DeleteHydrogens();
num2 = mol.NumAtoms();
cout << (num1 - num2) << " hydrogens deleted." << endl;
if (!pFF->Setup(mol)) {
cout << "error while initializing the force field for this molecule." <<endl;
continue;
}
continue;
}
if (EQn(commandline, "gen", 3)) {
//pFF->GenerateCoordinates();
pFF->UpdateCoordinates(mol);
continue;
}
if (EQn(commandline, "rs", 2)) {
pFF->SystematicRotorSearch();
pFF->UpdateCoordinates(mol);
continue;
}
if (EQn(commandline, "nconf", 5)) {
cout << endl << " number of conformers = " << mol.NumConformers() << endl << endl;
continue;
}
//
// commands with parameters
//
tokenize(vs, commandline);
// select forcefield
if (EQn(commandline, "ff", 2)) {
if (vs.size() < 2) {
cout << "no <forcefield> specified." << endl;
continue;
}
pFF = OBForceField::FindForceField(vs[1]);
if (!mol.Empty())
if (!pFF->Setup(mol))
cout << "error while initializing the force field (" << vs[1] << ") for this molecule." <<endl;
continue;
}
// load <filename>
if (EQn(commandline, "load", 4)) {
if (vs.size() < 2) {
cout << "no <filename> specified." << endl;
continue;
}