Electron-boson coupling matrix containers.
ebcc.ham.elbos.RElectronBoson(mf, g, space, mo_coeff=None)
Bases: BaseElectronBoson
, BaseRHamiltonian
Restricted electron-boson coupling matrices.
Initialise the Hamiltonian.
Parameters: |
|
---|
Source code in ebcc/ham/base.py
def __init__(
self,
mf: SCF,
g: NDArray[float64],
space: tuple[SpaceType, ...],
mo_coeff: Optional[tuple[CoeffType, ...]] = None,
) -> None:
"""Initialise the Hamiltonian.
Args:
mf: Mean-field object.
g: The electron-boson coupling matrix array.
space: Space object for each index.
mo_coeff: Molecular orbital coefficients for each index.
"""
super().__init__(mf, space, mo_coeff=mo_coeff)
# Boson parameters:
self.__dict__["g"] = g
ebcc.ham.elbos.RElectronBoson.__getitem__(key)
Just-in-time getter.
Parameters: |
|
---|
Returns: |
|
---|
Source code in ebcc/ham/elbos.py
def __getitem__(self, key: str) -> NDArray[T]:
"""Just-in-time getter.
Args:
key: Key to get.
Returns:
Electron-boson coupling matrix for the given spaces.
"""
if key not in self._members:
assert key[0] == "b"
if "p" in key:
raise NotImplementedError(f"AO basis not supported in {self.__class__.__name__}.")
# Get the slices
slices = (slice(None),) + self._get_slices(key[1:])
# Store the block
self._members[key] = np.copy(self.g[slices])
return self._members[key]
ebcc.ham.elbos.UElectronBoson(mf, g, space, mo_coeff=None)
Bases: BaseElectronBoson
, BaseUHamiltonian
Unrestricted electron-boson coupling matrices.
Initialise the Hamiltonian.
Parameters: |
|
---|
Source code in ebcc/ham/base.py
def __init__(
self,
mf: SCF,
g: NDArray[float64],
space: tuple[SpaceType, ...],
mo_coeff: Optional[tuple[CoeffType, ...]] = None,
) -> None:
"""Initialise the Hamiltonian.
Args:
mf: Mean-field object.
g: The electron-boson coupling matrix array.
space: Space object for each index.
mo_coeff: Molecular orbital coefficients for each index.
"""
super().__init__(mf, space, mo_coeff=mo_coeff)
# Boson parameters:
self.__dict__["g"] = g
ebcc.ham.elbos.UElectronBoson.__getitem__(key)
Just-in-time getter.
Parameters: |
|
---|
Returns: |
|
---|
Source code in ebcc/ham/elbos.py
def __getitem__(self, key: str) -> RElectronBoson:
"""Just-in-time getter.
Args:
key: Key to get.
Returns:
Electron-boson coupling matrix for the given spin.
"""
if key not in ("aa", "bb"):
raise KeyError(f"Invalid key: {key}")
if key not in self._members:
i = "ab".index(key[0])
self._members[key] = RElectronBoson(
self.mf,
self.g[i] if self.g.ndim == 4 else self.g,
space=(self.space[0][i], self.space[1][i]),
)
self._members[key]._spin_index = i
return self._members[key]
ebcc.ham.elbos.GElectronBoson(mf, g, space, mo_coeff=None)
Bases: BaseElectronBoson
, BaseGHamiltonian
Generalised electron-boson coupling matrices.
Initialise the Hamiltonian.
Parameters: |
|
---|
Source code in ebcc/ham/base.py
def __init__(
self,
mf: SCF,
g: NDArray[float64],
space: tuple[SpaceType, ...],
mo_coeff: Optional[tuple[CoeffType, ...]] = None,
) -> None:
"""Initialise the Hamiltonian.
Args:
mf: Mean-field object.
g: The electron-boson coupling matrix array.
space: Space object for each index.
mo_coeff: Molecular orbital coefficients for each index.
"""
super().__init__(mf, space, mo_coeff=mo_coeff)
# Boson parameters:
self.__dict__["g"] = g
ebcc.ham.elbos.GElectronBoson.__getitem__(key)
Just-in-time getter.
Parameters: |
|
---|
Returns: |
|
---|
Source code in ebcc/ham/elbos.py
def __getitem__(self, key: str) -> NDArray[T]:
"""Just-in-time getter.
Args:
key: Key to get.
Returns:
Electron-boson coupling matrix for the given spaces.
"""
if key not in self._members:
assert key[0] == "b"
if "p" in key:
raise NotImplementedError(f"AO basis not supported in {self.__class__.__name__}.")
# Get the slices
slices = (slice(None),) + self._get_slices(key[1:])
# Store the block
self._members[key] = np.copy(self.g[slices])
return self._members[key]