---------- Forwarded message ---------- From: James Jack <james.j...@symyx.com> Date: 2009/10/14 Subject: RE: [Noel O'Blog] New comment on Mono, C# and OpenBabel. To: Noel O'Boyle <baoille...@gmail.com>
Hi Noel, I'm seeing a few issues preparing Cartesian MOPAC files from Molfiles for certain structures. I'm trying to take a 2D molfile and use OpenBabel to prepare a Cartesian mop file suitable to send to MOPAC for geometrical optimization. See attached molfiles: //Input.mol = my starting point //Stage1.mol = openbabel reads in input.mol: OBConversion obconv = new OBConversion(); OBMol mol = new OBMol(); string inputMolfileString = this.renditor1.MolfileString; //set the MOPAC application location MOPACPath = @"C:\Program Files\MOPAC\mopac2009.exe"; //convert to cartesian MOP obconv.SetInFormat("mdl"); obconv.ReadString(mol, inputMolfileString); //check the files is read in ok obconv.SetOutFormat("mdl"); this.renderer1.MolfileString = obconv.WriteString(mol); //result looks good //stage2.mol if (mol.GetDimension() < 3) //if we have a 2D structure - prep for sending to MOPAC { //Generate a reasonable 3D model OBOp builder = OBOp.FindType("Gen3D"); builder.Do(mol); //check the resilt obconv.SetOutFormat("mdl"); this.renderer1.MolfileString = obconv.WriteString(mol); //looks bad - Nitrogens have valencies overfilled } Currently things seem to go wrong at stage 2. Even if I do an AddHydrogens() first the builder.Do(mol) seems to add extra H to the nitrogens and I believe this causes issues later. For sure, if I bypass stage2 by starting with a 3d molfile I get a much better outcome. I tried to replace stage2 as follows: //Sprout H mol.AddHydrogens(); //PreOptimize OBForceField obff = OBForceField.FindForceField("MMFF94"); if (obff.Setup(mol)) { obff.SteepestDescent(50); if (obff.GetCoordinates(mol)) { //check the output - we never get here - the optimization/setup fails. obconv.SetOutFormat("mdl"); this.renderer1.MolfileString = obconv.WriteString(mol); } } But the preoptimize code fails, not sure why... Even if I pass it a good 3D structure it still fails. If you have any ideas I'd be interested to hear... Best Regards, James -------------------------------------------------------------------------------- J. James Jack, Ph.D. +44 (0) 1530 220906, office Senior Consultant +44 (0) 7834 215542, mobile ELN Application Services +44 (0) 7590 258058, iPhone Symyx Technologies UK ltd. james.j...@symyx.com www.symyx.com --------------------------------------------------------------------------------
stage2.mol
Description: Binary data
input.mol
Description: Binary data
stage1.mol
Description: Binary data
mopac output.mol
Description: Binary data
------------------------------------------------------------------------------ Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now! http://p.sf.net/sfu/devconference
_______________________________________________ OpenBabel-Devel mailing list OpenBabel-Devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/openbabel-devel