Electron-boson coupling matrix containers.

ebcc.ham.elbos.RElectronBoson(cc, array=None, space=None)

Bases: BaseElectronBoson, BaseRHamiltonian

Restricted electron-boson coupling matrices.

Initialise the electron-boson coupling matrix.

Parameters:
  • cc (BaseEBCC) –

    Coupled cluster object.

  • array (Optional[Any], default: None ) –

    Electron-boson coupling matrix in the MO basis.

  • space (Optional[tuple[Any, ...]], default: None ) –

    Space object for each index.

Source code in ebcc/ham/base.py
def __init__(
    self,
    cc: BaseEBCC,
    array: Optional[Any] = None,
    space: Optional[tuple[Any, ...]] = None,
) -> None:
    """Initialise the electron-boson coupling matrix.

    Args:
        cc: Coupled cluster object.
        array: Electron-boson coupling matrix in the MO basis.
        space: Space object for each index.
    """
    Namespace.__init__(self)

    # Parameters:
    self.__dict__["cc"] = cc
    self.__dict__["space"] = space if space is not None else (cc.space,) * 2
    self.__dict__["array"] = array if array is not None else self._get_g()

ebcc.ham.elbos.RElectronBoson.__getitem__(key)

Just-in-time getter.

Parameters:
  • key (str) –

    Key to get.

Returns:
  • NDArray[T]

    Electron-boson coupling matrix for the given spaces.

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"
        i = self.space[0].mask(key[1])
        j = self.space[1].mask(key[2])
        self._members[key] = self.array[:, i][:, :, j].copy()
    return self._members[key]

ebcc.ham.elbos.UElectronBoson(cc, array=None, space=None)

Bases: BaseElectronBoson, BaseUHamiltonian

Unrestricted electron-boson coupling matrices.

Initialise the electron-boson coupling matrix.

Parameters:
  • cc (BaseEBCC) –

    Coupled cluster object.

  • array (Optional[Any], default: None ) –

    Electron-boson coupling matrix in the MO basis.

  • space (Optional[tuple[Any, ...]], default: None ) –

    Space object for each index.

Source code in ebcc/ham/base.py
def __init__(
    self,
    cc: BaseEBCC,
    array: Optional[Any] = None,
    space: Optional[tuple[Any, ...]] = None,
) -> None:
    """Initialise the electron-boson coupling matrix.

    Args:
        cc: Coupled cluster object.
        array: Electron-boson coupling matrix in the MO basis.
        space: Space object for each index.
    """
    Namespace.__init__(self)

    # Parameters:
    self.__dict__["cc"] = cc
    self.__dict__["space"] = space if space is not None else (cc.space,) * 2
    self.__dict__["array"] = array if array is not None else self._get_g()

ebcc.ham.elbos.UElectronBoson.__getitem__(key)

Just-in-time getter.

Parameters:
  • key (str) –

    Key to get.

Returns:
  • RElectronBoson

    Electron-boson coupling matrix for the given spin.

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.cc,
            array=self.array[i] if self.array.ndim == 4 else self.array,
            space=(self.space[0][i], self.space[1][i]),
        )
    return self._members[key]

ebcc.ham.elbos.GElectronBoson(cc, array=None, space=None)

Bases: BaseElectronBoson, BaseGHamiltonian

Generalised electron-boson coupling matrices.

Initialise the electron-boson coupling matrix.

Parameters:
  • cc (BaseEBCC) –

    Coupled cluster object.

  • array (Optional[Any], default: None ) –

    Electron-boson coupling matrix in the MO basis.

  • space (Optional[tuple[Any, ...]], default: None ) –

    Space object for each index.

Source code in ebcc/ham/base.py
def __init__(
    self,
    cc: BaseEBCC,
    array: Optional[Any] = None,
    space: Optional[tuple[Any, ...]] = None,
) -> None:
    """Initialise the electron-boson coupling matrix.

    Args:
        cc: Coupled cluster object.
        array: Electron-boson coupling matrix in the MO basis.
        space: Space object for each index.
    """
    Namespace.__init__(self)

    # Parameters:
    self.__dict__["cc"] = cc
    self.__dict__["space"] = space if space is not None else (cc.space,) * 2
    self.__dict__["array"] = array if array is not None else self._get_g()

ebcc.ham.elbos.GElectronBoson.__getitem__(key)

Just-in-time getter.

Parameters:
  • key (str) –

    Key to get.

Returns:
  • NDArray[T]

    Electron-boson coupling matrix for the given spaces.

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"
        i = self.space[0].mask(key[1])
        j = self.space[1].mask(key[2])
        self._members[key] = self.array[:, i][:, :, j].copy()
    return self._members[key]