def __getitem__(self, block): if block not in self.blocks: raise KeyError(f"Invalid block {block} requested. " f"Available blocks are: {self.blocks}.") if block not in self._tensors: sym = libadcc.make_symmetry_operator(self.mospaces, block, self.is_symmetric, "1") self._tensors[block] = Tensor(sym) return self._tensors[block]
def density(self): """ Return the Hartree-Fock density in the MO basis """ density = OneParticleOperator(self.mospaces, is_symmetric=True) for b in density.blocks: sym = libadcc.make_symmetry_operator(self.mospaces, b, True, "1") density.set_block(b, Tensor(sym)) for ss in self.mospaces.subspaces_occupied: density[ss + ss].set_mask("ii", 1) density.reference_state = self return density