nvalchemi.csp.sample_space_groups#
- nvalchemi.csp.sample_space_groups(num_samples, num_operations, *, probabilities=None, crystal_system=None, sohncke_only=False, seed=None, device=None)[source]#
Sample compatible International space-group numbers with replacement.
A supplied
probabilitiesmapping replaces the default relative sampling weights. Missing group entries have zero weight. After removing incompatible groups, the remaining weights determine relative sampling probabilities.- Parameters:
num_samples (int) – Number of samples to draw; must be positive.
num_operations (int) – Required number of symmetry operations.
probabilities (Mapping[int, float], optional) – Replacement relative weights keyed by group number; values must be finite and nonnegative.
crystal_system (CrystalSystem, optional) – Restrict the compatible groups to one crystal system.
sohncke_only (bool, default=False) – Use only groups whose symmetry-generated copies preserve molecular handedness, such as for chiral molecules.
seed (int, optional) – Nonnegative seed for a local CPU
torch.Generator.device (torch.device or str, optional) – Device for the returned int32 tensor.
- Returns:
space_groups – Sampled International numbers.
- Return type:
torch.Tensor, shape
[num_samples], dtype=torch.int32- Raises:
TypeError – If the prior, filters, or integer arguments have invalid types.
ValueError – If no compatible group has positive weight or
seedis negative.
Examples
>>> groups = sample_space_groups(4, 1, seed=7) >>> groups.dtype torch.int32