Example of loading a structure file with multiple moleculesΒΆ

We can load a structure that contains multiple molecules, separate them into distinct molecules and analyse.

We can load the file, but now we rebuild the structure:

import pywindow as pw

# From xyz, or pdb file:
molsys = pw.MolecularSystem.load_file(path / "EPIRUR_no_solvent.pdb")

# But now, we rebuild the system (capturing periodic effects).
rebuild_molsys = molsys.rebuild_system()
# And find all distinct molecules - as an attribute to `rebuild_molsys`.
# We can dump the cleaned up system - see below.
rebuild_molsys.dump_system(
    str(path / "EPIRUR_no_solvent_rebuild.pdb"),
    override=True,
)
rebuild_molsys.make_modular()

Now we iterate through the molecules, analyse and save:

pore_diameters = []
for molecule_id in rebuild_molsys.molecules:
    mol = rebuild_molsys.molecules[molecule_id]
    mol.full_analysis()
    pore_diameters.append(mol.properties["pore_diameter"]["diameter"])