CustomXC

class dqc.xc.CustomXC[source]

Base class of custom xc functional.

abstract property family

Returns 1 for LDA, 2 for GGA, and 3 for Meta-GGA.

abstract get_edensityxc(densinfo: Union[dqc.utils.datastruct.ValGrad, dqc.utils.datastruct.SpinParam[dqc.utils.datastruct.ValGrad]]) → torch.Tensor[source]

Returns the xc energy density (energy per unit volume)

getparamnames(methodname: str = '', prefix: str = '') → List[str][source]

This method should list tensor names that affect the output of the method with name indicated in methodname. If the methodname is not on the list in this function, it should raise KeyError.

Parameters
  • methodname (str) – The name of the method of the class.

  • prefix (str) – The prefix to be appended in front of the parameters name. This usually contains the dots.

Returns

Sequence of name of parameters affecting the output of the method.

Return type

Sequence of string

Raises

KeyError – If the list in this function does not contain methodname.

Example

>>> class A(xitorch.EditableModule):
...     def __init__(self, a):
...         self.b = a*a
...
...     def mult(self, x):
...         return self.b * x
...
...     def getparamnames(self, methodname, prefix=""):
...         if methodname == "mult":
...             return [prefix+"b"]
...         else:
...             raise KeyError()