int main(int argc, char **argv) { if (argc < 3) { std::cerr << "Usage: " << argv[0] << " <molecule_file> <output_score_file>" << std::endl; return 1; } unsigned long numAtoms = 0; unsigned long numAromaticAtoms = 0; unsigned long numCyclicAtoms = 0; std::map<int, unsigned long> mass; std::map<int, unsigned long> elem; std::map<int, unsigned long> aromelem; std::map<int, unsigned long> aliphelem; std::map<int, unsigned long> hcount; std::map<int, unsigned long> charge; std::map<int, unsigned long> connect; std::map<int, unsigned long> degree; std::map<int, unsigned long> implicit; std::map<int, unsigned long> rings; std::map<int, unsigned long> size; std::map<int, unsigned long> valence; std::map<int, unsigned long> chiral; std::map<int, unsigned long> hyb; std::map<int, unsigned long> ringconnect; unsigned long numBonds = 0; unsigned long numSingleBonds = 0; unsigned long numDoubleBonds = 0; unsigned long numTripleBonds = 0; unsigned long numAromaticBonds = 0; unsigned long numRingBonds = 0; OBConversion conv; conv.SetInFormat(conv.FormatFromExt(argv[1])); std::ifstream ifs(argv[1]); conv.SetInStream(&ifs); OBMol mol; unsigned long molecule = 0; while (conv.Read(&mol)) { ++molecule; //if ((molecule % 1000) == 0) // std::cout << molecule << std::endl; FOR_ATOMS_OF_MOL (atom, mol) { numAtoms++; if (atom->IsAromatic()) { numAromaticAtoms++; aromelem[atom->GetAtomicNum()]++; } else aliphelem[atom->GetAtomicNum()]++; if (atom->IsInRing()) numCyclicAtoms++; mass[atom->GetIsotope()]++; elem[atom->GetAtomicNum()]++; hcount[atom->ExplicitHydrogenCount() + atom->ImplicitHydrogenCount()]++; charge[atom->GetFormalCharge()]++; connect[atom->GetImplicitValence()]++; degree[atom->GetValence()]++; implicit[atom->ImplicitHydrogenCount()]++; rings[atom->MemberOfRingCount()]++; for (int i = 3; i < 25; ++i) if (atom->IsInRingSize(i)) size[i]++; valence[atom->KBOSum() - (atom->GetSpinMultiplicity() ? atom->GetSpinMultiplicity() - 1 : 0)]++; hyb[atom->GetHyb()]++; ringconnect[atom->CountRingBonds()]++; } FOR_BONDS_OF_MOL (bond, mol) { numBonds++; if (bond->IsSingle()) numSingleBonds++; else if (bond->IsDouble()) numDoubleBonds++; else if (bond->IsTriple()) numTripleBonds++; if (bond->IsAromatic()) numAromaticBonds++; if (bond->IsInRing()) numRingBonds++;; }