Hi, The implementation of the new stereochimestry code is over. It works for Pgchem and Mychem (== we have the same results as obgrep).
Here's a sample from the code: Serialization: vector<OBGenericData*>::iterator data; vector<OBGenericData*> stereoData; if (mol.HasData(OBGenericDataType::StereoData)) { stereoData = mol.GetAllData(OBGenericDataType::StereoData); } unsigned int numstereo = stereoData.size(); for (data = stereoData.begin(); data != stereoData.end(); ++data) { OBStereo::Type type; type = ((OBStereoBase*)*data)->GetType(); if (type == OBStereo::Tetrahedral) { OBTetrahedralStereo *ts = dynamic_cast<OBTetrahedralStereo*>(*data); OBTetrahedralStereo::Config config = ts->GetConfig(); stereoptr->type = type; stereoptr->atomids[0] = config.center; stereoptr->atomids[1] = config.towards; stereoptr->refs[0] = config.refs[0]; stereoptr->refs[1] = config.refs[1]; stereoptr->refs[2] = config.refs[2]; stereoptr->winding = config.winding; stereoptr->view = config.view; } else if (type == OBStereo::SquarePlanar) { OBSquarePlanarStereo *sp = dynamic_cast<OBSquarePlanarStereo*>(*data); OBSquarePlanarStereo::Config config = sp->GetConfig(); stereoptr->type = type; stereoptr->atomids[0] = config.center; stereoptr->refs[0] = config.refs[0]; stereoptr->refs[1] = config.refs[1]; stereoptr->refs[2] = config.refs[2]; stereoptr->refs[3] = config.refs[3]; stereoptr->shape = config.shape; } else if (type == OBStereo::CisTrans) { OBCisTransStereo *ct = dynamic_cast<OBCisTransStereo*>(*data); OBCisTransStereo::Config config = ct->GetConfig(); stereoptr->type = type; stereoptr->atomids[0] = config.begin; stereoptr->atomids[1] = config.end; stereoptr->refs[0] = config.refs[0]; stereoptr->refs[1] = config.refs[1]; stereoptr->refs[2] = config.refs[2]; stereoptr->refs[3] = config.refs[3]; stereoptr->shape = config.shape; } ++stereoptr; } Unserialization: for (i=0; i < nstereo; ++i) { if (stereoptr->type == OBStereo::Tetrahedral) { OBTetrahedralStereo::Config cfg; cfg.center = stereoptr->atomids[0]; cfg.towards = stereoptr->atomids[1]; cfg.refs = OBStereo::MakeRefs(stereoptr->refs[0],stereoptr->refs[1],stereoptr->refs[2]); cfg.winding = stereoptr->winding; cfg.view = stereoptr->view; OBTetrahedralStereo *obts = new OBTetrahedralStereo(&mol); obts->SetConfig(cfg); mol.SetData(obts); } else if (stereoptr->type == OBStereo::SquarePlanar) { OBSquarePlanarStereo::Config cfg; cfg.center = stereoptr->atomids[0]; cfg.refs = OBStereo::MakeRefs(stereoptr->refs[0],stereoptr->refs[1],stereoptr->refs[2],stereoptr->refs[3]); cfg.shape = stereoptr->shape; OBSquarePlanarStereo *obsp = new OBSquarePlanarStereo(&mol); obsp->SetConfig(cfg); mol.SetData(obsp); } else if (stereoptr->type == OBStereo::CisTrans) { OBCisTransStereo::Config cfg; cfg.begin = stereoptr->atomids[0]; cfg.end = stereoptr->atomids[1]; cfg.refs = OBStereo::MakeRefs(stereoptr->refs[0],stereoptr->refs[1],stereoptr->refs[2],stereoptr->refs[3]); cfg.shape = stereoptr->shape; OBCisTransStereo *obct = new OBCisTransStereo(&mol); obct->SetConfig(cfg); mol.SetData(obct); } ++stereoptr; } Should I add to the end of unserialization : if (nstereo > 0) { mol.SetChiralityPerceived(); } Do not hesitate to send us any comments about this code. Cheers, Jerome On ven., 2011-12-09 at 17:17 +0100, Jérôme Pansanel wrote: > Hi, > > I will wait for the release of Mychem 0.9.0 (it is based on Open Babel > 2.3.0). > > Ernst-Georg, I have started the serialization of the OBCisTransStereo > and OBTetrahedralStereo objects. I will send you the code next week. > > Cheers, > > Jerome > > On ven., 2011-12-09 at 11:15 +0000, Ernst-Georg Schmid wrote: > > Hi, > > > > >The OBChiralData isn't used anymore. Also the functions > > >OBAtom::IsClockwise, and OBAtom::IsAntiClockwise are obsolate. > > >Instead, you should serialize the OBCisTransStereo and > > >OBTetrahedralStereo data objects. > > > > thank you. This was the missing link. > > > > Best regards, > > > > Ernst-Georg > > > > > > ------------------------------------------------------------------------------ > > Cloud Services Checklist: Pricing and Packaging Optimization > > This white paper is intended to serve as a reference, checklist and point > > of > > discussion for anyone considering optimizing the pricing and packaging > > model > > of a cloud services business. Read Now! > > http://www.accelacomm.com/jaw/sfnl/114/51491232/ > > _______________________________________________ > > OpenBabel-Devel mailing list > > OpenBabel-Devel@lists.sourceforge.net > > https://lists.sourceforge.net/lists/listinfo/openbabel-devel > > > > ------------------------------------------------------------------------------ > Cloud Services Checklist: Pricing and Packaging Optimization > This white paper is intended to serve as a reference, checklist and point of > discussion for anyone considering optimizing the pricing and packaging model > of a cloud services business. Read Now! > http://www.accelacomm.com/jaw/sfnl/114/51491232/ > _______________________________________________ > OpenBabel-Devel mailing list > OpenBabel-Devel@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/openbabel-devel ------------------------------------------------------------------------------ Keep Your Developer Skills Current with LearnDevNow! The most comprehensive online learning library for Microsoft developers is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3, Metro Style Apps, more. Free future releases when you subscribe now! http://p.sf.net/sfu/learndevnow-d2d _______________________________________________ OpenBabel-Devel mailing list OpenBabel-Devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/openbabel-devel