Hallo,
in the attached patch to openbabel current I made babel read the gamout
input parameters ICHARG and MULT containing total charge
and spin multiplicity.
I checked that it works from the babel python bindings.
However this did not solve my problem, i.e. obtain the right
InChI descriptor. InChI appears to be insensitive to global
charge setting.
Also bonds and aromaticity sensing are not affected by the
charge assignment.
Anyhow, thanks for the very smart tool
Fulvio Ciriaco
Index: src/formats/gamessformat.cpp
===================================================================
--- src/formats/gamessformat.cpp	(revision 5057)
+++ src/formats/gamessformat.cpp	(working copy)
@@ -244,6 +244,7 @@
     int lowFreqModesBegin; // the number of the first low frequency mode
     int lowFreqModesEnd; // the number of the last low frequency mode
     int numFreq, numIntens, numDisp; // GAMESS prints rotations & transl., which we ignore
+    int charge=0,mult=1;
     numFreq = numIntens = numDisp = 0;
 
     // must build generic data while we parse then add at the end.
@@ -255,6 +256,16 @@
     mol.BeginModify();
     while (ifs.getline(buffer,BUFF_SIZE))
       {
+        if(strstr(buffer,"ICHARG="))
+          {
+            tokenize(vs,(strstr(buffer,"ICHARG=")));
+            charge=atoi(vs[1].c_str());
+          }
+        if(strstr(buffer,"MULT ")) 
+          {
+            tokenize(vs,(strstr(buffer,"MULT ")));
+            mult=atoi(vs[2].c_str());
+          }
         if(strstr(buffer,"ATOMIC                      COORDINATES (BOHR)") != NULL)
           {
             //mol.Clear();
@@ -900,6 +911,8 @@
       mol.SetData(vd);
     }
 
+    mol.SetTotalCharge(charge);
+    mol.SetTotalSpinMultiplicity(mult);
 
     mol.SetTitle(title);
     return(true);
------------------------------------------------------------------------------
Master Java SE, Java EE, Eclipse, Spring, Hibernate, JavaScript, jQuery
and much more. Keep your Java skills current with LearnJavaNow -
200+ hours of step-by-step video tutorials by Java experts.
SALE $49.99 this month only -- learn more at:
http://p.sf.net/sfu/learnmore_122612 
_______________________________________________
OpenBabel-Devel mailing list
OpenBabel-Devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbabel-devel

Reply via email to