Skip to content

Commit

Permalink
Fixed bug with gCCE if no bath pulses were provided but delays were
Browse files Browse the repository at this point in the history
  • Loading branch information
foxfixfax committed Jun 5, 2022
1 parent aee627c commit 62c428f
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
12 changes: 12 additions & 0 deletions pycce/run/gcce.py
Original file line number Diff line number Diff line change
Expand Up @@ -300,8 +300,11 @@ def _delays_no_ps(self):
evalues, evec = np.linalg.eigh(self.hamiltonian * PI2)

full_u = np.eye(self.base_hamiltonian.data.shape[0], dtype=np.complex128)
times = 0

for delay, rotation in zip(self.delays, self.rotations):
times += delay

eigexp = np.exp(-1j * np.outer(delay, evalues),
dtype=np.complex128)

Expand All @@ -313,8 +316,17 @@ def _delays_no_ps(self):
if rotation is not None:
full_u = np.matmul(rotation, full_u)

which = np.isclose(self.timespace, times)

if ((self.timespace - times)[~which] >= 0).all():
u = simple_propagator(self.timespace - times, self.hamiltonian)

full_u = np.matmul(u, full_u)

elif not which.all():
raise ValueError(f"Pulse sequence time steps add up to larger than total times. Delays at"
f"{self.timespace[(self.timespace - times) < 0]} ms are longer than total time.")

return full_u

def _delays_ps(self):
Expand Down
1 change: 1 addition & 0 deletions pycce/utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ def partial_trace(dmarray, dimensions, sel):
ndarray with shape (n, n) or (m, n, n): Partially traced operator.
"""
sel = np.asarray(sel, dtype=int).reshape(-1)
dmarray = dmarray.copy()
dimensions = np.asarray(dimensions, dtype=int)
lendim = len(dimensions)

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

setup(
name='pycce',
version='1.0.1.2',
version='1.0.1.3',
url='',
license='',
author='Nikita Onizhuk',
Expand Down

0 comments on commit 62c428f

Please sign in to comment.