class_docstr: Orthogonal orbital parameterization using QR decomposition.
  The orthogonal orbital is represented by:
  
  P = QR
  
  Where Q is the parameters defining the rotation of the orthogonal tensor,
  and R is the coefficients tensor.
  
  Examples
  --------
  >>> import torch
  >>> from deepchem.models.dft import QROrbParams
  >>> params = torch.randn(3, 3)
  >>> coeffs = torch.randn(4, 3)
  >>> with_penalty = 0.1
  >>> orb, penalty = QROrbParams.params2orb(params, coeffs, with_penalty)
  >>> params2, coeffs2 = QROrbParams.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.
  coeffs: torch.Tensor
      The coefficients to get the orthogonal orbitals.
  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",".","coeffs",":","torch.Tensor","The","coefficients","to","get","the","orthogonal","orbitals",".","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.
      coeffs: torch.Tensor
          The coefficients to get the orthogonal orbitals.
      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.
  
      """
      orb, _ = torch.linalg.qr(params)
      if with_penalty == 0.0:
          return [orb]
      else:
          # QR decomposition's solution is not unique in a way that every column
          # can be multiplied by -1 and it still a solution
          # So, to remove the non-uniqueness, we will make the sign of the sum
          # positive.
          s1 = torch.sign(
              orb.sum(dim=-2, keepdim=True)
          )  # (*BD, 1, norb)
          s2 = torch.sign(params.sum(dim=-2, keepdim=True))
          penalty = (
              torch.mean((orb * s1 - params * s2) ** 2) * with_penalty
          )
          return [orb, penalty]
  
file_path: deepchem/deepchem/models/dft/hamilton/orbparams.py
imports: from typing import List
  import torch
label_desc: Use image node_id 1 for calling the QROrbParams obj's underlying member method code with example usage: obj.params2orb(params, coeffs, with_penalty) and returns: list, list