[ghemical-devel] GPR format vs. OpenBabel

Tommi Hassinen thassine at messi.uku.fi
Tue Jul 5 05:27:22 EDT 2005


On Mon, 4 Jul 2005, Geoff Hutchison wrote:

> On Jul 4, 2005, at 8:57 AM, Tommi Hassinen wrote:
>
> >> Btw, I could compile ghemical-1.90 on my laptop. It seems I cannot
> >> export molecules from gchempaint to ghemical-1.90. It does not
> >> read the
> >> gpr files written using openbabel?
> >
> > Sometimes I need to change the .gpr format for my own works. I think I
> > tested that import/export works with openbabel-1.100.2 but perhaps
> > the fix
> > is only in 1.02/1.51 and not in 1.90. I need to check this tomorrow.
>
> I'm more than happy to update the OpenBabel code to read/write new
> versions of GPR. I'll admit that I don't keep up-to-date with
> Ghemical CVS changes as I used to.

I have to admit that it has been very hard indeed to follow what's
happening in ghemical/libghemical CVS during the last year. There have
been a lot of changes and the Makefiles and scripts have been very messy.
This is why I decided to make the releases now, even though there are some
rough edges remaining ; at least you can see what's going on.

> I updated the OB 2.0 development code to handle the changes in 1.51 a
> while ago, but didn't know that you were actively changing the CVS
> HEAD version.
>
> If you could send me a few sample 1.90 files, I should be set (since
> I also have the code). But I wonder, why the Ghemical-1.90 code won't
> read older .gpr files? I know that for 1.0x and 1.5x, the OpenBabel
> code was very much in sync with the Ghemical code and wrote
> completely "correct" .gpr files.
>
> Is Ghemical-1.90 ignoring backwards-compatibility with Ghemical 1.02
> and 1.51 files??

Certainly it is my intention to preserve the backwards-compatibility.

Today I checked for all stuff the following :
	- ported the f2c.h/g2c.h solution from libmopac7 to libghemical ;
	so it should now accept either of them.
	- tested that compiles with gcc-3.4 ; however linking errors
	happen in my system but maybe that's only my own problem.

Then I checked the compatibility with openbabel-1.100.2. The v1.02 appears
to be 100% compatible. The v1.02 writes out files that have version number
"100".

Then v1.90 is "almost" compatible, but v1.51 is not since it lacks those
changes made to v1.90 ; but I'm right now adding them to CVS.

What does it mean that v1.90 is "almost" compatible? It has 2 methods for
writing out .gpr files ; the new one that I have modified (version number
"111" for those files) and a stable one that writes out "100" files. The
"File/Save as" method uses the new file format, while the "File/Export"
one uses the stable file format, thus making file import/export work with
openbabel-1.100.2. In CVS versions I made a new better warning message
that says SaveAs is not OB-compatible and advices using File/Export.

So by this workaround I mean "almost" compatibility that we can achieve
quickly. In fact it should already work in CVS versions when you read
this.

Following is an old file...

!Header gpr 100
!Info 1
!Atoms 5
0 6
1 1
2 1
3 1
4 1
!Bonds 4
0 1 S
0 2 S
0 3 S
0 4 S
!Coord
0 0.000000 0.000000 -0.000000
1 0.085178 -0.021839 0.066089
2 0.008254 -0.060336 -0.091605
3 0.000429 0.106813 -0.026285
4 -0.093860 -0.024637 0.051800
!Charges
0 0.000000
1 0.000000
2 0.000000
3 0.000000
4 0.000000
!End

...and this is a new file for a methane molecule.

!Header gpr 111
!Info 1 allmm 80
!Atoms 5
0 6 +0 4096
1 1 +0 4096
2 1 +0 4096
3 1 +0 4096
4 1 +0 4096
!Bonds 4
0 1 S
0 2 S
0 3 S
0 4 S
!Coord
0 +5.9604645663569e-09 +1.49011611938477e-08 -6.98491958717185e-11
1 +0.0851777419447899 -0.0218393355607986 +0.0660893172025681
2 +0.00825384818017483 -0.0603363439440727 -0.0916045755147934
3 +0.000428831583121791 +0.106812566518784 -0.0262847989797592
4 -0.0938604101538658 -0.0246368795633316 +0.0518000647425652
!PartialCharges
0 +0
1 +0
2 +0
3 +0
4 +0
!End

In the new format, "Info" section has some new stuff at the end, the
purpose of which is to better save the state of the program (for example
you had a QM method with total charge set to +1 etc). OB can ignore them
when reading and just write "allmm -1" when writing.

"Atom" records have new columns, the ones marked with +0 above are formal
charges for atoms ; the backwards-compatible way is just to set them zero.
Then comes some flags coded into an int value (OB can set these so zero).

Finally the "Charges" section has been renamed to "PartialCharges" in
order to make it more clearly separate from formal charges of atoms.

Regards,

	Tommi



More information about the ghemical-devel mailing list