kups.application.utils.particles
¶
Shared particle data structures and ASE loading utilities.
Particles
¶
Particle state shared across simulation types.
Attributes:
| Name | Type | Description |
|---|---|---|
positions |
Array
|
Cartesian coordinates in the lower-triangular frame, shape (n_atoms, 3). |
masses |
Array
|
Atomic masses (amu), shape (n_atoms,). |
atomic_numbers |
Array
|
Atomic numbers, shape (n_atoms,). |
charges |
Array
|
Partial charges, shape (n_atoms,). |
labels |
Index[Label]
|
Per-atom string labels. |
system |
Index[SystemId]
|
Index mapping each particle to a system. |
Source code in src/kups/application/utils/particles.py
inclusion
property
¶
System index re-labeled as InclusionId.
default_exclusion(n)
¶
Build a default per-particle exclusion index (each atom excludes itself).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
n
|
int
|
Number of particles. |
required |
Returns:
| Type | Description |
|---|---|
Index[ExclusionId]
|
Index mapping each particle to a unique ExclusionId. |
Source code in src/kups/application/utils/particles.py
particles_from_arrays(*, positions, cell_vectors, periodicity, masses, atomic_numbers, labels, charges=None)
¶
Build particle data and cell from source-neutral arrays.
Numeric inputs follow the active JAX dtype configuration; exact dtype preservation is not guaranteed.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
positions
|
ArrayLike
|
Cartesian positions in Å, shape |
required |
cell_vectors
|
ArrayLike
|
Three cell vectors in Å stored row-wise, shape |
required |
periodicity
|
Sequence[bool | bool_ | Array] | ndarray[Any, dtype[bool_]] | Array
|
Three boolean values selecting periodic axes. |
required |
masses
|
ArrayLike
|
Particle masses in amu, shape |
required |
atomic_numbers
|
ArrayLike
|
Integer atomic numbers, shape |
required |
labels
|
Sequence[str]
|
Non-string sequence of string labels, one per particle. |
required |
charges
|
ArrayLike | None
|
Partial charges in elementary-charge units, shape |
None
|
Returns:
| Type | Description |
|---|---|
Table[ParticleId, Particles]
|
Tuple of |
Cell[AnyPeriodicity]
|
rotates Cartesian coordinates into the lower-triangular cell frame. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If an input shape or particle/label count is invalid. |
TypeError
|
If conversion fails or an input has an invalid type or dtype. |
Source code in src/kups/application/utils/particles.py
64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 | |
particles_from_ase(atoms)
¶
Build particle data and cell from an ASE Atoms object or file path.
Results are cached when atoms is a file path.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
atoms
|
Atoms | str | Path
|
ASE Atoms object, or a file path (str/Path) readable by
|
required |
Returns:
| Type | Description |
|---|---|
Table[ParticleId, Particles]
|
Tuple of (particles, cell, uc_transform) where uc_transform |
Cell[AnyPeriodicity]
|
rotates Cartesian positions into the lower-triangular frame. |