jTWA.spin1#
jTWA.spin1 comprises all functionality that is specific to systems with spin-1.
jTWA.spin1.hamiltonian#
- jTWA.spin1.hamiltonian.hamiltonian(sample_conj, sample, cfg)#
Defines the hamiltonian of the full system. The function takes both the sample and its complex conjugate as input, so that it is easy to obtain its time derivative
\[i\partial_t \alpha = \partial_{\alpha^*} H(\alpha, \alpha^*).\]Here \(\alpha\) is the vector of length \(N_{wells} \cdot N_{internal}\) for which the time derivative is computed by differentiating \(H\) with respect to the complex conjugated sample \(\alpha^*\).
- Args:
sample_conj: A single complex conjugated sample.sample: The same sample without complex conjugation.cfg: The dictionary that contains the settings of the current run.
- Returns:
The energy of the sample.
- jTWA.spin1.hamiltonian.hamiltonian_singleWell(sample_conj, sample, cfg)#
Defines the internal hamiltonian of a single well.
- Args:
sample_conj: A single complex conjugated sample.sample: The same sample without complex conjugation.cfg: The dictionary that contains the settings of the current run.
- Returns:
The energy of the sample within a single well.
- jTWA.spin1.hamiltonian.update_cfg(cfg)#
Since the energy scale is set by \(\langle N \rangle c_1 = -1\) we have \(c_1=-1/\langle N \rangle\). This computation is done at runtime to minimize the risk of inconsistencies, when setting \(c_1\) and \(\langle N \rangle\) separately. However, this also means that all quantities that depend on \(c_1\) must be computed at runtime as well. This is done within this function.
- Args:
cfg: The dictionary that contains the settings of the current run.
- Returns:
cfg: The altered dictionary that contains the settings of the current run.
jTWA.spin1.initState#
- jTWA.spin1.initState.getPolarState(cfg)#
Returns samples of the Wigner distribution representing the polar state, with all atoms in the zero mode, so that
\[|\psi\rangle = |0, \alpha, 0\rangle^{\otimes N_{wells}}.\]Note that it is also possible to set a temperature \(\beta\) that broadens the distribution, accounting for thermal fluctuations.
- Args:
cfg: The dictionary that contains the settings of the current run.
- Returns:
samples: An array of samples of shape (\(N_{samples}\), \(N_{wells}\), \(N_{internal}\)).
jTWA.spin1.observables#
- jTWA.spin1.observables.get_spin_operators(cfg)#
Returns the matrices representing the spin operators of the spin-1 system. The matrices are computed according to the Jordan-Schwinger map. Note that only those matrices that are mentioned in
cfg["simulationParameters"]["obs"]are returned.- Args:
cfg: The dictionary that contains the settings of the current run.
- Returns:
A dictionary containing the operators and their denotations.
- jTWA.spin1.observables.compute_observables(sample, key, spin_operators, norm)#
Compute spin observables as well as occupations in both real space and momentum space.
- Args:
sample: A single sample of shape (\(N_{wells}\), \(N_{internal}\)).key: Ajax.random.PRNGKey, used to add Gaussian noise to the sample.operators: An array of shape (\(N_{obs}\), 3, 3) corresponding to the Jordan-Schwinger matrix representations of the spin-1 operators obtained withget_spin_operators().norm: A normalization factor, usually taken to be \(\sqrt{2 \langle N \rangle}\).
- Returns:
Occupations in each mode of each well for each sample.
- jTWA.spin1.observables.compute_spin_observables(operators, sample, norm)#
Compute the single-well spin observables that are contained in
operators.sampleis an array representing a single sample that is expected to be of shape (\(N_{wells}\), \(N_{internal}\)) andnormis a normalization factor.- Args:
operators: An array of shape (\(N_{obs}\), 3, 3) corresponding to the Jordan-Schwinger matrix representations of the spin-1 operators obtained withget_spin_operators().sample: A single sample of shape (\(N_{wells}\), \(N_{internal}\)) for which the operators are evaluated.norm: A normalization factor, usually taken to be \(\sqrt{2 \langle N \rangle}\).
- Returns:
An array holding the values for each observable in each well.
Note that these are not expectation values, as there is no average over all samples in this routine. Instead, this routine allows to obtain the full distribution of measurement outcomes.
- jTWA.spin1.observables.compute_mode_occupations(sample)#
Compute the mode occupations of a sample.
- Args:
sample: A single sample of shape (\(N_{wells}\), \(N_{internal}\)) for which the mode occupations are computed.
- Returns:
Occupations in each mode of each well for each sample.
- jTWA.spin1.observables.beamsplit(sample, key)#
Returns a sample that is blurred with Gaussian noise. This recreates the effect of a broadened distribution when reading out non-commuting observables simultaneously, as for example in the case of the Husimi Q-distribution.
- Args:
sample: A single sample.key: Ajax.random.PRNGKey.
- Returns:
A dictionary containing the operators and their denotations.