|
| 1 | +# Configuration Spaces |
| 2 | + |
| 3 | +## What is a Configuration Space? |
| 4 | + |
| 5 | +A **configuration space** is an abstract vector space that represents possible arrangements of distinguishable objects. A configuration space consists of: |
| 6 | + |
| 7 | +1. **A vector space** - n positions in a vector (indexed 0, 1, 2, ..., n-1) |
| 8 | +2. **Object labels** - integers representing different types or species |
| 9 | + |
| 10 | +This abstract framework can represent many different systems: atoms distributed across crystallographic sites, molecular conformations, states at discrete time steps, or any other system where discrete objects can be arranged in different ways. |
| 11 | + |
| 12 | +### A Simple Example |
| 13 | + |
| 14 | +Consider a 3-dimensional vector space. We can represent arrangements of two types of objects (labelled 0 and 1) as vectors like `[1, 1, 0]`. |
| 15 | + |
| 16 | +If we interpret this vector as three sites in a triangle: |
| 17 | + |
| 18 | + |
| 19 | + |
| 20 | +then `[1, 1, 0]` represents: |
| 21 | + |
| 22 | + |
| 23 | + |
| 24 | +where positions 0 and 1 have object type 1 (shown in black), and position 2 has object type 0 (shown in white). |
| 25 | + |
| 26 | +Different arrangements like `[0, 1, 1]` or `[1, 0, 1]` represent different **configurations** within the same **configuration space**. |
| 27 | + |
| 28 | +### Configurations vs Configuration Spaces |
| 29 | + |
| 30 | +- **Configuration Space**: The vector space itself (e.g., "3-dimensional space") |
| 31 | +- **Configuration**: A specific assignment of labels (e.g., `[1, 1, 0]`) |
| 32 | + |
| 33 | +## Mathematical Representation |
| 34 | + |
| 35 | +### Configuration Vectors |
| 36 | + |
| 37 | +Each configuration is represented as a vector of integers. For a configuration space with n positions, a configuration is an n-element vector: |
| 38 | + |
| 39 | +$$\mathbf{v} = \begin{pmatrix}v_0\\v_1\\v_2\\\vdots\\v_{n-1}\end{pmatrix}$$ |
| 40 | + |
| 41 | +where each $v_i$ is a non-negative integer representing the type of object at position $i$. |
| 42 | + |
| 43 | +### Object Labels |
| 44 | + |
| 45 | +Object labels are arbitrary integers. Objects with the same label are considered indistinguishable. For example: |
| 46 | + |
| 47 | +- Binary system: labels `0` and `1` (e.g., vacant/occupied, or species A/species B) |
| 48 | +- Ternary system: labels `0`, `1`, and `2` (e.g., three different atomic species) |
| 49 | +- Multi-species: any number of distinct integer labels |
| 50 | + |
| 51 | +The specific integers used as labels are arbitrary - what matters is which positions have the same or different labels. |
| 52 | + |
| 53 | +### Examples |
| 54 | + |
| 55 | +For a 4-dimensional configuration space: |
| 56 | + |
| 57 | +- `[0, 0, 1, 1]` - positions 0 and 1 have type 0, positions 2 and 3 have type 1 |
| 58 | +- `[0, 1, 0, 1]` - positions 0 and 2 have type 0, positions 1 and 3 have type 1 |
| 59 | +- `[2, 2, 1, 0]` - position 0 has type 2, position 1 has type 2, position 2 has type 1, position 3 has type 0 |
| 60 | +- `[1, 1, 1, 1]` - all positions have type 1 |
| 61 | + |
| 62 | +Each vector represents a distinct configuration. Whether two configurations like `[0, 0, 1, 1]` and `[0, 1, 0, 1]` are equivalent depends on the symmetry operations defined for the configuration space (discussed in the next section). |
| 63 | + |
| 64 | +## The Configuration and ConfigurationSpace Classes |
| 65 | + |
| 66 | +### The Configuration Class |
| 67 | + |
| 68 | +In bsym, individual configurations are represented by `Configuration` objects. A `Configuration` stores: |
| 69 | + |
| 70 | +- **A vector**: The integer array representing the configuration |
| 71 | +- **Metadata**: Optional attributes like degeneracy counts |
| 72 | + |
| 73 | +Creating a configuration: |
| 74 | +```python |
| 75 | +from bsym import Configuration |
| 76 | + |
| 77 | +config = Configuration([1, 1, 0, 0]) |
| 78 | +``` |
| 79 | + |
| 80 | +### Numeric Representation |
| 81 | + |
| 82 | +Each configuration has a numeric representation accessed via the `as_number` property. This provides a unique integer identifier for the configuration: |
| 83 | +```python |
| 84 | +config = Configuration([1, 2, 0]) |
| 85 | +print(config.as_number) # Output: 120 |
| 86 | +``` |
| 87 | + |
| 88 | +This numeric representation is primarily used internally for efficient comparison and hashing of configurations during symmetry analysis. |
| 89 | + |
| 90 | +### The ConfigurationSpace Class |
| 91 | + |
| 92 | +A `ConfigurationSpace` object combines: |
| 93 | + |
| 94 | +- **Objects**: A list defining the dimensionality of the space |
| 95 | +- **Symmetry group**: Optional symmetry operations (defaults to identity only) |
| 96 | + |
| 97 | +The objects list defines the vector space dimension: |
| 98 | +```python |
| 99 | +from bsym import ConfigurationSpace |
| 100 | + |
| 101 | +# Create a 4-dimensional configuration space |
| 102 | +config_space = ConfigurationSpace(objects=[1, 2, 3, 4]) |
| 103 | +``` |
| 104 | + |
| 105 | +The integers in the objects list serve as labels for the vector positions - they don't represent the configuration itself. They're often just sequential integers `[1, 2, 3, ..., n]`, but can be any distinct values. |
| 106 | + |
| 107 | +### Configuration Space Without Symmetry |
| 108 | + |
| 109 | +A `ConfigurationSpace` can be created without specifying symmetry operations. In this case, it contains only the identity operation, meaning no configurations are considered equivalent: |
| 110 | +```python |
| 111 | +config_space = ConfigurationSpace(objects=[1, 2, 3]) |
| 112 | +# Implicitly has only the identity symmetry operation |
| 113 | +``` |
| 114 | + |
| 115 | +This is useful when you want to use the configuration space framework but don't need to identify symmetry-equivalent configurations. |
| 116 | + |
| 117 | +## Why Use Abstract Representation? |
| 118 | + |
| 119 | +### Separation of Concerns |
| 120 | + |
| 121 | +The abstract vector representation separates the mathematical logic of symmetry analysis from the physical details of specific systems. This means: |
| 122 | + |
| 123 | +- **Symmetry algorithms** work at the vector level, independent of coordinates or structures |
| 124 | +- **Physical interpretation** is added as a separate layer when needed |
| 125 | +- **The same code** handles crystals, molecules, or any other symmetric system |
| 126 | + |
| 127 | +### Computational Efficiency |
| 128 | + |
| 129 | +Working with integer vectors is computationally efficient: |
| 130 | + |
| 131 | +- Integer comparisons are fast |
| 132 | +- Vectors can be hashed and stored in sets/dictionaries |
| 133 | +- No floating-point arithmetic or coordinate transformations needed during enumeration |
| 134 | +- **Symmetry operations are simple permutations** of integer indices - just rearranging vector elements rather than matrix-vector multiplication with floating-point coordinates |
| 135 | + |
| 136 | +### Generality |
| 137 | + |
| 138 | +The abstract approach makes bsym applicable to any problem involving symmetric arrangements of discrete objects. You're not limited to crystallographic applications - the same framework handles: |
| 139 | + |
| 140 | +- Disorder in crystal structures |
| 141 | +- Molecular conformations |
| 142 | +- Combinatorial problems with symmetry constraints |
| 143 | +- Abstract group theory problems |
| 144 | + |
| 145 | +### From Abstract to Physical |
| 146 | + |
| 147 | +When working with real systems, the workflow is: |
| 148 | + |
| 149 | +1. **Define the abstract configuration space** - vector dimension and symmetry operations |
| 150 | +2. **Enumerate configurations** - find unique arrangements using vector-based algorithms |
| 151 | +3. **Map to physical structures** - interpret abstract configurations as coordinates, structures, etc. |
| 152 | + |
| 153 | +This separation allows the expensive symmetry analysis to happen at the abstract level, then efficiently generate corresponding physical structures only for the unique configurations. |
| 154 | + |
| 155 | +## Connecting to Real Structures |
| 156 | + |
| 157 | +### The CoordinateConfigSpace Class |
| 158 | + |
| 159 | +For systems where vector positions correspond to physical coordinates, bsym provides `CoordinateConfigSpace`, which extends `ConfigurationSpace` with coordinate information: |
| 160 | +```python |
| 161 | +from bsym import CoordinateConfigSpace |
| 162 | +import numpy as np |
| 163 | + |
| 164 | +# Define coordinates for each position |
| 165 | +coordinates = np.array([[0.0, 0.0], [1.0, 0.0], [0.0, 1.0], [1.0, 1.0]]) |
| 166 | + |
| 167 | +# Create configuration space with coordinates |
| 168 | +coord_space = CoordinateConfigSpace(coordinates, symmetry_group=my_symmetry_group) |
| 169 | +``` |
| 170 | + |
| 171 | +The `CoordinateConfigSpace` maintains the abstract vector representation internally while also storing the associated coordinates. This allows symmetry analysis to happen at the abstract level, with results mapped back to coordinates when needed. |
| 172 | + |
| 173 | +### The Pymatgen Interface |
| 174 | + |
| 175 | +For crystallographic applications, bsym provides an interface to work with pymatgen `Structure` objects. This handles: |
| 176 | + |
| 177 | +- Extracting symmetry operations from crystal structures |
| 178 | +- Converting between abstract configurations and atomic structures |
| 179 | +- Generating symmetry-inequivalent crystal structures from substitution patterns |
| 180 | + |
| 181 | +The pymatgen interface is covered in detail in the [User Guide](../user_guide/index.rst). The key point is that it operates as a wrapper around the abstract `ConfigurationSpace` machinery - symmetry analysis happens at the vector level, then results are converted to `Structure` objects. |
0 commit comments