PeriodicStructure
PeriodicStructure
Represents a periodic arrangement of sites. Assigns identifiers to sites so that they can be referred to elsewhere.
Supports retrieving sites by identifier or by location.
Attributes
Lattice
The periodic lattice in which this structure exists
int
The dimensionality of the structure
Source code in pylattica/core/periodic_structure.py
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 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 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 162 163 164 165 166 167 168 169 170 171 172 173 174 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__(lattice)
Instantiates a structure with the specified lattice. The dimensionaliity is inferred by the dimensionality of the lattice.
Parameters
Lattice
description
Source code in pylattica/core/periodic_structure.py
104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 |
|
add_site(site_class, location)
Adds a new site to the structure.
Parameters
str
The class of the site to be added. This can be anything, but must be provided Think of this as a tag for the site
Tuple[float]
The location of the new site in Cartesian coordinates
Returns
int The ID of the site. This can be used to retrieve the site later
Source code in pylattica/core/periodic_structure.py
151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 |
|
all_site_classes()
Returns a list of all the site classes present in this structure.
Returns
List[str] The site classes in this structure. Each class appears once in this list.
Source code in pylattica/core/periodic_structure.py
244 245 246 247 248 249 250 251 252 |
|
build_from(_, lattice, num_cells, site_motif, frac_coords=False)
classmethod
Builds a PeriodicStructure by repeating the unit cell num_cell times in each dimension. For instance, to build a structure that has 2 unit cells in each direction (and itself is three dimensional), the num_cells parameter should be
[2, 2, 2]
Lattice sites must also be specified by the site_motif parameter. This allows specification of which sites are where in the unit cell. For instance, if my 2D lattice has two types of sites, A and B, and each type exists in two different places, I might use the following site_motif:
{ "A": [ [0.2, 0.2], [0.4, 0.4] ], "B": [ [0.6, 0.6], [0.8, 0.8] ] }
Parameters
List[int]
As described above, a list of the number of repetitions of the unit cell in each direction.
dict
A dictionary mapping string site classes to lists of the locations within the unit cell at which a site of that type exists.
Returns
PeriodicStructure The structure resulting from the lattice tiling and motif filling specified.
Source code in pylattica/core/periodic_structure.py
30 31 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 |
|
get_site(site_id)
Returns the site with the specified ID.
Parameters
int
The ID of the desired site.
Returns
Dict A dictionary with keys "site_class", "location", and "id" representing the site.
Source code in pylattica/core/periodic_structure.py
229 230 231 232 233 234 235 236 237 238 239 240 241 242 |
|
site_at(location)
Retrieves the site at a particular location. Uses float equality to check.
Parameters
Tuple[float]
The location of the desired site
Returns
int A dictionary with keys "site_class", "location", and "id" representing the site.
Source code in pylattica/core/periodic_structure.py
188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 |
|
sites(site_class=None)
Returns a list of the sites with the specified site class.
Parameters
str, optional
The desired site class, by default None
Returns
List[Dict] A list of the sites matching that site class.
Source code in pylattica/core/periodic_structure.py
254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 |
|