gpe.bec2#
Two component BEC in 1D.
Here we demonstrate the dynamics a two component BEC such as 87Rb.
Simplifications:
g_aa = g_bb = g_ab = g
m_a = m_b = m
Assume that only total particle number is conserved.
Attributes#
Classes#
Underlying implementation of features needed for IStateDFT. |
|
Two component state. |
|
Mixing providing the 2-component GPE equation of state. |
|
Two component state with GPE equation of state. |
|
Helper mixin class for backwards compatibility. |
|
This state implements the scaling from Castin and Dum. |
|
This state implements the scaling from Castin and Dum for |
Module Contents#
- class StateDFTBase(**kw)[source]#
Bases:
gpe.bec.StateDFTBaseUnderlying implementation of features needed for IStateDFT.
- braket_GPU(y)[source]#
Return the dot product of self.conjugate() with y.
- Parameters:
y (State) – The states for which the braket will be computed.
- get_Vext_mu_GPU()[source]#
Return (Va, Vb, Vab) with the chemical potential subtracted if initializing.
The chemical potential should be subtracted if initializing or minimizing to get the initial state. Minimization might be done with imaginary time evolution, which should be done with negative times.
Thus, we check for self.initializing, self.t < 0, and make sure that self.mu is valid.
- class _StateBase(basis=None, Nxyz=(2**5, 2**5, 2**5), Lxyz=(30 * u.micron, 50 * u.micron, 50 * u.micron), symmetric_grid=False, twist=None, v_x=0, kwz2=None, t=0, hbar=u.hbar, ms=(u.m, u.m), mus=None, x_TF=None, cooling_phase=1.0, constraint='N', PGPE=False, mu_Bs=(0 * u.mu_B, 0 * u.mu_B), k_r=0.0, rotating_phases=False, basis_args={}, t_final=None)[source]#
Bases:
StateDFTBaseTwo component state.
This state is designed for a spin-orbit (SO) coupled BEC in a harmonic confining potential with the SO field along the x-axis, and a possible magnetic field gradient also along the x-axis.
- Parameters:
basis (IBasis, None) – If provided, then this is used to specify the basis. If not, then a periodic basis is constructed from Nxyz and Lxyz.
constraint ('N' | 'Nab') – If ‘N’, then constrain the total density allowing particles to convert from one species to the other. If ‘Nab’ Then independently constrain Na and Nb.
twist ((float, float)) – Twisted boundary conditions for species a and b. This is the twist angle.
x_TF (float) – Thomas Fermi “radius” for setting the initial state. The initial state will be set so that the density will fall to zero at this point x=x_TF (with y and z in the middle of the trap). If None, then we default to 80% of the length.
PGPE (bool) – If True, then the code implements the PGPE, imposing a cutoff at kc
- init()[source]#
Initialize the state.
This method defines the basis positions, momenta, etc. for use later on. We define these here rather than in the constructor __init__() so that the user can change them later and the reinitialize the state. We also call this function from the pre_evolve_hook() so that it is called before any evolution takes place. For this reason, we should not modify the state here.
- set_initial_state(mus=None, x_TF=None)[source]#
Set the state using the Thomas Fermi (TF) approximation from either mus or x_TF (pick only one or the other).
- get_mus_from_Vs_TF(Vs_TF)[source]#
Return the corrected chemical potential from Vs_TF.
In some cases, the chemical potential may differ from the value of the external potentials at V(x_TF) due to kinetic energy shifts (in the SOC case for example) or due to the energy of radial excitations (see the tube codes). This function adds the appropriate correction.
- get_Vs_TF(x_TF, V_ext=None)[source]#
Return the Thomas Fermi chemical potential at x_TF.
- Parameters:
x_TF (float) – Position defining the Thomas Fermi “radius”. (The external potential is evaluated at this position and this is used to get mu.)
- _get_kx2(kx=None, Lx=None)[source]#
Return the effective kx**2 and twist_phase_x for the kinetic energy matrix. This will be passed as the kx2 and twist_phase_x arguments to the basis.lagrangian function.
- property E_max[source]#
Return the maximum kinetic energy in the basis.
This is useful when using evolvers as convergence should be obtained when the time-step is roughly:
dt = 0.1 * state.hbar / state.E_max
See t_scale.
- property t_scale[source]#
Return the smallest time-scale for the problem.
Evolvers - especially the ABM evolvers - should use a dt=0.1*t_scale or so. If much smaller dt values are required for convergence, then it usually indicates that your lattice spacing is too larger. Likewise, if you can get away with much larger dt values, then your lattice spacing might be unnecessarily small.
Required by Simulation.
- compute_dy_dt(dy, subtract_mu=True)[source]#
Return dy_dt storing the results in dy.
- Parameters:
subtract_mu (bool) –
If True, then subtract the chemical potential such that dy_dt is orthogonal to the original state y. This will minimize the evolution of the overall phase during real-time evolution (which can reduce numerical errors) and will ensure that evolution under imaginary or complex time will preserve particle number.
This should not be set if computing physical energy of the state, however, which is why it is a parameter.
- apply_exp_V(dt, state)[source]#
Apply \(e^{-i V dt}\) in place using state for any nonlinear dependence in V. (Linear problems should ignore state.)
- apply_laplacian(factor, exp=False, **_kw)[source]#
Apply the laplacian multiplied by factor to the state.
- Parameters:
factor (array-like) – The result will be multiplied by this factor.
exp (bool) – If True then exp(factor*laplacian)(y) will be computed instead.
- get_energy_density(a=True, b=True, ab=True)[source]#
Return the energy density.
- Parameters:
a (bool) – Include the energies associated with this species. This includes the kinetic energy and the self-interaction, but no inter-species interactions.
b (bool) – Include the energies associated with this species. This includes the kinetic energy and the self-interaction, but no inter-species interactions.
ab (bool) – Include only the interaction energy.
- evolve_to(t_end, dt_t_scale=0.2, Evolver=evolvers.EvolverABM, evolve_steps=200, callback=None)[source]#
Evolve state to self.t = t_end.
- Parameters:
t_end (float) – Evolves the state for t_end time units. Remember to convert times by self.t_unit.
dt_t_scale (float) – Scales dt.
Evolver (IEvolver) – Pick the relevent evolver, either evolvers.EvolverABM or evolvers.EvolverSplit.
evolve_steps (float) – Number of evolution steps between callbacks if defined.
callback (function) – Any function that takes the state as an argument, like plotting or visualization.
- class GPEMixin[source]#
Mixing providing the 2-component GPE equation of state.
- get_Eint(state=None)[source]#
Return the “internal” mean-field energy-densities (Ea, Eb, Eab).
This version implements the standard GPE where the energy-density has \(gn^2/2\). The method get_Vint() should return the appropriate derivative of this.
- class StateGPEBase(gs=None, **kw)[source]#
Bases:
GPEMixin,_StateBaseTwo component state with GPE equation of state.
- class HOMixin(ws=None, Omega=None, delta=None, **kw)[source]#
Bases:
gpe.utils.GPUHelperHelper mixin class for backwards compatibility.
This provides a default get_Vext_GPU().
- class StateScaleBase(basis=None, Nxyz=(2**5, 2**5, 2**5), Lxyz=(30 * u.micron, 50 * u.micron, 50 * u.micron), symmetric_grid=False, twist=None, v_x=0, kwz2=None, t=0, hbar=u.hbar, ms=(u.m, u.m), mus=None, x_TF=None, cooling_phase=1.0, constraint='N', PGPE=False, mu_Bs=(0 * u.mu_B, 0 * u.mu_B), k_r=0.0, rotating_phases=False, basis_args={}, t_final=None)[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.
- init()[source]#
Initialize the state.
This method defines the basis positions, momenta, etc. for use later on. We define these here rather than in the constructor __init__() so that the user can change them later and the reinitialize the state. We also call this function from the pre_evolve_hook() so that it is called before any evolution takes place. For this reason, we should not modify the state here.
- 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.
- class StateScaleHO(basis=None, Nxyz=(2**5, 2**5, 2**5), Lxyz=(30 * u.micron, 50 * u.micron, 50 * u.micron), symmetric_grid=False, twist=None, v_x=0, kwz2=None, t=0, hbar=u.hbar, ms=(u.m, u.m), mus=None, x_TF=None, cooling_phase=1.0, constraint='N', PGPE=False, mu_Bs=(0 * u.mu_B, 0 * u.mu_B), k_r=0.0, rotating_phases=False, basis_args={}, t_final=None)[source]#
Bases:
StateScaleBaseThis state implements the scaling from Castin and Dum for harmonic oscillators. This provides the required get_lambdas() function but now requires the user specify the time-dependence of the trapping frequencies in get_ws().
- init()[source]#
Initialize the state.
This method defines the basis positions, momenta, etc. for use later on. We define these here rather than in the constructor __init__() so that the user can change them later and the reinitialize the state. We also call this function from the pre_evolve_hook() so that it is called before any evolution takes place. For this reason, we should not modify the state here.
- 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.