Hi everyone, As some one asked today about the Multiple conformations in one molecule, I thought I would give it a crack, I've managed to get the conformations in to one molecule (with what looks like a memory leak, that I can't seem to shift) but I can't seem to write them back out again, I think the issue is with conformer ids however I can't find any neat way of returning the conformer ids. I has a look through the source and couldn't find too much, I had a check to see if I could store them in the function, but the ids seem to be the same, so I'm a little confused. Source is below...
With regards to the memory leak, this is poor programming not an RDKit issue, anyone know why I can't seem to delete the ROMol mol? The compiler throws up an error when I do. Is this even a memory leak or is the memory being sucked up by the conformations, because it seems like a lot. It was nice to meet you all and hear some excellent talks. #include <iostream> #include <string> #include <GraphMol/FileParsers/MolSupplier.h> #include <GraphMol/FileParsers/MolWriters.h> #include <GraphMol/RDKitBase.h> #include <GraphMol/MolOps.h> #include <GraphMol/SmilesParse/SmilesParse.h> #include <GraphMol/SmilesParse/SmilesWrite.h> #include <GraphMol/Conformer.h> using namespace std; using namespace RDKit; ROMol *SDConfSupplier(string); int main(int argc, char *argv []){ ROMol *mol; mol= SDConfSupplier(argv[1]); //takes first argument as the input file SDWriter writer("out.txt"); cout << mol->getNumConformers() << endl; for(int i=0; i<mol->getNumConformers(); ++i){ writer.write(*mol,i); } return 0; } ROMol* SDConfSupplier(string filename){ SDMolSupplier suppl(filename); ROMol *res=0; res = suppl.next(); while(!suppl.atEnd()){ ROMol *mol; unsigned short resNumAtoms=res->getNumAtoms(), confNumAtoms=0; try{ mol= suppl.next(); confNumAtoms = mol->getNumAtoms(); if(confNumAtoms!= resNumAtoms){ cerr << "Number of atoms in conformer incorrect\n"; exit(0); } Conformer *conf = &(mol->getConformer(0)); res->addConformer(conf, true); delete conf; } catch(...){ continue; } //delete mol; } return res; } Best, Nick The Institute of Cancer Research: Royal Cancer Hospital, a charitable Company Limited by Guarantee, Registered in England under Company No. 534147 with its Registered Office at 123 Old Brompton Road, London SW7 3RP. This e-mail message is confidential and for use by the addressee only. If the message is received by anyone other than the addressee, please return the message to the sender by replying to it and then delete the message from your computer and network. ------------------------------------------------------------------------------ Don't let slow site performance ruin your business. Deploy New Relic APM Deploy New Relic app performance management and know exactly what is happening inside your Ruby, Python, PHP, Java, and .NET app Try New Relic at no cost today and get our sweet Data Nerd shirt too! http://p.sf.net/sfu/newrelic-dev2dev _______________________________________________ Rdkit-discuss mailing list Rdkit-discuss@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/rdkit-discuss