kim-tools 0.2.0b0__py3-none-any.whl → 0.2.2__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.
- kim_tools/__init__.py +1 -1
- kim_tools/aflow_util/core.py +30 -13
- kim_tools/kimunits.py +14 -0
- kim_tools/symmetry_util/core.py +36 -0
- kim_tools/test_driver/core.py +14 -3
- {kim_tools-0.2.0b0.dist-info → kim_tools-0.2.2.dist-info}/METADATA +1 -1
- {kim_tools-0.2.0b0.dist-info → kim_tools-0.2.2.dist-info}/RECORD +10 -10
- {kim_tools-0.2.0b0.dist-info → kim_tools-0.2.2.dist-info}/WHEEL +1 -1
- {kim_tools-0.2.0b0.dist-info → kim_tools-0.2.2.dist-info}/licenses/LICENSE.CDDL +0 -0
- {kim_tools-0.2.0b0.dist-info → kim_tools-0.2.2.dist-info}/top_level.txt +0 -0
kim_tools/__init__.py
CHANGED
kim_tools/aflow_util/core.py
CHANGED
@@ -719,6 +719,11 @@ class AFLOW:
|
|
719
719
|
|
720
720
|
"""
|
721
721
|
|
722
|
+
class AFLOWNotFoundException(Exception):
|
723
|
+
"""
|
724
|
+
Raised when the AFLOW executable is not found
|
725
|
+
"""
|
726
|
+
|
722
727
|
class ChangedSymmetryException(Exception):
|
723
728
|
"""
|
724
729
|
Raised when an unexpected symmetry change is detected
|
@@ -744,6 +749,15 @@ class AFLOW:
|
|
744
749
|
np: Sets :attr:`np`
|
745
750
|
"""
|
746
751
|
self.aflow_executable = aflow_executable
|
752
|
+
|
753
|
+
try:
|
754
|
+
subprocess.check_output(["aflow", "--proto=A_cF4_225_a"])
|
755
|
+
except Exception:
|
756
|
+
raise self.AFLOWNotFoundException(
|
757
|
+
"Failed to run an AFLOW test command. It is likely "
|
758
|
+
"that the AFLOW executable was not found."
|
759
|
+
)
|
760
|
+
|
747
761
|
self.np = np
|
748
762
|
if aflow_work_dir != "" and not aflow_work_dir.endswith("/"):
|
749
763
|
self.aflow_work_dir = aflow_work_dir + "/"
|
@@ -1412,7 +1426,11 @@ class AFLOW:
|
|
1412
1426
|
return equation_sets
|
1413
1427
|
|
1414
1428
|
def solve_for_params_of_known_prototype(
|
1415
|
-
self,
|
1429
|
+
self,
|
1430
|
+
atoms: Atoms,
|
1431
|
+
prototype_label: str,
|
1432
|
+
max_resid: float = 1e-5,
|
1433
|
+
cell_rtol: float = 0.01,
|
1416
1434
|
) -> List[float]:
|
1417
1435
|
"""
|
1418
1436
|
Given an Atoms object that is a primitive cell of its Bravais lattice as
|
@@ -1437,6 +1455,8 @@ class AFLOW:
|
|
1437
1455
|
max_resid:
|
1438
1456
|
Maximum residual allowed when attempting to match the fractional
|
1439
1457
|
positions of the atoms to the crystallographic equations
|
1458
|
+
cell_rtol:
|
1459
|
+
Relative tolerance on cell lengths and angles
|
1440
1460
|
|
1441
1461
|
Returns:
|
1442
1462
|
List of free parameters that will regenerate `atoms` (up to permutations,
|
@@ -1635,7 +1655,11 @@ class AFLOW:
|
|
1635
1655
|
# The internal shift may have taken us to an internal parameter
|
1636
1656
|
# solution that represents a rotation, so we need to check
|
1637
1657
|
if self.confirm_unrotated_prototype_designation(
|
1638
|
-
atoms,
|
1658
|
+
atoms,
|
1659
|
+
species,
|
1660
|
+
prototype_label,
|
1661
|
+
candidate_prototype_param_values,
|
1662
|
+
cell_rtol,
|
1639
1663
|
):
|
1640
1664
|
logger.info(
|
1641
1665
|
f"Found set of parameters for prototype {prototype_label} "
|
@@ -1665,8 +1689,7 @@ class AFLOW:
|
|
1665
1689
|
test_atoms: Atoms,
|
1666
1690
|
ref_atoms: Atoms,
|
1667
1691
|
sgnum: Union[int, str],
|
1668
|
-
rtol: float =
|
1669
|
-
atol: float = 1.0e-8,
|
1692
|
+
rtol: float = 0.01,
|
1670
1693
|
) -> bool:
|
1671
1694
|
"""
|
1672
1695
|
Check whether `test_atoms` and `reference_atoms` are unrotated as follows:
|
@@ -1689,12 +1712,10 @@ class AFLOW:
|
|
1689
1712
|
sgnum:
|
1690
1713
|
Space group number
|
1691
1714
|
rtol:
|
1692
|
-
Parameter to pass to :func:`numpy.allclose` for comparing cell params
|
1693
|
-
atol:
|
1694
|
-
Parameter to pass to :func:`numpy.allclose` for comparing cell params
|
1715
|
+
Parameter to pass to :func:`numpy.allclose` for comparing cell params.
|
1695
1716
|
"""
|
1696
1717
|
if not np.allclose(
|
1697
|
-
ref_atoms.cell.cellpar(), test_atoms.cell.cellpar(),
|
1718
|
+
ref_atoms.cell.cellpar(), test_atoms.cell.cellpar(), rtol=rtol
|
1698
1719
|
):
|
1699
1720
|
logger.info(
|
1700
1721
|
"Cell lengths and angles do not match.\n"
|
@@ -1736,8 +1757,7 @@ class AFLOW:
|
|
1736
1757
|
species: List[str],
|
1737
1758
|
prototype_label: str,
|
1738
1759
|
parameter_values: List[float],
|
1739
|
-
rtol: float =
|
1740
|
-
atol: float = 1.0e-8,
|
1760
|
+
rtol: float = 0.01,
|
1741
1761
|
) -> bool:
|
1742
1762
|
"""
|
1743
1763
|
Check whether the provided prototype designation recreates ``reference_atoms``
|
@@ -1761,8 +1781,6 @@ class AFLOW:
|
|
1761
1781
|
The free parameters of the AFLOW prototype designation
|
1762
1782
|
rtol:
|
1763
1783
|
Parameter to pass to :func:`numpy.allclose` for comparing cell params
|
1764
|
-
atol:
|
1765
|
-
Parameter to pass to :func:`numpy.allclose` for comparing cell params
|
1766
1784
|
|
1767
1785
|
Returns:
|
1768
1786
|
Whether or not the crystals match
|
@@ -1778,5 +1796,4 @@ class AFLOW:
|
|
1778
1796
|
reference_atoms,
|
1779
1797
|
get_space_group_number_from_prototype(prototype_label),
|
1780
1798
|
rtol,
|
1781
|
-
atol,
|
1782
1799
|
)
|
kim_tools/kimunits.py
CHANGED
@@ -24,6 +24,19 @@ _units_output_expression = re.compile(
|
|
24
24
|
)
|
25
25
|
|
26
26
|
|
27
|
+
def check_units_util():
|
28
|
+
"""
|
29
|
+
Check that units util can be found
|
30
|
+
"""
|
31
|
+
try:
|
32
|
+
subprocess.check_output(["units", "--help"])
|
33
|
+
except Exception:
|
34
|
+
raise UnitConversion(
|
35
|
+
"Failed to run a 'units' test command. It is likely "
|
36
|
+
"that the 'units' executable was not found."
|
37
|
+
)
|
38
|
+
|
39
|
+
|
27
40
|
def linear_fit(x, y):
|
28
41
|
"""
|
29
42
|
Perform a linear fit between x,y, returning the average error for each data
|
@@ -55,6 +68,7 @@ def islinear(unit, to_unit=None):
|
|
55
68
|
|
56
69
|
def convert_units(from_value, from_unit, wanted_unit=None, suppress_unit=False):
|
57
70
|
"""Works with 'units' utility"""
|
71
|
+
check_units_util()
|
58
72
|
from_sign = from_value < 0
|
59
73
|
from_value = str(abs(from_value))
|
60
74
|
from_unit = str(from_unit)
|
kim_tools/symmetry_util/core.py
CHANGED
@@ -131,6 +131,42 @@ def cartesian_to_fractional_itc_rotation_from_ase_cell(
|
|
131
131
|
return np.transpose(cell_arr @ cart_rot_arr @ np.linalg.inv(cell_arr))
|
132
132
|
|
133
133
|
|
134
|
+
def fractional_to_cartesian_itc_rotation_from_ase_cell(
|
135
|
+
frac_rot: ArrayLike, cell: ArrayLike
|
136
|
+
) -> ArrayLike:
|
137
|
+
"""
|
138
|
+
Convert fractional to Cartesian rotation. Read the arguments and returns carefully,
|
139
|
+
as there is some unfortunate mixing of row and columns because of the different
|
140
|
+
conventions of the ITC and ASE and other simulation packages
|
141
|
+
|
142
|
+
Args:
|
143
|
+
frac_rot:
|
144
|
+
The fractional rotation in ITC convention, i.e. for left-multiplying column
|
145
|
+
vectors. Here the distinction with a matrix's transpose DOES matter, because
|
146
|
+
the fractional coordinate system is not orthonormal.
|
147
|
+
cell:
|
148
|
+
The cell of the crystal, with each row being a cartesian vector
|
149
|
+
representing a lattice vector. This is consistent with most simulation
|
150
|
+
packages, but transposed from the ITC
|
151
|
+
|
152
|
+
Returns:
|
153
|
+
Cartesian rotation. It is assumed that this is for left-multiplying column
|
154
|
+
vectors, although in cases where we don't care if we're working with the
|
155
|
+
rotation or its inverse (e.g. when checking whether or not it's in the
|
156
|
+
point group), this doesn't matter due to orthogonality
|
157
|
+
"""
|
158
|
+
|
159
|
+
cell_arr = np.asarray(cell)
|
160
|
+
frac_rot_arr = np.asarray(frac_rot)
|
161
|
+
|
162
|
+
if not ((cell_arr.shape == (3, 3)) and (frac_rot_arr.shape == (3, 3))):
|
163
|
+
raise IncorrectCrystallographyException(
|
164
|
+
"Either the rotation matrix or the cell provided were not 3x3 matrices"
|
165
|
+
)
|
166
|
+
|
167
|
+
return np.transpose(np.linalg.inv(cell_arr) @ frac_rot_arr @ cell_arr)
|
168
|
+
|
169
|
+
|
134
170
|
def cartesian_rotation_is_in_point_group(
|
135
171
|
cart_rot: ArrayLike, sgnum: Union[int, str], cell: ArrayLike
|
136
172
|
) -> bool:
|
kim_tools/test_driver/core.py
CHANGED
@@ -1218,7 +1218,9 @@ class SingleCrystalTestDriver(KIMTestDriver):
|
|
1218
1218
|
print(f"\nNOTE: {msg}\n")
|
1219
1219
|
logger.info(msg)
|
1220
1220
|
|
1221
|
-
def _update_nominal_parameter_values(
|
1221
|
+
def _update_nominal_parameter_values(
|
1222
|
+
self, atoms: Atoms, max_resid: float = 1e-5, cell_rtol: float = 0.01
|
1223
|
+
) -> None:
|
1222
1224
|
"""
|
1223
1225
|
Update the nominal parameter values of the nominal crystal structure from the
|
1224
1226
|
provided :class:`~ase.Atoms` object. It is assumed that the crystallographic
|
@@ -1246,6 +1248,11 @@ class SingleCrystalTestDriver(KIMTestDriver):
|
|
1246
1248
|
|
1247
1249
|
Args:
|
1248
1250
|
atoms: Structure to analyze to get the new parameter values
|
1251
|
+
max_resid:
|
1252
|
+
Maximum residual allowed when attempting to match the fractional
|
1253
|
+
positions of the atoms to the crystallographic equations
|
1254
|
+
cell_rtol:
|
1255
|
+
Relative tolerance on cell lengths and angles
|
1249
1256
|
|
1250
1257
|
Raises:
|
1251
1258
|
AFLOW.FailedToMatchException:
|
@@ -1259,8 +1266,12 @@ class SingleCrystalTestDriver(KIMTestDriver):
|
|
1259
1266
|
|
1260
1267
|
try:
|
1261
1268
|
aflow_parameter_values = AFLOW().solve_for_params_of_known_prototype(
|
1262
|
-
atoms,
|
1263
|
-
self.__nominal_crystal_structure_npt["prototype-label"][
|
1269
|
+
atoms=atoms,
|
1270
|
+
prototype_label=self.__nominal_crystal_structure_npt["prototype-label"][
|
1271
|
+
"source-value"
|
1272
|
+
],
|
1273
|
+
max_resid=max_resid,
|
1274
|
+
cell_rtol=cell_rtol,
|
1264
1275
|
)
|
1265
1276
|
except (AFLOW.FailedToMatchException, AFLOW.ChangedSymmetryException) as e:
|
1266
1277
|
raise type(e)(
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: kim-tools
|
3
|
-
Version: 0.2.
|
3
|
+
Version: 0.2.2
|
4
4
|
Summary: Base classes and helper routines for writing KIM Tests
|
5
5
|
Author-email: ilia Nikiforov <nikif002@umn.edu>, Ellad Tadmor <tadmor@umn.edu>, Claire Waters <bwaters@umn.edu>, "Daniel S. Karls" <karl0100umn@gmail.com>, Matt Bierbaum <matt.bierbaum@gmail.com>, Eric Fuemmeler <efuemmel@umn.edu>
|
6
6
|
Maintainer-email: ilia Nikiforov <nikif002@umn.edu>
|
@@ -1,12 +1,12 @@
|
|
1
|
-
kim_tools/__init__.py,sha256=
|
2
|
-
kim_tools/kimunits.py,sha256=
|
1
|
+
kim_tools/__init__.py,sha256=gGt0sG7foY9MROLXGAYUkxV8GdwEulr_PS5wMm06mcM,433
|
2
|
+
kim_tools/kimunits.py,sha256=jOxBv9gRVhxPE6ygAIUxOzCAfPI6tT6sBaF_FNl9m-M,5387
|
3
3
|
kim_tools/aflow_util/__init__.py,sha256=lJnQ8fZCma80QVRQeKvY4MQ87oCWu-9KATV3dKJfpDc,80
|
4
|
-
kim_tools/aflow_util/core.py,sha256=
|
4
|
+
kim_tools/aflow_util/core.py,sha256=57K2G1jGgJhUA312RkWnhb3MOmlo9B5DdenNb_dIkzc,72206
|
5
5
|
kim_tools/aflow_util/data/README_PROTO.TXT,sha256=bTpcd8GHOkpcQn6YUZzqKhiTytwSDpkgu4boeoogT38,447851
|
6
6
|
kim_tools/ase/__init__.py,sha256=1i6ko5tNr0VZC3T7hoEzq4fnSU0DdxNpxXcSaWMcJWc,76
|
7
7
|
kim_tools/ase/core.py,sha256=d6eOu_HSxVr-ae0TSEbY4HKdePxhNu3yv8NN9VDl-BA,30256
|
8
8
|
kim_tools/symmetry_util/__init__.py,sha256=uu-ZSUDUTe2P81rkAS3tXverx31s_uZ3wL4SD_dn5aI,86
|
9
|
-
kim_tools/symmetry_util/core.py,sha256=
|
9
|
+
kim_tools/symmetry_util/core.py,sha256=VTYH1MRADraJVc6SBfFHZweWI_WZgCViSKM4MazF7KY,21634
|
10
10
|
kim_tools/symmetry_util/data/possible_primitive_shifts.json,sha256=4OVNgn3NnykgGlYiAcecERmVWiIZFrmP2LZI3ml_Sh0,25010
|
11
11
|
kim_tools/symmetry_util/data/primitive_GENPOS_ops.json,sha256=FDu4H4PosOpK9yKwOPy3SxbH7xLMOmZfKZ4ItKPMjoQ,224498
|
12
12
|
kim_tools/symmetry_util/data/space_groups_for_each_bravais_lattice.json,sha256=wSNu6d5pH72lJ6Zj5MZ64qzwS_6Fn5WOs0ts7E9uPC4,2507
|
@@ -14,11 +14,11 @@ kim_tools/symmetry_util/data/wyck_pos_xform_under_normalizer.json,sha256=6g1YuYh
|
|
14
14
|
kim_tools/symmetry_util/data/wyckoff_multiplicities.json,sha256=qG2RPBd_-ejDIfz-E4ZhkHyRpIboxRy7oiXkdDf5Eg8,32270
|
15
15
|
kim_tools/symmetry_util/data/wyckoff_sets.json,sha256=f5ZpHKDHo6_JWki1b7KUGoYLlhU-44Qikw_-PtbLssw,9248
|
16
16
|
kim_tools/test_driver/__init__.py,sha256=KOiceeZNqkfrgZ66CiRiUdniceDrCmmDXQkOw0wXaCQ,92
|
17
|
-
kim_tools/test_driver/core.py,sha256=
|
17
|
+
kim_tools/test_driver/core.py,sha256=bA1tZPM3dES5PZSanN_xPC-SApSB1usO10EvoIq8EgY,78685
|
18
18
|
kim_tools/vc/__init__.py,sha256=zXjhxXCKVMLBMXXWYG3if7VOpBnsFrn_RjVpnohDm5c,74
|
19
19
|
kim_tools/vc/core.py,sha256=BIjzEExnQAL2S90a_npptRm3ACqAo4fZBtvTDBMWMdw,13963
|
20
|
-
kim_tools-0.2.
|
21
|
-
kim_tools-0.2.
|
22
|
-
kim_tools-0.2.
|
23
|
-
kim_tools-0.2.
|
24
|
-
kim_tools-0.2.
|
20
|
+
kim_tools-0.2.2.dist-info/licenses/LICENSE.CDDL,sha256=I2luEED_SHjuZ01B4rYG-AF_135amL24JpHvZ1Jhqe8,16373
|
21
|
+
kim_tools-0.2.2.dist-info/METADATA,sha256=3OJoiiqV0-dLI_4hq--8wWF5BcedispUTMgZ1Z4ieR8,1460
|
22
|
+
kim_tools-0.2.2.dist-info/WHEEL,sha256=zaaOINJESkSfm_4HQVc5ssNzHCPXhJm0kEUakpsEHaU,91
|
23
|
+
kim_tools-0.2.2.dist-info/top_level.txt,sha256=w_YCpJ5ERigj9te74ln7k64tqj1VumOzM_s9dsalIWY,10
|
24
|
+
kim_tools-0.2.2.dist-info/RECORD,,
|
File without changes
|
File without changes
|