Coordination number: Common helpers#

Generic building blocks that mirror the container-based design of mctc-lib.

tad_mctc.ncoord.common.coordination_number(numbers, positions, *, counting_function, rcov=None, cutoff=None, cn_max=None, pair_weight=None, **kwargs)[source]#

Generic coordination number evaluator.

Parameters:
  • numbers (Tensor) – Atomic numbers for all atoms in the system (shape: (..., nat)).

  • positions (Tensor) – Cartesian coordinates (shape: (..., nat, 3)).

  • counting_function (CountingFunction) – Pair counting function (exp, erf, dexp, …).

  • rcov (Tensor | None, optional) – Covalent radii for each species.

  • cutoff (Tensor | float | int) – Real-space cutoff.

  • cn_max (Tensor | float | int | None, optional) – Optional upper bound for the coordination number.

  • pair_weight (Tensor | None, optional) – Optional per-pair weighting factor applied to the counting function.

  • kwargs (dict[str, Any]) – Additional keyword arguments forwarded to the counting function.

Returns:

Coordination numbers for all atoms (shape: (..., nat)).

Return type:

Tensor

tad_mctc.ncoord.common.cut_coordination_number(cn, cn_max=8.0)[source]#

Apply the smooth logarithmic cutoff used throughout mctc projects.

Parameters:
  • cn (Tensor) – Coordination numbers.

  • cn_max (Tensor | float | int, optional) – Maximum coordination number. Large values disable the cutoff.

Returns:

Cut coordination numbers.

Return type:

Tensor