Giter VIP home page Giter VIP logo

braketlab's Introduction

Out-of-the-box outside-of-the-box thinking

BraketLab is a pure Python-code for doing quantum theory in Jupyter Notebooks.

BraketLab is being developed by Audun Skau Hansen ([email protected]) at the Department of Chemistry, Hylleraas Centre for Quantum Molecular Sciences, University of Oslo.

Documentation (in developement)

Documentation on github pages

Installation

Install the BraketLab-module using pip install braketlab from your terminal.

braketlab's People

Contributors

audunsh avatar

Stargazers

Ahmed Moawad avatar Xinmeng avatar Håkon E. Kristiansen avatar Tor S. Haugland avatar

Watchers

James Cloos avatar  avatar Ahmed Moawad avatar

braketlab's Issues

Using "x = sp.symbols("x y z")" not same as "x = bk.get_default_variables(1,3)"

x,y,z = sp.symbols("x y z")

psi_a = bk.ket( sp.exp(-.1*x**2), name = "psi_a")

psi_b = bk.ket( x*sp.exp(-.2*x**2), name = "psi_b")

ab = psi_a@psi_b

Gives the error message:

Traceback (most recent call last):
  File "braketlab2/braketlab/testing/generalize_plotting_tests.py", line 55, in <module>
    ab = psi_a@psi_b
  File "/Users/<USERNAME>/Library/Python/3.8/lib/python/site-packages/braketlab/braketlab.py", line 1106, in __matmul__
    bij, sep = relabel_direct(self.basis[i].ket_sympy_expression, other.basis[j].ket_sympy_expression)

  File "/Users/<USERNAME>/Library/Python/3.8/lib/python/site-packages/braketlab/braketlab.py", line 1330, in relabel_direct
    p1 = get_particles_in_expression(s1)

  File "/Users/<USERNAME>/Library/Python/3.8/lib/python/site-packages/braketlab/braketlab.py", line 1314, in get_particles_in_expression

    particles.append( int(i.name.split("{")[1].split(";")[0] ) )

IndexError: list index out of range

While the following works fine. Both ways of defining a sympy symbol (?) are used in the tutorial, so maybe that should be changed?

x,y,z = bk.get_default_variables(1,3)

psi_a = bk.ket( sp.exp(-.1*x**2), name = "psi_a")

psi_b = bk.ket( x*sp.exp(-.2*x**2), name = "psi_b")

ab = psi_a@psi_b

Problem using one-body Coulomb operator

Hello,

I have an issue using the one-body Coulomb operator. This is the code I'm trying to run:

x, y, z = bk.get_default_variables(1,3)  #
a = 1; b = 1; c = 1
k = bk.ket(a*sp.exp(-(x-b)**2/2*c**2), name="k")
norm = (k.bra@k)**-0.5
knorm = k*norm

T = bk.get_kinetic_operator()
V = bk.onebody_coulomb_operator()

print(knorm.bra@(T*knorm))
print(knorm.bra@(V*knorm))

This yields the output:

0.25
<lambdifygenerated-9>:2: RuntimeWarning: divide by zero encountered in double_scalars
  return (Dummy_35**2)**(-0.5)*exp(-1/2*(Dummy_35 - 1)**2)
-inf

The code from the tutorial works:

n,l,m = 1,0,0
psi_0 = bk.basisbank.get_hydrogen_function(n,l,m)
print(psi_0.bra@(V*psi_0))

Is this a bug, or is there an obvious, quantum-mechical explanation for this that I'm missing?

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.