edipole

dqc.edipole(qc: dqc.qccalc.base_qccalc.BaseQCCalc, unit: Optional[str] = 'Debye') → torch.Tensor[source]

Returns the electric dipole moment of the system, i.e. negative derivative of energy w.r.t. electric field. The dipole is pointing from negative to positive charge.

Parameters
  • qc (BaseQCCalc) – The qc calc object that has been executed.

  • unit (str or None) – The returned dipole unit. If None, returns in atomic unit.

Returns

Tensor representing the dipole moment in atomic unit with shape (ndim,)

Return type

torch.Tensor

Example

import torch
import dqc

dtype = torch.float64
moldesc = "O 0 0 0.2156; H 0 1.4749 -0.8625; H 0 -1.4749 -0.8625"  # in Bohr
efield = torch.zeros(3, dtype=dtype).requires_grad_()  # efield must be specified
mol = dqc.Mol(moldesc=moldesc, basis="3-21G", dtype=dtype, efield=(efield,))
qc = dqc.HF(mol).run()
dip_moment = dqc.edipole(qc, unit="debye")