kim-tools 0.3.9__py3-none-any.whl → 0.3.11__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 CHANGED
@@ -1,4 +1,4 @@
1
- __version__ = "0.3.9"
1
+ __version__ = "0.3.11"
2
2
 
3
3
  from .aflow_util import *
4
4
  from .aflow_util import __all__ as aflow_all
@@ -1642,9 +1642,21 @@ class AFLOW:
1642
1642
  ]
1643
1643
 
1644
1644
  if match_library_proto:
1645
- library_prototype_label, short_name = (
1646
- self.get_library_prototype_label_and_shortname_from_atoms(atoms)
1647
- )
1645
+ try:
1646
+ library_prototype_label, short_name = (
1647
+ self.get_library_prototype_label_and_shortname_from_atoms(atoms)
1648
+ )
1649
+ except subprocess.CalledProcessError:
1650
+ library_prototype_label = None
1651
+ short_name = None
1652
+ msg = (
1653
+ "WARNING: aflow --compare2prototypes returned error, skipping "
1654
+ "library matching"
1655
+ )
1656
+ print()
1657
+ print(msg)
1658
+ print()
1659
+ logger.warning(msg)
1648
1660
 
1649
1661
  # NOTE: Because of below, this only works if the provided prototype label is
1650
1662
  # correctly alphabetized. Change this?
@@ -777,8 +777,9 @@ class KIMTestDriver(ABC):
777
777
  Args:
778
778
  filename: path to write the file
779
779
  """
780
- kim_property_dump(self._get_serialized_property_instances(), filename)
781
780
  filename_parent = Path(filename).parent.resolve()
781
+ os.makedirs(filename_parent, exist_ok=True)
782
+ kim_property_dump(self._get_serialized_property_instances(), filename)
782
783
  if filename_parent != Path("output").resolve():
783
784
  for file_in_output in glob.glob("output/*"):
784
785
  file_in_output_name = str(Path(file_in_output).name)
@@ -787,6 +788,10 @@ class KIMTestDriver(ABC):
787
788
  if isinstance(instance[key], dict):
788
789
  if file_in_output_name == instance[key]["source-value"]:
789
790
  shutil.move(file_in_output, filename_parent)
791
+ elif isinstance(instance[key]["source-value"], list):
792
+ for file_in_property in instance[key]["source-value"]:
793
+ if file_in_output_name == file_in_property:
794
+ shutil.move(file_in_output, filename_parent)
790
795
 
791
796
  def get_isolated_energy_per_atom(self, symbol: str) -> float:
792
797
  """
@@ -1402,6 +1407,7 @@ class SingleCrystalTestDriver(KIMTestDriver):
1402
1407
  cell_rtol: float = 0.01,
1403
1408
  rot_rtol: float = 0.01,
1404
1409
  rot_atol: float = 0.01,
1410
+ match_library_proto: bool = True,
1405
1411
  ) -> None:
1406
1412
  """
1407
1413
  Update the nominal parameter values of the nominal crystal structure from the
@@ -1446,6 +1452,8 @@ class SingleCrystalTestDriver(KIMTestDriver):
1446
1452
  Parameter to pass to :func:`numpy.allclose` for compariong fractional
1447
1453
  rotations. Default value chosen to be commensurate with AFLOW
1448
1454
  default distance tolerance of 0.01*(NN distance)
1455
+ match_library_proto:
1456
+ Whether to match to library prototypes
1449
1457
 
1450
1458
  Raises:
1451
1459
  AFLOW.FailedToMatchException:
@@ -1458,16 +1466,29 @@ class SingleCrystalTestDriver(KIMTestDriver):
1458
1466
  """
1459
1467
  aflow = AFLOW(aflow_executable=self.aflow_executable)
1460
1468
  try:
1461
- (aflow_parameter_values, library_prototype_label, short_name) = (
1462
- aflow.solve_for_params_of_known_prototype(
1469
+ if match_library_proto:
1470
+ (aflow_parameter_values, library_prototype_label, short_name) = (
1471
+ aflow.solve_for_params_of_known_prototype(
1472
+ atoms=atoms,
1473
+ prototype_label=self.get_nominal_prototype_label(),
1474
+ max_resid=max_resid,
1475
+ cell_rtol=cell_rtol,
1476
+ rot_rtol=rot_rtol,
1477
+ rot_atol=rot_atol,
1478
+ )
1479
+ )
1480
+ else:
1481
+ aflow_parameter_values = aflow.solve_for_params_of_known_prototype(
1463
1482
  atoms=atoms,
1464
1483
  prototype_label=self.get_nominal_prototype_label(),
1465
1484
  max_resid=max_resid,
1466
1485
  cell_rtol=cell_rtol,
1467
1486
  rot_rtol=rot_rtol,
1468
1487
  rot_atol=rot_atol,
1488
+ match_library_proto=False,
1469
1489
  )
1470
- )
1490
+ library_prototype_label = None
1491
+ short_name = None
1471
1492
  except (AFLOW.FailedToMatchException, AFLOW.ChangedSymmetryException) as e:
1472
1493
  raise type(e)(
1473
1494
  "Encountered an error that MAY be the result of the nominal crystal "
@@ -1946,21 +1967,38 @@ class SingleCrystalTestDriver(KIMTestDriver):
1946
1967
  def get_nominal_space_group_number(self) -> int:
1947
1968
  return get_space_group_number_from_prototype(self.get_nominal_prototype_label())
1948
1969
 
1949
- def get_stoichiometry(self) -> List[int]:
1970
+ def get_nominal_stoichiometric_species(self) -> List[str]:
1971
+ return self._get_nominal_crystal_structure_npt()["stoichiometric-species"][
1972
+ "source-value"
1973
+ ]
1974
+
1975
+ def get_nominal_stoichiometry(self) -> List[int]:
1950
1976
  return get_stoich_reduced_list_from_prototype(
1951
1977
  self.get_nominal_prototype_label()
1952
1978
  )
1953
1979
 
1980
+ def get_nominal_a(self) -> float:
1981
+ return self._get_nominal_crystal_structure_npt()["a"]["source-value"]
1982
+
1954
1983
  def get_nominal_parameter_names(self) -> List[str]:
1955
- """
1956
- Get the list of parameter names besides "a". Return an
1957
- empty list for cubic crystals
1958
- """
1959
- crystal_structure = self._get_nominal_crystal_structure_npt()
1960
- if "parameter-names" in crystal_structure:
1961
- return crystal_structure["parameter-names"]["source-value"]
1962
- else:
1963
- return []
1984
+ return _get_optional_source_value(
1985
+ self._get_nominal_crystal_structure_npt(), "parameter-names"
1986
+ )
1987
+
1988
+ def get_nominal_parameter_values(self) -> List[float]:
1989
+ return _get_optional_source_value(
1990
+ self._get_nominal_crystal_structure_npt(), "parameter-values"
1991
+ )
1992
+
1993
+ def get_nominal_short_name(self) -> List[str]:
1994
+ return _get_optional_source_value(
1995
+ self._get_nominal_crystal_structure_npt(), "short-name"
1996
+ )
1997
+
1998
+ def get_nominal_library_prototype_label(self) -> str:
1999
+ return _get_optional_source_value(
2000
+ self._get_nominal_crystal_structure_npt(), "library-prototype-label"
2001
+ )
1964
2002
 
1965
2003
  def get_atom_indices_for_each_wyckoff_orb(self) -> List[Dict]:
1966
2004
  """
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: kim-tools
3
- Version: 0.3.9
3
+ Version: 0.3.11
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=JnYWdvQufTnlREvqTcBFv0ZQoOwdekELyzJCKwE7XTI,433
1
+ kim_tools/__init__.py,sha256=YZdzUiZNlEczGQLTPVRxzz5-jGxgJTEaeAK_p-oJu4o,434
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=PM-ww2zoZXksGHbyPKW54v8r1bignJvFhDByx7Qm1ac,80837
4
+ kim_tools/aflow_util/core.py,sha256=mMS2r9ayJJ6ApOFTAIkCZ72Dg3g1EnREbrqe2YEipMo,81273
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
@@ -2023,11 +2023,11 @@ kim_tools/symmetry_util/data/wyck_pos_xform_under_normalizer.json,sha256=6g1YuYh
2023
2023
  kim_tools/symmetry_util/data/wyckoff_multiplicities.json,sha256=qG2RPBd_-ejDIfz-E4ZhkHyRpIboxRy7oiXkdDf5Eg8,32270
2024
2024
  kim_tools/symmetry_util/data/wyckoff_sets.json,sha256=f5ZpHKDHo6_JWki1b7KUGoYLlhU-44Qikw_-PtbLssw,9248
2025
2025
  kim_tools/test_driver/__init__.py,sha256=KOiceeZNqkfrgZ66CiRiUdniceDrCmmDXQkOw0wXaCQ,92
2026
- kim_tools/test_driver/core.py,sha256=sM0SPmNFuYVdvKbmCM3kJblFs5--k1xRm57FdUtgs34,97367
2026
+ kim_tools/test_driver/core.py,sha256=ZHS26S8-HxCPTDhv6h6WZ2x7pDQMTu6G1bWD4rPvoz8,99107
2027
2027
  kim_tools/vc/__init__.py,sha256=zXjhxXCKVMLBMXXWYG3if7VOpBnsFrn_RjVpnohDm5c,74
2028
2028
  kim_tools/vc/core.py,sha256=BIjzEExnQAL2S90a_npptRm3ACqAo4fZBtvTDBMWMdw,13963
2029
- kim_tools-0.3.9.dist-info/licenses/LICENSE.CDDL,sha256=I2luEED_SHjuZ01B4rYG-AF_135amL24JpHvZ1Jhqe8,16373
2030
- kim_tools-0.3.9.dist-info/METADATA,sha256=mz0naaggDlfsGZXT1jSq9MbwQIaz3r8PkfKIO2DEw94,2032
2031
- kim_tools-0.3.9.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
2032
- kim_tools-0.3.9.dist-info/top_level.txt,sha256=w_YCpJ5ERigj9te74ln7k64tqj1VumOzM_s9dsalIWY,10
2033
- kim_tools-0.3.9.dist-info/RECORD,,
2029
+ kim_tools-0.3.11.dist-info/licenses/LICENSE.CDDL,sha256=I2luEED_SHjuZ01B4rYG-AF_135amL24JpHvZ1Jhqe8,16373
2030
+ kim_tools-0.3.11.dist-info/METADATA,sha256=AdNljYaTm6fqCc8eaRcIFX0oeMcsqDTcMPdmqvBPAcs,2033
2031
+ kim_tools-0.3.11.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
2032
+ kim_tools-0.3.11.dist-info/top_level.txt,sha256=w_YCpJ5ERigj9te74ln7k64tqj1VumOzM_s9dsalIWY,10
2033
+ kim_tools-0.3.11.dist-info/RECORD,,