void UCK::getGraph(vector<String>& v, PairVector& e, const Molecule& mol) { weight_ = 0.0; Size count = 0; vector<pair<String, Size> >* mol_name; mol_name = new vector<pair<String, Size> >; bool found_atom = false; for(AtomConstIterator atit1 = mol.beginAtom(); atit1 != mol.endAtom(); ++atit1) { if(ignore_hydrogens_ && atit1->getElement()==PTE[1]) continue; // find chemical formula for(Size i = 0; i != mol_name->size(); ++i) { if((*mol_name)[i].first == atit1->getElement().getSymbol()) // increase number of already existing molecules { (*mol_name)[i].second++; found_atom = true; break; } } if(!found_atom) // add current atom to formula, if it doesn't exist { mol_name->push_back(make_pair(atit1->getElement().getSymbol(),1)); found_atom = false; } found_atom = false; weight_ += atit1->getElement().getAtomicWeight(); v.push_back(atit1->getElement().getSymbol()); // add atom-name to label-list Size dest = 0; // find bonds from current atom to all other atoms and store them in e for(AtomConstIterator atit2 = mol.beginAtom(); atit2 != mol.endAtom(); ++atit2) { if(ignore_hydrogens_ && atit2->getElement()==PTE[1]) continue; if(atit1->getBond(*atit2) != 0) { e.push_back(make_pair(count, dest)); } ++dest; } ++count; } sort(mol_name->begin(), mol_name->end()); // sort vector mol_name in order to get the lexicographically ordered for(Size i = 0; i != mol_name->size(); ++i) // chemical formula { formula_ += ((*mol_name)[i].first)+(String)(*mol_name)[i].second; } delete mol_name; return; }
Molecule* RGroupAssembler::generateNextMolecule() { if (!not_finished_) return NULL; Molecule* mol = new Molecule; System* scaffold_copy = new System; if (scaffolds_[scaffold_counter_] != NULL) { *scaffold_copy = *scaffolds_[scaffold_counter_]; } else { return 0; } mol->insert(*scaffold_copy); for (AtomIterator atom_it = mol->beginAtom(); +atom_it; ) { String atom_name = atom_it->getName(); if (isPlacemark_(atom_name)) { atom_it++; appendMoiety_(mol, moieties_[atom_name][moiety_counter_[atom_name]], atom_name); } else { atom_it++; } } not_finished_ = incrementCounter_(); return mol; }
DistanceFinder::DistanceFinder(SimInfo* info) : info_(info) { nObjects_.push_back(info_->getNGlobalAtoms()+info_->getNGlobalRigidBodies()); nObjects_.push_back(info_->getNGlobalBonds()); nObjects_.push_back(info_->getNGlobalBends()); nObjects_.push_back(info_->getNGlobalTorsions()); nObjects_.push_back(info_->getNGlobalInversions()); stuntdoubles_.resize(nObjects_[STUNTDOUBLE]); bonds_.resize(nObjects_[BOND]); bends_.resize(nObjects_[BEND]); torsions_.resize(nObjects_[TORSION]); inversions_.resize(nObjects_[INVERSION]); SimInfo::MoleculeIterator mi; Molecule::AtomIterator ai; Molecule::RigidBodyIterator rbIter; Molecule::BondIterator bondIter; Molecule::BendIterator bendIter; Molecule::TorsionIterator torsionIter; Molecule::InversionIterator inversionIter; Molecule* mol; Atom* atom; RigidBody* rb; Bond* bond; Bend* bend; Torsion* torsion; Inversion* inversion; for (mol = info_->beginMolecule(mi); mol != NULL; mol = info_->nextMolecule(mi)) { for(atom = mol->beginAtom(ai); atom != NULL; atom = mol->nextAtom(ai)) { stuntdoubles_[atom->getGlobalIndex()] = atom; } for (rb = mol->beginRigidBody(rbIter); rb != NULL; rb = mol->nextRigidBody(rbIter)) { stuntdoubles_[rb->getGlobalIndex()] = rb; } for (bond = mol->beginBond(bondIter); bond != NULL; bond = mol->nextBond(bondIter)) { bonds_[bond->getGlobalIndex()] = bond; } for (bend = mol->beginBend(bendIter); bend != NULL; bend = mol->nextBend(bendIter)) { bends_[bend->getGlobalIndex()] = bend; } for (torsion = mol->beginTorsion(torsionIter); torsion != NULL; torsion = mol->nextTorsion(torsionIter)) { torsions_[torsion->getGlobalIndex()] = torsion; } for (inversion = mol->beginInversion(inversionIter); inversion != NULL; inversion = mol->nextInversion(inversionIter)) { inversions_[inversion->getGlobalIndex()] = inversion; } } }
void IndexFinder::init() { SimInfo::MoleculeIterator mi; Molecule::AtomIterator ai; Molecule::RigidBodyIterator rbIter; Molecule::BondIterator bondIter; Molecule::BendIterator bendIter; Molecule::TorsionIterator torsionIter; Molecule::InversionIterator inversionIter; Molecule* mol; Atom* atom; RigidBody* rb; Bond* bond; Bend* bend; Torsion* torsion; Inversion* inversion; for (mol = info_->beginMolecule(mi); mol != NULL; mol = info_->nextMolecule(mi)) { SelectionSet ss(nObjects_); ss.bitsets_[MOLECULE].setBitOn(mol->getGlobalIndex()); for(atom = mol->beginAtom(ai); atom != NULL; atom = mol->nextAtom(ai)) { ss.bitsets_[STUNTDOUBLE].setBitOn(atom->getGlobalIndex()); } for (rb = mol->beginRigidBody(rbIter); rb != NULL; rb = mol->nextRigidBody(rbIter)) { ss.bitsets_[STUNTDOUBLE].setBitOn(rb->getGlobalIndex()); } for (bond = mol->beginBond(bondIter); bond != NULL; bond = mol->nextBond(bondIter)) { ss.bitsets_[BOND].setBitOn(bond->getGlobalIndex()); } for (bend = mol->beginBend(bendIter); bend != NULL; bend = mol->nextBend(bendIter)) { ss.bitsets_[BEND].setBitOn(bend->getGlobalIndex()); } for (torsion = mol->beginTorsion(torsionIter); torsion != NULL; torsion = mol->nextTorsion(torsionIter)) { ss.bitsets_[TORSION].setBitOn(torsion->getGlobalIndex()); } for (inversion = mol->beginInversion(inversionIter); inversion != NULL; inversion = mol->nextInversion(inversionIter)) { ss.bitsets_[INVERSION].setBitOn(inversion->getGlobalIndex()); } selectionSets_[mol->getGlobalIndex()] = ss; } }
int main(int argc, char* argv[]) { CommandlineParser parpars("RMSDCalculator", "calculate RMSD between ligand poses", VERSION, String(__DATE__), "Analysis"); parpars.registerMandatoryInputFile("i", "input molecule file"); parpars.registerMandatoryInputFile("org", "molecule file containing the original ('true') poses"); parpars.registerOptionalOutputFile("o", "output molecule file"); parpars.registerFlag("quiet", "by quiet, i.e. do not print progress information"); String man = "This tool calculates the RMSD between different conformations of the same molecule.\n\nThis tool can be used to evaluate the differences between ligand poses taken from co-crystal structures, e.g. generated by a docking run.\nNote:Molecules may be sorted differently in the two input files; a topology hashkey will be used to match molecules to each other.\n\nOutput of this tool is a molecule file which will for each molecule contain a property-tag 'RMSD' holding the calculated RMSD value."; parpars.setToolManual(man); parpars.setSupportedFormats("i",MolFileFactory::getSupportedFormats()); parpars.setSupportedFormats("org",MolFileFactory::getSupportedFormats()); parpars.setSupportedFormats("o","mol2,sdf,drf"); parpars.parse(argc, argv); // Retrieve coordinates of original poses GenericMolFile* original = MolFileFactory::open(parpars.get("org")); HashMap<String, list<Vector3> > original_poses; for (Molecule* mol = original->read(); mol; delete mol, mol = original->read()) { String topology_hash; FlexibleMolecule::generateTopologyHash(mol, topology_hash, true); if (original_poses.find(topology_hash) != original_poses.end()) { Log<<"[Warning:] more than one 'original' conformation for a molecule detected. Will use only the first conformation and ignore all other."<<endl; } else { list<Vector3> l; HashMap<String, list<Vector3> >::iterator map_it = original_poses.insert(make_pair(topology_hash, l)).first; for (AtomConstIterator it = mol->beginAtom(); +it; it++) { if (it->getElement().getSymbol() != "H") { map_it->second.push_back(it->getPosition()); } } } } delete original; // Retrieve coordinates of input poses and calculate RMSDs GenericMolFile* input = MolFileFactory::open(parpars.get("i")); GenericMolFile* output = 0; String filename = parpars.get("o"); if (filename != CommandlineParser::NOT_FOUND) { output = MolFileFactory::open(filename, ios::out, input); } double average_RMSD = 0; int no_mols = 0; int no_valid_rmsds = 0; bool quiet = (parpars.get("quiet")!=CommandlineParser::NOT_FOUND); for (Molecule* mol = input->read(); mol; delete mol, mol = input->read()) { no_mols++; String topology_hash; FlexibleMolecule::generateTopologyHash(mol, topology_hash, true); HashMap<String, list<Vector3> >::iterator map_it = original_poses.find(topology_hash); if (map_it == original_poses.end()) { Log<<"[Warning:] no original pose for molecule '"<<mol->getName()<<"' found, its RMSD can thus not be computed."<<endl; mol->setProperty("RMSD", "N/A"); } else { double RMSD = 0; list<Vector3>::iterator list_it = map_it->second.begin(); int no_heavy_atoms = 0; AtomConstIterator it = mol->beginAtom(); for (; +it ; it++) { if (it->getElement().getSymbol() != "H" && list_it != map_it->second.end()) { RMSD += pow(it->getPosition().getDistance(*list_it), 2); no_heavy_atoms++; list_it++; } } if (it != mol->endAtom() || list_it != map_it->second.end()) { Log.error()<<"[Error:] Number of heavy atoms of input pose do not match number of heavy atoms of original pose!!"<<endl; return 1; } RMSD = sqrt(RMSD/no_heavy_atoms); mol->setProperty("RMSD", RMSD); average_RMSD += RMSD; no_valid_rmsds++; if (!quiet) Log << "RMSD for molecule "<<no_mols<<", '"<<mol->getName()<<"' = "<<RMSD<<endl; } if (output) *output << *mol; } average_RMSD /= no_valid_rmsds; Log <<endl<<"average RMSD = "<<average_RMSD<<endl<<endl; delete input; delete output; return 0; }
void BondAngleDistribution::process() { Molecule* mol; Atom* atom; RigidBody* rb; int myIndex; SimInfo::MoleculeIterator mi; Molecule::RigidBodyIterator rbIter; Molecule::AtomIterator ai; StuntDouble* sd; Vector3d vec; std::vector<Vector3d> bondvec; RealType r; int nBonds; int i; bool usePeriodicBoundaryConditions_ = info_->getSimParams()->getUsePeriodicBoundaryConditions(); DumpReader reader(info_, dumpFilename_); int nFrames = reader.getNFrames(); frameCounter_ = 0; nTotBonds_ = 0; for (int istep = 0; istep < nFrames; istep += step_) { reader.readFrame(istep); frameCounter_++; currentSnapshot_ = info_->getSnapshotManager()->getCurrentSnapshot(); if (evaluator_.isDynamic()) { seleMan_.setSelectionSet(evaluator_.evaluate()); } // update the positions of atoms which belong to the rigidbodies for (mol = info_->beginMolecule(mi); mol != NULL; mol = info_->nextMolecule(mi)) { for (rb = mol->beginRigidBody(rbIter); rb != NULL; rb = mol->nextRigidBody(rbIter)) { rb->updateAtoms(); } } // outer loop is over the selected StuntDoubles: for (sd = seleMan_.beginSelected(i); sd != NULL; sd = seleMan_.nextSelected(i)) { myIndex = sd->getGlobalIndex(); nBonds = 0; bondvec.clear(); // inner loop is over all other atoms in the system: for (mol = info_->beginMolecule(mi); mol != NULL; mol = info_->nextMolecule(mi)) { for (atom = mol->beginAtom(ai); atom != NULL; atom = mol->nextAtom(ai)) { if (atom->getGlobalIndex() != myIndex) { vec = sd->getPos() - atom->getPos(); if (usePeriodicBoundaryConditions_) currentSnapshot_->wrapVector(vec); // Calculate "bonds" and make a pair list r = vec.length(); // Check to see if neighbor is in bond cutoff if (r < rCut_) { // Add neighbor to bond list's bondvec.push_back(vec); nBonds++; nTotBonds_++; } } } for (int i = 0; i < nBonds-1; i++ ){ Vector3d vec1 = bondvec[i]; vec1.normalize(); for(int j = i+1; j < nBonds; j++){ Vector3d vec2 = bondvec[j]; vec2.normalize(); RealType theta = acos(dot(vec1,vec2))*180.0/NumericConstant::PI; if (theta > 180.0){ theta = 360.0 - theta; } int whichBin = int(theta/deltaTheta_); histogram_[whichBin] += 2; } } } } } writeBondAngleDistribution(); }
bool KCFFile::write(const Molecule& molecule) throw(File::CannotWrite) { if (!isOpen() || getOpenMode() != std::ios::out) { throw File::CannotWrite(__FILE__, __LINE__, name_); } // An alias for simplicity's sake... std::ostream& os(getFileStream()); // Write ENTRY block // number of blanks???? properties are not read, written??? Which ones are there? os << ENTRY_TAG << " " << molecule.getName() << std::endl; static char buffer[BALL_MAX_LINE_LENGTH]; // Write NODE block // How to create the KEGG atom types? How many blanks? // This is not specified in the KCF format description, so we use what we can // deduce from example files. // First line gets the NODE tag os << NODE_TAG << " " << molecule.countAtoms() << "\n"; Size count = 1; AtomConstIterator ai(molecule.beginAtom()); std::map<const Atom*, Position> atom_to_index; for (; +ai; ++ai, ++count) { // Write the atom line. // Blanks???? String type = ai->getTypeName(); String comment; // Make sure the type is in the set of KEGG types???? // Blanks? sprintf(buffer, " %d %s %s %6.4f %6.4f %s\n", count, type.c_str(), ai->getElement().getSymbol().c_str(), ai->getPosition().x, ai->getPosition().y, comment.c_str()); os << buffer; // Remember the index of the current atom to map atom // pointers back to indices for the EDGE section. atom_to_index[&*ai] = count; } // Write EDGE block. Walk over all bonds to do so. // Blanks???? os << "EDGE " << molecule.countBonds() << "\n"; count = 1; for (ai = molecule.beginAtom(); +ai; ++ai) { for (Atom::BondConstIterator bi(ai->beginBond()); +bi; ++bi) { Position index1 = atom_to_index[bi->getFirstAtom()]; Position index2 = atom_to_index[bi->getSecondAtom()]; String comment; // Write every bond just once if (bi->getFirstAtom() == &*ai) { sprintf(buffer, " %4d %4d %4d %1d%s\n", count, index1, index2, bi->getOrder(), comment.c_str()); os << buffer; ++count; } } } // Write the DELIMITER block os << DELIMITER_TAG << std::endl; return true; }
int main(int argc, char** argv) { Path path; String tmp; String configuration_string = ""; CommandlineParser parpars("SLICK", "scoring protein-carbohydrate interactions", VERSION, String(__DATE__), "Scoring"); parpars.registerFlag("E", "compute only SLICKEnergy"); parpars.registerFlag("S", "compute only SLICKScore"); parpars.registerFlag("u", "unite atoms"); parpars.registerFlag("n", "read radius rules for the nonpolar solvation from FILE"); parpars.registerFlag("N", "scale nonpolar radii by FACTOR"); parpars.registerFlag("log", "write log file"); parpars.registerMandatoryInputFile("rec", "input receptor file"); parpars.registerMandatoryInputFile("lig", "input ligand file"); parpars.registerOptionalInputFile("cr", "charge rules"); parpars.registerOptionalInputFile("pr", "radius rules for the polar solvation"); parpars.registerOptionalInputFile("lj", "use FILE for LJ parameters"); parpars.registerOptionalInputFile("op", "read options from FILE (command line overrides!)"); parpars.registerOptionalIntegerParameter("v", "verbosity to level"); parpars.registerOptionalDoubleParameter("s", "scaling factor for receptor charges"); parpars.registerOptionalDoubleParameter("t", "scaling factor for ligand charges"); parpars.setSupportedFormats("rec","PDB"); parpars.setSupportedFormats("lig","HIN"); parpars.setSupportedFormats("cr","rul"); parpars.setSupportedFormats("pr","rul"); parpars.setSupportedFormats("lj","rul"); parpars.setSupportedFormats("op", "ini"); String man = "This tool calculates the SLICKEnergy / SLICK Score for protein-carbohydrate complexes."; parpars.setToolManual(man); parpars.parse(argc, argv); Options options; ScoringFunction::getDefaultOptions(options); unsigned int verbosity = 0; if (parpars.get("v") != CommandlineParser::NOT_FOUND) { verbosity = parpars.get("v").toInt(); options.setInteger("verbosity", verbosity); } float receptor_charge_scaling_factor = 1.0f; if (parpars.get("s") != CommandlineParser::NOT_FOUND) { receptor_charge_scaling_factor = parpars.get("s").toFloat(); configuration_string += "scale_receptor_charges " + parpars.get("s") + "\n"; } float ligand_charge_scaling_factor = 1.0f; if (parpars.get("t") != CommandlineParser::NOT_FOUND) { ligand_charge_scaling_factor = parpars.get("t").toFloat(); configuration_string += "scale_ligand_charges " + parpars.get("t") + "\n"; } String protein_file_name = parpars.get("rec"); if (protein_file_name == CommandlineParser::NOT_FOUND) { Log.error() << "Missing protein file name." << endl; return 1; } configuration_string += "protein_file_name " + protein_file_name + "\n"; String ligand_file_name = parpars.get("lig"); if (ligand_file_name == CommandlineParser::NOT_FOUND) { Log.error() << "Missing ligand file name." << endl; return 1; } configuration_string += "ligand_file_name " + ligand_file_name + "\n"; if (verbosity > 0) { Log.info() << "Initializing residue checker." << endl; } FragmentDB db("fragments/Fragments.db"); ResidueChecker check(db); time_t rawtime; time(&rawtime); String time_string("start: " + String(asctime(localtime(&rawtime)))); // now load the molecules and assign radii and charges depending on // what the user wants System system; PDBFile protein_file(protein_file_name); protein_file >> system; protein_file.close(); Molecule* protein = system.getMolecule(0); if (verbosity > 0) { Log.info() << "Normalizing names (protein)." << endl; } system.apply(db.normalize_names); if (verbosity > 0) { Log.info() << "Building bonds (protein)." << endl; } system.apply(db.build_bonds); HINFile ligand_hin_file; ligand_hin_file.open(ligand_file_name); ligand_hin_file >> system; ligand_hin_file.close(); Molecule* ligand = system.getMolecule(1); // Read and apply charge rules String charge_rule_file_name = parpars.get("cr"); if (charge_rule_file_name == CommandlineParser::NOT_FOUND) { charge_rule_file_name = "solvation/PARSE+ions.rul"; } else { configuration_string += "use_charge_rules " + charge_rule_file_name + "\n"; tmp = path.find(charge_rule_file_name); if (tmp != "") { charge_rule_file_name = tmp; } if (verbosity > 0) { Log.info() << "Using " << charge_rule_file_name << " as charge rule file" << endl; } INIFile charge_ini(charge_rule_file_name); charge_ini.read(); ChargeRuleProcessor charge_rules(charge_ini); system.apply(charge_rules); } // Read and apply polar charge rules String polar_radius_rule_file_name = parpars.get("pr"); if (polar_radius_rule_file_name == CommandlineParser::NOT_FOUND) { polar_radius_rule_file_name = "solvation/PARSE+ions.rul"; } else { configuration_string += "use_polar_radius_rules " + polar_radius_rule_file_name + "\n"; tmp = path.find(polar_radius_rule_file_name); if (tmp != "") { polar_radius_rule_file_name = tmp; } if (verbosity > 0) { Log.info() << "Using " << polar_radius_rule_file_name << " as polar radius rule file" << endl; } INIFile radius_ini(polar_radius_rule_file_name); radius_ini.read(); RadiusRuleProcessor radius_rules(radius_ini); system.apply(radius_rules); } if (verbosity > 8) { Log.info() << "system statistics:" << endl; Log.info() << "molecules: " << system.countMolecules() << endl; Log.info() << "proteins: " << system.countProteins() << endl; Log.info() << "fragments: " << system.countFragments() << endl; Log.info() << "atoms: " << system.countAtoms() << endl; } // check for uassigned type names AtomIterator it; int count = 0; for (it = system.beginAtom(); +it; ++it) { count++; if (it->getElement().getSymbol() == "?") { Log.info() << "Got symbol \"?\": " << it->getFullName() << endl; } if (it->getCharge() > 8.0) { Log.error() << "Mysterious charge: " << it->getCharge() << "\t" << it->getFullName() << "\t" << count << "\t" << it->getElement().getSymbol() << endl; } } // scale charges if (verbosity > 0) { Log.info() << "Scaling receptor charges by " << receptor_charge_scaling_factor << endl; } if (parpars.has("s")) { for (it = protein->beginAtom(); +it; ++it) { it->setCharge(it->getCharge() * receptor_charge_scaling_factor); } } if (verbosity > 0) { Log.info() << "Scaling ligand charges by " << ligand_charge_scaling_factor << endl; } if (parpars.has("t")) { for (it = ligand->beginAtom(); +it; ++it) { it->setCharge(it->getCharge() * ligand_charge_scaling_factor); } } String options_file_name = parpars.get("op"); if (options_file_name != CommandlineParser::NOT_FOUND) { options.readOptionFile(options_file_name); configuration_string += "read_options_file " + options_file_name; } String lj_parameter_file_name = parpars.get("lj"); if (lj_parameter_file_name == CommandlineParser::NOT_FOUND) { lj_parameter_file_name = "Amber/amber94gly.ini"; } else { configuration_string = configuration_string + "lj_parameter_file_name " + lj_parameter_file_name; } options.set(VanDerWaalsSlick::Option::LENNARD_JONES_FILE, lj_parameter_file_name); if (parpars.has("u")) { options.setBool(PolarSolvation::Option::UNITE_ATOMS, true); cout << "Uniting atoms." << endl; configuration_string += "unite_atoms true\n"; } else { options.setBool(PolarSolvation::Option::UNITE_ATOMS, false); cout << "Not uniting atoms." << endl; } String nonpolar_radius_rule_file_name = parpars.get("n"); if (nonpolar_radius_rule_file_name == CommandlineParser::NOT_FOUND) { nonpolar_radius_rule_file_name = "solvation/bondi.rul"; } else { cout << "Using " << nonpolar_radius_rule_file_name << " for nonpolar radii" << endl; configuration_string += "use_nonpolar_radius_rules " + nonpolar_radius_rule_file_name + "\n"; options.setBool(NonpolarSolvation::Option::NONPOLAR_OVERWRITE_RADII, true); options.set(NonpolarSolvation::Option::NONPOLAR_RADIUS_RULES, nonpolar_radius_rule_file_name); } float score = 0.0f; if (!parpars.has("S")) { configuration_string = configuration_string + "calculate_energy\n"; SLICKEnergy slick(*protein, *ligand, options); score = slick.calculateScore(); cout << endl << "SLICK/energy is " << score << " kJ/mol" << endl; if (verbosity > 1) { cout << endl << "Scores (w/o coefficients)" << endl << endl; cout << "Hydrogen bonds " << slick.getHydrogenBondScore() << endl; cout << "CHPI " << slick.getCHPIScore() << endl; cout << "VanDerWaalsSlick " << slick.getVDWScore() << endl; cout << "Nonpolar solvation " << slick.getNonpolarSolvationScore() << endl; cout << "Polar Solvation " << slick.getPolarSolvationScore() << endl; } #ifdef OLD_DATAFILE_FORMAT String dat_file_name; String component; File datfile; component = "SLICKenergy"; dat_file_name = component + ".dat"; datfile.open(dat_file_name, std::ios::out); datfile << protein_file_name << " " << ligand_file_name << " " << score << " " << component << endl; datfile.close(); component = "HB"; dat_file_name = component + ".dat"; datfile.open(dat_file_name, std::ios::out); datfile << protein_file_name << " " << ligand_file_name << " " << slick.getHydrogenBondScore() << " " << component << endl; datfile.close(); component = "CHPISlick"; dat_file_name = component + ".dat"; datfile.open(dat_file_name, std::ios::out); datfile << protein_file_name << " " << ligand_file_name << " " << slick.getCHPIScore() << " " << component << endl; datfile.close(); component = "VDW5"; dat_file_name = component + ".dat"; datfile.open(dat_file_name, std::ios::out); datfile << protein_file_name << " " << ligand_file_name << " " << slick.getVDWScore() << " " << component << endl; datfile.close(); component = "NONPOLAR2"; dat_file_name = component + ".dat"; datfile.open(dat_file_name, std::ios::out); datfile << protein_file_name << " " << ligand_file_name << " " << slick.getNonpolarSolvationScore() << " " << component << endl; datfile.close(); component = "DESOLV4"; dat_file_name = component + ".dat"; datfile.open(dat_file_name, std::ios::out); datfile << protein_file_name << " " << ligand_file_name << " " << slick.getPolarSolvationScore() << " " << component << endl; datfile.close(); #endif time(&rawtime); time_string = time_string + String("stop: " + String(asctime(localtime(&rawtime)))); if (parpars.has("log")) { File logfile("SLICKenergy.log", std::ios::out); logfile << configuration_string << endl; logfile << time_string << endl; logfile.close(); } } if (!parpars.has("E")) { configuration_string = configuration_string + "calculate_score\n"; SLICKScore slick(*protein, *ligand, options); score = slick.calculateScore(); cout << endl << "SLICK/score is " << score << " (arb. units)" << endl; if (verbosity > 1) { cout << endl << "Scores (w/o coefficients)" << endl << endl; cout << "Hydrogen bonds " << slick.getHydrogenBondScore() << endl; cout << "CHPI " << slick.getCHPIScore() << endl; cout << "VanDerWaalsSlick " << slick.getVDWScore() << endl; cout << "Electrostatic int. " << slick.getPolarSolvationScore() << endl; } #ifdef OLD_DATAFILE_FORMAT String dat_file_name; String component; File datfile; component = "SLICKenergy"; dat_file_name = component + ".dat"; datfile.open(dat_file_name, std::ios::out); datfile << protein_file_name << " " << ligand_file_name << " " << score << " " << component << endl; datfile.close(); component = "HB"; dat_file_name = component + ".dat"; datfile.open(dat_file_name, std::ios::out); datfile << protein_file_name << " " << ligand_file_name << " " << slick.getHydrogenBondScore() << " " << component << endl; datfile.close(); component = "CHPISlick"; dat_file_name = component + ".dat"; datfile.open(dat_file_name, std::ios::out); datfile << protein_file_name << " " << ligand_file_name << " " << slick.getCHPIScore() << " " << component << endl; datfile.close(); component = "VDW5"; dat_file_name = component + ".dat"; datfile.open(dat_file_name, std::ios::out); datfile << protein_file_name << " " << ligand_file_name << " " << slick.getVDWScore() << " " << component << endl; datfile.close(); component = "COULOMB"; dat_file_name = component + ".dat"; datfile.open(dat_file_name, std::ios::out); datfile << protein_file_name << " " << ligand_file_name << " " << slick.getPolarSolvationScore() << " " << component << endl; datfile.close(); #endif time(&rawtime); time_string = time_string + String("stop: " + String(asctime(localtime(&rawtime)))); if (parpars.has("log")) { File logfile("SLICKscore.log", std::ios::out); logfile << configuration_string << endl; logfile << time_string << endl; logfile.close(); } } }