BioSimSpace.IO.readMolecules¶
- BioSimSpace.IO.readMolecules(files, make_whole=False, rotate_box=False, reduce_box=False, show_warnings=False, download_dir=None, property_map={})[source]¶
Read a molecular system from file.
- Parameters:
files (str, [str]) – A file name, or a list of file names. Note that the file names can be URLs, in which case the files will be downloaded and (if necessary) extracted before reading.
make_whole (bool) – Whether to make molecules whole, i.e. unwrap those that are split across the periodic boundary.
rotate_box (bool) – Rotate the box vectors of the system so that the first vector is aligned with the x-axis, the second vector lies in the x-y plane, and the third vector has a positive z-component. This is a requirement of certain molecular dynamics engines and is used for simulation efficiency. All vector properties of the system, e.g. coordinates, velocities, etc., will be rotated accordingly.
reduce_box (bool) – Reduce the box vectors.
show_warnings (bool) – Whether to show any warnings raised during parsing of the input files.
download_dir (str) – The directory to download files to. If None, then a temporary directory will be created for you.
property_map (dict) – A dictionary that maps system “properties” to their user defined values. This allows the user to refer to properties with their own naming scheme, e.g. { “charge” : “my-charge” }
- Returns:
system – A molecular system.
- Return type:
Examples
Load a molecular system from AMBER coordinate and topology files.
>>> import BioSimSpace as BSS >>> system = BSS.IO.readMolecules(["ala.rst7", "ala.prm7"])
Load the same system, but map the “charge” property to the key “my-charge”.
>>> import BioSimSpace as BSS >>> system = BSS.IO.readMolecules(["ala.rst7", "ala.prm7"], property_map={"charge" : "my-charge"})
>>> import BioSimSpace as BSS >>> system = BSS.IO.readMolecules(["ala.rst7", "ala.prm7"])
Load a molecular system from all of the files contained within a directory.
>>> import BioSimSpace as BSS >>> system = BSS.IO.readMolecules("dir/*")
Load a molecular system from GROMACS coordinate and topology files using a custom GROMACS topology directory.
>>> import BioSimSpace as BSS >>> system = BSS.IO.readMolecules(["mol.gro87", "mol.grotop"], property_map={"GROMACS_PATH" : "/path/to/gromacs/topology"})