Skip to content

Commit

Permalink
Merge pull request #19 from mcgalcode/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
mcgalcode authored Feb 14, 2024
2 parents 8ed8b8f + dae7925 commit ba1177c
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 2 deletions.
Binary file modified paper/flowchart.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion paper/paper.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ The result of a simulation run is an instance of `SimulationResult`, which store

## Overview

![\label{fig_1}Diagram showing relationships between `pylattica` entities.](./flowchart.png)
![\label{fig_1}Diagram showing relationships between `pylattica` entities.](./flowchart.png){width=1080}

\autoref{fig_1} shows the relationship between the entities discussed so far, and how they are connected in producing a `SimulationResult`. To summarize, a `Lattice` is used to create a `Structure`, which is paired with an initial `SimulationState` to create a `Simulation`, or the starting point for simulation execution. The `Structure` is also fed to a `NeighborhoodBuilder` to construct a `Neighborhood` object, which is used in the update rule implemented by the `Controller` to determine how the simulation evolves. Finally, the `Simulation` and `Controller` are passed to a `Runner`, which applies the update rule repeatedly, producing a series of `SimulationState`s, which are concatenated to form a `SimulationResult`.

Expand Down
2 changes: 1 addition & 1 deletion src/pylattica/core/simulation_state.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ def batch_update(self, update_batch: Dict) -> None:
"""

if GENERAL in update_batch:
for site_id, updates in update_batch[SITES].items():
for site_id, updates in update_batch.get(SITES, {}).items():
self.set_site_state(site_id, updates)

self.set_general_state(update_batch[GENERAL])
Expand Down
15 changes: 15 additions & 0 deletions src/pylattica/structures/square_grid/grid_setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,21 @@ def _build_blank_state(
state.set_site_state(site[SITE_ID], {DISCRETE_OCCUPANCY: fill})
return state

def build_structure(self, size: int) -> PeriodicStructure:
"""Constructs a structure without a state of the specified size
Parameters
----------
size : int
The size of the structure to build
Returns
-------
PeriodicStructure
The resulting structure.
"""
return self._builder.build(size)

def setup_solid_phase(
self, structure: PeriodicStructure, phase_name: str
) -> SimulationState:
Expand Down

0 comments on commit ba1177c

Please sign in to comment.