symfc 1.3.3__tar.gz → 1.3.4__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {symfc-1.3.3/src/symfc.egg-info → symfc-1.3.4}/PKG-INFO +1 -1
- {symfc-1.3.3 → symfc-1.3.4}/src/symfc/utils/eig_tools.py +17 -4
- symfc-1.3.4/src/symfc/utils/matrix_tools.py +35 -0
- {symfc-1.3.3 → symfc-1.3.4}/src/symfc/utils/matrix_tools_O2.py +115 -17
- {symfc-1.3.3 → symfc-1.3.4}/src/symfc/utils/matrix_tools_O3.py +115 -17
- {symfc-1.3.3 → symfc-1.3.4}/src/symfc/utils/matrix_tools_O4.py +117 -19
- symfc-1.3.4/src/symfc/utils/permutation_tools.py +113 -0
- {symfc-1.3.3 → symfc-1.3.4}/src/symfc/utils/permutation_tools_O2.py +39 -21
- {symfc-1.3.3 → symfc-1.3.4}/src/symfc/utils/permutation_tools_O3.py +41 -24
- {symfc-1.3.3 → symfc-1.3.4}/src/symfc/utils/permutation_tools_O4.py +43 -25
- {symfc-1.3.3 → symfc-1.3.4}/src/symfc/version.py +1 -1
- {symfc-1.3.3 → symfc-1.3.4/src/symfc.egg-info}/PKG-INFO +1 -1
- symfc-1.3.3/src/symfc/utils/matrix_tools.py +0 -89
- symfc-1.3.3/src/symfc/utils/permutation_tools.py +0 -35
- {symfc-1.3.3 → symfc-1.3.4}/LICENSE +0 -0
- {symfc-1.3.3 → symfc-1.3.4}/MANIFEST.in +0 -0
- {symfc-1.3.3 → symfc-1.3.4}/README.md +0 -0
- {symfc-1.3.3 → symfc-1.3.4}/pyproject.toml +0 -0
- {symfc-1.3.3 → symfc-1.3.4}/setup.cfg +0 -0
- {symfc-1.3.3 → symfc-1.3.4}/src/symfc/__init__.py +0 -0
- {symfc-1.3.3 → symfc-1.3.4}/src/symfc/api_symfc.py +0 -0
- {symfc-1.3.3 → symfc-1.3.4}/src/symfc/basis_sets/__init__.py +0 -0
- {symfc-1.3.3 → symfc-1.3.4}/src/symfc/basis_sets/basis_sets_O1.py +0 -0
- {symfc-1.3.3 → symfc-1.3.4}/src/symfc/basis_sets/basis_sets_O2.py +0 -0
- {symfc-1.3.3 → symfc-1.3.4}/src/symfc/basis_sets/basis_sets_O3.py +0 -0
- {symfc-1.3.3 → symfc-1.3.4}/src/symfc/basis_sets/basis_sets_O4.py +0 -0
- {symfc-1.3.3 → symfc-1.3.4}/src/symfc/basis_sets/basis_sets_base.py +0 -0
- {symfc-1.3.3 → symfc-1.3.4}/src/symfc/solvers/__init__.py +0 -0
- {symfc-1.3.3 → symfc-1.3.4}/src/symfc/solvers/solver_O2.py +0 -0
- {symfc-1.3.3 → symfc-1.3.4}/src/symfc/solvers/solver_O2O3.py +0 -0
- {symfc-1.3.3 → symfc-1.3.4}/src/symfc/solvers/solver_O2O3O4.py +0 -0
- {symfc-1.3.3 → symfc-1.3.4}/src/symfc/solvers/solver_O3.py +0 -0
- {symfc-1.3.3 → symfc-1.3.4}/src/symfc/solvers/solver_O3O4.py +0 -0
- {symfc-1.3.3 → symfc-1.3.4}/src/symfc/solvers/solver_O4.py +0 -0
- {symfc-1.3.3 → symfc-1.3.4}/src/symfc/solvers/solver_base.py +0 -0
- {symfc-1.3.3 → symfc-1.3.4}/src/symfc/spg_reps/__init__.py +0 -0
- {symfc-1.3.3 → symfc-1.3.4}/src/symfc/spg_reps/spg_reps_O1.py +0 -0
- {symfc-1.3.3 → symfc-1.3.4}/src/symfc/spg_reps/spg_reps_O2.py +0 -0
- {symfc-1.3.3 → symfc-1.3.4}/src/symfc/spg_reps/spg_reps_O3.py +0 -0
- {symfc-1.3.3 → symfc-1.3.4}/src/symfc/spg_reps/spg_reps_O4.py +0 -0
- {symfc-1.3.3 → symfc-1.3.4}/src/symfc/spg_reps/spg_reps_base.py +0 -0
- {symfc-1.3.3 → symfc-1.3.4}/src/symfc/utils/__init__.py +0 -0
- {symfc-1.3.3 → symfc-1.3.4}/src/symfc/utils/cutoff_tools.py +0 -0
- {symfc-1.3.3 → symfc-1.3.4}/src/symfc/utils/matrix_tools_O1.py +0 -0
- {symfc-1.3.3 → symfc-1.3.4}/src/symfc/utils/rotation_dev/__init__.py +0 -0
- {symfc-1.3.3 → symfc-1.3.4}/src/symfc/utils/rotation_dev/run_rotation_tools_O2.py +0 -0
- {symfc-1.3.3 → symfc-1.3.4}/src/symfc/utils/rotation_dev/run_rotation_tools_O3.py +0 -0
- {symfc-1.3.3 → symfc-1.3.4}/src/symfc/utils/rotation_dev/run_test_O2.py +0 -0
- {symfc-1.3.3 → symfc-1.3.4}/src/symfc/utils/rotation_tools_O2.py +0 -0
- {symfc-1.3.3 → symfc-1.3.4}/src/symfc/utils/solver_funcs.py +0 -0
- {symfc-1.3.3 → symfc-1.3.4}/src/symfc/utils/utils.py +0 -0
- {symfc-1.3.3 → symfc-1.3.4}/src/symfc/utils/utils_O1.py +0 -0
- {symfc-1.3.3 → symfc-1.3.4}/src/symfc/utils/utils_O2.py +0 -0
- {symfc-1.3.3 → symfc-1.3.4}/src/symfc/utils/utils_O3.py +0 -0
- {symfc-1.3.3 → symfc-1.3.4}/src/symfc/utils/utils_O4.py +0 -0
- {symfc-1.3.3 → symfc-1.3.4}/src/symfc.egg-info/SOURCES.txt +0 -0
- {symfc-1.3.3 → symfc-1.3.4}/src/symfc.egg-info/dependency_links.txt +0 -0
- {symfc-1.3.3 → symfc-1.3.4}/src/symfc.egg-info/requires.txt +0 -0
- {symfc-1.3.3 → symfc-1.3.4}/src/symfc.egg-info/top_level.txt +0 -0
- {symfc-1.3.3 → symfc-1.3.4}/tests/NaCl-unitcell.yaml +0 -0
- {symfc-1.3.3 → symfc-1.3.4}/tests/basis_sets/test_basis_sets_O2.py +0 -0
- {symfc-1.3.3 → symfc-1.3.4}/tests/basis_sets/test_basis_sets_O3.py +0 -0
- {symfc-1.3.3 → symfc-1.3.4}/tests/basis_sets/test_basis_sets_O4.py +0 -0
- {symfc-1.3.3 → symfc-1.3.4}/tests/basis_sets/test_basis_sets_base.py +0 -0
- {symfc-1.3.3 → symfc-1.3.4}/tests/compact_fc_GaN_222.xz +0 -0
- {symfc-1.3.3 → symfc-1.3.4}/tests/compact_fc_GaN_442.xz +0 -0
- {symfc-1.3.3 → symfc-1.3.4}/tests/compact_fc_NaCl_222.xz +0 -0
- {symfc-1.3.3 → symfc-1.3.4}/tests/compact_fc_SiO2_221.xz +0 -0
- {symfc-1.3.3 → symfc-1.3.4}/tests/compact_fc_Si_111_fc3_2.xz +0 -0
- {symfc-1.3.3 → symfc-1.3.4}/tests/compact_fc_Si_111_fc3_3.xz +0 -0
- {symfc-1.3.3 → symfc-1.3.4}/tests/compact_fc_Si_111_fc4_2.xz +0 -0
- {symfc-1.3.3 → symfc-1.3.4}/tests/compact_fc_Si_111_fc4_3.xz +0 -0
- {symfc-1.3.3 → symfc-1.3.4}/tests/compact_fc_Si_111_fc4_4.xz +0 -0
- {symfc-1.3.3 → symfc-1.3.4}/tests/compact_fc_SnO2_223.xz +0 -0
- {symfc-1.3.3 → symfc-1.3.4}/tests/conftest.py +0 -0
- {symfc-1.3.3 → symfc-1.3.4}/tests/dfset_GaN_222_rd.xz +0 -0
- {symfc-1.3.3 → symfc-1.3.4}/tests/dfset_GaN_442_rd.xz +0 -0
- {symfc-1.3.3 → symfc-1.3.4}/tests/dfset_NaCl_222_rd.xz +0 -0
- {symfc-1.3.3 → symfc-1.3.4}/tests/dfset_SiO2_221_rd.xz +0 -0
- {symfc-1.3.3 → symfc-1.3.4}/tests/dfset_Si_111_fc3_rd.xz +0 -0
- {symfc-1.3.3 → symfc-1.3.4}/tests/dfset_SnO2_223_rd.xz +0 -0
- {symfc-1.3.3 → symfc-1.3.4}/tests/full_fc_NaCl_222.xz +0 -0
- {symfc-1.3.3 → symfc-1.3.4}/tests/full_fc_Si_111_fc3_2.xz +0 -0
- {symfc-1.3.3 → symfc-1.3.4}/tests/full_fc_Si_111_fc3_3.xz +0 -0
- {symfc-1.3.3 → symfc-1.3.4}/tests/full_fc_Si_111_fc4_2.xz +0 -0
- {symfc-1.3.3 → symfc-1.3.4}/tests/full_fc_Si_111_fc4_3.xz +0 -0
- {symfc-1.3.3 → symfc-1.3.4}/tests/full_fc_Si_111_fc4_4.xz +0 -0
- {symfc-1.3.3 → symfc-1.3.4}/tests/full_fc_Si_111_fc4_step_2.xz +0 -0
- {symfc-1.3.3 → symfc-1.3.4}/tests/full_fc_Si_111_fc4_step_3.xz +0 -0
- {symfc-1.3.3 → symfc-1.3.4}/tests/full_fc_Si_111_fc4_step_4.xz +0 -0
- {symfc-1.3.3 → symfc-1.3.4}/tests/full_fc_SnO2_223.xz +0 -0
- {symfc-1.3.3 → symfc-1.3.4}/tests/perms_super.dat +0 -0
- {symfc-1.3.3 → symfc-1.3.4}/tests/phonopy_to_python.py +0 -0
- {symfc-1.3.3 → symfc-1.3.4}/tests/solvers/test_solver_utils.py +0 -0
- {symfc-1.3.3 → symfc-1.3.4}/tests/spg_reps/test_spg_reps_O1.py +0 -0
- {symfc-1.3.3 → symfc-1.3.4}/tests/spg_reps/test_spg_reps_O2.py +0 -0
- {symfc-1.3.3 → symfc-1.3.4}/tests/spg_reps/test_spg_reps_O3.py +0 -0
- {symfc-1.3.3 → symfc-1.3.4}/tests/spg_reps/test_spg_reps_O4.py +0 -0
- {symfc-1.3.3 → symfc-1.3.4}/tests/spg_reps/test_spg_reps_base.py +0 -0
- {symfc-1.3.3 → symfc-1.3.4}/tests/test_api.py +0 -0
- {symfc-1.3.3 → symfc-1.3.4}/tests/utils/test_cutoff_tools.py +0 -0
- {symfc-1.3.3 → symfc-1.3.4}/tests/utils/test_eig_tools.py +0 -0
- {symfc-1.3.3 → symfc-1.3.4}/tests/utils/test_matrix_tools_O2.py +0 -0
- {symfc-1.3.3 → symfc-1.3.4}/tests/utils/test_matrix_tools_O3.py +0 -0
- {symfc-1.3.3 → symfc-1.3.4}/tests/utils/test_matrix_tools_O4.py +0 -0
- {symfc-1.3.3 → symfc-1.3.4}/tests/utils/test_solver_funcs.py +0 -0
- {symfc-1.3.3 → symfc-1.3.4}/tests/utils/test_utils.py +0 -0
- {symfc-1.3.3 → symfc-1.3.4}/tests/utils/test_utils_O1.py +0 -0
- {symfc-1.3.3 → symfc-1.3.4}/tests/utils/test_utils_O2.py +0 -0
- {symfc-1.3.3 → symfc-1.3.4}/tests/utils/test_utils_O2_2.py +0 -0
- {symfc-1.3.3 → symfc-1.3.4}/tests/utils/test_utils_O3.py +0 -0
- {symfc-1.3.3 → symfc-1.3.4}/tests/utils/test_utils_O4.py +0 -0
|
@@ -359,10 +359,23 @@ def eigsh_projector_sumrule_large(p: csr_array, verbose: bool = True) -> np.ndar
|
|
|
359
359
|
When p = diag(A,B), Av = v, and Bw = w, p[v,0] = [v,0] and p[0,w] = [0,w]
|
|
360
360
|
are solutions.
|
|
361
361
|
|
|
362
|
-
This
|
|
363
|
-
|
|
364
|
-
block
|
|
365
|
-
|
|
362
|
+
This algorithm is optimized to solve an eigenvalue problem for
|
|
363
|
+
projection matrix p with large block submatrices.
|
|
364
|
+
The algorithm for solving each block submatrix is as follows.
|
|
365
|
+
1. Divide each block submatrix into reasonable sizes of submatrices,
|
|
366
|
+
not projectors.
|
|
367
|
+
2. Solve eigenvalue problems for these submatrices and eigenvectors
|
|
368
|
+
with eigenvalues of one are extracted. The eigenvectors with
|
|
369
|
+
eigenvalues e < 1 are used for compressing the complementary matrix
|
|
370
|
+
in the next step.
|
|
371
|
+
3. Calculate the complementary matrix, which corresponds to the complement
|
|
372
|
+
of the vector space spanned by the eigenvectors. The complementary matrix
|
|
373
|
+
is compressed using the eigenvectors with e < 1.
|
|
374
|
+
4. Solve eigenvalue problem for the complementary matrix and eigenvectors
|
|
375
|
+
with e = 1 are calculated. The eigenvalue problems are efficiently solved
|
|
376
|
+
using the compressed complementary matrix and the eigenvectors are recovered by
|
|
377
|
+
the compression matrix.
|
|
378
|
+
5. Collect all eigenvectors with e = 1.
|
|
366
379
|
"""
|
|
367
380
|
group = _find_projector_blocks(p)
|
|
368
381
|
if verbose:
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"""Matrix utility functions."""
|
|
2
|
+
|
|
3
|
+
import numpy as np
|
|
4
|
+
from scipy.sparse import csr_array
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
def permutation_dot_lat_trans(
|
|
8
|
+
combinations_ijk: np.ndarray,
|
|
9
|
+
combinations_abc: np.ndarray,
|
|
10
|
+
atomic_decompr_idx: np.ndarray,
|
|
11
|
+
n_perms: int,
|
|
12
|
+
n_perms_group: int,
|
|
13
|
+
n_lp: int,
|
|
14
|
+
order: int,
|
|
15
|
+
natom: int,
|
|
16
|
+
) -> csr_array:
|
|
17
|
+
"""Return C_perm.T @ C_trans for permulation symmetry rules."""
|
|
18
|
+
assert combinations_ijk.shape[0] == combinations_abc.shape[0]
|
|
19
|
+
|
|
20
|
+
sum_abc = 3**order
|
|
21
|
+
sum_ijkabc = natom**order * sum_abc
|
|
22
|
+
n_combinations = combinations_ijk.shape[0] // n_perms
|
|
23
|
+
n_perms_sym = n_perms // n_perms_group
|
|
24
|
+
c_pt = csr_array(
|
|
25
|
+
(
|
|
26
|
+
np.full(n_combinations * n_perms, 1 / np.sqrt(n_perms_sym * n_lp)),
|
|
27
|
+
(
|
|
28
|
+
np.repeat(np.arange(n_combinations * n_perms_group), n_perms_sym),
|
|
29
|
+
atomic_decompr_idx[combinations_ijk] * sum_abc + combinations_abc,
|
|
30
|
+
),
|
|
31
|
+
),
|
|
32
|
+
shape=(n_combinations * n_perms_group, sum_ijkabc // n_lp),
|
|
33
|
+
dtype="double",
|
|
34
|
+
)
|
|
35
|
+
return c_pt
|
|
@@ -7,7 +7,8 @@ import scipy
|
|
|
7
7
|
from scipy.sparse import csr_array
|
|
8
8
|
|
|
9
9
|
from symfc.utils.cutoff_tools import FCCutoff
|
|
10
|
-
from symfc.utils.matrix_tools import
|
|
10
|
+
from symfc.utils.matrix_tools import permutation_dot_lat_trans
|
|
11
|
+
from symfc.utils.permutation_tools import get_combinations
|
|
11
12
|
from symfc.utils.solver_funcs import get_batch_slice
|
|
12
13
|
from symfc.utils.utils import get_indep_atoms_by_lat_trans
|
|
13
14
|
from symfc.utils.utils_O2 import _get_atomic_lat_trans_decompr_indices
|
|
@@ -111,18 +112,67 @@ def compressed_projector_sum_rules_O2(
|
|
|
111
112
|
n_batch: int = 1,
|
|
112
113
|
use_mkl: bool = False,
|
|
113
114
|
) -> csr_array:
|
|
114
|
-
"""Return projection matrix for sum rule.
|
|
115
|
+
r"""Return projection matrix for translational sum rule.
|
|
115
116
|
|
|
116
|
-
Calculate a
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
117
|
+
Calculate a compressed projector for translational sum rules
|
|
118
|
+
efficiently using independent atom with respect to lattice translations.
|
|
119
|
+
This compression is achieved using C_trans and n_a_compress_mat,
|
|
120
|
+
without the need to allocate C_trans. The implementation utilizes
|
|
121
|
+
get_atomic_lat_trans_decompr_indices_O3 to ensure efficient memory usage.
|
|
120
122
|
|
|
121
123
|
Return
|
|
122
124
|
------
|
|
123
|
-
Compressed projector I - P^(c)
|
|
124
|
-
|
|
125
|
-
|
|
125
|
+
Compressed projector I - P^(c).
|
|
126
|
+
I - P^(c)
|
|
127
|
+
= n_a_compress_mat.T @ C_trans.T
|
|
128
|
+
@ [I - C_sum^(c) @ C_sum^(c).T] @ C_trans @ n_a_compress_mat
|
|
129
|
+
= I - [n_a_compress_mat.T @ C_trans.T @ C_sum^(c)]
|
|
130
|
+
@ [C_sum^(c).T @ C_trans @ n_a_compress_mat]
|
|
131
|
+
|
|
132
|
+
Algorithm
|
|
133
|
+
---------
|
|
134
|
+
1. C_sum^(c).T = [I, I, I, ...] of size (27N, 27N^2).
|
|
135
|
+
I denotes the unit matrix of size (27N, 27N).
|
|
136
|
+
C_sum^(c).T is composed of N unit matrices.
|
|
137
|
+
In this representation, the translational sum rules are given by
|
|
138
|
+
\sum_i FC2(i, j, a, b) = 0.
|
|
139
|
+
|
|
140
|
+
2. To divide the computation of a compressed projector into several batches,
|
|
141
|
+
C_sum^(c) and C_trans are permuted from the index order of (i, j, a, b)
|
|
142
|
+
to (a, b, j, i).
|
|
143
|
+
This is represented by C_sum^(c).T @ C_trans = C_sum^(c).T @ S.T @ S @ C_trans,
|
|
144
|
+
where S denotes the permutation matrix that changes the index order to
|
|
145
|
+
(a, b, j, i). Using this permutation, the translational sum rules are
|
|
146
|
+
represented as
|
|
147
|
+
C_sum^(c).T @ S.T = [
|
|
148
|
+
[1_N.T, 0_N.T, 0_N.T, ...]
|
|
149
|
+
[0_N.T, 1_N.T, 0_N.T, ...]
|
|
150
|
+
[0_N.T, 0_N.T, 1_N.T, ...]
|
|
151
|
+
...
|
|
152
|
+
],
|
|
153
|
+
where 1_N and 0_N are column vectors of size N with all elements
|
|
154
|
+
equal to one and zero, respectively.
|
|
155
|
+
(Example) C_sum^(c).T @ S.T = [
|
|
156
|
+
[1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 ...]
|
|
157
|
+
[0 0 0 0 0 1 1 1 1 1 0 0 0 0 0 ...]
|
|
158
|
+
[0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 ...]
|
|
159
|
+
...
|
|
160
|
+
]
|
|
161
|
+
In this function, the permutation is achieved by using matrix reshapes.
|
|
162
|
+
|
|
163
|
+
3. Set C_trans.T @ C_sum^(c) @ C_sum^(c).T @ C_trans
|
|
164
|
+
= [(C_trans.T @ S.T) @ (S @ C_sum^(c))] @ [(C_sum^(c).T @ S.T) @ (S @ C_trans)]
|
|
165
|
+
= [T_1, T_2, ..., T_N33]
|
|
166
|
+
@ (S @ C_sum^(c)) @ (C_sum^(c).T @ S.T)
|
|
167
|
+
@ [T_1, T_2, ..., T_N33].T
|
|
168
|
+
= \sum_i t_i @ t_i.T,
|
|
169
|
+
where t_i = \sum_c T_i[:, c].
|
|
170
|
+
t_i is represented by c_sum_cplmt.T in this function.
|
|
171
|
+
T_i is the submatrix of size (N, n_aN33) of permuted C_trans.
|
|
172
|
+
|
|
173
|
+
4. Compute P^(c) = \sum_i (n_a_compress_mat.T @ t_i) @ (t_i.T @ n_a_compress_mat)
|
|
174
|
+
|
|
175
|
+
5. Compute P = I - P^(c)
|
|
126
176
|
"""
|
|
127
177
|
n_lp, natom = trans_perms.shape
|
|
128
178
|
NN9 = natom**2 * 9
|
|
@@ -184,18 +234,66 @@ def compressed_projector_sum_rules_O2_stable(
|
|
|
184
234
|
n_batch: int = 1,
|
|
185
235
|
use_mkl: bool = False,
|
|
186
236
|
) -> csr_array:
|
|
187
|
-
"""Return projection matrix for sum rule.
|
|
237
|
+
r"""Return projection matrix for translational sum rule.
|
|
188
238
|
|
|
189
|
-
Calculate a
|
|
190
|
-
This is
|
|
191
|
-
|
|
192
|
-
|
|
239
|
+
Calculate a compressed projector for translational sum rules.
|
|
240
|
+
This compression is achieved using C_trans and n_a_compress_mat,
|
|
241
|
+
without the need to allocate C_trans. The implementation utilizes
|
|
242
|
+
get_atomic_lat_trans_decompr_indices_O3 to ensure efficient memory usage.
|
|
193
243
|
|
|
194
244
|
Return
|
|
195
245
|
------
|
|
196
|
-
Compressed projector I - P^(c)
|
|
197
|
-
|
|
198
|
-
|
|
246
|
+
Compressed projector I - P^(c).
|
|
247
|
+
I - P^(c)
|
|
248
|
+
= n_a_compress_mat.T @ C_trans.T
|
|
249
|
+
@ [I - C_sum^(c) @ C_sum^(c).T] @ C_trans @ n_a_compress_mat
|
|
250
|
+
= I - [n_a_compress_mat.T @ C_trans.T @ C_sum^(c)]
|
|
251
|
+
@ [C_sum^(c).T @ C_trans @ n_a_compress_mat]
|
|
252
|
+
|
|
253
|
+
Algorithm
|
|
254
|
+
---------
|
|
255
|
+
1. C_sum^(c).T = [I, I, I, ...] of size (27N, 27N^2).
|
|
256
|
+
I denotes the unit matrix of size (27N, 27N).
|
|
257
|
+
C_sum^(c).T is composed of N unit matrices.
|
|
258
|
+
In this representation, the translational sum rules are given by
|
|
259
|
+
\sum_i FC2(i, j, a, b) = 0.
|
|
260
|
+
|
|
261
|
+
2. To divide the computation of a compressed projector into several batches,
|
|
262
|
+
C_sum^(c) and C_trans are permuted from the index order of (i, j, a, b)
|
|
263
|
+
to (a, b, j, i).
|
|
264
|
+
This is represented by C_sum^(c).T @ C_trans = C_sum^(c).T @ S.T @ S @ C_trans,
|
|
265
|
+
where S denotes the permutation matrix that changes the index order to
|
|
266
|
+
(a, b, j, i). Using this permutation, the translational sum rules are
|
|
267
|
+
represented as
|
|
268
|
+
C_sum^(c).T @ S.T = [
|
|
269
|
+
[1_N.T, 0_N.T, 0_N.T, ...]
|
|
270
|
+
[0_N.T, 1_N.T, 0_N.T, ...]
|
|
271
|
+
[0_N.T, 0_N.T, 1_N.T, ...]
|
|
272
|
+
...
|
|
273
|
+
],
|
|
274
|
+
where 1_N and 0_N are column vectors of size N with all elements
|
|
275
|
+
equal to one and zero, respectively.
|
|
276
|
+
(Example) C_sum^(c).T @ S.T = [
|
|
277
|
+
[1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 ...]
|
|
278
|
+
[0 0 0 0 0 1 1 1 1 1 0 0 0 0 0 ...]
|
|
279
|
+
[0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 ...]
|
|
280
|
+
...
|
|
281
|
+
]
|
|
282
|
+
In this function, the permutation is achieved by using matrix reshapes.
|
|
283
|
+
|
|
284
|
+
3. Set C_trans.T @ C_sum^(c) @ C_sum^(c).T @ C_trans
|
|
285
|
+
= [(C_trans.T @ S.T) @ (S @ C_sum^(c))] @ [(C_sum^(c).T @ S.T) @ (S @ C_trans)]
|
|
286
|
+
= [T_1, T_2, ..., T_N33]
|
|
287
|
+
@ (S @ C_sum^(c)) @ (C_sum^(c).T @ S.T)
|
|
288
|
+
@ [T_1, T_2, ..., T_N33].T
|
|
289
|
+
= \sum_i t_i @ t_i.T,
|
|
290
|
+
where t_i = \sum_c T_i[:, c].
|
|
291
|
+
t_i is represented by c_sum_cplmt.T in this function.
|
|
292
|
+
T_i is the submatrix of size (N, n_aN33) of permuted C_trans.
|
|
293
|
+
|
|
294
|
+
4. Compute P^(c) = \sum_i (n_a_compress_mat.T @ t_i) @ (t_i.T @ n_a_compress_mat)
|
|
295
|
+
|
|
296
|
+
5. Compute P = I - P^(c)
|
|
199
297
|
"""
|
|
200
298
|
n_lp, natom = trans_perms.shape
|
|
201
299
|
NN9 = natom**2 * 9
|
|
@@ -7,7 +7,8 @@ import scipy
|
|
|
7
7
|
from scipy.sparse import csr_array, vstack
|
|
8
8
|
|
|
9
9
|
from symfc.utils.cutoff_tools import FCCutoff
|
|
10
|
-
from symfc.utils.matrix_tools import
|
|
10
|
+
from symfc.utils.matrix_tools import permutation_dot_lat_trans
|
|
11
|
+
from symfc.utils.permutation_tools import get_combinations
|
|
11
12
|
from symfc.utils.solver_funcs import get_batch_slice
|
|
12
13
|
from symfc.utils.utils import get_indep_atoms_by_lat_trans
|
|
13
14
|
from symfc.utils.utils_O3 import get_atomic_lat_trans_decompr_indices_O3
|
|
@@ -317,18 +318,67 @@ def compressed_projector_sum_rules_O3(
|
|
|
317
318
|
use_mkl: bool = False,
|
|
318
319
|
verbose: bool = False,
|
|
319
320
|
) -> csr_array:
|
|
320
|
-
"""Return projection matrix for sum rule.
|
|
321
|
+
r"""Return projection matrix for translational sum rule.
|
|
321
322
|
|
|
322
|
-
Calculate a
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
323
|
+
Calculate a compressed projector for translational sum rules
|
|
324
|
+
efficiently using independent atom with respect to lattice translations.
|
|
325
|
+
This compression is achieved using C_trans and n_a_compress_mat,
|
|
326
|
+
without the need to allocate C_trans. The implementation utilizes
|
|
327
|
+
get_atomic_lat_trans_decompr_indices_O3 to ensure efficient memory usage.
|
|
326
328
|
|
|
327
329
|
Return
|
|
328
330
|
------
|
|
329
|
-
Compressed projector I - P^(c)
|
|
330
|
-
|
|
331
|
-
|
|
331
|
+
Compressed projector I - P^(c).
|
|
332
|
+
I - P^(c)
|
|
333
|
+
= n_a_compress_mat.T @ C_trans.T
|
|
334
|
+
@ [I - C_sum^(c) @ C_sum^(c).T] @ C_trans @ n_a_compress_mat
|
|
335
|
+
= I - [n_a_compress_mat.T @ C_trans.T @ C_sum^(c)]
|
|
336
|
+
@ [C_sum^(c).T @ C_trans @ n_a_compress_mat]
|
|
337
|
+
|
|
338
|
+
Algorithm
|
|
339
|
+
---------
|
|
340
|
+
1. C_sum^(c).T = [I, I, I, ...] of size (27N^2, 27N^3).
|
|
341
|
+
I denotes the unit matrix of size (27N^2, 27N^2).
|
|
342
|
+
C_sum^(c).T is composed of N unit matrices.
|
|
343
|
+
In this representation, the translational sum rules are given by
|
|
344
|
+
\sum_i FC3(i, j, k, a, b, c) = 0.
|
|
345
|
+
|
|
346
|
+
2. To divide the computation of a compressed projector into several batches,
|
|
347
|
+
C_sum^(c) and C_trans are permuted from the index order of (i, j, k, a, b, c)
|
|
348
|
+
to (a, b, c, j, k, i).
|
|
349
|
+
This is represented by C_sum^(c).T @ C_trans = C_sum^(c).T @ S.T @ S @ C_trans,
|
|
350
|
+
where S denotes the permutation matrix that changes the index order to
|
|
351
|
+
(a, b, c, j, k, i). Using this permutation, the translational sum rules are
|
|
352
|
+
represented as
|
|
353
|
+
C_sum^(c).T @ S.T = [
|
|
354
|
+
[1_N.T, 0_N.T, 0_N.T, ...]
|
|
355
|
+
[0_N.T, 1_N.T, 0_N.T, ...]
|
|
356
|
+
[0_N.T, 0_N.T, 1_N.T, ...]
|
|
357
|
+
...
|
|
358
|
+
],
|
|
359
|
+
where 1_N and 0_N are column vectors of size N with all elements
|
|
360
|
+
equal to one and zero, respectively.
|
|
361
|
+
(Example) C_sum^(c).T @ S.T = [
|
|
362
|
+
[1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 ...]
|
|
363
|
+
[0 0 0 0 0 1 1 1 1 1 0 0 0 0 0 ...]
|
|
364
|
+
[0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 ...]
|
|
365
|
+
...
|
|
366
|
+
]
|
|
367
|
+
In this function, the permutation is achieved by using matrix reshapes.
|
|
368
|
+
|
|
369
|
+
3. Set C_trans.T @ C_sum^(c) @ C_sum^(c).T @ C_trans
|
|
370
|
+
= [(C_trans.T @ S.T) @ (S @ C_sum^(c))] @ [(C_sum^(c).T @ S.T) @ (S @ C_trans)]
|
|
371
|
+
= [T_1, T_2, ..., T_NN333]
|
|
372
|
+
@ (S @ C_sum^(c)) @ (C_sum^(c).T @ S.T)
|
|
373
|
+
@ [T_1, T_2, ..., T_NN333].T
|
|
374
|
+
= \sum_i t_i @ t_i.T,
|
|
375
|
+
where t_i = \sum_c T_i[:, c].
|
|
376
|
+
t_i is represented by c_sum_cplmt.T in this function.
|
|
377
|
+
T_i is the submatrix of size (N, n_aNN333) of permuted C_trans.
|
|
378
|
+
|
|
379
|
+
4. Compute P^(c) = \sum_i (n_a_compress_mat.T @ t_i) @ (t_i.T @ n_a_compress_mat)
|
|
380
|
+
|
|
381
|
+
5. Compute P = I - P^(c)
|
|
332
382
|
"""
|
|
333
383
|
n_lp, natom = trans_perms.shape
|
|
334
384
|
NNN27 = natom**3 * 27
|
|
@@ -394,18 +444,66 @@ def compressed_projector_sum_rules_O3_stable(
|
|
|
394
444
|
use_mkl: bool = False,
|
|
395
445
|
verbose: bool = False,
|
|
396
446
|
) -> csr_array:
|
|
397
|
-
"""Return projection matrix for sum rule.
|
|
447
|
+
r"""Return projection matrix for translational sum rule.
|
|
398
448
|
|
|
399
|
-
Calculate a
|
|
400
|
-
This is
|
|
401
|
-
|
|
402
|
-
|
|
449
|
+
Calculate a compressed projector for translational sum rules.
|
|
450
|
+
This compression is achieved using C_trans and n_a_compress_mat,
|
|
451
|
+
without the need to allocate C_trans. The implementation utilizes
|
|
452
|
+
get_atomic_lat_trans_decompr_indices_O3 to ensure efficient memory usage.
|
|
403
453
|
|
|
404
454
|
Return
|
|
405
455
|
------
|
|
406
|
-
Compressed projector I - P^(c)
|
|
407
|
-
|
|
408
|
-
|
|
456
|
+
Compressed projector I - P^(c).
|
|
457
|
+
I - P^(c)
|
|
458
|
+
= n_a_compress_mat.T @ C_trans.T
|
|
459
|
+
@ [I - C_sum^(c) @ C_sum^(c).T] @ C_trans @ n_a_compress_mat
|
|
460
|
+
= I - [n_a_compress_mat.T @ C_trans.T @ C_sum^(c)]
|
|
461
|
+
@ [C_sum^(c).T @ C_trans @ n_a_compress_mat]
|
|
462
|
+
|
|
463
|
+
Algorithm
|
|
464
|
+
---------
|
|
465
|
+
1. C_sum^(c).T = [I, I, I, ...] of size (27N^2, 27N^3).
|
|
466
|
+
I denotes the unit matrix of size (27N^2, 27N^2).
|
|
467
|
+
C_sum^(c).T is composed of N unit matrices.
|
|
468
|
+
In this representation, the translational sum rules are given by
|
|
469
|
+
\sum_i FC3(i, j, k, a, b, c) = 0.
|
|
470
|
+
|
|
471
|
+
2. To divide the computation of a compressed projector into several batches,
|
|
472
|
+
C_sum^(c) and C_trans are permuted from the index order of (i, j, k, a, b, c)
|
|
473
|
+
to (a, b, c, j, k, i).
|
|
474
|
+
This is represented by C_sum^(c).T @ C_trans = C_sum^(c).T @ S.T @ S @ C_trans,
|
|
475
|
+
where S denotes the permutation matrix that changes the index order to
|
|
476
|
+
(a, b, c, j, k, i). Using this permutation, the translational sum rules are
|
|
477
|
+
represented as
|
|
478
|
+
C_sum^(c).T @ S.T = [
|
|
479
|
+
[1_N.T, 0_N.T, 0_N.T, ...]
|
|
480
|
+
[0_N.T, 1_N.T, 0_N.T, ...]
|
|
481
|
+
[0_N.T, 0_N.T, 1_N.T, ...]
|
|
482
|
+
...
|
|
483
|
+
],
|
|
484
|
+
where 1_N and 0_N are column vectors of size N with all elements
|
|
485
|
+
equal to one and zero, respectively.
|
|
486
|
+
(Example) C_sum^(c).T @ S.T = [
|
|
487
|
+
[1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 ...]
|
|
488
|
+
[0 0 0 0 0 1 1 1 1 1 0 0 0 0 0 ...]
|
|
489
|
+
[0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 ...]
|
|
490
|
+
...
|
|
491
|
+
]
|
|
492
|
+
In this function, the permutation is achieved by using matrix reshapes.
|
|
493
|
+
|
|
494
|
+
3. Set C_trans.T @ C_sum^(c) @ C_sum^(c).T @ C_trans
|
|
495
|
+
= [(C_trans.T @ S.T) @ (S @ C_sum^(c))] @ [(C_sum^(c).T @ S.T) @ (S @ C_trans)]
|
|
496
|
+
= [T_1, T_2, ..., T_NN333]
|
|
497
|
+
@ (S @ C_sum^(c)) @ (C_sum^(c).T @ S.T)
|
|
498
|
+
@ [T_1, T_2, ..., T_NN333].T
|
|
499
|
+
= \sum_i t_i @ t_i.T,
|
|
500
|
+
where t_i = \sum_c T_i[:, c].
|
|
501
|
+
t_i is represented by c_sum_cplmt.T in this function.
|
|
502
|
+
T_i is the submatrix of size (N, n_aNN333) of permuted C_trans.
|
|
503
|
+
|
|
504
|
+
4. Compute P^(c) = \sum_i (n_a_compress_mat.T @ t_i) @ (t_i.T @ n_a_compress_mat)
|
|
505
|
+
|
|
506
|
+
5. Compute P = I - P^(c)
|
|
409
507
|
"""
|
|
410
508
|
n_lp, natom = trans_perms.shape
|
|
411
509
|
NNN27 = natom**3 * 27
|
|
@@ -8,7 +8,8 @@ import scipy
|
|
|
8
8
|
from scipy.sparse import csr_array, vstack
|
|
9
9
|
|
|
10
10
|
from symfc.utils.cutoff_tools import FCCutoff
|
|
11
|
-
from symfc.utils.matrix_tools import
|
|
11
|
+
from symfc.utils.matrix_tools import permutation_dot_lat_trans
|
|
12
|
+
from symfc.utils.permutation_tools import get_combinations
|
|
12
13
|
from symfc.utils.solver_funcs import get_batch_slice
|
|
13
14
|
from symfc.utils.utils import get_indep_atoms_by_lat_trans
|
|
14
15
|
from symfc.utils.utils_O4 import get_atomic_lat_trans_decompr_indices_O4
|
|
@@ -255,7 +256,7 @@ def optimize_batch_size_sum_rules_O4(natom: int, n_batch: Optional[int] = None):
|
|
|
255
256
|
return batch_size
|
|
256
257
|
|
|
257
258
|
|
|
258
|
-
def
|
|
259
|
+
def compressed_projector_sum_rules_O4_stable(
|
|
259
260
|
trans_perms: np.ndarray,
|
|
260
261
|
n_a_compress_mat: csr_array,
|
|
261
262
|
atomic_decompr_idx: Optional[np.ndarray] = None,
|
|
@@ -264,18 +265,66 @@ def compressed_projector_sum_rules_O4(
|
|
|
264
265
|
use_mkl: bool = False,
|
|
265
266
|
verbose: bool = False,
|
|
266
267
|
) -> csr_array:
|
|
267
|
-
"""Return projection matrix for sum rule.
|
|
268
|
+
r"""Return projection matrix for translational sum rule.
|
|
268
269
|
|
|
269
|
-
Calculate a
|
|
270
|
-
This is
|
|
271
|
-
|
|
272
|
-
|
|
270
|
+
Calculate a compressed projector for translational sum rules.
|
|
271
|
+
This compression is achieved using C_trans and n_a_compress_mat,
|
|
272
|
+
without the need to allocate C_trans. The implementation utilizes
|
|
273
|
+
get_atomic_lat_trans_decompr_indices_O4 to ensure efficient memory usage.
|
|
273
274
|
|
|
274
275
|
Return
|
|
275
276
|
------
|
|
276
|
-
Compressed projector I - P^(c)
|
|
277
|
-
|
|
278
|
-
|
|
277
|
+
Compressed projector I - P^(c).
|
|
278
|
+
I - P^(c)
|
|
279
|
+
= n_a_compress_mat.T @ C_trans.T
|
|
280
|
+
@ [I - C_sum^(c) @ C_sum^(c).T] @ C_trans @ n_a_compress_mat
|
|
281
|
+
= I - [n_a_compress_mat.T @ C_trans.T @ C_sum^(c)]
|
|
282
|
+
@ [C_sum^(c).T @ C_trans @ n_a_compress_mat]
|
|
283
|
+
|
|
284
|
+
Algorithm
|
|
285
|
+
---------
|
|
286
|
+
1. C_sum^(c).T = [I, I, I, ...] of size (27N^3, 27N^4).
|
|
287
|
+
I denotes the unit matrix of size (27N^3, 27N^3).
|
|
288
|
+
C_sum^(c).T is composed of N unit matrices.
|
|
289
|
+
In this representation, the translational sum rules are given by
|
|
290
|
+
\sum_i FC4(i, j, k, l, a, b, c, d) = 0.
|
|
291
|
+
|
|
292
|
+
2. To divide the computation of a compressed projector into several batches,
|
|
293
|
+
C_sum^(c) and C_trans are permuted from the index order of
|
|
294
|
+
(i, j, k, l, a, b, c, d) to (a, b, c, d, j, k, l, i).
|
|
295
|
+
This is represented by C_sum^(c).T @ C_trans = C_sum^(c).T @ S.T @ S @ C_trans,
|
|
296
|
+
where S denotes the permutation matrix that changes the index order to
|
|
297
|
+
(a, b, c, d, j, k, l, i). Using this permutation, the translational sum rules are
|
|
298
|
+
represented as
|
|
299
|
+
C_sum^(c).T @ S.T = [
|
|
300
|
+
[1_N.T, 0_N.T, 0_N.T, ...]
|
|
301
|
+
[0_N.T, 1_N.T, 0_N.T, ...]
|
|
302
|
+
[0_N.T, 0_N.T, 1_N.T, ...]
|
|
303
|
+
...
|
|
304
|
+
],
|
|
305
|
+
where 1_N and 0_N are column vectors of size N with all elements
|
|
306
|
+
equal to one and zero, respectively.
|
|
307
|
+
(Example) C_sum^(c).T @ S.T = [
|
|
308
|
+
[1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 ...]
|
|
309
|
+
[0 0 0 0 0 1 1 1 1 1 0 0 0 0 0 ...]
|
|
310
|
+
[0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 ...]
|
|
311
|
+
...
|
|
312
|
+
]
|
|
313
|
+
In this function, the permutation is achieved by using matrix reshapes.
|
|
314
|
+
|
|
315
|
+
3. Set C_trans.T @ C_sum^(c) @ C_sum^(c).T @ C_trans
|
|
316
|
+
= [(C_trans.T @ S.T) @ (S @ C_sum^(c))] @ [(C_sum^(c).T @ S.T) @ (S @ C_trans)]
|
|
317
|
+
= [T_1, T_2, ..., T_NNN3333]
|
|
318
|
+
@ (S @ C_sum^(c)) @ (C_sum^(c).T @ S.T)
|
|
319
|
+
@ [T_1, T_2, ..., T_NNN3333].T
|
|
320
|
+
= \sum_i t_i @ t_i.T,
|
|
321
|
+
where t_i = \sum_c T_i[:, c].
|
|
322
|
+
t_i is represented by c_sum_cplmt.T in this function.
|
|
323
|
+
T_i is the submatrix of size (N, n_aNNN333) of permuted C_trans.
|
|
324
|
+
|
|
325
|
+
4. Compute P^(c) = \sum_i (n_a_compress_mat.T @ t_i) @ (t_i.T @ n_a_compress_mat)
|
|
326
|
+
|
|
327
|
+
5. Compute P = I - P^(c)
|
|
279
328
|
"""
|
|
280
329
|
n_lp, natom = trans_perms.shape
|
|
281
330
|
NNNN81 = natom**4 * 81
|
|
@@ -337,7 +386,7 @@ def compressed_projector_sum_rules_O4(
|
|
|
337
386
|
return scipy.sparse.identity(proj_cplmt.shape[0]) - proj_cplmt
|
|
338
387
|
|
|
339
388
|
|
|
340
|
-
def
|
|
389
|
+
def compressed_projector_sum_rules_O4(
|
|
341
390
|
trans_perms: np.ndarray,
|
|
342
391
|
n_a_compress_mat: csr_array,
|
|
343
392
|
atomic_decompr_idx: Optional[np.ndarray] = None,
|
|
@@ -346,18 +395,67 @@ def compressed_projector_sum_rules_O4_indep_atoms(
|
|
|
346
395
|
use_mkl: bool = False,
|
|
347
396
|
verbose: bool = False,
|
|
348
397
|
) -> csr_array:
|
|
349
|
-
"""Return projection matrix for sum rule.
|
|
398
|
+
r"""Return projection matrix for translational sum rule.
|
|
350
399
|
|
|
351
|
-
Calculate a
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
400
|
+
Calculate a compressed projector for translational sum rules
|
|
401
|
+
efficiently using independent atom with respect to lattice translations.
|
|
402
|
+
This compression is achieved using C_trans and n_a_compress_mat,
|
|
403
|
+
without the need to allocate C_trans. The implementation utilizes
|
|
404
|
+
get_atomic_lat_trans_decompr_indices_O4 to ensure efficient memory usage.
|
|
355
405
|
|
|
356
406
|
Return
|
|
357
407
|
------
|
|
358
|
-
Compressed projector I - P^(c)
|
|
359
|
-
|
|
360
|
-
|
|
408
|
+
Compressed projector I - P^(c).
|
|
409
|
+
I - P^(c)
|
|
410
|
+
= n_a_compress_mat.T @ C_trans.T
|
|
411
|
+
@ [I - C_sum^(c) @ C_sum^(c).T] @ C_trans @ n_a_compress_mat
|
|
412
|
+
= I - [n_a_compress_mat.T @ C_trans.T @ C_sum^(c)]
|
|
413
|
+
@ [C_sum^(c).T @ C_trans @ n_a_compress_mat]
|
|
414
|
+
|
|
415
|
+
Algorithm
|
|
416
|
+
---------
|
|
417
|
+
1. C_sum^(c).T = [I, I, I, ...] of size (27N^3, 27N^4).
|
|
418
|
+
I denotes the unit matrix of size (27N^3, 27N^3).
|
|
419
|
+
C_sum^(c).T is composed of N unit matrices.
|
|
420
|
+
In this representation, the translational sum rules are given by
|
|
421
|
+
\sum_i FC4(i, j, k, l, a, b, c, d) = 0.
|
|
422
|
+
|
|
423
|
+
2. To divide the computation of a compressed projector into several batches,
|
|
424
|
+
C_sum^(c) and C_trans are permuted from the index order of
|
|
425
|
+
(i, j, k, l, a, b, c, d) to (a, b, c, d, j, k, l, i).
|
|
426
|
+
This is represented by C_sum^(c).T @ C_trans = C_sum^(c).T @ S.T @ S @ C_trans,
|
|
427
|
+
where S denotes the permutation matrix that changes the index order to
|
|
428
|
+
(a, b, c, d, j, k, l, i). Using this permutation, the translational sum rules are
|
|
429
|
+
represented as
|
|
430
|
+
C_sum^(c).T @ S.T = [
|
|
431
|
+
[1_N.T, 0_N.T, 0_N.T, ...]
|
|
432
|
+
[0_N.T, 1_N.T, 0_N.T, ...]
|
|
433
|
+
[0_N.T, 0_N.T, 1_N.T, ...]
|
|
434
|
+
...
|
|
435
|
+
],
|
|
436
|
+
where 1_N and 0_N are column vectors of size N with all elements
|
|
437
|
+
equal to one and zero, respectively.
|
|
438
|
+
(Example) C_sum^(c).T @ S.T = [
|
|
439
|
+
[1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 ...]
|
|
440
|
+
[0 0 0 0 0 1 1 1 1 1 0 0 0 0 0 ...]
|
|
441
|
+
[0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 ...]
|
|
442
|
+
...
|
|
443
|
+
]
|
|
444
|
+
In this function, the permutation is achieved by using matrix reshapes.
|
|
445
|
+
|
|
446
|
+
3. Set C_trans.T @ C_sum^(c) @ C_sum^(c).T @ C_trans
|
|
447
|
+
= [(C_trans.T @ S.T) @ (S @ C_sum^(c))] @ [(C_sum^(c).T @ S.T) @ (S @ C_trans)]
|
|
448
|
+
= [T_1, T_2, ..., T_NNN3333]
|
|
449
|
+
@ (S @ C_sum^(c)) @ (C_sum^(c).T @ S.T)
|
|
450
|
+
@ [T_1, T_2, ..., T_NNN3333].T
|
|
451
|
+
= \sum_i t_i @ t_i.T,
|
|
452
|
+
where t_i = \sum_c T_i[:, c].
|
|
453
|
+
t_i is represented by c_sum_cplmt.T in this function.
|
|
454
|
+
T_i is the submatrix of size (N, n_aNNN333) of permuted C_trans.
|
|
455
|
+
|
|
456
|
+
4. Compute P^(c) = \sum_i (n_a_compress_mat.T @ t_i) @ (t_i.T @ n_a_compress_mat)
|
|
457
|
+
|
|
458
|
+
5. Compute P = I - P^(c)
|
|
361
459
|
"""
|
|
362
460
|
n_lp, natom = trans_perms.shape
|
|
363
461
|
NNNN81 = natom**4 * 81
|