Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes missing complex conjugation in transition method #23

Merged
merged 7 commits into from
Jun 6, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions aisim/atoms.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,13 +87,33 @@ def state_vectors(self, new_state_vectors):
assert new_state_vectors.shape[0] == len(self)
self._state_vectors = new_state_vectors

@property
def density_matrices(self):
"""
n × m x m array, representing the density matrix of the m level system of the n atoms.
These are pure states.
"""
# |Psi><Psi|
bleykauf marked this conversation as resolved.
Show resolved Hide resolved
return np.einsum('ji,il->ijl', np.conjugate(self.state_vectors).T, self.state_vectors)
bleykauf marked this conversation as resolved.
Show resolved Hide resolved

@property
def density_matrix(self):
"""
m x m array, representing the density matrix of the AtomicEnsemble's m level system
"""
pure_dm = self.density_matrices
n_atoms = self.state_vectors.shape[0]
# sum over pure |Psi><Psi| and divide by N
return 1/n_atoms * np.einsum('ijk->jk', pure_dm) # sum over pure state's density matrices

@property
def position(self):
"""
n × 3 dimensional array representing the current positions (x, y, z) of the atoms in the
ensemble
"""
return self.phase_space_vectors[:, 0:3]

@position.setter
def position(self, new_position):
self.phase_space_vectors[:, 0:3] = new_position
Expand Down
4 changes: 2 additions & 2 deletions aisim/prop.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ def transition(atoms, intensity_profile, tau, wave_vectors=None, wf=None, phase_

propagator = np.array([[U_ee, U_eg], [U_ge, U_gg]], dtype='complex')
propagator = np.transpose(propagator, (2, 0, 1))
# U*Psi
atoms.state_vectors = np.einsum('ijk,ki ->ij', propagator, atoms.state_vectors.T)
# U*|Psi>
atoms.state_vectors = np.conjugate(np.einsum('ijk,ki ->ij', propagator, np.conjugate(atoms.state_vectors).T))
bleykauf marked this conversation as resolved.
Show resolved Hide resolved
atoms = free_evolution(atoms, tau)
return atoms