gpe.ufg
=======

.. py:module:: gpe.ufg

.. autoapi-nested-parse::

   Extended Thomas Fermi model of the Unitary Fermi Gas.



Attributes
----------

.. autoapisummary::

   gpe.ufg.gpu
   gpe.ufg.gpu


Classes
-------

.. autoapisummary::

   gpe.ufg.DimerStateMixinBase
   gpe.ufg.DimerStateMixin
   gpe.ufg.DimerStateCPU
   gpe.ufg.DimerState
   gpe.ufg.Experiment


Module Contents
---------------

.. py:data:: gpu

.. py:data:: gpu
   :value: None


.. py:class:: DimerStateMixinBase

   Bases: :py:obj:`gpe.utils.GPUHelper`


   Dimer state.

   This class represents a BEC of dimers.

   .. attribute:: m

      Dimer mass

      :type: float

   .. attribute:: Note

      

      :type: Everything in the code, except for the functional, refers

   .. attribute:: to the dimer properties.  Thus m is the dimer mass, get_density()

      

   .. attribute:: returns the dimer density, etc.

      


   .. py:attribute:: _Vext
      :value: None



   .. py:attribute:: _memoize
      :value: False



   .. py:property:: t_unit


   .. py:property:: pxyz

      Return pxyz as list of numpy arrays.


   .. py:method:: init()


   .. py:property:: cooling_phase


   .. py:property:: _phase


   .. py:method:: get_V_GPU()

      Return the complete potential `V` - internal and external.

      This function defines the non-linear interaction of the equations.



   .. py:method:: get_energy_density(energy=False)

      Return the energy density.

      :param energy: If `True`, then set `self.mu = None` during the computation
                     so that the actual energy is computed.  Otherwise, if
                     `self.mu` is provided, then this is actually the grand
                     potential including the `mu*N` subtraction. (See
                     `get_Vext_GPU` which subtracts `self.mu` if it is not `None`.)
      :type energy: bool
      :param In this energy density function:
      :param we calculate the energy density:
      :param for the dimers in two ways. First:
      :param we do it from equation:
      :param of state (please see the method edf below) and then do it:
      :param from explicit analytical expression with _factors. Both:
      :param gives the same result and it has been tested carefully. Hence:
      :param :
      :param we have two Vint expressions. We use the one from edf as it is:
      :param easier to keep track. Both expressions can be used interchangably.:



   .. py:method:: get_energy(energy=False)

      Return the energy of the state.  Useful for minimization.

      :param energy: If `True`, then set `self.mu = None` during the computation
                     so that the actual energy is computed.  Otherwise, if
                     `self.mu` is provided, then this is actually the grand
                     potential including the `mu*N` subtraction. (See
                     `get_Vext_GPU` which subtracts `self.mu` if it is not `None`.)
      :type energy: bool



   .. py:method:: get_Eint(nF=None)


   .. py:method:: get_velocity()

      Returns superfluid velocity field in position space
      as an array.



   .. py:method:: get_current()

      Calculating the probability current.
      Attributes:
      -----------
      _j : Probability current (shape = 3*N)
           $\frac{\hbar}{2*m*i} {\psi^* \nabla \psi - \psi \nabla \psi^*}$.



   .. py:method:: get_omegas()

      Returns irrotational and compressible effective velocity field.
      Tsubota 2017, https://arxiv.org/abs/1704.02566, Eq. 79, 80.



   .. py:method:: get_Vint_GPU(nF=None)


   .. py:method:: get_Vext_GPU()

      Return the external potential.

      This delegates to the experiment get_VFext_GPU() and then
      includes an appropriate factor of 2 for the dimers.



   .. py:method:: get_Vext_mu_GPU()

      Return Vext 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.



   .. py:property:: mF

      Fermion mass.


   .. py:method:: get_nF_GPU()


   .. py:method:: edf(nF, d=0)

      Return the energy density of homogeneous matter.

      :param nF: Total fermion density = 2*dimer density
      :type nF: float
      :param d: Derivative.
      :type d: int



   .. py:method:: get_nF_TF(muF=None)

      Invert the edf to get nF(muF).
      Returns Thomas-Fermi density of the dimers.

      :param muF: Effective fermionic chemical potential.  Usually muF_0 - V_F(x)
      :type muF: float



   .. py:method:: get_n_TF(V_TF=None, V_ext=None)

      Return the Thomas Fermi density profile n (for dimers) from V_TF.

      :param V_TF: Value of V(x_TF) where the density should vanish in the TF limit.
      :type V_TF: float



   .. py:method:: get_healing_length()

      Coherence length in dimensionless units.



   .. py:method:: get_c()

      Speed of sound.



   .. py:property:: txt

      Text widget.


.. py:class:: DimerStateMixin

   Bases: :py:obj:`DimerStateMixinBase`


   Class with method to evolve and plot.


   .. py:method:: plot(log=False, slice=True)


   .. py:method:: plot_pv(n_nmax=0.5)


   .. py:method:: evolve_to(t, dt_t_scale=0.1)


   .. py:method:: evolve(steps=500, t__max=10000, dt_t_scale=0.1, display=True, pv=False, hist=False)

      Time evolves a state.

      Arguments:
      ----------
      pv: bool
         If True, does PyVista 3d plotting.
      hist: bool
         If True, returns a list of evolved states at different times.
      t__max : float
         Evolve up to this time (units of t_unit).



.. py:class:: DimerStateCPU(experiment, **kw)

   Bases: :py:obj:`DimerStateMixin`, :py:obj:`gpe.bec.StateBase`


   Class with method to evolve and plot.


   .. py:attribute:: experiment


.. py:class:: DimerState(experiment, **kw)

   Bases: :py:obj:`DimerStateMixin`, :py:obj:`gpu.bec.StateBase if gpu else gpe.bec.StateBase`


   Class with method to evolve and plot.


   .. py:attribute:: experiment


.. py:class:: Experiment(_local_dict=None, **kw)

   Bases: :py:obj:`gpe.utils.ExperimentBase`, :py:obj:`gpe.utils.GPUHelper`


   Experimental setup.

   .. attribute:: xi

      Bertsch parameter.

      :type: float

   .. attribute:: Everything here refers to fermions.  External potentials

      

   .. attribute:: are defined for fermions, etc.

      


   .. py:attribute:: mF
      :value: 1.0



   .. py:attribute:: hbar
      :value: 1.0



   .. py:attribute:: State


   .. py:attribute:: Nxyz
      :value: (50, 50, 50)



   .. py:attribute:: kF
      :value: 1.0



   .. py:attribute:: dx_kF
      :value: 1.0



   .. py:attribute:: omega_eF
      :value: 0



   .. py:attribute:: cooling_phase
      :value: 1.0



   .. py:attribute:: normalized_cooling
      :value: True



   .. py:attribute:: fix_N
      :value: False



   .. py:attribute:: eta
      :value: 0.5



   .. py:attribute:: xi
      :value: 0.4



   .. py:method:: init()

      Overload this to perform any initial computations.



   .. py:property:: dim


   .. py:property:: t_unit


   .. py:method:: get_state(t_=0, minimize=False, initialize=False, _E_tol=1e-12, _psi_tol=1e-12)

      Quickly return a valid `State` object.



   .. py:method:: get_initial_state(psi0=None, _E_tol=1e-12, _psi_tol=1e-12, callback=None, **kw)

      Return the valid `t=0` state to initialize the simulations.



   .. py:method:: get_initialized_state(state)

      Return a valid state initialized from `state`.

      This is used in chained simulations where a specified state of one
      simulation is used to initialize a state for further use.  For example,
      for expansion.



   .. py:method:: get_VFext_GPU(state)

      Return the external potential for fermions.



