I had a look at it too, the following hack seems to work for all types
of imidazolium ions.
In gaussformat.cpp I moved mol.SetTotalCharge(charge) close to the
location where the charge is extracted from the Gaussian file and in
kekulize.cpp I added the following:
diff --git a/src/kekulize.cpp b/src/kekulize.cpp
index dedf371..e5f7841 100644
--- a/src/kekulize.cpp
+++ b/src/kekulize.cpp
@@ -515,6 +515,9 @@ namespace OpenBabel
int idx;
OBAtom *atom;
OBBond *bond;
+ int charge;
+
+ charge = _totalCharge;
// Figure out which atoms are in this ring system and whether or not each
// atom can donate an electron.
@@ -532,6 +535,13 @@ namespace OpenBabel
atomState[idx] = DOUBLE_PROHIBITED;
if (DEBUG) { cout << "atom " << idx << " rejected NR3 double bonds "
<< endl; }
}
+
+ if (atom->IsNitrogen() && atom->GetFormalCharge() == 0 &&
atom->GetValence() == 3 && charge > 0) {
+ atomState[idx] = DOUBLE_ALLOWED; // It has an electron it can
donate, because of the total charge
+ charge--;
+ if (DEBUG) { cout << "atom " << idx << " rejected NR3 double bonds
overruled by totalcharge " << endl; }
+ }
+
And I get:
babel -ig03 1-ethyl-3-methylimidazolium3-esp.log.gz -osmi
c1n(ccn1C)CC
--
Regards,
Paul
On Fri, Mar 07, 2014 at 03:10:18PM -0800, David Osguthorpe wrote:
> > Any pointers to where to start fixing this?
> >
> > I'm happy to do some programming, but it seems the problems lie deeper
> > in the code than in forcefieldgaff.cpp.
> >
> >
>
> Ive had a look at this - I think the problem is in the gaussian input parsing
>
> the primary issue is that the SMILES from gaussian is
>
> [CH]1N(C=CN1C)CC
>
> rather than
>
> [CH]=1N(C=CN1C)CC
>
> (taken from pubchem for the molecule)
>
> note same is true for mol format - the real molecule has 2 double bonds
> assigned
> in the ring - the output from gaussian parsing only 1
> charge does not seem to matter
>
> with [CH]=1N(C=CN1C)CC it seems to assign ca/na to the 5 membered ring
>
> I have a dirty python script which I was using to play with parameterization
> as per the function in forcefieldgaff.cpp (it simply emulates what the typing
> function was doing in c++ in python) - it is a playing script but I can send
> it to you
> if you want - my analysis is from the output of this script not running
> anything
> else in openbabel
>
> I suspect the issue in the guassian parsing is the difficulty of assigning
> integral bond orders from a partial double bond geometry
>
> David
------------------------------------------------------------------------------
Subversion Kills Productivity. Get off Subversion & Make the Move to Perforce.
With Perforce, you get hassle-free workflows. Merge that actually works.
Faster operations. Version large binaries. Built-in WAN optimization and the
freedom to use Git, Perforce or both. Make the move to Perforce.
http://pubads.g.doubleclick.net/gampad/clk?id=122218951&iu=/4140/ostg.clktrk
_______________________________________________
OpenBabel-Devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbabel-devel