stk.PdbWriter
- class stk.PdbWriter[source]
Bases:
object
A writer class for
.pdb
files.Examples
Writing to a File with a Unit Cell
This writer can write to a file with the unit cell included for periodic molecules. Note that this always assumes P1 space group.
import stk bb1 = stk.BuildingBlock('BrCCBr', [stk.BromoFactory()]) bb2 = stk.BuildingBlock( smiles='BrCC(CBr)CBr', functional_groups=[stk.BromoFactory()], ) topology_graph = stk.cof.PeriodicHoneycomb( building_blocks=(bb1, bb2), lattice_size=(3, 3, 1), ) construction_result = topology_graph.construct() cof = ( stk.ConstructedMolecule.init_from_construction_result( construction_result=construction_result, ) ) writer = stk.PdbWriter() writer.write( molecule=cof, path='cof.pdb', periodic_info=construction_result.get_periodic_info(), )
Methods
Get a
.pdb
file format string of molecule.Write molecule to
.pdb
file format.- to_string(molecule, atom_ids=None, periodic_info=None)[source]
Get a
.pdb
file format string of molecule.- Parameters:
- Returns:
A string holding the content of a
.pdf
file.- Return type:
- write(molecule, path, atom_ids=None, periodic_info=None)[source]
Write molecule to
.pdb
file format.- Parameters:
molecule (Molecule) – Molecule to write to
.pdb
format.path (Path | str) – The full path to the file being written.
atom_ids (int | Iterable[int] | None) – The atom ids of atoms to write. Can be a single
int
, if a single atom is to be used, orNone
, if all atoms are to be used.periodic_info (PeriodicInfo | None) – Information about the periodic cell.
- Return type:
None