Original submission:
The openbabel converter compiled with ghemical outputs improperly formatted CONECT records in pdb export. There is an extra space inserted between the CONECT card and the first atom serial number. The result is bad connectivity of exported files when viewed in standard pdb-based molecular viewers (c.f. rasmol). The fix is trivial and a patch for 1.00 is shown below.
---------------------------------------------------
diff -Naur ghemical-1.00/openbabel/pdb.cpp ghemical-patch/openbabel/pdb.cpp
--- ghemical-1.00/openbabel/pdb.cpp 2002-06-19 17:19:01.000000000 -0400
+++ ghemical-patch/openbabel/pdb.cpp 2004-06-25 18:59:01.000000000 -0400
@@ -185,7 +185,7 @@
for (k = 0;k < bo;k++)
bond[count++] = nbr->GetIdx();
}
- sprintf(buffer,"CONECT %3d %3d %3d %3d %3d",
+ sprintf(buffer,"CONECT%5d%5d%5d%5d%5d",
bond[0],bond[1],bond[2],bond[3],bond[4]);
ofs << buffer << endl;
@@ -702,7 +702,7 @@
atom = mol.GetAtom(i);
if (atom->GetValence())
{
- sprintf(buffer,"CONECT %5d",i);
+ sprintf(buffer,"CONECT%5d",i);
ofs << buffer;
for (nbr = atom->BeginNbrAtom(k);nbr;nbr = atom->NextNbrAtom(k))
{
|