Hi,

I need to use openbabel to add hydrogens for ligands in PDB structures. The 
executable program works. But when I included the code as part of the C++ cgi, 
it has the error 500 because the output stream messed up with the output stream 
in cgi. I tried to comment out cout, printf, etc and it still didn't work. Any 
suggestions?

The compile alone caused the problem. I added the following to compile with 
openbabel library:
=========
CPPFLAGS = ... \
  -I /mypath/openbabel-openbabel-3-1-1/include/openbabel3

LDFLAGS= -lopenbabel -L /mypath/delphi/openbabel-openbabel-3-1-1/lib
=========

Here is my small program:
=========
#include <iostream>
#include <fstream>

using namespace std;
using namespace OpenBabel;

string addHydrogen(string& pdbStr)
{
  string pdbHStr = "";

  cout.rdbuf(NULL);
  cerr.rdbuf(NULL);
  clog.rdbuf(NULL);

  OBConversion conv;
  conv.SetInFormat("pdb");
  conv.SetOutFormat("pdb");

  OBMol mol;
  //conv.ReadFile(&mol,filepath);
  conv.ReadString(&mol,pdbStr);

  mol.AddHydrogens();

  //string filepath2 = "./test.pdbH";
  //conv.WriteFile(&mol,filepath2.c_str());
  bool trimWhitespace = true;
  pdbHStr = conv.WriteString(&mol, trimWhitespace);

  return pdbHStr;
}
=========

Thanks!

Jiyao Wang


_______________________________________________
OpenBabel-discuss mailing list
OpenBabel-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
  • [Open Babel] How to d... Wang, Jiyao (NIH/NLM/NCBI) [E] via OpenBabel-discuss

Reply via email to