<jupyter_start><jupyter_text>Documentation  ModulePython 3.8 and FFmpeg are required for executing code from this module. Keep in mind that all quantities present in this program are specified in atomic units. This includes not only output such as the expectation values which are written to a file, but also input such as the grid dimensions and the time increment.<jupyter_code>import wave_packet_dynamics as wpd<jupyter_output><empty_output><jupyter_text>GridThe module provides a `Grid` class with helpful methods used by all other classes of the module. This is why one should start by creating a `Grid` object.<jupyter_code># create a 1 dimensional grid with bounds x_min and x_max
# the grid contains a finite number of points with even spacing
x_min = -3
x_max = 3
bounds = (x_min, x_max)
points = 3001
grid = wpd.Grid(bounds, points)<jupyter_output><empty_output><jupyter_text>Wave Functions and PotentialsThe quantum dynamics simulation requires a wave function and a potential. For this the module provides the classes `WaveFunction` and `Potential`. When creating an instance of these classes, two  parameters  are  required:  a `Grid` object  and a function with only one parameter, the grid coordinate. Upon  initialisation, the provided function will then act on the `Grid` coordinates, resulting in an array containing discretized function values. These are labeled as the instance attribute `values`.You can create your own wave and potential functions or use the predefined functions in the `wave_function` and `potential` submodules.  These functions require multiple parameters. However, the `WaveFunction` and `Potential` classes expect a function with only one parameter, the grid coordinate. `partial` from the `functools` module allows us to manipulate the given functions so that they only require this one parameter.<jupyter_code>from wave_packet_dynamics import wave_function as wave
from wave_packet_dynamics import potential as pot

from functools import partial

# create a gaussian wave function with width 0.25 at initial x coordinate 1
# the particle has no initial momentum, meaning its initial wavenumber is 0
gaussian_function = partial(wave.gaussian, sigma=0.25, x0=1, k0=0)
wave_function = wpd.WaveFunction(grid, gaussian_function)

# create a parabola potential with force constant 10^2 centered at x coordinate 0
harmonic_function = partial(pot.harmonic, k=1*10**2, x0=0)
potential = wpd.Potential(grid, harmonic_function)<jupyter_output><empty_output><jupyter_text>Simulation and AnimationThe `Simulation` class is the key component of this package. Creating an instance of this class by providing a `Grid`, `WaveFunction` and `Potential` object alongside a desired `time_increment` in atomic units primes the simulation. The simulation is executed by calling the instance and providing the run time in form of an integer `total_time_steps`.  A unique folder will be created in the working directory when executing the simulation, which will contain all associated files. The wave function will then evolve through time. Specifying additional keyword arguments when calling the simulation changes what data will be shown, how it will be represented in the animation and what data will be written to files.<jupyter_code># create a simulation object
# provide a grid, wave function, potential and the time increment
# an optional name for the simulation can be added
dt = 2*10**-3
simulation = wpd.Simulation(grid, wave_function, potential, dt, "documentation")

# start the simulation by calling the instance
# provide the total number of time steps and optional keyword arguments
# -> take a look at the other examples for possible options
tn = 1000
simulation(tn, animate_step=tn,
           data_to_animate=["wave_function", "probability_density"],
           y_limits=(-2, 2), z_limits=(-2, 2), x_ticks=[-1, 0, 1],
           write_step=tn, data_to_write=["wave_function"],
           value_to_write=["integrated_density"])

# videos consisting only of 1 frame or less are deleted
# however the last frame of the animation is shown in jupyter notebook
# only the specified data and expectation values of the last timestep
# are written to a file by default<jupyter_output>Starting simulation:
Writing data from time step 1000 to file
Adding data from time step 1000 to animation
Deleting animation!
Simulation finished!
{'fraction_non_alphanumeric': 0.05363282145312858, 'fraction_numerical': 0.012606005042402018, 'mean_word_length': 5.333817126269956, 'pattern_counts': {'":': 0, '<': 16, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '4', 'dir': 'jupyter-structured-clean-dedup', 'id': '380616', 'license': 'MIT', 'n_tokens_mistral': 1156, 'n_tokens_neox': 1082, 'n_words': 570, 'path': 'docs/source/notebooks/documentation.ipynb', 'repo_name': 'Rastow/wave_packet_dynamics', 'size': '4363'}