On Mon, Oct 08, 2012 at 07:40:51PM +0200, David van der Spoel wrote: > On 2012-10-08 19:11, Reinis Danne wrote: > > On Mon, Oct 08, 2012 at 03:00:30PM +0200, David van der Spoel wrote: > >>> > >>> It adds TWO H for InChi output, not for SDF output, but it only produces > >>> two double bonds (out of three). I guess these are related? > > > > Yes, they are. It is bond order perception fail (together with > > kekulization). More about it below. > > > >>> Thanks for reading, > >>> > >> Sorry for spamming but I have to correct this, the gaussian files > >> produce the right inchi but not the correct bondorder! > >> > >> % wget http://folding.bmc.uu.se/fulvene-g4.log.gz > >> % babel -ig09 fulvene-g4.log.gz -osdf fulvene.sdf > >> % open fulvene.sdf (in Avogadro) > >> Look at the bonds. > > > > Actually tetracene also is failing to properly set bond orders > > in one of the cases. It looks like a kekulization algorithm > > fails to find optimal solution or some rings are not found and > > marked approprietly. > > > > As for the bond perception fail, the issue is that bond order > > perception trigers kekulization which in turn relies on bond > > orders to select some parameters. So it is a bit of chicken and > > egg problem. > > > > I have a patch which tries to fix it by adding extra logic in > > kekulization to make sure that it is working also in case when > > bond perception has not finished, but it breaks canonstable test > > in such a way that I have to ask if those tests were correct to > > begin with. > > > > For example this one: > > 4: ref = CCN(CCNc1ccc2c3c1c(=O)c1c(n3NN2)ccc(c1)[N+](=O)[O-])CC > > 4: can = CCN(CCNc1ccc2c3c1c(=O)c1cc(ccc1n3[nH][nH]2)[N+](=O)[O-])CC > > > > First of all I'm not a SMILES expert, but I think there is a > > confusion about which rings are aromatic. In contrast to what > > reference SMILES suggest I think the 5member ring with 3 > > nitrogens might be aromatic since in at least one resonance > > structure it has 10 pi electrons (6 from Ns and 4 from Cs which > > are part of pi system). Also the middle ringe has some resonance > > structures where Huckels law (4n+2) holds and some where it > > doesn't. So the quiestion is, which of these SMILES is correct > > one or maybe both of them are wrong? > Hm, not a smiles expert either, sorry. > > > > Also is fulvene aromatic? The cycle has 6 electrons if those > > from adjasent double bond count. > > > > Below is the patch that seems to fix remaining original issues. > > > > > Fulvene works with this patch, both pdb and gaussian. > For Azulene and Tetracene pdb input work but not gaussian (double bonds > in the wrong place).
In wrong place? I saw just respectively one or two separate Cs, so I think it didn't find optimal matching and ended up with one less double bond. Tough I still have to check if it really was the case. I have a new kekulization implementation (it is not yet really in usable state) and it finds correct double bonds for azulene and tetracene so I think there might be kekulization at fault. Tough it still doesn't explain why now PDB works while Gaussian output doesn't. > > Is the Gaussian parsing based on Z-matrix or coordinates? If it would be > based on coordinates I don't see why pdb should work and gaussian not. > If there is some other kind of tree algorithm based on the zmat that > could explain the difference. No, looking at the sources (line 388 and below) looks like it uses xyz coordinates. > > Fulvene and Azulene are both resonant structures, but do not adhere to > the (2n+2) rule, so not aromatic according to that definition. I presume you meant 4n+2 rule. So the answer is that one can't count those two electrons. Interestingly a quick search turned up a paper (DOI: 10.1039/C003686B) suggesting it can go from antiaromatic to aromatic depending on substituents or electronic excitation state (DOI: 10.1021/ja045729c). I ran a short HF calculation on the SMILES molecule and the small ring turned out to be not planar when there are Hs, so I guess that it makes the reference SMILES correct since planarity is one of the conditions for aromaticity. Still have to figure out why the tests fail. Reinis ------------------------------------------------------------------------------ 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 _______________________________________________ OpenBabel-discuss mailing list OpenBabel-discuss@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/openbabel-discuss