BioSimSpace makes it easy to get up and running with molecular dynamics simulation. Any simulation takes two ingredients:
- A molecular system
This is the set of atoms and molecules that define your system of interest.
- A simulation protocol
This defines what you want to do to the system.
You should think of a molecular simulation as a means of applying a protocol to a given system. BioSimSpace allows you to think in terms of these higher level abstractions. It will automatically take care finding an appropriate molecular dynamics package on your computer, setting up the all of the required configuration and input files, and initialising the simulation. This frees you from having to think about running a molecular dynamics simulation with a specific package, allowing you to write robust and interoperable scripts.
Let’s walk through the process of setting up and running a simple molecular dynamics simulation to perform energy minimisation.
1) Load the molecular system
First we need to create a molecular system. BioSimSpace can read and write a wide range of common molecular file formats. See here for further details.
import BioSimSpace as BSS # Create a molecular system from a set of input files. system = BSS.IO.readMolecules(["ala.crd", "ala.top"])
2) Define a protocol
We next need to tell BioSimSpace what we want to do. BioSimSpace provides support for a set of common molecular dynamics protocols, such as
BioSimSpace.Protocol.Production. These high-level objects use collective best practice from within the field to define a set of common defaults that can be used out-of-the-box. Minimal configuration is allowed for options that are supported across all molecular simulation packages.
For example, to define a default minimisation protocol:
protocol = BSS.Protocol.Minimisation()
To define a minimisation protocol with 1000 steps:
protocol = BSS.Protocol.Minimisation(steps=1000)
3) Run the molecular simulation
We now have everything that is needed to run a molecular simulation:
process = BSS.MD.run(system, protocol)
BioSimSpace has automatically searched your computer and found the best available molecular dynamics package. It has then set up all of the required input and launched a simulation, returning to you an interactive handle to the running process! Phew, that’s a lot of stuff.
If you wish to manually start the process (perhaps you’d like to check that it’s configured to your liking) then you can use the
autostart keyword argument.
# Create a process but don't start it. process = BSS.MD.run(system, protocol, autostart=False) # Manually start the process. process.start()
By default BioSimSpace creates a temporary workspace for each new process. If you’d like to configure the working directory, or the name of the process, then simply pass the appropriate keyword arguments:
process = BSS.MD.run(system, protocol, name="my-process", work_dir="my-dir")
(Note that the directory will be created if it doesn’t already exist.)