quantum_nodes.algorithms.schrodinger_equation
Modules
quantum_nodes.algorithms.schrodinger_equation.simulation_cache
- class quantum_nodes.algorithms.schrodinger_equation.simulation_cache.SimulationCache(max_frame: int)
Bases:
object
Store all the computed frames and to determine the ones that need to be computed when the user is asking the data for a specific frame.
- getFrame(frame: int, d: SimulationDataManager, inp: SimulationInputsManager)
Return the requested data at the given frame. Manages the situations where several frames need to be calculated in order to return the requested data.
- Parameters
frame (int) -- index of the frame
d (SimulationDataManager) -- simulation data manager
inp (SimulationInputsManager) -- simulation inputs manager
- Raises
e -- whenever something wrong happens during the frame computation
IndexError -- frame index out of range
- Returns
requested data at the given frame
- Return type
np.ndarray
- processFrame(d: SimulationDataManager, inp: SimulationInputsManager)
Compute the next frame.
This method is only an implementation of the plot_animation() function taken from the source code.
- Parameters
d (SimulationDataManager) -- simulation data manager
inp (SimulationInputsManager) -- simulation inputs manager
quantum_nodes.algorithms.schrodinger_equation.simulation_data_manager
- class quantum_nodes.algorithms.schrodinger_equation.simulation_data_manager.SimulationDataManager
Bases:
object
Manage all the data needed to compute the next frame.
All these methods are taken from util.py.- classmethod applyObstacle(MM, N, mesh_x, mesh_y, sim_inputs)
- classmethod dxSquare(MM, N, step)
- classmethod dySquare(MM, N, step)
- classmethod getAdjPos(x, y, N)
- classmethod integrate(MM, N, step)
- classmethod xConcatenate(MM, N)
- classmethod xDeconcatenate(vector, N)
- classmethod yConcatenate(MM, N)
- classmethod yDeconcatenate(vector, N)
quantum_nodes.algorithms.schrodinger_equation.simulation_inputs_manager
- class quantum_nodes.algorithms.schrodinger_equation.simulation_inputs_manager.SimulationInputsManager(dim: int, size: int, center: ndarray, n_o_w: ndarray, spr: ndarray, pot: str, obs: str, fr: int, d: float, dt: float)
Bases:
object
Manage all the user inputs.
All these methods are taken from field.py. Source code: https://github.com/Azercoco/Python-2D-Simulation-of-Schrodinger-Equation/blob/master/field.py
- getPotential(x, y)
- hasChanged(dim: int, size: int, center: ndarray, n_o_w: ndarray, spr: ndarray, pot: str, obs: str, fr: int, d: float, dt: float)
Check if node inputs have changed.
- Parameters
dim (int) -- size of the 2d grid, which corresponds to dim**2 points
size (int) -- scale of the simulation
center (np.ndarray) -- starting position of the wave packet
n_o_w (np.ndarray) -- number of waves that composes the wave packet
spr (np.ndarray) -- spreading of the wave packet
pot (str) -- boolean expression of the potential (in function of x and y)
obs (str) -- boolean expression of the obstacle.s (in function of x and y)
fr (int) -- frame rate of the simulation
d (float) -- duration of the simulation
dt (float) -- simulation time spent for each second of animation
- Returns
indicate if node inputs have changed
- Return type
bool
- isObstacle(x, y)
- setObstacle(expr: str)
Set the obstacle expression.
- Parameters
expr (str) -- boolean expression in function of x and y
- setPotential(expr: str)
Set the potential expression.
- Parameters
expr (str) -- boolean expression in function of x and y
- classmethod verifyObstacleExpr(expr)
- classmethod verifyPotentialExpr(expr)
quantum_nodes.algorithms.schrodinger_equation.simulation_manager
- class quantum_nodes.algorithms.schrodinger_equation.simulation_manager.SimulationManager(dim: int, size: int, center: ndarray, n_o_w: ndarray, spr: ndarray, pot: str, obs: str, fr: int, d: float, dt: float)
Bases:
object
Implementation of the 2D simulation of Schrödinger equation.
This code is just a new architecture to meet our needs (adapted for blender animation nodes).All the simulation computation is from Azercoco.You can find his code here: https://github.com/Azercoco/Python-2D-Simulation-of-Schrodinger-Equation- getFrameData(frame: int)
Return data from the requested frame.
- Parameters
frame (int) -- the requested frame
- Raises
e -- whenever something goes wrong during the computation of the frames
- Returns
state of the simulation at the given frame (list of numpy.complex128)
- Return type
np.ndarray
- initialize()
Initialize the data needed for the simulation.
This method is only an implementation of the init function taken from the source code.
- updateSimulation(dim: int, size: int, center: ndarray, n_o_w: ndarray, spr: ndarray, pot: str, obs: str, fr: int, d: float, dt: float)
Check if any of the user inputs have changed in order to update the parameters of the simulation.
- Parameters
dim (int) -- size of the 2d grid, which corresponds to dim**2 points
size (int) -- scale of the simulation
center (np.ndarray) -- starting position of the wave packet
n_o_w (np.ndarray) -- number of waves that composes the wave packet
spr (np.ndarray) -- spreading of the wave packet
pot (str) -- boolean expression of the potential (in function of x and y)
obs (str) -- boolean expression of the obstacle.s (in function of x and y)
fr (int) -- frame rate of the simulation
d (float) -- duration of the simulation
dt (float) -- simulation time spent for each second of animation):