Skip to content

gemdat.collective

This module contains classes for computing which jumps show collective behaviour.

Collective(jumps, sites, lattice, max_steps, max_dist=1)

Data class for collective jumps.

Attributes:

  • n_solo_jumps (int) –

    Number of solo jumps

  • coll_jumps (list[tuple(int, int)]) –

    List with start/stop site indices involved in collective jumps

  • collective (list[tuple[int, int]]) –

    List of indices to collective jump events

Parameters:

  • jumps (Jumps) –

    Input jump events

  • sites (Structure) –

    Structure with list of jump sites

  • lattice (Lattice) –

    Input lattice for distance calculations (from simulation data)

  • max_steps (int) –

    Maximum number of time steps which would still mean correlation

  • max_dist (float, default: 1 ) –

    Maximum distance for collective motions in Angstrom

Source code in src/gemdat/collective.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
def __init__(self,
             jumps: Jumps,
             sites: Structure,
             lattice: Lattice,
             max_steps: int,
             max_dist: float = 1):
    """Determine number of jumps which could show collective behaviour.

    Parameters
    ----------
    jumps : Jumps
        Input jump events
    sites : pymatgen.core.structure.Structure
        Structure with list of jump sites
    lattice : pymatgen.core.lattice.Lattice
        Input lattice for distance calculations (from simulation data)
    max_steps : int
        Maximum number of time steps which would still mean correlation
    max_dist : float
        Maximum distance for collective motions in Angstrom
    """
    self.jumps = jumps
    self.sites = sites
    self.lattice = lattice
    self.max_steps = max_steps
    self.max_dist = max_dist

    self._compute()

multiple_collective()

Find jumps that occur collectively multiple times.

returns collective jumps and their occurence

Returns:

  • multiple_collective ( (ndarray, ndarray) ) –

    Result of a np.unique on the collective jump pairs

Source code in src/gemdat/collective.py
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
@weak_lru_cache()
def multiple_collective(self) -> tuple[np.ndarray, np.ndarray]:
    """Find jumps that occur collectively multiple times.

    returns collective jumps and their occurence

    Returns
    -------
    multiple_collective : np.ndarray, np.ndarray
        Result of a np.unique on the collective jump pairs
    """
    collective = np.array(dtype=[('start', int), ('stop', int)],
                          object=[[(event_i['start site'],
                                    event_i['destination site']),
                                   (event_j['start site'],
                                    event_j['destination site'])]
                                  for event_i, event_j in self.collective])
    # Sort jumps so equal jumps are orderd similarily
    collective = np.sort(collective, axis=1)

    # Counts how often collective jumps occur
    jumps, counts = np.unique(collective, axis=0, return_counts=True)

    return jumps, counts

site_pair_count_matrix()

Collective jumps matrix.

Returns:

  • site_pair_count_matrix ( ndarray ) –

    Matrix where all types of jumps combinations are counted

Source code in src/gemdat/collective.py
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
@weak_lru_cache()
def site_pair_count_matrix(self) -> np.ndarray:
    """Collective jumps matrix.

    Returns
    -------
    site_pair_count_matrix : np.ndarray
        Matrix where all types of jumps combinations are counted
    """
    labels = self.sites.labels
    coll_jumps = self.coll_jumps
    site_pairs = self.site_pair_count_matrix_labels()

    site_pair_count_matrix = np.zeros((len(site_pairs), len(site_pairs)),
                                      dtype=int)

    for ((start_i, stop_i), (start_j, stop_j)) in coll_jumps:
        name_start_i = labels[start_i]
        name_stop_i = labels[stop_i]
        name_start_j = labels[start_j]
        name_stop_j = labels[stop_j]

        i = site_pairs.index((name_start_i, name_stop_i))
        j = site_pairs.index((name_start_j, name_stop_j))

        site_pair_count_matrix[i, j] += 1

    return site_pair_count_matrix