class_docstr: Interface to DQC's KS calculation.
  
  Parameters
  ----------
  qc: BaseQCCalc
      object often acts as a wrapper around an engine class (from dqc.qccalc) that contains information about the self-consistent iterations.
  
  References
  ----------
  Kasim, Muhammad F., and Sam M. Vinko. "Learning the exchange-correlation functional from nature with fully differentiable density functional theory." Physical Review Letters 127.12 (2021): 126403.
  https://github.com/diffqc/dqc/blob/master/dqc/qccalc/ks.py
class_docstr_tok: ["Interface","to","DQC","'s","KS","calculation",".","Parameters","--","--","--","--","--","qc",":","BaseQCCalc","object","often","acts","as","a","wrapper","around","an","engine","class","(","from","dqc.qccalc",")","that","contains","information","about","the","self-consistent","iterations",".","References","--","--","--","--","--","Kasim",",","Muhammad","F.",",","and","Sam","M.","Vinko",".","``","Learning","the","exchange-correlation","functional","from","nature","with","fully","differentiable","density","functional","theory",".","''","Physical","Review","Letters","127.12","(","2021",")",":","126403.","https",":","\/\/github.com\/diffqc\/dqc\/blob\/master\/dqc\/qccalc\/ks.py"]
docstr: The force on an atom is calculated as the gradient of energy with respect to the atomic position.
  
  Returns
  -------
  The force for each atom.
docstr_tok: ["The","force","on","an","atom","is","calculated","as","the","gradient","of","energy","with","respect","to","the","atomic","position",".","Returns","--","--","--","-","The","force","for","each","atom","."]
code: def force(self) -> torch.Tensor:
      """
      The force on an atom is calculated as the gradient of energy with respect to the atomic position.
  
      Returns
      -------
      The force for each atom.
      """
      ene = self.energy()
      atompos = self.qc.get_system().atompos
      is_grad_enabled = torch.is_grad_enabled()
      (f,) = torch.autograd.grad(
          ene, atompos, create_graph=is_grad_enabled, retain_graph=True
      )
      return f
  
imports: import hashlib
  import xitorch
  from dataclasses import dataclass
  from abc import abstractmethod, abstractproperty
  from typing import Union, List, TypeVar, Generic, Callable
label_desc: Use image node_id 5 for calling the KSCalc obj's underlying member method code with example usage: obj.force() and returns: f