gemdat.transitions
This module contains classes for computing jumps and transitions between sites.
SiteRadius(radius, inner_fraction, pdist, site_pairs, min_dist)
dataclass
Container class for sites radius.
Attributes:
-
radius(dict[str, float]) βSite radius in Angstrom
-
inner_fraction(dict[str, float]) βFraction of inner sphere
-
pdist(ndarray) βPairwise distance matrix between sites
-
site_pairs(dict) βAll site pairs for given site labels in site_radius
-
min_dist(dict) βMinimal distance between given sites
from_given_radius(*, trajectory, sites, radius, inner_fraction, fraction_of_overlap=0.0)
classmethod
Create SiteRadius from given radius.
Parameters:
-
trajectory(Trajectory) βInput trajectory
-
sites(Structure) βInput structure with atom sites
-
radius(float | dict[str, float]) βSite radius (per site label) in Angstrom
-
inner_fraction(float | dict[str, float]) βFraction of inner sphere
-
fraction_of_overlap(float, default:0.0) βFraction of allowed overlap between sites
Returns:
-
site_radius_obj(SiteRadius object) β
Source code in src/gemdat/transitions.py
509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 | |
from_vibration_amplitude(*, trajectory, sites, vibration_amplitude, inner_fraction=1.0)
classmethod
Calculate tolerance wihin which atoms are considered to be close to a site.
Parameters:
-
trajectory(Trajectory) βInput trajectory
-
sites(Structure) βInput sites
-
vibration_amplitude(float) βVibration amplitude used to calculate site radius
Returns:
-
site_radius(SiteRadius) βSiteRadius dataclass
Source code in src/gemdat/transitions.py
564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 | |
raise_if_overlapping(sites, factor=1.0)
Raise error if sites are overlapping.
Source code in src/gemdat/transitions.py
687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 | |
sites_are_overlapping(factor=1.0)
Return True if sites any pairwise distances are within the site radius.
Source code in src/gemdat/transitions.py
678 679 680 681 682 683 684 685 | |
Transitions(*, trajectory, diff_trajectory, sites, events, states, inner_states, site_radius)
Container class for transitions between sites.
Attributes:
-
events(ndarray) β5-column numpy array holding all transition events
-
n_sites(int) βTotal number of sites
-
states(ndarray) βFor each time step, for each atom, track the index of the site it is at. Assingn NOSITE if the atom is in transition
Parameters:
-
trajectory(Trajectory) βFull trajectory of all sites in the simulation
-
diff_trajectory(Trajectory) βTrajectory of species of interest (e.g. diffusing) for which transitions are generated
-
sites(Structure) βStructure with known sites used for calculation of events
-
events(DataFrame) βInput events
-
states(ndarray) βInput states
-
inner_states(ndarray) βInput states for inner sites
-
site_radius(SiteRadius) βsite_radius used to calculate if an atom is at a site.
Source code in src/gemdat/transitions.py
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 | |
n_events
property
Return number of events.
n_floating
property
Return number of floating species.
n_sites
property
Return number of sites.
n_states
property
Return number of states.
atom_locations()
Calculate fraction of time atoms spent at a type of site.
Returns:
Source code in src/gemdat/transitions.py
323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 | |
from_trajectory(*, trajectory, sites, floating_specie, site_radius=None, site_inner_fraction=1.0, remove_part_occup_from_structure=False, fraction_of_overlap=0.0)
classmethod
Compute transitions between given sites for floating specie.
Parameters:
-
sites(Structure) βInput structure with known sites
-
floating_specie(str) βName of the floating specie to calculate transitions for
-
site_radius(float | dict[str, float] | None, default:None) βA custom site radius in Γ ngstrom to determine if an atom is at a site. A dict keyed by the site label can be used to have a site per atom type, e.g. `site_radius = {'Li1': 1.0, 'Li2': 1.2}.
-
site_inner_fraction(float | dict[str, float], default:1.0) βA fraction of the site radius which is determined to be the
inner sitewhich is used in jump calculations -
remove_part_occup_from_structure(bool, default:False) βA flag to remove partial occupancies from structure
-
fraction_of_overlap(float, default:0.0) βFraction of allowed overlap between sites
Returns:
-
transitions(Transitions) β
Source code in src/gemdat/transitions.py
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 | |
jumps(**kwargs)
Analyze transitions and classify them as jumps.
Parameters:
-
**kwargs(dict, default:{}) βThese parameters are passed to the gemdat.Jumps initializer.
Returns:
-
jumps(Jumps) β
Source code in src/gemdat/transitions.py
188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 | |
matrix()
Convert list of transition events to dense matrix.
Returns:
-
transitions_matrix(ndarray) βSquare matrix with number of each transitions
Source code in src/gemdat/transitions.py
243 244 245 246 247 248 249 250 251 252 | |
occupancy()
Calculate occupancy per site.
Returns:
-
sites(Structure) βStructure with occupancies set on the sites.
Source code in src/gemdat/transitions.py
280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 | |
occupancy_by_site_type()
Calculate average occupancy per a type of site.
Returns:
Source code in src/gemdat/transitions.py
308 309 310 311 312 313 314 315 316 317 318 319 320 321 | |
radial_distribution(**kwargs)
Calculate and sum RDFs for the floating species in the given sites data.
Parameters:
-
**kwargs(dict, default:{}) βThese parameters are passed to the gemdat.radial_distribution function.
Returns:
-
rdfs(dict[str, RDFCollection]) βDictionary with rdf arrays per symbol
Source code in src/gemdat/transitions.py
204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 | |
residence_time()
Return the residence time of atoms on individual sites.
The residence time is the number of consecutive timesteps an atom
spends on a site, derived directly from the site occupation
(states). This captures every contiguous occupancy on a site.
Visits at the very start and end of the simulation are omitted, since the arrival or departure time is not observed and the true duration cannot be determined.
Returns:
-
df(DataFrame) βDataframe with one row per site visit and columns
atom index,site(site index),label(site label) andtime(residence time in number of timesteps).
Source code in src/gemdat/transitions.py
339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 | |
split(n_parts=10)
Split data into equal parts in time for statistics.
Parameters:
-
n_parts(int, default:10) βNumber of parts to split the data into
Returns:
-
parts(list[Transitions]) βList with
Transitionsobject for each part
Source code in src/gemdat/transitions.py
375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 | |
states_next()
Calculate atom transition states per time step by backward filling
self.states.
Returns:
-
ndarrayβOutput array with atom transition states.
states_nextcontains the index of the next site for every atom.
Source code in src/gemdat/transitions.py
254 255 256 257 258 259 260 261 262 263 264 265 | |
states_prev()
Calculate atom transition states per time step by forward filling
self.states.
Returns:
-
ndarrayβOutput array with atom transition states.
states_prevcontains the index of the previous site for every atom.
Source code in src/gemdat/transitions.py
267 268 269 270 271 272 273 274 275 276 277 278 | |