Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dev #19

Merged
merged 3 commits into from
Feb 14, 2024
Merged

Dev #19

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@
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)

Check warning on line 66 in src/pylattica/structures/square_grid/grid_setup.py

View check run for this annotation

Codecov / codecov/patch

src/pylattica/structures/square_grid/grid_setup.py#L66

Added line #L66 was not covered by tests

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