Skip to content
dstoeckel edited this page Mar 16, 2015 · 4 revisions

How can I write a system into a PDB-file?

Open a PDB-file in openmode out and stream a system of molecules into that file. Don't forget to close your file.

#include <BALL/FORMAT/PDBFile.h>
#include <BALL/KERNEL/system.h>
 
using namespace BALL;
using namespace std;

System system;
...

// add or change something in the system
...

// and write the file
PDBFile outfile("test.pdb", ios::out);
outfile << system;
outfile.close();

Python

import sys
from BALL import *

system = System()
...
  
# add or change something in the system
...

# and write the system into a PDB file
outfile = PDBFile("test.pdb", File.MODE_OUT)
outfile.write(system)
outfile.close()

print "File test.pdb saved successfully!"
Clone this wiki locally