NeighborhoodBuilders
AnnularNeighborhoodBuilder
Bases: NeighborhoodBuilder
This neighborhood builder creates neighbor connections between sites which are within a ring-shaped region around eachother. This region is specified by a minimum (inner radius) and maximum (outer radius) distance.
Source code in pylattica/core/neighborhood_builders.py
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 |
|
__init__(inner_radius, outer_radius)
Instantiates an AnnularNeighborhoodBuilder
Parameters
float
The minimum at which two sites are considered neighbors.
float
The maximum distance at which two sites are considered neighbors.
Source code in pylattica/core/neighborhood_builders.py
145 146 147 148 149 150 151 152 153 154 155 156 |
|
get_neighbors(curr_site, struct)
Builds a NeighborGraph from the provided structure according to the cutoff distance of this Builder.
Parameters
PeriodicStructure
The structure from which a NeighborGraph should be constructed.
Returns
NeighborGraph The resulting NeighborGraph
Source code in pylattica/core/neighborhood_builders.py
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 |
|
DistanceNeighborhoodBuilder
Bases: NeighborhoodBuilder
This neighborhood builder creates neighbor connections between sites which are within some cutoff distance of eachother.
Source code in pylattica/core/neighborhood_builders.py
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 |
|
__init__(cutoff)
Instantiates a DistanceNeighborhoodBuilder
Parameters
float
The maximum distance at which two sites are considered neighbors.
Source code in pylattica/core/neighborhood_builders.py
98 99 100 101 102 103 104 105 106 |
|
get_neighbors(curr_site, struct)
Builds a NeighborGraph from the provided structure according to the cutoff distance of this Builder.
Parameters
PeriodicStructure
The structure from which a NeighborGraph should be constructed.
Returns
NeighborGraph The resulting NeighborGraph
Source code in pylattica/core/neighborhood_builders.py
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 |
|
MotifNeighborhoodBuilder
Bases: NeighborhoodBuilder
This NeighborhoodBuilder constructs NeighborGraphs with connections between points that are separated by one of a set of specific offset vectors.
For example, consider a 2D structure with two types of sites, A and B. Each A site is connected to two other A sites, one offset by 1 unit in each of the positive and negative x directions. Each A site is also connected to two B sites, one offset by one unit in each of the positive and negative y directions, then the spec parameter for this arrangement would look as follows.
{
"A": [
[0, 1],
[1, 0],
[0, -1],
[-1, 0],
],
"B": [
[0, 1],
[0, -1],
]
}
Note that there is reciprocity here between the A and B sites. The A sites list B sites as their neighbors, and the B sites list A sites as their neighbors.
Source code in pylattica/core/neighborhood_builders.py
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 |
|
__init__(motif)
Instantiates the MotifNeighborhoodBuilder by a motif as described in the docstring for the class.
Parameters
Dict[str, List[List[float]]]
See class docstring.
Source code in pylattica/core/neighborhood_builders.py
216 217 218 219 220 221 222 223 224 225 226 227 |
|
get_neighbors(curr_site, struct)
Given a structure, constructs a NeighborGraph with site connections according to the motif.
Parameters
PeriodicStructure
The structure for which a NeighborGraph should be constructed.
Returns
NeighborGraph The resulting NeighborGraph.
Source code in pylattica/core/neighborhood_builders.py
229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 |
|
NeighborhoodBuilder
An abstract class to extend in order to implement a new type of NeighborhoodBuilder
Source code in pylattica/core/neighborhood_builders.py
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 |
|
get(struct, site_class=None)
Given a structure and a site class to build a neighborhood for, build the neighborhood.
Parameters
PeriodicStructure
The structure for which the Neighborhood of every site should be calculated
str, optional
Specify a single class of sites to calculate the neighborhood for, by default None
Returns
Neighborhood description
Source code in pylattica/core/neighborhood_builders.py
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 |
|
SiteClassNeighborhoodBuilder
Bases: NeighborhoodBuilder
A class which constructs the neighborhood of each site as a function of the class of that site.
Source code in pylattica/core/neighborhood_builders.py
254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 |
|
__init__(nb_builders)
Instantiates the SiteClassNeighborhoodBuilder.
Parameters
Dict[str, NeighborhoodBuilder]
A mapping of site classes to the NeighborhoodBuilders which specify what neighborhood that class of sites should have.
Source code in pylattica/core/neighborhood_builders.py
258 259 260 261 262 263 264 265 266 267 |
|
get(struct)
Constructs the neighborhood of every site in the provided structure, conditional on the class of each site.
Parameters
PeriodicStructure
The structure for which the neigborhood should be calculated.
Returns
Neighborhood The resulting Neighborhood object.
Source code in pylattica/core/neighborhood_builders.py
269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 |
|
StochasticNeighborhoodBuilder
Bases: NeighborhoodBuilder
A helper class for building StochasticNeighborhoods - that is, neighborhoods for which one of several random neighbor sets is chosen each time a site's neighbors are requested.
Source code in pylattica/core/neighborhood_builders.py
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 |
|
__init__(builders)
Instantiates the StochasticNeighborhoodBuilder class.
Parameters
List[NeighborhoodBuilder]
A list of builders which will give the neighborhoods that might be returned by the StochasticNeighborhood
Source code in pylattica/core/neighborhood_builders.py
65 66 67 68 69 70 71 72 73 74 |
|
get(struct)
For the provided structure, calculate the StochasticNeighborhood specified by the list of builders originally provided to this class.
Parameters
PeriodicStructure
The structure for which the neighborhood should be calculated.
Returns
Neighborhood The resulting StochasticNeighborhood
Source code in pylattica/core/neighborhood_builders.py
76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 |
|