kim-tools 0.3.0__py3-none-any.whl → 0.3.1__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 +83 -6
- {kim_tools-0.3.0.dist-info → kim_tools-0.3.1.dist-info}/METADATA +1 -1
- {kim_tools-0.3.0.dist-info → kim_tools-0.3.1.dist-info}/RECORD +7 -7
- {kim_tools-0.3.0.dist-info → kim_tools-0.3.1.dist-info}/WHEEL +0 -0
- {kim_tools-0.3.0.dist-info → kim_tools-0.3.1.dist-info}/licenses/LICENSE.CDDL +0 -0
- {kim_tools-0.3.0.dist-info → kim_tools-0.3.1.dist-info}/top_level.txt +0 -0
kim_tools/__init__.py
CHANGED
kim_tools/aflow_util/core.py
CHANGED
@@ -6,6 +6,7 @@ import os
|
|
6
6
|
import subprocess
|
7
7
|
from curses.ascii import isalpha, isdigit
|
8
8
|
from dataclasses import dataclass
|
9
|
+
from itertools import permutations
|
9
10
|
from math import acos, cos, degrees, radians, sqrt
|
10
11
|
from os import PathLike
|
11
12
|
from tempfile import NamedTemporaryFile
|
@@ -343,6 +344,30 @@ def get_stoich_reduced_list_from_prototype(prototype_label: str) -> List[int]:
|
|
343
344
|
return stoich_reduced_list
|
344
345
|
|
345
346
|
|
347
|
+
def build_abstract_formula_from_stoich_reduced_list(
|
348
|
+
stoich_reduced_list: List[int],
|
349
|
+
) -> str:
|
350
|
+
"""
|
351
|
+
Get abstract chemical formula from numerical list of stoichiometry
|
352
|
+
i.e. [1,3] -> "AB3"
|
353
|
+
|
354
|
+
Args:
|
355
|
+
stoich_reduced_list:
|
356
|
+
List of reduced stoichiometric numbers
|
357
|
+
|
358
|
+
Returns:
|
359
|
+
Abstract chemical formula
|
360
|
+
"""
|
361
|
+
formula = ""
|
362
|
+
for spec_num, stoich_num in enumerate(stoich_reduced_list):
|
363
|
+
assert isinstance(stoich_num, int)
|
364
|
+
assert stoich_num > 0
|
365
|
+
formula += chr(65 + spec_num)
|
366
|
+
if stoich_num > 1:
|
367
|
+
formula += str(stoich_num)
|
368
|
+
return formula
|
369
|
+
|
370
|
+
|
346
371
|
def get_wyckoff_lists_from_prototype(prototype_label: str) -> List[str]:
|
347
372
|
"""
|
348
373
|
Expand the list of Wyckoff letters in the prototype to account for each individual
|
@@ -350,7 +375,7 @@ def get_wyckoff_lists_from_prototype(prototype_label: str) -> List[str]:
|
|
350
375
|
e.g. A2B3C_mC48_15_aef_3f_2e -> ['aef','fff','ee']
|
351
376
|
"""
|
352
377
|
expanded_wyckoff_letters = []
|
353
|
-
prototype_label_split = prototype_label.split("_")
|
378
|
+
prototype_label_split = prototype_label.split("-")[0].split("_")
|
354
379
|
for species_wyckoff_string in prototype_label_split[3:]:
|
355
380
|
expanded_wyckoff_letters.append("")
|
356
381
|
curr_wyckoff_count = 0
|
@@ -371,14 +396,14 @@ def prototype_labels_are_equivalent(
|
|
371
396
|
prototype_label_1: str,
|
372
397
|
prototype_label_2: str,
|
373
398
|
allow_enantiomorph: bool = False,
|
374
|
-
allow_species_permutation: bool = False,
|
375
399
|
) -> bool:
|
376
400
|
"""
|
377
|
-
Checks if two prototype labels are equivalent
|
401
|
+
Checks if two prototype labels are equivalent (species permutations not allowed)
|
402
|
+
|
403
|
+
Args:
|
404
|
+
allow_enantiomorph:
|
405
|
+
Whether to consider enantiomorphic pairs of space groups to be equivalent
|
378
406
|
"""
|
379
|
-
if allow_species_permutation:
|
380
|
-
# TODO: Possibly add this (for checking library prototype labels)
|
381
|
-
raise NotImplementedError("Species permutations not implemented")
|
382
407
|
|
383
408
|
if prototype_label_1 == prototype_label_2:
|
384
409
|
return True
|
@@ -494,6 +519,58 @@ def prototype_labels_are_equivalent(
|
|
494
519
|
return True
|
495
520
|
|
496
521
|
|
522
|
+
def find_species_permutation_between_prototype_labels(
|
523
|
+
prototype_label_1: str,
|
524
|
+
prototype_label_2: str,
|
525
|
+
allow_enantiomorph: bool = False,
|
526
|
+
) -> Optional[Tuple[int]]:
|
527
|
+
"""
|
528
|
+
Find the permutation of species required to match two prototype labels
|
529
|
+
|
530
|
+
Args:
|
531
|
+
allow_enantiomorph:
|
532
|
+
Whether to consider enantiomorphic pairs of space groups to be equivalent
|
533
|
+
|
534
|
+
Returns:
|
535
|
+
The permutation of species of ``prototype_label_1`` required to match
|
536
|
+
``prototype_label_2``, or None if no match is found
|
537
|
+
"""
|
538
|
+
# Disassemble prototype_label_1
|
539
|
+
stoich_reduced_list_1 = get_stoich_reduced_list_from_prototype(prototype_label_1)
|
540
|
+
pearson_1 = get_pearson_symbol_from_prototype(prototype_label_1)
|
541
|
+
space_group_1 = str(get_space_group_number_from_prototype(prototype_label_1))
|
542
|
+
species_wyckoff_sections_1 = prototype_label_1.split("-")[0].split("_")[3:]
|
543
|
+
|
544
|
+
nspecies = len(stoich_reduced_list_1)
|
545
|
+
assert nspecies == len(species_wyckoff_sections_1)
|
546
|
+
|
547
|
+
permutation_candidates = permutations(tuple(range(nspecies)))
|
548
|
+
for permutation in permutation_candidates:
|
549
|
+
# Permute the species
|
550
|
+
stoich_reduced_list_1_permuted = [stoich_reduced_list_1[i] for i in permutation]
|
551
|
+
species_wyckoff_sections_1_permuted = [
|
552
|
+
species_wyckoff_sections_1[i] for i in permutation
|
553
|
+
]
|
554
|
+
|
555
|
+
# Reassemble prototype_label_1_permuted
|
556
|
+
abstract_formula_1_permuted = build_abstract_formula_from_stoich_reduced_list(
|
557
|
+
stoich_reduced_list_1_permuted
|
558
|
+
)
|
559
|
+
prototype_label_1_permuted_list = [
|
560
|
+
abstract_formula_1_permuted,
|
561
|
+
pearson_1,
|
562
|
+
space_group_1,
|
563
|
+
] + species_wyckoff_sections_1_permuted
|
564
|
+
prototype_label_1_permuted = "_".join(prototype_label_1_permuted_list)
|
565
|
+
if prototype_labels_are_equivalent(
|
566
|
+
prototype_label_1=prototype_label_1_permuted,
|
567
|
+
prototype_label_2=prototype_label_2,
|
568
|
+
allow_enantiomorph=allow_enantiomorph,
|
569
|
+
):
|
570
|
+
return permutation
|
571
|
+
return None
|
572
|
+
|
573
|
+
|
497
574
|
def get_space_group_number_from_prototype(prototype_label: str) -> int:
|
498
575
|
return int(prototype_label.split("_")[2])
|
499
576
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: kim-tools
|
3
|
-
Version: 0.3.
|
3
|
+
Version: 0.3.1
|
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>, Philipp Hoellmer <ph2484@nyu.edu>, Guanming Zhang <gz2241@nyu.edu>, Tom Egg <tje3676@nyu.edu>
|
6
6
|
Maintainer-email: ilia Nikiforov <nikif002@umn.edu>
|
@@ -1,7 +1,7 @@
|
|
1
|
-
kim_tools/__init__.py,sha256=
|
1
|
+
kim_tools/__init__.py,sha256=dOQsrWeoyK-9Fr4gPNLzdouLMm0J0hhh6qd86cPECns,433
|
2
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=NULg8zJG4B5lh4p-Q7yPsJvgzPG_BgSRjgrLpyX3UUI,75526
|
5
5
|
kim_tools/aflow_util/aflow_prototype_encyclopedia/data/A108B24C11D24_cP334_222_h4i_i_bf_i-001/info.json,sha256=IsFiO9X2Ko7yoq2QkDurUVP7k1BE4WFgblu7oxl6iZs,2013
|
6
6
|
kim_tools/aflow_util/aflow_prototype_encyclopedia/data/A10B11_tI84_139_dehim_eh2n-001/info.json,sha256=f1EdtouuSL2y9NNw40Rvz2J9ZZcsqQBcyEmlHj6XoW8,1186
|
7
7
|
kim_tools/aflow_util/aflow_prototype_encyclopedia/data/A10B2C_hP39_171_5c_c_a-001/info.json,sha256=vD1xjZKWShL0E6XNsSlmIhilGcGNefl56oQDLQlHO1M,1596
|
@@ -2015,8 +2015,8 @@ kim_tools/test_driver/__init__.py,sha256=KOiceeZNqkfrgZ66CiRiUdniceDrCmmDXQkOw0w
|
|
2015
2015
|
kim_tools/test_driver/core.py,sha256=r4hiZcV-PkWcOo0uEqfqeP1-YGGpPepaAjmR4LJog0w,89208
|
2016
2016
|
kim_tools/vc/__init__.py,sha256=zXjhxXCKVMLBMXXWYG3if7VOpBnsFrn_RjVpnohDm5c,74
|
2017
2017
|
kim_tools/vc/core.py,sha256=BIjzEExnQAL2S90a_npptRm3ACqAo4fZBtvTDBMWMdw,13963
|
2018
|
-
kim_tools-0.3.
|
2019
|
-
kim_tools-0.3.
|
2020
|
-
kim_tools-0.3.
|
2021
|
-
kim_tools-0.3.
|
2022
|
-
kim_tools-0.3.
|
2018
|
+
kim_tools-0.3.1.dist-info/licenses/LICENSE.CDDL,sha256=I2luEED_SHjuZ01B4rYG-AF_135amL24JpHvZ1Jhqe8,16373
|
2019
|
+
kim_tools-0.3.1.dist-info/METADATA,sha256=scnOzhP0hy9JNn5NS6W9lSESU6G0PS2rPoCdkwIIVSE,1962
|
2020
|
+
kim_tools-0.3.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
2021
|
+
kim_tools-0.3.1.dist-info/top_level.txt,sha256=w_YCpJ5ERigj9te74ln7k64tqj1VumOzM_s9dsalIWY,10
|
2022
|
+
kim_tools-0.3.1.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|