symfc 1.2.2__tar.gz → 1.3.0__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.
Files changed (109) hide show
  1. {symfc-1.2.2/src/symfc.egg-info → symfc-1.3.0}/PKG-INFO +1 -1
  2. {symfc-1.2.2 → symfc-1.3.0}/src/symfc/api_symfc.py +59 -2
  3. {symfc-1.2.2 → symfc-1.3.0}/src/symfc/basis_sets/__init__.py +1 -0
  4. {symfc-1.2.2 → symfc-1.3.0}/src/symfc/basis_sets/basis_sets_O2.py +18 -0
  5. {symfc-1.2.2 → symfc-1.3.0}/src/symfc/basis_sets/basis_sets_O3.py +18 -0
  6. {symfc-1.2.2 → symfc-1.3.0}/src/symfc/basis_sets/basis_sets_O4.py +18 -0
  7. {symfc-1.2.2 → symfc-1.3.0}/src/symfc/version.py +1 -1
  8. {symfc-1.2.2 → symfc-1.3.0/src/symfc.egg-info}/PKG-INFO +1 -1
  9. {symfc-1.2.2 → symfc-1.3.0}/tests/conftest.py +9 -3
  10. {symfc-1.2.2 → symfc-1.3.0}/tests/test_api.py +15 -0
  11. {symfc-1.2.2 → symfc-1.3.0}/LICENSE +0 -0
  12. {symfc-1.2.2 → symfc-1.3.0}/MANIFEST.in +0 -0
  13. {symfc-1.2.2 → symfc-1.3.0}/README.md +0 -0
  14. {symfc-1.2.2 → symfc-1.3.0}/pyproject.toml +0 -0
  15. {symfc-1.2.2 → symfc-1.3.0}/setup.cfg +0 -0
  16. {symfc-1.2.2 → symfc-1.3.0}/src/symfc/__init__.py +0 -0
  17. {symfc-1.2.2 → symfc-1.3.0}/src/symfc/basis_sets/basis_sets_O1.py +0 -0
  18. {symfc-1.2.2 → symfc-1.3.0}/src/symfc/basis_sets/basis_sets_base.py +0 -0
  19. {symfc-1.2.2 → symfc-1.3.0}/src/symfc/solvers/__init__.py +0 -0
  20. {symfc-1.2.2 → symfc-1.3.0}/src/symfc/solvers/solver_O2.py +0 -0
  21. {symfc-1.2.2 → symfc-1.3.0}/src/symfc/solvers/solver_O2O3.py +0 -0
  22. {symfc-1.2.2 → symfc-1.3.0}/src/symfc/solvers/solver_O2O3O4.py +0 -0
  23. {symfc-1.2.2 → symfc-1.3.0}/src/symfc/solvers/solver_O3.py +0 -0
  24. {symfc-1.2.2 → symfc-1.3.0}/src/symfc/solvers/solver_O3O4.py +0 -0
  25. {symfc-1.2.2 → symfc-1.3.0}/src/symfc/solvers/solver_O4.py +0 -0
  26. {symfc-1.2.2 → symfc-1.3.0}/src/symfc/solvers/solver_base.py +0 -0
  27. {symfc-1.2.2 → symfc-1.3.0}/src/symfc/spg_reps/__init__.py +0 -0
  28. {symfc-1.2.2 → symfc-1.3.0}/src/symfc/spg_reps/spg_reps_O1.py +0 -0
  29. {symfc-1.2.2 → symfc-1.3.0}/src/symfc/spg_reps/spg_reps_O2.py +0 -0
  30. {symfc-1.2.2 → symfc-1.3.0}/src/symfc/spg_reps/spg_reps_O3.py +0 -0
  31. {symfc-1.2.2 → symfc-1.3.0}/src/symfc/spg_reps/spg_reps_O4.py +0 -0
  32. {symfc-1.2.2 → symfc-1.3.0}/src/symfc/spg_reps/spg_reps_base.py +0 -0
  33. {symfc-1.2.2 → symfc-1.3.0}/src/symfc/utils/__init__.py +0 -0
  34. {symfc-1.2.2 → symfc-1.3.0}/src/symfc/utils/cutoff_tools.py +0 -0
  35. {symfc-1.2.2 → symfc-1.3.0}/src/symfc/utils/eig_tools.py +0 -0
  36. {symfc-1.2.2 → symfc-1.3.0}/src/symfc/utils/matrix_tools.py +0 -0
  37. {symfc-1.2.2 → symfc-1.3.0}/src/symfc/utils/matrix_tools_O1.py +0 -0
  38. {symfc-1.2.2 → symfc-1.3.0}/src/symfc/utils/matrix_tools_O2.py +0 -0
  39. {symfc-1.2.2 → symfc-1.3.0}/src/symfc/utils/matrix_tools_O3.py +0 -0
  40. {symfc-1.2.2 → symfc-1.3.0}/src/symfc/utils/matrix_tools_O4.py +0 -0
  41. {symfc-1.2.2 → symfc-1.3.0}/src/symfc/utils/permutation_tools.py +0 -0
  42. {symfc-1.2.2 → symfc-1.3.0}/src/symfc/utils/permutation_tools_O2.py +0 -0
  43. {symfc-1.2.2 → symfc-1.3.0}/src/symfc/utils/permutation_tools_O3.py +0 -0
  44. {symfc-1.2.2 → symfc-1.3.0}/src/symfc/utils/permutation_tools_O4.py +0 -0
  45. {symfc-1.2.2 → symfc-1.3.0}/src/symfc/utils/rotation_tools_O2.py +0 -0
  46. {symfc-1.2.2 → symfc-1.3.0}/src/symfc/utils/run_rotation_tools_O2.py +0 -0
  47. {symfc-1.2.2 → symfc-1.3.0}/src/symfc/utils/run_rotation_tools_O3.py +0 -0
  48. {symfc-1.2.2 → symfc-1.3.0}/src/symfc/utils/run_test_O2.py +0 -0
  49. {symfc-1.2.2 → symfc-1.3.0}/src/symfc/utils/solver_funcs.py +0 -0
  50. {symfc-1.2.2 → symfc-1.3.0}/src/symfc/utils/utils.py +0 -0
  51. {symfc-1.2.2 → symfc-1.3.0}/src/symfc/utils/utils_O1.py +0 -0
  52. {symfc-1.2.2 → symfc-1.3.0}/src/symfc/utils/utils_O2.py +0 -0
  53. {symfc-1.2.2 → symfc-1.3.0}/src/symfc/utils/utils_O3.py +0 -0
  54. {symfc-1.2.2 → symfc-1.3.0}/src/symfc/utils/utils_O4.py +0 -0
  55. {symfc-1.2.2 → symfc-1.3.0}/src/symfc.egg-info/SOURCES.txt +0 -0
  56. {symfc-1.2.2 → symfc-1.3.0}/src/symfc.egg-info/dependency_links.txt +0 -0
  57. {symfc-1.2.2 → symfc-1.3.0}/src/symfc.egg-info/requires.txt +0 -0
  58. {symfc-1.2.2 → symfc-1.3.0}/src/symfc.egg-info/top_level.txt +0 -0
  59. {symfc-1.2.2 → symfc-1.3.0}/tests/NaCl-unitcell.yaml +0 -0
  60. {symfc-1.2.2 → symfc-1.3.0}/tests/basis_sets/test_basis_sets_O2.py +0 -0
  61. {symfc-1.2.2 → symfc-1.3.0}/tests/basis_sets/test_basis_sets_O3.py +0 -0
  62. {symfc-1.2.2 → symfc-1.3.0}/tests/basis_sets/test_basis_sets_O4.py +0 -0
  63. {symfc-1.2.2 → symfc-1.3.0}/tests/basis_sets/test_basis_sets_base.py +0 -0
  64. {symfc-1.2.2 → symfc-1.3.0}/tests/compact_fc_GaN_222.xz +0 -0
  65. {symfc-1.2.2 → symfc-1.3.0}/tests/compact_fc_GaN_442.xz +0 -0
  66. {symfc-1.2.2 → symfc-1.3.0}/tests/compact_fc_NaCl_222.xz +0 -0
  67. {symfc-1.2.2 → symfc-1.3.0}/tests/compact_fc_SiO2_221.xz +0 -0
  68. {symfc-1.2.2 → symfc-1.3.0}/tests/compact_fc_Si_111_fc3_2.xz +0 -0
  69. {symfc-1.2.2 → symfc-1.3.0}/tests/compact_fc_Si_111_fc3_3.xz +0 -0
  70. {symfc-1.2.2 → symfc-1.3.0}/tests/compact_fc_Si_111_fc4_2.xz +0 -0
  71. {symfc-1.2.2 → symfc-1.3.0}/tests/compact_fc_Si_111_fc4_3.xz +0 -0
  72. {symfc-1.2.2 → symfc-1.3.0}/tests/compact_fc_Si_111_fc4_4.xz +0 -0
  73. {symfc-1.2.2 → symfc-1.3.0}/tests/compact_fc_SnO2_223.xz +0 -0
  74. {symfc-1.2.2 → symfc-1.3.0}/tests/dfset_GaN_222_rd.xz +0 -0
  75. {symfc-1.2.2 → symfc-1.3.0}/tests/dfset_GaN_442_rd.xz +0 -0
  76. {symfc-1.2.2 → symfc-1.3.0}/tests/dfset_NaCl_222_rd.xz +0 -0
  77. {symfc-1.2.2 → symfc-1.3.0}/tests/dfset_SiO2_221_rd.xz +0 -0
  78. {symfc-1.2.2 → symfc-1.3.0}/tests/dfset_Si_111_fc3_rd.xz +0 -0
  79. {symfc-1.2.2 → symfc-1.3.0}/tests/dfset_SnO2_223_rd.xz +0 -0
  80. {symfc-1.2.2 → symfc-1.3.0}/tests/full_fc_NaCl_222.xz +0 -0
  81. {symfc-1.2.2 → symfc-1.3.0}/tests/full_fc_Si_111_fc3_2.xz +0 -0
  82. {symfc-1.2.2 → symfc-1.3.0}/tests/full_fc_Si_111_fc3_3.xz +0 -0
  83. {symfc-1.2.2 → symfc-1.3.0}/tests/full_fc_Si_111_fc4_2.xz +0 -0
  84. {symfc-1.2.2 → symfc-1.3.0}/tests/full_fc_Si_111_fc4_3.xz +0 -0
  85. {symfc-1.2.2 → symfc-1.3.0}/tests/full_fc_Si_111_fc4_4.xz +0 -0
  86. {symfc-1.2.2 → symfc-1.3.0}/tests/full_fc_Si_111_fc4_step_2.xz +0 -0
  87. {symfc-1.2.2 → symfc-1.3.0}/tests/full_fc_Si_111_fc4_step_3.xz +0 -0
  88. {symfc-1.2.2 → symfc-1.3.0}/tests/full_fc_Si_111_fc4_step_4.xz +0 -0
  89. {symfc-1.2.2 → symfc-1.3.0}/tests/full_fc_SnO2_223.xz +0 -0
  90. {symfc-1.2.2 → symfc-1.3.0}/tests/perms_super.dat +0 -0
  91. {symfc-1.2.2 → symfc-1.3.0}/tests/phonopy_to_python.py +0 -0
  92. {symfc-1.2.2 → symfc-1.3.0}/tests/solvers/test_solver_utils.py +0 -0
  93. {symfc-1.2.2 → symfc-1.3.0}/tests/spg_reps/test_spg_reps_O1.py +0 -0
  94. {symfc-1.2.2 → symfc-1.3.0}/tests/spg_reps/test_spg_reps_O2.py +0 -0
  95. {symfc-1.2.2 → symfc-1.3.0}/tests/spg_reps/test_spg_reps_O3.py +0 -0
  96. {symfc-1.2.2 → symfc-1.3.0}/tests/spg_reps/test_spg_reps_O4.py +0 -0
  97. {symfc-1.2.2 → symfc-1.3.0}/tests/spg_reps/test_spg_reps_base.py +0 -0
  98. {symfc-1.2.2 → symfc-1.3.0}/tests/utils/test_cutoff_tools.py +0 -0
  99. {symfc-1.2.2 → symfc-1.3.0}/tests/utils/test_eig_tools.py +0 -0
  100. {symfc-1.2.2 → symfc-1.3.0}/tests/utils/test_matrix_tools_O2.py +0 -0
  101. {symfc-1.2.2 → symfc-1.3.0}/tests/utils/test_matrix_tools_O3.py +0 -0
  102. {symfc-1.2.2 → symfc-1.3.0}/tests/utils/test_matrix_tools_O4.py +0 -0
  103. {symfc-1.2.2 → symfc-1.3.0}/tests/utils/test_solver_funcs.py +0 -0
  104. {symfc-1.2.2 → symfc-1.3.0}/tests/utils/test_utils.py +0 -0
  105. {symfc-1.2.2 → symfc-1.3.0}/tests/utils/test_utils_O1.py +0 -0
  106. {symfc-1.2.2 → symfc-1.3.0}/tests/utils/test_utils_O2.py +0 -0
  107. {symfc-1.2.2 → symfc-1.3.0}/tests/utils/test_utils_O2_2.py +0 -0
  108. {symfc-1.2.2 → symfc-1.3.0}/tests/utils/test_utils_O3.py +0 -0
  109. {symfc-1.2.2 → symfc-1.3.0}/tests/utils/test_utils_O4.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: symfc
3
- Version: 1.2.2
3
+ Version: 1.3.0
4
4
  Summary: This is the symfc module.
5
5
  Author-email: Atsuto Seko <seko@cms.mtl.kyoto-u.ac.jp>
6
6
  Maintainer-email: Atsushi Togo <atztogo@gmail.com>
@@ -67,6 +67,11 @@ class Symfc:
67
67
  self._force_constants: dict[np.ndarray] = {}
68
68
  self._prepare_cutoff(cutoff)
69
69
 
70
+ @property
71
+ def supercell(self) -> SymfcAtoms:
72
+ """Return supercell."""
73
+ return self._supercell
74
+
70
75
  @property
71
76
  def p2s_map(self) -> Optional[np.ndarray]:
72
77
  """Return indices of translationally independent atoms."""
@@ -276,8 +281,7 @@ class Symfc:
276
281
  orders: list
277
282
  Orders of force constants.
278
283
  """
279
- orders = self._check_orders(max_order, orders)
280
- for order in orders:
284
+ for order in self._check_orders(max_order, orders):
281
285
  if order == 2:
282
286
  basis_set_o2 = FCBasisSetO2(
283
287
  self._supercell,
@@ -306,6 +310,59 @@ class Symfc:
306
310
  self._basis_set[4] = basis_set_o4
307
311
  return self
308
312
 
313
+ def estimate_basis_size(
314
+ self,
315
+ max_order: Optional[int] = None,
316
+ orders: Optional[list] = None,
317
+ ) -> dict:
318
+ """Estimate the size of basis set.
319
+
320
+ Parameters
321
+ ----------
322
+ max_order : int
323
+ Maximum fc order.
324
+ orders: list
325
+ Orders of force constants.
326
+
327
+ Returns
328
+ -------
329
+ dict :
330
+ Estimates of basis set sizes for each order. The key of dict is the
331
+ order.
332
+ """
333
+ basis_size_estimates = {}
334
+ for order in self._check_orders(max_order, orders):
335
+ if order < 2 or order > 4:
336
+ raise NotImplementedError(
337
+ "Only fc2, fc3 and fc4 basis sets are implemented."
338
+ )
339
+
340
+ if order == 2:
341
+ basis_size_estimates[order] = FCBasisSetO2(
342
+ self._supercell,
343
+ spacegroup_operations=self._spacegroup_operations,
344
+ use_mkl=self._use_mkl,
345
+ log_level=self._log_level,
346
+ ).estimate_basis_size()
347
+ elif order == 3:
348
+ basis_size_estimates[order] = FCBasisSetO3(
349
+ self._supercell,
350
+ spacegroup_operations=self._spacegroup_operations,
351
+ cutoff=self._cutoff[3],
352
+ use_mkl=self._use_mkl,
353
+ log_level=self._log_level,
354
+ ).estimate_basis_size()
355
+ elif order == 4:
356
+ basis_size_estimates[order] = FCBasisSetO4(
357
+ self._supercell,
358
+ spacegroup_operations=self._spacegroup_operations,
359
+ cutoff=self._cutoff[4],
360
+ use_mkl=self._use_mkl,
361
+ log_level=self._log_level,
362
+ ).estimate_basis_size()
363
+
364
+ return basis_size_estimates
365
+
309
366
  def _check_orders(self, max_order: int, orders: list) -> tuple:
310
367
  if max_order is None and orders is None:
311
368
  raise RuntimeError("Maximum order and orders not found.")
@@ -1,6 +1,7 @@
1
1
  """Symmetry adapted basis sets of force constants."""
2
2
 
3
3
  from .basis_sets_base import FCBasisSetBase # noqa 401
4
+ from .basis_sets_O1 import FCBasisSetO1 # noqa 401
4
5
  from .basis_sets_O2 import FCBasisSetO2 # noqa 401
5
6
  from .basis_sets_O3 import FCBasisSetO3 # noqa 401
6
7
  from .basis_sets_O4 import FCBasisSetO4 # noqa 401
@@ -186,3 +186,21 @@ class FCBasisSetO2(FCBasisSetBase):
186
186
  self._n_a_compression_matrix = n_a_compress_mat
187
187
 
188
188
  return self
189
+
190
+ def estimate_basis_size(self) -> int:
191
+ """Estimate basis set size."""
192
+ if self._fc_cutoff is None:
193
+ n_sym, N = self._spg_reps._permutations.shape
194
+ basis_size_estimates = 9 * (N**2) / n_sym / 2
195
+ return int(np.round(basis_size_estimates).astype(int))
196
+
197
+ trans_perms = self._spg_reps.translation_permutations
198
+ c_pt = compr_permutation_lat_trans_O2(
199
+ trans_perms,
200
+ atomic_decompr_idx=self._atomic_decompr_idx,
201
+ fc_cutoff=self._fc_cutoff,
202
+ verbose=False,
203
+ )
204
+ n_sym_prim = len(self._spg_reps._unique_rotations)
205
+ basis_size_estimates = c_pt.shape[1] / n_sym_prim
206
+ return int(np.round(basis_size_estimates).astype(int))
@@ -250,3 +250,21 @@ class FCBasisSetO3(FCBasisSetBase):
250
250
  self._n_a_compression_matrix = n_a_compress_mat
251
251
 
252
252
  return self
253
+
254
+ def estimate_basis_size(self) -> int:
255
+ """Estimate basis set size."""
256
+ if self._fc_cutoff is None:
257
+ n_sym, N = self._spg_reps._permutations.shape
258
+ basis_size_estimates = 27 * (N**3) / n_sym / 6
259
+ return int(np.round(basis_size_estimates).astype(int))
260
+
261
+ trans_perms = self._spg_reps.translation_permutations
262
+ c_pt = compr_permutation_lat_trans_O3(
263
+ trans_perms,
264
+ atomic_decompr_idx=self._atomic_decompr_idx,
265
+ fc_cutoff=self._fc_cutoff,
266
+ verbose=False,
267
+ )
268
+ n_sym_prim = len(self._spg_reps._unique_rotations)
269
+ basis_size_estimates = c_pt.shape[1] / n_sym_prim
270
+ return int(np.round(basis_size_estimates).astype(int))
@@ -245,3 +245,21 @@ class FCBasisSetO4(FCBasisSetBase):
245
245
  self._n_a_compression_matrix = n_a_compress_mat
246
246
 
247
247
  return self
248
+
249
+ def estimate_basis_size(self) -> int:
250
+ """Estimate basis set size."""
251
+ if self._fc_cutoff is None:
252
+ n_sym, N = self._spg_reps._permutations.shape
253
+ basis_size_estimates = 81 * (N**4) / n_sym / 24
254
+ return int(np.round(basis_size_estimates).astype(int))
255
+
256
+ trans_perms = self._spg_reps.translation_permutations
257
+ c_pt = compr_permutation_lat_trans_O4(
258
+ trans_perms,
259
+ atomic_decompr_idx=self._atomic_decompr_idx,
260
+ fc_cutoff=self._fc_cutoff,
261
+ verbose=False,
262
+ )
263
+ n_sym_prim = len(self._spg_reps._unique_rotations)
264
+ basis_size_estimates = c_pt.shape[1] / n_sym_prim
265
+ return int(np.round(basis_size_estimates).astype(int))
@@ -1,3 +1,3 @@
1
1
  """Version number of the package."""
2
2
 
3
- __version__ = "1.2.2"
3
+ __version__ = "1.3.0"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: symfc
3
- Version: 1.2.2
3
+ Version: 1.3.0
4
4
  Summary: This is the symfc module.
5
5
  Author-email: Atsuto Seko <seko@cms.mtl.kyoto-u.ac.jp>
6
6
  Maintainer-email: Atsushi Togo <atztogo@gmail.com>
@@ -78,8 +78,8 @@ def cell_gan_111() -> SymfcAtoms:
78
78
 
79
79
 
80
80
  @pytest.fixture(scope="session")
81
- def ph_nacl_222() -> tuple[SymfcAtoms, np.ndarray, np.ndarray]:
82
- """Return NaCl-222 data."""
81
+ def cell_nacl_222() -> SymfcAtoms:
82
+ """Return 2x2x2 supercell of NaCl."""
83
83
  lattice = [
84
84
  [11.281120000000000, 0.000000000000000, 0.000000000000000],
85
85
  [0.000000000000000, 11.281120000000000, 0.000000000000000],
@@ -218,11 +218,17 @@ def ph_nacl_222() -> tuple[SymfcAtoms, np.ndarray, np.ndarray]:
218
218
  17,
219
219
  ]
220
220
  cell = SymfcAtoms(cell=lattice, scaled_positions=points, numbers=numbers)
221
+ return cell
222
+
223
+
224
+ @pytest.fixture(scope="session")
225
+ def ph_nacl_222(cell_nacl_222) -> tuple[SymfcAtoms, np.ndarray, np.ndarray]:
226
+ """Return NaCl-222 data."""
221
227
  N = 20
222
228
  dfset = np.loadtxt(cwd / "dfset_NaCl_222_rd.xz")
223
229
  d = dfset[:, :3].reshape(N, -1, 3)
224
230
  f = dfset[:, 3:].reshape(N, -1, 3)
225
- return cell, d, f
231
+ return cell_nacl_222, d, f
226
232
 
227
233
 
228
234
  @pytest.fixture(scope="session")
@@ -166,3 +166,18 @@ def test_api_si_111_fc4_step(
166
166
  np.testing.assert_allclose(fc2_ref, fc2, atol=1e-6)
167
167
  np.testing.assert_allclose(fc3_ref, fc3, atol=1e-6)
168
168
  np.testing.assert_allclose(fc4_ref, fc4, atol=1e-6)
169
+
170
+
171
+ def test_api_estimate_basis_size_NaCl_222(
172
+ cell_nacl_222: SymfcAtoms,
173
+ ):
174
+ """Test Symfc class."""
175
+ symfc = Symfc(cell_nacl_222)
176
+ ref_estimates = {
177
+ 2: 12,
178
+ 3: 768,
179
+ 4: 36864,
180
+ }
181
+
182
+ assert symfc.estimate_basis_size(orders=[2, 3, 4]) == ref_estimates
183
+ assert symfc.estimate_basis_size(max_order=4) == ref_estimates
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes