oqp.SimulationManager
SimulationManager — Unified Python interface for multi-scale simulations in OpenQP.
Supports four modes:
qp : Pure QM single-point (OpenQP)
qmmm : QM/MM (OpenQP + OpenMM via QMMM_MD)
namd : Non-adiabatic MD (PyRAI2MD + OpenQP)
namd_qmmm : NAMD with QM/MM potential (PyRAI2MD + OpenQP + OpenMM)
Minimal usage
-------------
manager = SimulationManager.from_template(
"template_namd.json",
folder="Nac_run",
title="test1-1",
xyz="test1-1.xyz",
)
manager.show_config()
manager.run()
Attributes
Classes
Module Contents
- ELEMENT_TO_Z
- BUILTIN_TEMPLATES
- class OpenQPEngine(config=None)
- Runner = None
- config
- project
- workdir
- input_dict
- back_door_data
- results = None
- setup_input(folder, openqp_content, title)
- setup_input_with_xyz(folder, openqp_content, xyz_content, title)
- prepare()
- run()
- run_qmmm()
- class PyRAI2MDEngine(mode, config=None)
- mode
- config
- prepare()
- setup_files(folder, input_content, openqp_content, xyz_content, title)
Write the three NAMD files into folder: title — PyRAI2MD control file title.openqp — OpenQP electronic structure input title.xyz — molecular coordinates
- run(folder, title)
- class SimulationManager(mode=None, folder='.', title='test1-1', xyz=None, pdb=None, qm_atoms=None, sections=None, namd=None, template=None, openqp_content=None, xyz_content=None, input_content=None, configs=None)
Unified interface for QM, QM/MM, NAMD, and NAMD-QM/MM simulations. For NAMD modes, three files are generated in the working folder: title — PyRAI2MD control (&CONTROL, &MOLECULE, &openqp, &MD) title.openqp — OpenQP input ([input], [scf], [tdhf], [properties], ...) title.xyz — molecular coordinates :param mode: One of 'qp', 'qmmm', 'namd', 'namd_qmmm'. :type mode: str :param folder: Working directory. :type folder: str :param title: Project name (used for all filenames). :type title: str :param xyz: XYZ coordinates. :type xyz: str or path :param pdb: PDB file for QM/MM modes. :type pdb: str or path, optional :param qm_atoms: QM atom selection for QM/MM (e.g. '0-2'). :type qm_atoms: str, optional :param sections: OpenQP section overrides. :type sections: dict, optional :param namd: PyRAI2MD section overrides (control, molecule, openqp, md). :type namd: dict, optional :param template: JSON template path or built-in name. :type template: str, optional :param openqp_content: Pre-built inputs (bypass auto-generation). :type openqp_content: str, optional :param xyz_content: Pre-built inputs (bypass auto-generation). :type xyz_content: str, optional :param input_content: Pre-built inputs (bypass auto-generation). :type input_content: str, optional :param configs: Engine-level config overrides. :type configs: dict, optional- VALID_MODES
- mode
- folder = '.'
- title = 'test1-1'
- configs
- openqp = None
- pyrai2md = None
- static check_dependencies()
Print the installation status of all required packages. .. rubric:: Example SimulationManager.check_dependencies() # OpenQP (QM engine) ✓ installed (0.3.1) # OpenMM (MM engine) ✓ installed (8.1.1) # PyRAI2MD (NAMD driver) ✗ not installed
- save_template(filepath, description=None)
Save current settings as a reusable JSON template.
- classmethod from_template(template, **overrides)
Create a SimulationManager from a template with per-job overrides.
- static list_templates(directory=None)
List built-in and user templates.
- static create_template(filepath, mode, description=None, sections=None, namd=None)
Create a template JSON file from scratch.
- show_config(name=None)
Inspect generated inputs. name=None → print all to console name='openqp' → return OpenQP input string name='namd' → return PyRAI2MD control string name='xyz' → return XYZ string name='pdb' → return PDB string name='sections'→ return OpenQP sections dict name='namd_sections' → return NAMD sections dict
- set_config(section, key, value)
Modify OpenQP sections and regenerate .inp/.openqp. .. rubric:: Example manager.set_config("input", "basis", "cc-pvdz") manager.set_config("tdhf", "nstate", 8) manager.set_config("qmmm", "temperature", 350.0)
- set_namd_config(section, key, value)
Modify PyRAI2MD control sections and regenerate control file. :param section: One of 'control', 'molecule', 'openqp', 'md'. :type section: str :param key: Parameter name (e.g. 'step', 'temp', 'nstate'). :type key: str :param value: New value. :type value: any :param Example: manager.set_namd_config("md", "step", 200) manager.set_namd_config("md", "temp", 350) manager.set_namd_config("molecule", "ci", 8) manager.set_namd_config("openqp", "threads", 80)
- set_xyz(xyz)
- set_pdb(pdb)
- prepare()
- run()
Rewrite files from current config, then execute.