OpenBabel sees conformers #16 and #17 as identical by inchi but different by canonical SMILES (and by ordinary SMILES too, which is used in --readconformer). The differences are related to the stereochemistry around a C=C double bond. obabel 234551.sdf -osmi -f16 -l17 --unique obabel 234551.sdf -osmi -f16 -l17 --unique cansmi
This would seem to be a bug, but maybe others who understand how the stereo is perceived could comment. Chris On 17/05/2013 09:48, bm wrote: > Hello: > > I tried your method for reading and ran into two issues: > > 1) Perhaps my version of openbabel is outdated (2.3.1), but I figured by > trial and error that correct string argument to OBOp::FindType() should > be "readconformer", not "readconformers". Please fix the typo in the > documentation accordingly. > 2) Using the above code for reading, one file written as a series of > conformer failed to be identified as a single molecule. (50 conformers > becomes consolidated into 17 "unique" molecules). Attached is the > sample SDF file. Please confirm that it is possibly a mistake on my end > or that it is a bug on openbabel's end > > Thanks! > > > > On Fri, May 17, 2013 at 11:00 AM, Geoffrey Hutchison > <geoff.hutchi...@gmail.com <mailto:geoff.hutchi...@gmail.com>> wrote: > > The best bet is *always* to e-mail the list. My suggestion if you're > writing code is to look at what read/write conformers do. :-) > > % less src/ops/readconformers.cpp: > … > /* > To use with OBConversion::Read(), etc. > OBMol mol; > vector<OBBase*> vec; > while(pConv->Read(&mol)) > vec.push_back(&mol); > OBOp* pOp = OBOp::FindType("readconformers"); > if(!pOp) > pOp->ProcessVec(vec); > vec now contains one or more molecules with multiple conformers > */ > … > > % less src/obmolecformat.cpp > … > if(pConv->IsOption("writeconformers", > OBConversion::GENOPTIONS)) { > //The last conformer is written in the calling function > unsigned int c = 0; > for (; c < pmol->NumConformers()-1; ++c) { > pmol->SetConformer(c); > if(!pConv->GetOutFormat()->WriteMolecule(pmol, pConv)) > break; > } > pmol->SetConformer(c); > } > ... > > Not very hard, and of course you could do something like this: > > // Write all conformers in pmol to std::cout > pConv->AddOption("writeconformers",OBConversion::GENOPTIONS); > pConv->Write(pmol, &cout); > > Hope that helps, > -Geoff > > On May 15, 2013, at 12:50 AM, bm <b...@berkeley.edu > <mailto:b...@berkeley.edu>> wrote: > >> Hello: >> >> I am using OpenBabel to help me generate multiple conformers of >> one molecule, and then using them to calculate spatial fit with >> another molecule. However, I would like to save the conformers to >> a single file as I run my calculations, so that I have a record of >> the random conformers I have used. Is there a way to get >> OBConversion to read and write multiple conformers of a single >> molecule? I understand that one can do this using the obabel >> program's --readconformer and --writeconformers flags, but I would >> like to do all this in-code; i.e. >> >> // to save conformers >> OBMol *mol = generateConformers(); >> mol->NumConformers() // returns value greater than 1 >> obconversion->saveMoleculeAndAllConformersToFile(); >> >> // later, when I want to revisit my generated conformers >> obconversion->openFile("file") >> obconversion->loadAllConformersInFileToMolecule(mol) >> mol->NumConformers() // returns value greater than 1 >> >> I also tried using OpReadConformers to help me, but its churning >> out an incomplete type error on compile... >> >> Any help would be greatly appreciated! >> bm >> > > > > > ------------------------------------------------------------------------------ > AlienVault Unified Security Management (USM) platform delivers complete > security visibility with the essential security capabilities. Easily and > efficiently configure, manage, and operate all of your security controls > from a single console and one unified framework. Download a free trial. > http://p.sf.net/sfu/alienvault_d2d > > > > _______________________________________________ > OpenBabel-Devel mailing list > OpenBabel-Devel@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/openbabel-devel > ------------------------------------------------------------------------------ AlienVault Unified Security Management (USM) platform delivers complete security visibility with the essential security capabilities. Easily and efficiently configure, manage, and operate all of your security controls from a single console and one unified framework. Download a free trial. http://p.sf.net/sfu/alienvault_d2d _______________________________________________ OpenBabel-Devel mailing list OpenBabel-Devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/openbabel-devel