|
Pressomancy is a Python framework built on top of
EspressoMD, designed to streamline and abstract
the management of objects in molecular simulations. By creating a structured
environment for simulation objects, Pressomancy enables easy integration,
customization, and scalability for complex simulations with minimal setup.
The framework provides an abstract, modular approach for defining simulation components, ensuring compliance and ease of integration across various objects, such as magnetic filaments, G4 multimers, ligands, and more. |
![]() |
- Abstract Framework: Build and manage simulations with a consistent, object-oriented structure.
- Custom Simulation Objects: Create custom simulation objects with compatibility and compliance.
- Simulation Management: Centralized, singleton-like simulation class to wrap and control EspressoMD functionality with separate lifetime and memory management.
- Extendable: Easily extend the framework with new simulation objects by adhering to the abstract SimulationObject metaclass.
- Pre-Built Objects: Includes ready-to-use simulation objects such as magnetic filaments, G4 multimers, and ligands.
To install Pressomancy, use pip ( -e flag for edit mode):
pip install pressomancyTo test Pressomancy, use:
$path_to_espresso/build/pypresso -m unittest discover -s test- Python 3.x
- EspressoMD
Here’s a quick example to get started with Pressomancy.
- Initialize the Simulation: The
Simulationclass is a singleton-like wrapper for managing an EspressoMD instance with specialised methods to manage a molecular simualation. - Add Simulation Objects: Add simulation objects that inherit from the
SimulationObjectabstract class, ensuring easy integration and compliance.
from pressomancy.simulation import Simulation
from pressomancy.object_classes.part_class import GenericPart
# Initialize EspressoMD instance and set system parameters
sim_inst = Simulation(box_dim=(10, 10, 10))
sim_inst.set_sys(timestep=0.01, min_global_cut=3.0)
# Make a custom configuration (object aware)
configuration = GenericPart.config.specify(
espresso_handle=sim_inst.sys,
size=1.0,
espresso_part_kwargs={"type": GenericPart.part_types["real"]},
)
# Add simulation objects
particles = [GenericPart(config=configuration) for _ in range(100)]
# Register objects in the simulation instance
sim_inst.store_objects(particles)
# Create objects inside the EspressoMD instance
sim_inst.set_objects(particles)
# Set interactions
sim_inst.set_steric(key=("real",), wca_eps=1.0, sigma=1.0)
# Do work
sim_inst.sys.integrator.run(1000)Pressomancy is designed to be extendable and intuitive, with the aim to simplify and systematise complex architecture creation in molecular simulations. Each component in Pressomancy adheres to a standardized interface, making it straightforward to add or modify simulation objects.
The Simulation class manages the EspressoMD instance and provides methods for simulation management (i.e. I/O, properties), ensuring all objects are added and side effects are synchronized.
from pressomancy.simulation import Simulation
sim = Simulation() Objects in Pressomancy use the SimulationObject metaclass, ensuring that each object is compliant with the framework's structure. Examples include:
- Filament: Represents a linear array of objects.
- Quadriplex: Non-canonical DNA conformation.
- SWPart: Magnetic nanoparticle with internal anisotropy and magnetodynamis via the tSW model.
SimulationObject is implemented to facititate contributors adding their own simualtion object. The metaclass adds various methods, hooks and traps to guarantee compatibility and integration with the Pressomancy framework..
from pressomancy.object_classes.object_class import Simulation_Object
class CustomObject(metaclass=Simulation_Object):
# all required parameter and methods are attached
# various traps with detailed debugging info
# get boolean opeation, iteraton context, destructors
# the rest is up to youobjects: Library of simulation objects.resources: resources and metadata for objects.analysis: Library of utilities and anaysis routines.simulation: Centralized management of the simulation state.
Contributions to Pressomancy are welcome! To contribute, please fork the repository, make your changes, and submit a pull request. For major changes, please open an issue first to discuss your ideas.
