本文整理汇总了C++中OBMol::NumRotors方法的典型用法代码示例。如果您正苦于以下问题:C++ OBMol::NumRotors方法的具体用法?C++ OBMol::NumRotors怎么用?C++ OBMol::NumRotors使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OBMol
的用法示例。
在下文中一共展示了OBMol::NumRotors方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: tmpStr
extern "C" unsigned int
ob_num_rotatable_bonds (char *smiles)
{
OBMol mol;
OBConversion conv;
string tmpStr (smiles);
istringstream molstream (tmpStr);
unsigned int numrotors = 0;
conv.SetInAndOutFormats ("SMI", "SMI");
conv.Read (&mol, &molstream);
numrotors = mol.NumRotors ();
return (numrotors);
}
示例2: 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;
}
示例3: 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
示例4: Predict
virtual double Predict(OBBase *pOb, string *param = NULL) {
OBMol *pmol = dynamic_cast<OBMol *>(pOb);
if (!pmol)
return 0;
return pmol->NumRotors();
}
示例5: main
//.........这里部分代码省略.........
exit (-1);
}
ifstream ifs;
// Read the file
ifs.open(FileIn);
if (!ifs)
{
cerr << program_name << ": cannot read input file!" << endl;
exit (-1);
}
OBMol mol;
OBFormat *canSMIFormat = conv.FindFormat("can");
OBFormat *inchiFormat = conv.FindFormat("inchi");
////////////////////////////////////////////////////////////////////////////
// List of properties
// Name
// Molecular weight (Standard molar mass given by IUPAC atomic masses)
// Number of rings : the size of the smallest set of smallest rings (SSSR)
//.....ADD YOURS HERE.....
for (c = 1;; ++c)
{
mol.Clear();
conv.Read(&mol, &ifs);
if (mol.Empty())
break;
if (!mol.HasHydrogensAdded())
mol.AddHydrogens();
// Print the properties
if (strlen(mol.GetTitle()) != 0)
cout << "name " << mol.GetTitle() << endl;
else
cout << "name " << FileIn << " " << c << endl;
cout << "formula " << mol.GetFormula() << endl;
cout << "mol_weight " << mol.GetMolWt() << endl;
cout << "exact_mass " << mol.GetExactMass() << endl;
string smilesString = "-";
if (canSMIFormat) {
conv.SetOutFormat(canSMIFormat);
smilesString = conv.WriteString(&mol);
if ( smilesString.length() == 0 )
{
smilesString = "-";
}
}
cout << "canonical_SMILES " << smilesString << endl;
string inchiString = "-";
if (inchiFormat) {
conv.SetOutFormat(inchiFormat);
inchiString = conv.WriteString(&mol);
if ( inchiString.length() == 0 )
{
inchiString = "-";
}
}
cout << "InChI " << inchiString << endl;
cout << "num_atoms " << mol.NumAtoms() << endl;
cout << "num_bonds " << mol.NumBonds() << endl;
cout << "num_residues " << mol.NumResidues() << endl;
cout << "num_rotors " << mol.NumRotors() << endl;
if (mol.NumResidues() > 0)
cout << "sequence " << sequence(mol) << endl;
else
cout << "sequence " << "-" << endl;
cout << "num_rings " << nrings(mol) << endl;
OBDescriptor* pDesc;
pDesc= OBDescriptor::FindType("logP");
if(pDesc)
cout << "logP " << pDesc->Predict(&mol) << endl;
pDesc = OBDescriptor::FindType("TPSA");
if(pDesc)
cout << "PSA " << pDesc->Predict(&mol) << endl;
pDesc = OBDescriptor::FindType("MR");
if(pDesc)
cout << "MR " << pDesc->Predict(&mol) << endl;
cout << "$$$$" << endl; // SDF like end of compound descriptor list
//Other OBDescriptors could be output here, even ones that were rarely
// used. Since these are plugin classes, they may not be loaded, but
// then with code like the above they are just ignored.
} // end for loop
return(0);
}