MD Simulator (Solution, Membrane)
The Simulator projects share one helper class,
SimulatorProject, created with
molcube.create_simulator_project(). This page covers the common workflow
(search, create, status, download) together with the Solution and Membrane
simulators. For other simulator types, see AFES Simulator (Relative) (Free Energy)
and HTS MD Simulator (High-Throughput).
Search Simulator Projects
Use search_simulator_projects() to browse simulator projects. Results are
paginated by the backend and include pagination metadata:
simulator_projects = molcube.search_simulator_projects(
page=1,
perPage=20,
projectType="simulator",
projectStatus="Success",
workspace="personal",
)
projectType="simulator" includes all simulator project types. Pass a
specific simulator type to narrow the search. forceField accepts either a
single force field or a list of force fields; lists are serialized as a
comma-separated filter before the request is sent.
To find completed projects that are eligible as simulator inputs, use
search_available_projects(availableCategory="simulator"):
available_projects = molcube.search_available_projects(
workspace="personal",
page=1,
perPage=20,
projectType=["High-Throughput"],
availableCategory="simulator",
)
search_available_projects() always searches successful projects and
returns projects plus totalPages, currentPage, totalCount,
hasNext, and hasPrevious.
Search Reference Projects
Use search_available_reference_projects() to search the completed projects
that can be used as references by a builder workflow. The method name and
referenceType parameter are correctly spelled; the parameter is used to
select the project type being searched:
solution_references = molcube.search_available_reference_projects(
workspace="personal",
page=1,
perPage=20,
keyword="",
referenceType="PDB Reader",
projectType="Solution Builder",
forceField="amberff",
)
The method sends POST /builder/search/projects with
projectStatus="Success". projectType selects the workflow that will
consume the reference. referenceType selects the project type being
searched. The supported combinations are derived from the SDK’s reference
selection rules:
"Solution Builder"and all supported membrane-builder workflows accept"PDB Reader"references."Free Energy"accepts"PDB Reader","Solution Builder", and completed membrane-builder references (including the supported non-“Only” membrane variants)."Quick Free Energy"accepts"PDB Reader"references."Ligand Modeler"accepts"PDB Reader"references.
The selected rule adds the required project step and category filters. Invalid
projectType/referenceType combinations raise ValueError. The
optional forceField filter is passed through unchanged; workspace may
be "personal" or "team".
The remaining request parameters are page (one-based page number),
perPage (requested page size), and keyword (optional title-search
text). forceField accepts "charmmff", "amberff", or
"martiniff" (or the empty-string default).
On a successful response, the method returns the backend’s data dictionary
unchanged. Its normal paginated shape contains projects and may contain
totalPages, currentPage, totalCount, hasNext, and
hasPrevious. A non-success response is returned unchanged.
Create Simulator Project
Let’s walk through how to create a MolCube Simulator project. Before running the Simulator, you need a completed reference project.
Supported reference projects are:
Solution Builder
Membrane Builder
High-Throughput
Alchemical Free Energy Simulator
The reference project must be completed through the expected builder step:
Solution Builder: step
3Membrane Builder: step
6High-Throughput: step
3Alchemical Free Energy Simulator: step
4
The following arguments are available for the create_project method:
title (str): Simulator project title.
ref_id (str): Completed reference project id.
workspace (str | None): Workspace to submit from. (default:
personal)
Return:
bool:
Truewhen the simulator helper is prepared successfully.
Example:
sim = molcube.create_simulator_project()
assert sim.create_project(
title="my_simulator_project",
ref_id="completed-reference-project-id",
)
After create_project(), the helper stores the inferred project information
on the object:
sim.prev_project_type: Source reference project type.sim.project_type: Target simulator project type.sim.ref_id: Reference project id.sim.title: Simulator project title.
If you already have a submitted simulator project id, you can resume the object without creating or submitting a new project.
The following argument is available for the resume_project
methods:
project_id (str): Submitted simulator project id.
Return:
dict[str, Any]: Simulator project metadata fetched from the backend.
Example:
sim = molcube.create_simulator_project()
sim.resume_project("submitted-simulator-project-id")
sim.download_project("simulation.tar.gz")
Solution And Membrane Simulator
Use this workflow when the reference project is a completed Solution Builder or Membrane Builder project. The input parameters and runner methods are the same for Solution Simulator and Membrane Simulator.
Membrane Builder references include membrane-only, nanodisc, nanodisc-only, vesicle, vesicle-only, micelle, micelle-only, hexphase, hexphase-only, and quick bilayer projects.
The following arguments are available for the run_simulation method:
md_engine (str): Molecular dynamics engine. Available options are
openmmandgromacs.simulator_time (int): Simulation time in nanoseconds sent to the backend. Must be an integer between 1 and 100. Values from 1 to 10 are used as-is; values above 10 are rounded to the nearest multiple of 10 (for example,
15becomes20).
Return:
bool:
Truewhen the simulator project is submitted successfully.
Example:
# alt: builder_ref_id = sbuilder.projectId
# alt: builder_ref_id = mbuilder.projectId
builder_ref_id = "completed-builder-project-id"
sim = molcube.create_simulator_project()
assert sim.create_project(
title="simulator-project",
ref_id=builder_ref_id,
)
assert sim.run_simulation(
md_engine="gromacs",
simulator_time=10,
)
Status And Downloads
After a simulator job is submitted, sim.projectId stores the submitted
simulator project ID.
The following status methods are available:
simulation_status(): ReturnsSimulatorStatusResponsewithproject,base,tasks, anddetails. For HTS MD Simulator projects,detailscontains one entry for every MD-engine and ligand pair.format_status_summary(status=None): Returns a readable multiline summary. Whenstatusis omitted, it fetches the latest status.status(): Fetches and prints the summary, then returnsbase,tasks, anddetailswithout theprojectentry.stop_simulation(): Requests cancellation and returnsTruewhen the request is accepted.
Example:
status_payload = sim.simulation_status()
print(sim.format_status_summary(status_payload))
for hts_set in status_payload["details"]:
print(hts_set["info"], hts_set["data"]["status"])
For HTS MD Simulator projects, the formatted progress is one aggregate
min -> eq -> prod sequence across all returned HTS tasks. The engine used
to interpret that sequence is resolved from the first HTS detail, then from
project.spec.mdEngines (or md_engines), and finally defaults to
openmm when the status contains no engine metadata. Use details or
get_hts_sets() when per-engine/per-ligand status is required.
The following download methods are available:
download_project(filename="simulation.tar.gz"): Downloads the full simulator archive and returnsNone.download_morph(morph, filename=None): Downloads one Free Energy morph archive and returnsNone.
Examples:
sim.download_project("simulation.tar.gz")
sim.download_morph("1-2", "morph_1_2.tar.gz")
download_morph() is only available for Free Energy simulator projects.