Skip to content

Commit b563321

Browse files
WIP start adding exp for operator_ from squared_qn
1 parent a8f53e7 commit b563321

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

src/rydstate/rydberg_state/rydberg_base.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,13 @@ def calc_exp_qn(self, qn: str) -> float:
288288
if qn.startswith("raw_value_"):
289289
return self.calc_matrix_element(self, qn, q=0, unit="a.u.") # type: ignore [call-overload,no-any-return]
290290

291+
if qn.startswith("operator_"):
292+
qn_name = qn[len("operator_") :]
293+
exp_q2 = self.calc_matrix_element(self, "squared_" + qn_name, q=0, unit="a.u.") # type: ignore [call-overload]
294+
# exp_q2 returns the reduced matrix element of the operator \hat{S}^2
295+
# (which for the concrete (non reduced) matrix element gives -> S(S+1))
296+
return -0.5 + math.sqrt(1 / 4 + exp_q2)
297+
291298
if is_angular_momentum_quantum_number(qn):
292299
if qn not in self.rydberg_kets[0].angular.quantum_number_names:
293300
coupling_scheme = get_coupling_scheme_for_quantum_number(qn, [self.coupling_scheme])
@@ -311,6 +318,9 @@ def calc_std_qn(self, qn: str) -> float:
311318
return 0
312319
return math.sqrt(exp_q2 - exp_q**2)
313320

321+
if qn.startswith("operator_"):
322+
raise NotImplementedError("Standard deviation for operator quantum numbers is not implemented.")
323+
314324
if is_angular_momentum_quantum_number(qn):
315325
if qn not in self.rydberg_kets[0].angular.quantum_number_names:
316326
coupling_scheme = get_coupling_scheme_for_quantum_number(qn, [self.coupling_scheme])

0 commit comments

Comments
 (0)