yu-mcal 0.1.5__py3-none-any.whl → 0.1.6__py3-none-any.whl
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.
- mcal/mcal.py +1 -1
- mcal/utils/cif_reader.py +43 -4
- {yu_mcal-0.1.5.dist-info → yu_mcal-0.1.6.dist-info}/METADATA +1 -1
- {yu_mcal-0.1.5.dist-info → yu_mcal-0.1.6.dist-info}/RECORD +7 -7
- {yu_mcal-0.1.5.dist-info → yu_mcal-0.1.6.dist-info}/WHEEL +0 -0
- {yu_mcal-0.1.5.dist-info → yu_mcal-0.1.6.dist-info}/entry_points.txt +0 -0
- {yu_mcal-0.1.5.dist-info → yu_mcal-0.1.6.dist-info}/licenses/LICENSE +0 -0
mcal/mcal.py
CHANGED
|
@@ -140,7 +140,7 @@ def main():
|
|
|
140
140
|
cif_path_without_ext = f'{directory}/{filename}'
|
|
141
141
|
|
|
142
142
|
print('----------------------------------------')
|
|
143
|
-
print(' mcal 0.1.
|
|
143
|
+
print(' mcal 0.1.6 (2026/01/29) by Matsui Lab. ')
|
|
144
144
|
print('----------------------------------------')
|
|
145
145
|
|
|
146
146
|
if args.read_pickle:
|
mcal/utils/cif_reader.py
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
"""CifReader beta (2026/01/
|
|
1
|
+
"""CifReader beta (2026/01/29)"""
|
|
2
2
|
import os
|
|
3
3
|
import re
|
|
4
|
+
import warnings
|
|
5
|
+
from collections import deque
|
|
4
6
|
from itertools import product
|
|
5
7
|
from pathlib import Path
|
|
6
8
|
from typing import Dict, List, Literal, Tuple
|
|
7
|
-
import warnings
|
|
8
9
|
|
|
9
10
|
import numpy as np
|
|
10
11
|
import pandas as pd
|
|
@@ -67,6 +68,8 @@ class CifReader:
|
|
|
67
68
|
self._make_adjacency_mat()
|
|
68
69
|
self._split_mols()
|
|
69
70
|
self._put_unit_cell()
|
|
71
|
+
self._unwrap_molecules()
|
|
72
|
+
self._put_unit_cell()
|
|
70
73
|
# Remove duplicates again as they may occur when moving atoms into the unit cell
|
|
71
74
|
self.sym_symbols, self.sym_coords = self.remove_duplicates(self.sym_symbols, self.sym_coords)
|
|
72
75
|
self._make_adjacency_mat()
|
|
@@ -78,6 +81,14 @@ class CifReader:
|
|
|
78
81
|
f'Z value is not match. Z value in cif file is {self._ref_z_value}, but calculated Z value is {self.z_value}.'
|
|
79
82
|
)
|
|
80
83
|
|
|
84
|
+
def _apply_minimum_image(self):
|
|
85
|
+
"""Apply minimum image convention."""
|
|
86
|
+
frac_diff = self.sym_coords[:, np.newaxis, :] - self.sym_coords[np.newaxis, :, :]
|
|
87
|
+
frac_diff = frac_diff - np.round(frac_diff)
|
|
88
|
+
cart_diff = np.dot(frac_diff, self.lattice)
|
|
89
|
+
distance = np.linalg.norm(cart_diff, axis=-1)
|
|
90
|
+
return distance
|
|
91
|
+
|
|
81
92
|
def _calc_lattice(self):
|
|
82
93
|
"""Calculate lattice."""
|
|
83
94
|
a, b, c = self.cell_lengths
|
|
@@ -131,7 +142,7 @@ class CifReader:
|
|
|
131
142
|
num_atoms = len(self.sym_symbols)
|
|
132
143
|
self.adjacency_mat = np.zeros((num_atoms, num_atoms), dtype=bool)
|
|
133
144
|
|
|
134
|
-
|
|
145
|
+
distance = self._apply_minimum_image()
|
|
135
146
|
|
|
136
147
|
try:
|
|
137
148
|
covalent_distance = np.array([self.COVALENT_RADII[symbol] for symbol in self.sym_symbols]) \
|
|
@@ -139,7 +150,6 @@ class CifReader:
|
|
|
139
150
|
except KeyError:
|
|
140
151
|
raise ElementPropertiesIsNotDefinedError('Element properties is not defined.')
|
|
141
152
|
|
|
142
|
-
distance = np.linalg.norm(self.cart_coords[:, np.newaxis, :] - self.cart_coords[np.newaxis, :, :], axis=-1)
|
|
143
153
|
self.adjacency_mat[(distance <= covalent_distance * 1.3) & (distance != 0)] = 1
|
|
144
154
|
|
|
145
155
|
def _operate_sym(self) -> None:
|
|
@@ -362,6 +372,35 @@ class CifReader:
|
|
|
362
372
|
sub_matrix = self.adjacency_mat[np.ix_(index_group, index_group)]
|
|
363
373
|
self.sub_matrices.append(sub_matrix)
|
|
364
374
|
|
|
375
|
+
def _unwrap_molecules(self):
|
|
376
|
+
"""Unwrap molecules using the adjacency matrix based on the minimum image convention."""
|
|
377
|
+
for atom_group in self.bonded_atoms:
|
|
378
|
+
if len(atom_group) <= 1:
|
|
379
|
+
continue
|
|
380
|
+
|
|
381
|
+
criterion_idx = atom_group[0]
|
|
382
|
+
|
|
383
|
+
# Depth-first search
|
|
384
|
+
visited = {criterion_idx}
|
|
385
|
+
stack = deque([criterion_idx])
|
|
386
|
+
|
|
387
|
+
while stack:
|
|
388
|
+
current_idx = stack.popleft()
|
|
389
|
+
current_coord = self.sym_coords[current_idx]
|
|
390
|
+
|
|
391
|
+
for neighbor_idx in atom_group:
|
|
392
|
+
if neighbor_idx in visited:
|
|
393
|
+
continue
|
|
394
|
+
|
|
395
|
+
if self.adjacency_mat[current_idx, neighbor_idx]:
|
|
396
|
+
# Minimum image convention
|
|
397
|
+
frac_diff = self.sym_coords[neighbor_idx] - current_coord
|
|
398
|
+
frac_diff = frac_diff - np.round(frac_diff)
|
|
399
|
+
self.sym_coords[neighbor_idx] = current_coord + frac_diff
|
|
400
|
+
|
|
401
|
+
visited.add(neighbor_idx)
|
|
402
|
+
stack.append(neighbor_idx)
|
|
403
|
+
|
|
365
404
|
def calc_cen_of_weight(self, coordinates: NDArray[np.float64]) -> NDArray[np.float64]:
|
|
366
405
|
"""Calculate center of weight.
|
|
367
406
|
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
mcal/__init__.py,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
|
|
2
|
-
mcal/mcal.py,sha256=
|
|
2
|
+
mcal/mcal.py,sha256=LRKAcLKG8Uv0yI16zZW0GmOEiRkbUHuVWVYOrHZR014,29280
|
|
3
3
|
mcal/calculations/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
4
4
|
mcal/calculations/hopping_mobility_model.py,sha256=eD9doesa1yVDQxzBYW0N41OyjikZb77S69I_mIMbL2g,13180
|
|
5
5
|
mcal/calculations/rcal.py,sha256=CH3iV18KTM8xU7M7zKR3e1m67GbJLH8zi0j50TsUXLE,13500
|
|
6
6
|
mcal/constants/element_properties.csv,sha256=_Yanl713VZQaAqPYoLNn-hXDdg01ZfkYsCLQ1SQSX8w,4073
|
|
7
7
|
mcal/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
8
|
-
mcal/utils/cif_reader.py,sha256=
|
|
8
|
+
mcal/utils/cif_reader.py,sha256=QAV6xXMd3nfKLpJqBncA6fbGJ5kgYKDeKIx-sK_4P_M,24532
|
|
9
9
|
mcal/utils/gaus_log_reader.py,sha256=nNIgBae9hRUgpmNF7eIC5LOENSo6NQmuckMM4A3HAa8,3159
|
|
10
10
|
mcal/utils/gjf_maker.py,sha256=Kkh_gNcifFfhTikZar6SzoNJ7AyEBiCBXJTQkHxHX-0,8193
|
|
11
|
-
yu_mcal-0.1.
|
|
12
|
-
yu_mcal-0.1.
|
|
13
|
-
yu_mcal-0.1.
|
|
14
|
-
yu_mcal-0.1.
|
|
15
|
-
yu_mcal-0.1.
|
|
11
|
+
yu_mcal-0.1.6.dist-info/METADATA,sha256=6qhMLEDBBrwAKLXWz7hlohj-2JI26xxrX2kuf0AF8gE,7890
|
|
12
|
+
yu_mcal-0.1.6.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
13
|
+
yu_mcal-0.1.6.dist-info/entry_points.txt,sha256=_0xZR3t9qvFSd9L6Iot03NixVLxXioEY19L6w3Fs1Ew,40
|
|
14
|
+
yu_mcal-0.1.6.dist-info/licenses/LICENSE,sha256=JP8vm7gYE73jLgnMFTOLNo_RnH88RrB4Goyh7H_muto,1072
|
|
15
|
+
yu_mcal-0.1.6.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|