# Dispersion model#

Implementation of D3 model to obtain atomic C6 coefficients for a given geometry.

Examples

```>>> import torch
>>> numbers = mctc.convert.symbol_to_number(["O", "H", "H"])
>>> positions = torch.Tensor([
...     [+0.00000000000000, +0.00000000000000, -0.73578586109551],
...     [+1.44183152868459, +0.00000000000000, +0.36789293054775],
...     [-1.44183152868459, +0.00000000000000, +0.36789293054775],
... ])
>>> ref = d3.reference.Reference()
>>> cn = mctc.ncoord.cn_d3(numbers, positions, rcov=rcov, counting_function=d3.ncoord.exp_count)
>>> weights = d3.model.weight_references(numbers, cn, ref, d3.model.gaussian_weight)
>>> c6 = d3.model.atomic_c6(numbers, weights, ref)
>>> torch.set_printoptions(precision=7)
>>> print(c6)
tensor([[10.4130471,  5.4368822,  5.4368822],
[ 5.4368822,  3.0930154,  3.0930154],
[ 5.4368822,  3.0930154,  3.0930154]], dtype=torch.float64)
```

Calculate atomic dispersion coefficients.

Parameters:
• numbers (Tensor) – The atomic numbers of the atoms in the system of shape (…, nat).

• weights (Tensor) – Weights of all reference systems of shape (…, nat, 7).

• reference (Reference) – Reference systems for D3 model. Contains the reference C6 coefficients of shape (…, nelements, nelements, 7, 7).

Returns:

Atomic dispersion coefficients of shape (…, nat, nat).

Return type:

Tensor

Calculate weight of indivdual reference system.

Parameters:
• dcn (Tensor) – Difference of coordination numbers.

• factor (float) – Factor to calculate weight.

Returns:

Weight of individual reference system.

Return type:

Tensor

tad_dftd3.model.weight_references(numbers, cn, reference, weighting_function=<function gaussian_weight>, **kwargs)[source]#

Calculate the weights of the reference system.

Parameters:
• numbers (Tensor) – The atomic numbers of the atoms in the system.

• cn (Tensor) – Coordination numbers for all atoms in the system.

• reference (Reference) – Reference systems for D3 model.

• weighting_function (Callable) – Function to calculate weight of individual reference systems.

Returns:

Weights of all reference systems

Return type:

Tensor