Skip to content

Tiernan8r/variational_principle

Repository files navigation

The Variational Principle in Quantum Mechanics:

Quality Gate Status

The Variational Principle in Quantum Mechanics states that:

equation


This implementation utilises NumPy and Matplotlib to numerically calculate the energy eigenstates and energy eigenvalues of the given bounded potential system.

The code is capable of calculating the bound energies and states of any number of energy eigenstates, with decreasing accuracy with each new state.

The code can handle systems of any number of dimensions, but can only plot the energy eigenstates of a system up to and including 3D.


For full details read the report

Setup:

First, setup a virtualenvironment and install the requirements:

$ python -m virtualenv venv
$ source venv/bin/activate
$ pip install -r requirements.txt

Running:

Ensure the setup steps above are run.

From the top level directory:

$ python -m variational_principle.main

Should result in a help message like the following:

main.py - A tool to calculate the n energy eigenstates for a given bound potential
USAGE:
main.py [FLAGS] <start> <stop> <N>
FLAGS:
-i/--include-potential       Whether or not to plot the calculated graphs with the given potential superimposed
                             (default = False)
-v/--v-scale                 Scaling factor used on the potential when --include-potential is True (default = 10)
-d/--dimensions              The number of dimensions to calculate on, options are 1, 2 or 3 (default = 1)
-n/--num-states              Number of energy eigenstates to calculate (default = 1)
-n/--num-iterations          The number of iterations to calculate (default = 10^5)
-h/--help                    Show this message
ARGUMENTS:
<start>                      The initial coordinate for the grid
<stop>                       The end coordinate for the grid
<N>                          The number of subdivisions of the grid

To verify the code will run correctly, the easiest input is:

$ python -m variational_principle.main -1 1 1

If no errors occur, a GUI should appear with an empty plot.

After that, happy plotting!

Installing:

Using pyinstaller an executable binary can be compiled:

$ pyinstaller --onefile binary.spec

Will compile an executable binary at dist/variational_principle. Run the binary as usual with

$ ./dist/variational_principle [...input]