Optimization

Optimization#

%pylab inline --no-import-all
from gpe import bec
from gpe.bec import u
from pytimeode.evolvers import EvolverABM

s = bec.State(
    Nxyz=(2**9, 2**7, 2**7), Lxyz=(80 * u.micron, 45 * u.micron, 45 * u.micron)
)
# state = bec.State(Nxyz=(2**8, 2**5, 2**5), Lxyz=(80*u.micron, 30*u.micron, 30*u.micron))
e = EvolverABM(s, dt=0.1 * s.t_scale)
%time e.evolve(5)
%pylab is deprecated, use %matplotlib inline and import the required libraries.
Populating the interactive namespace from numpy and matplotlib
---------------------------------------------------------------------------
KeyboardInterrupt                         Traceback (most recent call last)
Cell In[1], line 6
      2 from gpe import bec
      3 from gpe.bec import u
      4 from pytimeode.evolvers import EvolverABM
      5 
----> 6 s = bec.State(
      7     Nxyz=(2**9, 2**7, 2**7), Lxyz=(80 * u.micron, 45 * u.micron, 45 * u.micron)
      8 )
      9 # state = bec.State(Nxyz=(2**8, 2**5, 2**5), Lxyz=(80*u.micron, 30*u.micron, 30*u.micron))

File ~/checkouts/readthedocs.org/user_builds/gpe/conda/latest/lib/python3.14/site-packages/gpe/bec.py:1329, in State.__init__(self, *v, **kw)
   1324 def __init__(self, *v, **kw):
   1325     warnings.warn(
   1326         "State class is Deprecated: use HOMixin and StateBase",
   1327         DeprecationWarning,
   1328     )
-> 1329     super().__init__(*v, **kw)

File ~/checkouts/readthedocs.org/user_builds/gpe/conda/latest/lib/python3.14/site-packages/gpe/bec.py:1256, in HOMixin.__init__(self, ws, **kw)
   1254 if ws is not None:
   1255     self.ws = ws
-> 1256 super().__init__(**kw)

File ~/checkouts/readthedocs.org/user_builds/gpe/conda/latest/lib/python3.14/site-packages/gpe/bec.py:1158, in GPEMixin.__init__(self, g, **kw)
   1156 if g is not None:
   1157     self.g = g
-> 1158 super().__init__(**kw)

File ~/checkouts/readthedocs.org/user_builds/gpe/conda/latest/lib/python3.14/site-packages/gpe/bec.py:485, in _StateBase.__init__(self, basis, Nxyz, Lxyz, symmetric_grid, t, hbar, m, mu, x_TF, cooling_phase, constraint, PGPE, kc_kmax, basis_args, t_final, Omega, **kw)
    482 super().__init__(**kw)
    484 # Once the state is initialized, we can set the initial state.
--> 485 self.set_initial_state()

File ~/checkouts/readthedocs.org/user_builds/gpe/conda/latest/lib/python3.14/site-packages/gpe/bec.py:560, in _StateBase.set_initial_state(self, mu, x_TF)
    557     mu = self.get_mu_from_V_TF(V_TF=self.get_V_TF(x_TF=x_TF))
    559 V_TF = self.get_V_TF_from_mu(mu=mu)
--> 560 n = self.get_n_TF(V_TF=V_TF)
    562 # Here we add a full array of zeros to make sure that V_ext is full
    563 # size.  (Sometimes this might try to save memory by returning an
    564 # object like 0.0 that does not have full shape, but here we are
    565 # initializing the state, so we should make sure it gets expended.
    566 n = n + np.zeros(self.shape)

File ~/checkouts/readthedocs.org/user_builds/gpe/conda/latest/lib/python3.14/site-packages/gpe/bec.py:1188, in GPEMixin.get_n_TF(self, V_TF, V_ext, g, state)
   1185 # In some applications, the external potential may be complex, so we
   1186 # consider only the real part here
   1187 V_ext = V_ext.real + np.zeros(state.shape)
-> 1188 return np.maximum(0, V_TF - V_ext) / g

KeyboardInterrupt: 
%pylab inline --no-import-all
from gpe import bec

reload(bec)
from gpe.bec import u
from pytimeode.evolvers import EvolverABM

s = bec.State(
    Nxyz=(2**9, 2**7, 2**7), Lxyz=(80 * u.micron, 45 * u.micron, 45 * u.micron)
)
# state = bec.State(Nxyz=(2**8, 2**5, 2**5), Lxyz=(80*u.micron, 30*u.micron, 30*u.micron))
e = EvolverABM(s, dt=0.1 * s.t_scale)
%time e.evolve(5)