[AMBER] leap cannot read MOL2 file that it has written before: small fix suggested

From: Jan-Philip Gehrcke <jgehrcke.googlemail.com>
Date: Thu, 10 Nov 2011 20:26:20 +0100

Hello,

in leap you can use any test.pdb file as input and try

> source leaprc.ff99SB
> x = loadpdb test.pdb
> savemol2 x out.mol2 0
> y = loadmol2 out.mol2

which will result in something like

> Loading PDB file: ./test.pdb
> [...]
> Writing mol2 file: out.mol2
> [...]
> Loading Mol2 file: ./out.mol2
> Reading MOLECULE named [...]
> Fatal Error: last line read: [...]

This is because the molecule name is not written by leap and then it is
expected during parsing. This is correct, since the molecule name is
required by the MOL2 format specification.

Now, I've quickly looked into the code of mol2File.c.

`sContainerName((CONTAINER) uUnit)` is used to get the object's name.
But it seems to be broken and returns an "empty string" which results in
the problem described above.

It is really hard to figure out how to get the object's name back. After
some minutes I gave up. The code in mol2File.c itself is badly
structured and I don't know if it's worth investing time in it. Besides
fixing the molecule name issue, there is more to do.. for example it
prints "Truncating residue name for PDB format: CLEU -> CLE" (and then
nevertheless writes "CLEU" to the MOL2 file).

To make a long story short.. a quick fix would be to just write a
default molecule name to any MOL2 file in order to at least stick to the
MOL2 format specs. This change worked for me:


--- src/leap/mol2File.c.old 2011-11-10 20:08:23.081930188 +0100
+++ src/leap/mol2File.c 2011-11-10 20:09:22.043721048 +0100
.. -288,7 +288,7 ..
  iResidueCount = zUnitIOAmberOrderResidues( uUnit );


-strcpy( sTemp, sContainerName((CONTAINER) uUnit));
+//strcpy( sTemp, sContainerName((CONTAINER) uUnit));

  iCount = 0;
  lTemp = lLoop((OBJEKT) uUnit, BONDS);
.. -302,7 +302,7 ..
                  
  iBondCount = iCount;

-fprintf(fOut, "%s\n", sTemp) ;
+fprintf(fOut, "molecule_name\n") ;
  fprintf(fOut, "%5d %5d %5d 0 1 \n",
iAtomCount,iBondCount,iResidueCount) ;
  fprintf(fOut, "SMALL\n");
  fprintf(fOut, "USER_CHARGES\n");


-->

> Loading PDB file: ./test.pdb
> [...]
> Writing mol2 file: out.mol2
> [...]
> Loading Mol2 file: ./out.mol2
> Reading MOLECULE named molecule_name



Maybe it's useful.

Jan-Philip


_______________________________________________
AMBER mailing list
AMBER.ambermd.org
http://lists.ambermd.org/mailman/listinfo/amber
Received on Thu Nov 10 2011 - 11:30:05 PST
Custom Search