mofbuilder.io.PdbWriter#

class mofbuilder.io.PdbWriter(comm=None, ostream=None, filepath=None, debug=False)[source]#

Bases: object

Writer for PDB format structure files. Handles MPI-aware write operations for PDB output.

Parameters:
  • comm (Any | None)

  • ostream (veloxchem.outputstream.OutputStream | None)

  • filepath (str | None)

  • debug (bool)

comm#

MPI communicator.

Type:

Any

rank#

MPI process rank.

Type:

int

nodes#

Number of MPI processes.

Type:

int

ostream#

Output stream for printing/logging.

Type:

OutputStream

filepath#

Path to the PDB file for writing.

Type:

Optional[str or Path]

_debug#

Flag for debug printout.

Type:

bool

file_dir#

Output file directory, set during write.

Type:

Optional[Path]

write(filepath, header, lines)[source]#

Write molecular structure to PDB file.

Parameters:
  • filepath (str | None)

  • header (str)

  • lines (Sequence[Sequence[Any]])

Return type:

None

write(filepath=None, header='', lines=())[source]#

Write a molecular structure to a PDB file.

Parameters:
  • filepath (Optional[str]) – Output PDB file path. Uses self.filepath if None.

  • header (str) – Optional header line to add at the top of the PDB file.

  • lines (Sequence[Sequence[Any]]) – Sequence of atom record lists. Each line should have: [atom_type, atom_label, atom_number, residue_name, residue_number, x, y, z, spin, charge, note]

Raises:

AssertionError – If the output file path is not specified.

Return type:

None

Example

writer.write(

filepath=”output.pdb”, header=”MODEL GENERATED BY MOFbuilder”, lines=[

[“ATOM”, “C”, 1, “BENZENE”, 1, 0.0, 0.0, 0.0, 1.0, 0.0, “C1”], …

]

)