Code Monkey home page Code Monkey logo

qmsolve's Introduction

QMsolve: A module for solving and visualizing the Schrödinger equation

animation

QMsolve seeks to provide easy solid and easy to use solver, capable of solving the Schrödinger equation for one and two particles, and creating descriptive and stunning visualizations of its solutions both in 1D, 2D, and 3D.

Installation

pip install qmsolve

How it works

The way this simulator works is by discretizing and Hamiltonian of an arbitrary potential, specified as a function of the particle observables. This is achieved with the Hamiltonian constructor.

Then, the Hamiltonian.solve method efficiently diagonalizes the Hamiltonian and outputs the energies and the eigenstates of the system. Finally, the eigenstates can be plotted with the use of the visualization class.

The visualization.superpositions method features the possibility of interactively visualizing a superposition of the computed eigenstates and studying the time dependence of the resulting wavefunction.

For a quick start, take a look to the examples found in the examples subdirectory.

Examples

To perform the simulations, just run from the corresponding Python scripts on the command prompt.

python 1D_harmonic_oscillator.py

animation

python 1D_interactive_fermions_HO.py

animation

python 1D_non_interactive_fermions_HO.py

animation

python 3D_four_gaussian_wells.py

animation

In the two interactive particle examples from above you can check how in the non interactive case the energy levels are equally spaced and degenerated, however in the interactive case the degeneracy is broken. As a starting point I suggest you to modify the confinement and the interaction potential to see what happens!

The interface use Hartree atomic units for input. In the file constants.py there is a list of common conversion factors from other units, that can be imported and used to build your potential.

3D examples are considerably faster when using a GPU. GPU acceleration requires having CuPy and CUDA installed in your computer.

To use GPU acceleration in your 3D simulations, add the argument method ='lobpcg-cupy' in the Hamiltonian solve method. For example:

eigenstates = H.solve( max_states = 50, method ='lobpcg-cupy')

Contributors

qmsolve's People

Contributors

rafael-fuente avatar marl0ny avatar dhudsmith avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.