Rings
The rings class contains functions for calculating ring statistics on an Atoms objects. The implementation of rings is an adapted version of the code for calculating rings from https://github.com/MotokiShiga/sova-cui making the code compatible with the vitrum package.
Currently supported ring types are: - Guttman
Included functions for ring objects: - Center - Size
Ring
Bases: object
A class representing a ring in a atomistic system.
Source code in src/vitrum/rings.py
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 162 163 164 165 166 167 168 169 170 171 172 | |
__init__(atoms, indexes=None)
Initialize a Ring object.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
atoms
|
Atoms
|
An Atoms object representing the atoms in the ring. |
required |
indexes
|
Optional[List[int]]
|
A list of indices of the atoms involved in the ring. Defaults to None. |
None
|
Source code in src/vitrum/rings.py
132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 | |
center()
Calculate the center of the ring.
Returns:
| Type | Description |
|---|---|
ndarray
|
np.ndarray: An array of shape (3,) representing the center of the ring. |
Source code in src/vitrum/rings.py
149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 | |
size()
Calculate the size of the ring, i.e., the number of atoms in the ring.
Returns:
| Name | Type | Description |
|---|---|---|
int |
int
|
The size of the ring. |
Source code in src/vitrum/rings.py
165 166 167 168 169 170 171 172 | |
RingAnalysis
A class for calculating and analyzing rings in atomistic systems.
Source code in src/vitrum/rings.py
175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 | |
__init__(atoms, included_atoms, bonding_dict=None)
Initialize the RingAnalysis class.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
atoms
|
Atoms
|
An Atoms object representing the atoms in the system. |
required |
included_atoms
|
List[str]
|
A list of strings representing the chemical symbols of the atoms to include in the analysis. |
required |
bonding_dict
|
Optional[List[Tuple[str, str]]]
|
A list of allowed bonds, e.g., [('Si', 'O')]. |
None
|
Source code in src/vitrum/rings.py
180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 | |
calculate(radii_factor=1.3, repeat=(1, 1, 1), max_size=np.inf)
Calculate the rings in the system.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
radii_factor
|
float
|
Factor to multiply covalent radii for neighbor search. |
1.3
|
repeat
|
Tuple[int, int, int]
|
Repeat unit cell. |
(1, 1, 1)
|
max_size
|
float
|
Maximum ring size. |
inf
|
Returns:
| Type | Description |
|---|---|
List[Ring]
|
List[Ring]: A list of Ring objects representing the rings in the system. |
Source code in src/vitrum/rings.py
200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 | |
get_ring_size_distribution()
Get the distribution of ring sizes.
Returns:
| Type | Description |
|---|---|
Dict[int, int]
|
Dict[int, int]: A dictionary where keys are ring sizes and values are counts. |
Source code in src/vitrum/rings.py
236 237 238 239 240 241 242 243 244 245 246 | |
plot_ring_size_distribution(ax=None)
Plots the distribution of ring sizes using matplotlib.
Source code in src/vitrum/rings.py
248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 | |
write_rings(filename, format='extxyz')
Write the rings to a file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
filename
|
str
|
The name of the file to write the rings to. |
required |
format
|
str
|
The format of the file. |
'extxyz'
|
Source code in src/vitrum/rings.py
224 225 226 227 228 229 230 231 232 233 234 | |
check_ring_is_periodic(ring, offsets)
Check if the ring wraps around the period cell, i.e., is not a true ring.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ring
|
List[int]
|
Atom indices of the ring. |
required |
offsets
|
Dict[Tuple[int, int], ndarray]
|
Unit cell offsets for all atoms pairs. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
bool |
bool
|
True if the ring is periodic (wraps around), False otherwise (contained within cell without wrapping sum). |
Source code in src/vitrum/rings.py
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | |
find_rings(ats, radii_factor=1.3, repeat=(1, 1, 1), bonds=None, limit=np.inf)
Find rings in the unit cell. Rings are found according to the definition of L. Guttman, J. Non-Cryst. Solids 1990, 116.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ats
|
Atoms
|
Atoms object containing the structure |
required |
radii_factor
|
float
|
Factor to multiply covalent radii for neighbor search |
1.3
|
repeat
|
Tuple[int, int, int]
|
How often to repeat the unit cell in each direction. Increase for small cells. |
(1, 1, 1)
|
bonds
|
Optional[List[Tuple[str, str]]]
|
List of allowed bonds, e.g., [('C', 'C'), ('C', 'O')], can be None to allow all bonds. |
None
|
limit
|
float
|
Maximum ring size to search for. |
inf
|
Returns:
| Type | Description |
|---|---|
List[List[int]]
|
List[List[int]]: A list of rings, where each ring is a list of atom indices. |
Source code in src/vitrum/rings.py
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 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 | |