Simulation
polymcsim.simulation
Main simulation interface for PolyMCsim polymer generation.
Simulation
A wrapper for the optimized PolyMCsim simulation engine.
__init__(config)
Initialize the simulation with a complete configuration.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
config
|
SimulationInput
|
The detailed simulation configuration object. |
required |
get_graph()
Return the resulting polymer graph.
Returns:
Type | Description |
---|---|
Optional[Graph]
|
The polymer graph, or None if the simulation has not been run or failed. |
get_metadata()
Return metadata from the simulation run.
Returns:
Type | Description |
---|---|
Optional[Dict[str, Any]]
|
The metadata dictionary, or None if the simulation has not been |
Optional[Dict[str, Any]]
|
run or failed. |
run()
Execute the simulation.
This method calls the core Numba-optimized Kinetic Monte Carlo engine and runs the simulation to completion based on the provided configuration. It stores the result internally and also returns it.
Returns:
Type | Description |
---|---|
SimulationResult
|
A |
SimulationResult
|
metadata, and the input configuration. |
run_batch(configs, max_workers=None)
Run a batch of simulations in parallel using a process pool.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
configs
|
List[SimulationInput]
|
A list of simulation configurations. |
required |
max_workers
|
Optional[int]
|
The maximum number of worker processes to use. If None, it defaults to the number of CPUs on the machine. |
None
|
Returns:
Type | Description |
---|---|
Dict[str, SimulationResult]
|
A dictionary mapping simulation names to their |
Dict[str, SimulationResult]
|
If a simulation fails, the |
run_simulation(config)
Run a polymer generation simulation.