class_docstr: Orthogonal orbital parameterization using matrix exponential.
  The orthogonal orbital is represented by:
  
      P = matrix_exp(Q) @ C
  
  where C is an orthogonal coefficient tensor, and Q is the parameters defining
  the rotation of the orthogonal tensor.
  
  Examples
  --------
  >>> from deepchem.utils.dft_utils import MatExpOrbParams
  >>> params = torch.randn(3, 3)
  >>> coeffs = torch.randn(4, 3)
  >>> with_penalty = 0.1
  >>> orb, penalty = MatExpOrbParams.params2orb(params, coeffs, with_penalty)
  >>> params2, coeffs2 = MatExpOrbParams.orb2params(orb)
docstr: Convert the parameters & coefficients to the orthogonal orbitals.
  ``params`` is the tensor to be optimized in variational method, while
  ``coeffs`` is a tensor that is needed to get the orbital, but it is not
  optimized in the variational method.
  
  Parameters
  ----------
  params: torch.Tensor
      The free parameters to be optimized. (*, nparams)
  coeffs: torch.Tensor
      The coefficients to get the orthogonal orbitals. (*, nao, norb)
  with_penalty: float (default 0.0)
      If not 0.0, return the penalty term for the free parameters.
  
  Returns
  -------
  orb: torch.Tensor
      The orthogonal orbitals.
  penalty: torch.Tensor
      The penalty term for the free parameters. If ``with_penalty`` is 0.0,
      this is not returned.
docstr_tok: ["Convert","the","parameters","&","coefficients","to","the","orthogonal","orbitals",".","``","params","``","is","the","tensor","to","be","optimized","in","variational","method",",","while","``","coeffs","``","is","a","tensor","that","is","needed","to","get","the","orbital",",","but","it","is","not","optimized","in","the","variational","method",".","Parameters","--","--","--","--","--","params",":","torch.Tensor","The","free","parameters","to","be","optimized",".","(","*",",","nparams",")","coeffs",":","torch.Tensor","The","coefficients","to","get","the","orthogonal","orbitals",".","(","*",",","nao",",","norb",")","with_penalty",":","float","(","default","0.0",")","If","not","0.0",",","return","the","penalty","term","for","the","free","parameters",".","Returns","--","--","--","-","orb",":","torch.Tensor","The","orthogonal","orbitals",".","penalty",":","torch.Tensor","The","penalty","term","for","the","free","parameters",".","If","``","with_penalty","``","is","0.0",",","this","is","not","returned","."]
code: def params2orb(
      params: torch.Tensor,
      coeffs: torch.Tensor,
      with_penalty: float = 0.0,
  ) -> List[torch.Tensor]:
      """
      Convert the parameters & coefficients to the orthogonal orbitals.
      ``params`` is the tensor to be optimized in variational method, while
      ``coeffs`` is a tensor that is needed to get the orbital, but it is not
      optimized in the variational method.
  
      Parameters
      ----------
      params: torch.Tensor
          The free parameters to be optimized. (*, nparams)
      coeffs: torch.Tensor
          The coefficients to get the orthogonal orbitals. (*, nao, norb)
      with_penalty: float (default 0.0)
          If not 0.0, return the penalty term for the free parameters.
  
      Returns
      -------
      orb: torch.Tensor
          The orthogonal orbitals.
      penalty: torch.Tensor
          The penalty term for the free parameters. If ``with_penalty`` is 0.0,
          this is not returned.
  
      """
      nao = coeffs.shape[-2]
      norb = coeffs.shape[-1]  # noqa: F841
      nparams = params.shape[-1]
      bshape = params.shape[:-1]
  
      # construct the rotation parameters
      triu_idxs = torch.triu_indices(nao, nao, offset=1)[..., :nparams]
      rotmat = torch.zeros(
          (*bshape, nao, nao), dtype=params.dtype, device=params.device
      )
      rotmat[..., triu_idxs[0], triu_idxs[1]] = params
      rotmat = rotmat - rotmat.transpose(-2, -1).conj()
  
      # calculate the orthogonal orbital
      ortho_orb = torch.matrix_exp(rotmat) @ coeffs
  
      if with_penalty != 0.0:
          penalty = torch.zeros(
              (1,), dtype=params.dtype, device=params.device
          )
          return [ortho_orb, penalty]
      else:
          return [ortho_orb]
  
file_path: deepchem/deepchem/utils/dft_utils/hamilton/orbparams.py
imports: from typing import List
  import torch
label_desc: Use image node_id 1 for calling the MatExpOrbParams obj's underlying member method code with example usage: obj.params2orb(params, coeffs, with_penalty) and returns: list, list