I assumed they would be in that order but got a seg fault when I tried, but that would be because I was deleting the pointer. Richard gets no errors when he compiles on his machine so I will check that when I get to work and then hopefully it should be ok to use.
I've also almost finished an RDKit implementation of the PBF score (http://pubs.acs.org/doi/abs/10.1021/ci300293f) so I will be adding that to the contributions asap. Also I'd like to apologise because although we've mentioned RDKit in the paper we somehow forgot to reference you, personally I'm blaming Nathan for this mistake, so Greg you can direct all hate mail to him. Best, Nick ________________________________________ From: Greg Landrum [greg.land...@gmail.com] Sent: 05 October 2012 05:19 To: Nicholas Firth Cc: rdkit-discuss@lists.sourceforge.net Subject: Re: [Rdkit-discuss] Multiple Conformations SD Reader On Thu, Oct 4, 2012 at 7:03 PM, Nicholas Firth <nicholas.fi...@icr.ac.uk> wrote: > > 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... I probably wouldn't return IDs from a function like this. You know the conformers are going in with increasing numeric IDs (from 0->N-1). > > 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. You should be deleting the molecules (that's the likely cause of the leak), but you shouldn't be deleting the conformer: when you call ROMol::addConformer() the ROMol takes ownership of the pointer. As an aside: In the C++ docs we tried to be careful about documenting things like this, but you have to know to look for it. From the docs for ROMol::addConformer() [http://www.rdkit.org/docs/cppapi/classRDKit_1_1ROMol.html#a68a3402095df86b357ce5ec0366b3ea5]: Parameters: conf - conformation to be added to the molecule, this molecule takes ownership of the conformer assignId - a unique ID will be assigned to the the conformation if true otherwise it is assumed that the conformation already has an (unique) ID set Best, -greg > 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 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