gpe.bec#
Code for simulating a single component BEC.
This is the reference implementation of the GPE for a single component BEC. The current parameters are designed for easily working with the Rb87 experiments in Peter Engels lab at WSU, but the framework is quite general and should be easy to adapt to other experiments.
Note: for performance, the classes here use the AsNumpyMixin class which turns “sunder” methods - those starting and ending with an underscore - into proper public methods using either numpy or cupy arrays.
Classes#
Units and physical constants. |
|
Mixing providing the GPE equation of state. |
|
State for the GPE in a homogeneous box. |
|
Helper mixin class for harmonically trapped systems. |
|
Minimal modification of the State class that implements twisted boundary |
|
This state implements the scaling from Castin and Dum. |
Module Contents#
- class Units[source]#
Units and physical constants.
This class is simply a container for physical constants and units. We have chosen values here that are relevant for 87Rb which is studied at WSU in Peter Engels’ lab.
- static get_magnetic_moment_mu_B(species=(1, -1))[source]#
Return the magnetic moment for the specified species in units of mu_B.
See also
https//steck.us/alkalidata/
https//link.aps.org/doi/10.1103/RevModPhys.49.31
- Parameters:
species ((int, int)) – (F, mF) specifying the hypdrfine states of the 87Rb ground state (5^2 S_{1/2}).
Examples
>>> u.get_magnetic_moment_mu_B((1, -1)), u.magnetic_moment[(1, -1)]/u.mu_B (0.5018..., 0.5018...) >>> u.get_magnetic_moment_mu_B((1, 0)) -0.0 >>> u.get_magnetic_moment_mu_B((2, -2)) -0.99967... >>> u.get_magnetic_moment_mu_B((2, 0)) 0.0 >>> u.get_magnetic_moment_mu_B((2, 2)) 0.99967...
- class GPEMixin(g=None, **kw)[source]#
Bases:
gpe.utils.GPUHelperMixing providing the GPE equation of state.
- get_n_TF(V_TF, V_ext=None, g=None, state=None)[source]#
Return the Thomas Fermi density profile n from V_TF.
- Parameters:
V_TF (float) – Value of V(x_TF) where the density should vanish in the TF limit.
- class StateBase(g=None, **kw)[source]#
Bases:
GPEMixin,_StateBaseState for the GPE in a homogeneous box.
- class HOMixin(ws=None, **kw)[source]#
Bases:
gpe.utils.GPUHelperHelper mixin class for harmonically trapped systems.
It is common in experiments for the clouds to be trapped in an external harmonic oscillator potential. Often, components of this trapping potential are turned off or relaxed to allow for expansion before imaging. This class provides an implementation of get_Vext_GPU() that implements the trapping potential. The user should call this (with super().get_Vext_GPU()) and then add any additional potentials.
This provides a default get_Vext_GPU().
- get_Vext_GPU(state=None)[source]#
Return the external potential.
Overload this method if you want to change the external potential. If the potential should be time dependent, use self.t which will be updated by the evolvers.
If a chemical potential self.mu is defined, then this is subtracted from Vext. This allows gpe.minimize to find states at a constant chemical potential. Note: for general evolution, it is better not to set the chemical potential as this is automatically set by compute_dy_dt and will then cause get_energy to return the thermodynamic potential instead.
- class StateTwist_x(twist=None, v_x=0, kwz2=None, **kw)[source]#
Bases:
StateBaseMinimal modification of the State class that implements twisted boundary conditions along the x direction and a boost with velocity v_x.
- Parameters:
twist (float) – Twisted boundary conditions. This is the twist angle from left to right over the length of the box. If there is a twist, then the wavefunction stored in the state is the periodic version with the twist removed. For this reason, we include the functions get_psi() and set_psi() which allow the user to access the physical non-periodic wavefunction.
v_x (float) – Boost velocity along the x axis.
kwz2 (float) – Angular velocity of about z-axis in expressed as kwz2 = m*omega_z/hbar.
- property kx[source]#
Momentum along x direction.
Twisted boundary conditions are implemented as a shift in the momenta by the “Bloch” momentum
- class StateScaleBase(g=None, **kw)[source]#
Bases:
StateBaseThis state implements the scaling from Castin and Dum.
To use this class, you must provide get_lambdas() which defines the scaling factors at the current time.
- get_lambdas(t=None)[source]#
Return (lams, dlams, ddlams): the scale factors and derivatives.
These should be computed at time t which should be self.t if t is None. There should be exactly self.dim scale factors - one for each dimension. If a dimension is not to be scaled, then the scale factor should be kept constant at 1.