1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24 """Module for functions relating to the paramagnetic centre."""
25
26
27 from numpy.linalg import norm
28
29
31 """Calculate the electron spin to nuclear spin unit vectors and distances.
32
33 This assumes that there is one paramagnetic centre per state of the system.
34
35
36 @param atomic_pos: The atomic positions in Angstrom. The first index is the spins, the second is the structures, and the third is the atomic coordinates.
37 @type atomic_pos: numpy rank-3 array
38 @param paramag_centre: The paramagnetic centre position in Angstrom.
39 @type paramag_centre: numpy rank-2, Nx3 array
40 @param unit_vector: The structure to fill with the electron spin to nuclear spin unit vectors.
41 @type unit_vector: numpy rank-3 array
42 @param r: The structure to fill with the electron spin to nuclear spin distances.
43 @type r: numpy rank-2 array
44 """
45
46
47 for i in range(len(atomic_pos)):
48
49 for c in range(len(atomic_pos[i])):
50
51 vect = atomic_pos[i, c] - paramag_centre[c]
52
53
54 r[i, c] = norm(vect)
55
56
57 unit_vector[i, c] = vect / r[i, c]
58
59
60 r[i, c] = r[i, c] * 1e-10
61
62
64 """Calculate the electron spin to nuclear spin unit vectors and distances.
65
66 This assumes that there is only one paramagnetic centre for all states of the system.
67
68
69 @param atomic_pos: The atomic positions in Angstrom. The first index is the spins, the second is the structures, and the third is the atomic coordinates.
70 @type atomic_pos: numpy rank-3 array
71 @param paramag_centre: The paramagnetic centre position in Angstrom.
72 @type paramag_centre: numpy rank-1, 3D array
73 @param unit_vector: The structure to fill with the electron spin to nuclear spin unit vectors.
74 @type unit_vector: numpy rank-3 array
75 @param r: The structure to fill with the electron spin to nuclear spin distances.
76 @type r: numpy rank-2 array
77 """
78
79
80 for i in range(len(atomic_pos)):
81
82 for c in range(len(atomic_pos[i])):
83
84 vect = atomic_pos[i, c] - paramag_centre
85
86
87 r[i, c] = norm(vect)
88
89
90 unit_vector[i, c] = vect / r[i, c]
91
92
93 r[i, c] = r[i, c] * 1e-10
94