BioSimSpace.IO.saveMolecules

BioSimSpace.IO.saveMolecules(filebase, system, fileformat, property_map={})

Save a molecular system to file.

Parameters
  • filebase (str) – The base name of the output files.

  • system (System, Molecule Molecule) – The molecular system.

  • fileformat (str, [str]) – The file format (or formats) to save to.

  • 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

files – The list of files that were generated.

Return type

[str]

Examples

Load a molecular system from AMBER coordinate and topology files then try to save it to all supported file formats.

>>> import BioSimSpace as BSS
>>> system = BSS.IO.readMolecules(["ala.rst7", "ala.prm7"])
>>> for format in BSS.IO.fileFormats():
...     try:
...         BSS.IO.saveMolecules("test", system, format)
...     except:
...         print("Could not convert to format: '%s'" % format)

Load a molecular system from AMBER coordinate and topology files then try to save it to GROMACS format, mapping and un-mapping the charge property along the way.

>>> import BioSimSpace as BSS
>>> system = BSS.IO.readMolecules(["ala.rst7", "ala.prm7"], property_map={"charge" : "my-charge"})
>>> BSS.IO.saveMolecules("test", system, ["gro87", "grotop"], property_map={"charge" : "my-charge"})