Sol

class dqc.Sol(soldesc: Union[str, Tuple[Union[List[str], List[Union[int, float, torch.Tensor]], torch.Tensor], Union[List[List[float]], numpy.ndarray, torch.Tensor]]], alattice: torch.Tensor, basis: Union[str, List[dqc.utils.datastruct.CGTOBasis], List[str], List[List[dqc.utils.datastruct.CGTOBasis]]], *, grid: Union[int, str] = 'sg3', spin: Optional[Union[int, float, torch.Tensor]] = None, lattsum_opt: Optional[Union[dqc.hamilton.intor.pbcintor.PBCIntOption, Dict]] = None, dtype: torch.dtype = torch.float64, device: torch.device = device(type='cpu'))[source]

Describe the system of a solid (i.e. periodic boundary condition system).

Parameters
  • soldesc (*) – Description of the molecule system. If string, it can be described like "H 1 0 0; H -1 0 0". If tuple, the first element of the tuple is the Z number of the atoms while the second element is the position of the atoms: (atomzs, atomposs).

  • basis (*) – The string describing the gto basis. If it is a list, then it must have the same length as the number of atoms.

  • grid (*) – Describe the grid. If it is an integer, then it uses the default grid with specified level of accuracy.

  • spin (*) – The difference between spin-up and spin-down electrons. It must be an integer or None. If None, then it is num_electrons % 2. For floating point atomzs and/or charge, the spin must be specified.

  • charge (*) – The charge of the molecule.

  • orb_weights (*) – Specifiying the orbital occupancy (or weights) directly. If specified, spin and charge arguments are ignored.

  • dtype (*) – The data type of tensors in this class.

  • device (*) – The device on which the tensors in this class are stored.

densityfit(method: Optional[str] = None, auxbasis: Optional[Union[str, List[dqc.utils.datastruct.CGTOBasis], List[str], List[List[dqc.utils.datastruct.CGTOBasis]], Dict[Union[str, int], Union[List[dqc.utils.datastruct.CGTOBasis], str]]]] = None) → dqc.system.base_system.BaseSystem[source]

Indicate that the system’s Hamiltonian uses density fit for its integral.

Parameters
  • method (Optional[str]) –

    Density fitting method. Available methods in this class are:

  • auxbasis (Optional[BasisInpType]) – Auxiliary basis for the density fit. If not specified, then it uses "cc-pvtz-jkfit".

get_hamiltonian() → dqc.hamilton.base_hamilton.BaseHamilton[source]

Returns the Hamiltonian that corresponds to the system, i.e. HamiltonCGTO_PBC

set_cache(fname: str, paramnames: Optional[List[str]] = None) → dqc.system.base_system.BaseSystem[source]

Setup the cache of some parameters specified by paramnames to be read/written on a file. If the file exists, then the parameters will not be recomputed, but just loaded from the cache instead. Cache is usually used for repeated calculations where the cached parameters are not changed (e.g. running multiple systems with slightly different environment.)

Parameters
  • fname (str) – The file to store the cache.

  • paramnames (list of str or None) – List of parameter names to be read/write from the cache.

get_orbweight(polarized: bool = False) → Union[torch.Tensor, dqc.utils.datastruct.SpinParam[torch.Tensor]][source]

Returns the atomic orbital weights. If polarized == False, then it returns the total orbital weights. Otherwise, it returns a tuple of orbital weights for spin-up and spin-down.

get_nuclei_energy() → torch.Tensor[source]

Returns the nuclei-nuclei repulsion energy.

setup_grid() → None[source]

Construct the integration grid for the system

get_grid() → dqc.grid.base_grid.BaseGrid[source]

Returns the grid of the system

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()
property atompos

Returns the atom positions as a tensor with shape (natoms, ndim)

property atomzs

Returns the tensor containing the atomic number with shape (natoms,)

property atommasses

Returns the tensor containing atomic mass with shape (natoms) in atomic unit

property spin

Returns the total spin of the system.

property charge

Returns the charge of the system.

property numel

Returns the total number of the electrons in the system.

property efield

Returns the external electric field of the system, or None if there is no electric field.