From fab8c539706f546ed4f80b1987b6a980fafe3c1b Mon Sep 17 00:00:00 2001 From: janssenhenning Date: Wed, 29 Jun 2022 14:34:58 +0200 Subject: [PATCH 01/15] Add empty CHANGELOG entry --- CHANGELOG.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index b9850c7a2..dc0abffa3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # Changelog +## latest +[full changelog](https://github.com/JuDFTteam/masci-tools/compare/v0.11.2...develop) + +Nothing here yet + ## v.0.11.2 [full changelog](https://github.com/JuDFTteam/masci-tools/compare/v0.11.1...v0.11.2) From 56b9906863f7fd47a474d77cbe8a373d591c7704 Mon Sep 17 00:00:00 2001 From: janssenhenning Date: Thu, 30 Jun 2022 17:18:42 +0200 Subject: [PATCH 02/15] Add reading of atomic elements from `greensf.hdf` --- masci_tools/tools/greensf_calculations.py | 8 +++--- masci_tools/tools/greensfunction.py | 15 ++++++++++ tests/tools/test_jij/test_jij.csv | 28 +++++++++---------- tests/tools/test_jij/test_jij_max_shells.csv | 16 +++++------ tests/tools/test_jij/test_jij_tensor.csv | 28 +++++++++---------- .../test_jij/test_jij_tensor_max_shells.csv | 16 +++++------ tests/tools/test_jij/test_jij_tensor_x.csv | 28 +++++++++---------- tests/tools/test_jij/test_jij_tensor_y.csv | 28 +++++++++---------- 8 files changed, 91 insertions(+), 76 deletions(-) diff --git a/masci_tools/tools/greensf_calculations.py b/masci_tools/tools/greensf_calculations.py index 2a86566dd..7e5d76a1c 100644 --- a/masci_tools/tools/greensf_calculations.py +++ b/masci_tools/tools/greensf_calculations.py @@ -78,8 +78,8 @@ def calculate_heisenberg_jij( jij_constants['R_ij_x'].append(g1.atomDiff.tolist()[0]) jij_constants['R_ij_y'].append(g1.atomDiff.tolist()[1]) jij_constants['R_ij_z'].append(g1.atomDiff.tolist()[2]) - jij_constants['Atom i'].append(g1.extras['atom_label']) - jij_constants['Atom j'].append(g1.extras['atom_labelp']) + jij_constants['Atom i'].append(f"{g1.extras['atom_label']}({g1.extras['element']})") + jij_constants['Atom j'].append(f"{g1.extras['atom_labelp']}({g1.extras['elementp']})") jij_constants['J_ij'].append(jij.real * 1000) #Convert to meV return pd.DataFrame.from_dict(jij_constants) @@ -128,8 +128,8 @@ def calculate_heisenberg_tensor(hdffileORgreensfunctions: FileLike | list[Greens jij_tensor['R_ij_x'].append(g1.atomDiff.tolist()[0]) jij_tensor['R_ij_y'].append(g1.atomDiff.tolist()[1]) jij_tensor['R_ij_z'].append(g1.atomDiff.tolist()[2]) - jij_tensor['Atom i'].append(g1.extras['atom_label']) - jij_tensor['Atom j'].append(g1.extras['atom_labelp']) + jij_tensor['Atom i'].append(f"{g1.extras['atom_label']}({g1.extras['element']})") + jij_tensor['Atom j'].append(f"{g1.extras['atom_labelp']}({g1.extras['elementp']})") for sigmai_str in ('x', 'y', 'z'): for sigmaj_str in ('x', 'y', 'z'): diff --git a/masci_tools/tools/greensfunction.py b/masci_tools/tools/greensfunction.py index 4b7850834..420cb906d 100644 --- a/masci_tools/tools/greensfunction.py +++ b/masci_tools/tools/greensfunction.py @@ -232,6 +232,14 @@ def _get_sphavg_recipe(group_name: str, index: int, contour: int, version: int | ] } + if version is not None and version >= 8: + recipe['attributes']['atoms_elements'] = { + 'h5path': '/atoms/atomicNumbers', + 'description': 'Atomic numbers', + 'transforms': [Transformation(name='periodic_elements')] + } + recipe['attributes']['atoms_groups'] = {'h5path': '/atoms/equivAtomsGroup'} + return recipe @@ -505,6 +513,13 @@ def __init__(self, element: GreensfElement, data: dict[str, Any], attributes: di self._local_spin_frame = attributes.get('local_spin_frame', True) self._local_real_frame = attributes.get('local_real_frame', True) + self.extras['element'] = 'Unknown' + self.extras['elementp'] = 'Unknown' + if 'atoms_elements' in self.extras: + element_map = self.extras['atoms_elements'] + self.extras['element'] = element_map[list(self.extras['atoms_groups']).index(self.atomType)] + self.extras['elementp'] = element_map[list(self.extras['atoms_groups']).index(self.atomTypep)] + self.kpoints = None self.kpath = None self._nkpts = attributes.get('nkpts', 0) diff --git a/tests/tools/test_jij/test_jij.csv b/tests/tools/test_jij/test_jij.csv index 149f8fa71..8e088a15c 100644 --- a/tests/tools/test_jij/test_jij.csv +++ b/tests/tools/test_jij/test_jij.csv @@ -1,15 +1,15 @@ ,R,R_ij_x,R_ij_y,R_ij_z,Atom i,Atom j,J_ij -0,4.5137089598270004,2.6059910830000002,2.6059910830000002,2.6059910830000002,1,1,16.188944460424477 -1,4.5137089598270004,2.6059910830000002,-2.6059910830000002,-2.6059910830000002,1,1,16.188944460424473 -2,4.5137089598270004,-2.6059910830000002,2.6059910830000002,-2.6059910830000002,1,1,16.188944460424477 -3,4.5137089598270004,-2.6059910830000002,-2.6059910830000002,2.6059910830000002,1,1,16.188944460424473 -4,4.5137089598270004,-2.6059910830000002,-2.6059910830000002,-2.6059910830000002,1,1,16.188944460424477 -5,4.5137089598270004,-2.6059910830000002,2.6059910830000002,2.6059910830000002,1,1,16.188944460424473 -6,4.5137089598270004,2.6059910830000002,-2.6059910830000002,2.6059910830000002,1,1,16.18894446042448 -7,4.5137089598270004,2.6059910830000002,2.6059910830000002,-2.6059910830000002,1,1,16.188944460424473 -8,5.2119821660000003,0,0,5.2119821660000003,1,1,7.5758853182336745 -9,5.2119821660000003,0,-5.2119821660000003,0,1,1,7.5758853182336701 -10,5.2119821660000003,-5.2119821660000003,0,0,1,1,7.5758853182336736 -11,5.2119821660000003,5.2119821660000003,0,0,1,1,7.5758853182336745 -12,5.2119821660000003,0,5.2119821660000003,0,1,1,7.5758853182336727 -13,5.2119821660000003,0,0,-5.2119821660000003,1,1,7.5758853182336745 +0,4.5137089598270004,2.6059910830000002,2.6059910830000002,2.6059910830000002,1(Unknown),1(Unknown),16.188944460424477 +1,4.5137089598270004,2.6059910830000002,-2.6059910830000002,-2.6059910830000002,1(Unknown),1(Unknown),16.188944460424473 +2,4.5137089598270004,-2.6059910830000002,2.6059910830000002,-2.6059910830000002,1(Unknown),1(Unknown),16.188944460424477 +3,4.5137089598270004,-2.6059910830000002,-2.6059910830000002,2.6059910830000002,1(Unknown),1(Unknown),16.188944460424473 +4,4.5137089598270004,-2.6059910830000002,-2.6059910830000002,-2.6059910830000002,1(Unknown),1(Unknown),16.188944460424477 +5,4.5137089598270004,-2.6059910830000002,2.6059910830000002,2.6059910830000002,1(Unknown),1(Unknown),16.188944460424473 +6,4.5137089598270004,2.6059910830000002,-2.6059910830000002,2.6059910830000002,1(Unknown),1(Unknown),16.18894446042448 +7,4.5137089598270004,2.6059910830000002,2.6059910830000002,-2.6059910830000002,1(Unknown),1(Unknown),16.188944460424473 +8,5.2119821660000003,0,0,5.2119821660000003,1(Unknown),1(Unknown),7.5758853182336745 +9,5.2119821660000003,0,-5.2119821660000003,0,1(Unknown),1(Unknown),7.5758853182336701 +10,5.2119821660000003,-5.2119821660000003,0,0,1(Unknown),1(Unknown),7.5758853182336736 +11,5.2119821660000003,5.2119821660000003,0,0,1(Unknown),1(Unknown),7.5758853182336745 +12,5.2119821660000003,0,5.2119821660000003,0,1(Unknown),1(Unknown),7.5758853182336727 +13,5.2119821660000003,0,0,-5.2119821660000003,1(Unknown),1(Unknown),7.5758853182336745 diff --git a/tests/tools/test_jij/test_jij_max_shells.csv b/tests/tools/test_jij/test_jij_max_shells.csv index fad2d5320..ab2f46e87 100644 --- a/tests/tools/test_jij/test_jij_max_shells.csv +++ b/tests/tools/test_jij/test_jij_max_shells.csv @@ -1,9 +1,9 @@ ,R,R_ij_x,R_ij_y,R_ij_z,Atom i,Atom j,J_ij -0,4.5137089598270004,2.6059910830000002,2.6059910830000002,2.6059910830000002,1,1,16.188944460424477 -1,4.5137089598270004,2.6059910830000002,-2.6059910830000002,-2.6059910830000002,1,1,16.188944460424473 -2,4.5137089598270004,-2.6059910830000002,2.6059910830000002,-2.6059910830000002,1,1,16.188944460424477 -3,4.5137089598270004,-2.6059910830000002,-2.6059910830000002,2.6059910830000002,1,1,16.188944460424473 -4,4.5137089598270004,-2.6059910830000002,-2.6059910830000002,-2.6059910830000002,1,1,16.188944460424477 -5,4.5137089598270004,-2.6059910830000002,2.6059910830000002,2.6059910830000002,1,1,16.188944460424473 -6,4.5137089598270004,2.6059910830000002,-2.6059910830000002,2.6059910830000002,1,1,16.18894446042448 -7,4.5137089598270004,2.6059910830000002,2.6059910830000002,-2.6059910830000002,1,1,16.188944460424473 +0,4.5137089598270004,2.6059910830000002,2.6059910830000002,2.6059910830000002,1(Unknown),1(Unknown),16.188944460424477 +1,4.5137089598270004,2.6059910830000002,-2.6059910830000002,-2.6059910830000002,1(Unknown),1(Unknown),16.188944460424473 +2,4.5137089598270004,-2.6059910830000002,2.6059910830000002,-2.6059910830000002,1(Unknown),1(Unknown),16.188944460424477 +3,4.5137089598270004,-2.6059910830000002,-2.6059910830000002,2.6059910830000002,1(Unknown),1(Unknown),16.188944460424473 +4,4.5137089598270004,-2.6059910830000002,-2.6059910830000002,-2.6059910830000002,1(Unknown),1(Unknown),16.188944460424477 +5,4.5137089598270004,-2.6059910830000002,2.6059910830000002,2.6059910830000002,1(Unknown),1(Unknown),16.188944460424473 +6,4.5137089598270004,2.6059910830000002,-2.6059910830000002,2.6059910830000002,1(Unknown),1(Unknown),16.18894446042448 +7,4.5137089598270004,2.6059910830000002,2.6059910830000002,-2.6059910830000002,1(Unknown),1(Unknown),16.188944460424473 diff --git a/tests/tools/test_jij/test_jij_tensor.csv b/tests/tools/test_jij/test_jij_tensor.csv index 33cb41695..aba353876 100644 --- a/tests/tools/test_jij/test_jij_tensor.csv +++ b/tests/tools/test_jij/test_jij_tensor.csv @@ -1,15 +1,15 @@ ,R,R_ij_x,R_ij_y,R_ij_z,Atom i,Atom j,J_xx,J_xy,J_xz,J_yx,J_yy,J_yz,J_zx,J_zy,J_zz,J_ij,A_ij,S_ij,D_ij -0,4.5137089598270004,2.6059910830000002,2.6059910830000002,2.6059910830000002,1,1,16.188944460424484,2.3870354670186245e-14,-5.8824020742903951e-18,-2.3870354670186245e-14,16.188944460424484,5.77189265728862e-18,-5.882402074290281e-18,5.7718926572886084e-18,-37.102291733149102,16.188944460424484,0,0,2.3870354670186245e-14 -1,4.5137089598270004,2.6059910830000002,-2.6059910830000002,-2.6059910830000002,1,1,16.18894446042448,1.7134536961668566e-14,-5.8824020742903242e-18,-1.7134536961668566e-14,16.18894446042448,5.7718926572886392e-18,-5.8824020742902656e-18,5.7718926572885907e-18,-37.102291733149094,16.18894446042448,0,0,1.7134536961668566e-14 -2,4.5137089598270004,-2.6059910830000002,2.6059910830000002,-2.6059910830000002,1,1,16.18894446042448,2.0486107759229747e-14,-5.8824020742903789e-18,-2.0486107759229747e-14,16.18894446042448,5.7718926572885514e-18,-5.8824020742903758e-18,5.7718926572886169e-18,-37.102291733149102,16.18894446042448,0,0,2.0486107759229747e-14 -3,4.5137089598270004,-2.6059910830000002,-2.6059910830000002,2.6059910830000002,1,1,16.188944460424484,2.5410216513940486e-14,-5.882402074290335e-18,-2.5410216513940486e-14,16.188944460424484,5.7718926572886023e-18,-5.8824020742903065e-18,5.7718926572886446e-18,-37.102291733149094,16.188944460424484,0,0,2.5410216513940486e-14 -4,4.5137089598270004,-2.6059910830000002,-2.6059910830000002,-2.6059910830000002,1,1,16.188944460424484,2.3870354670186245e-14,-5.8824020742903951e-18,-2.3870354670186245e-14,16.188944460424484,5.77189265728862e-18,-5.882402074290281e-18,5.7718926572886084e-18,-37.102291733149102,16.188944460424484,0,0,2.3870354670186245e-14 -5,4.5137089598270004,-2.6059910830000002,2.6059910830000002,2.6059910830000002,1,1,16.18894446042448,1.7134536961668566e-14,-5.8824020742903242e-18,-1.7134536961668566e-14,16.18894446042448,5.7718926572886392e-18,-5.8824020742902656e-18,5.7718926572885907e-18,-37.102291733149094,16.18894446042448,0,0,1.7134536961668566e-14 -6,4.5137089598270004,2.6059910830000002,-2.6059910830000002,2.6059910830000002,1,1,16.188944460424487,2.4597852028140283e-14,-5.8824020742903427e-18,-2.4597852028140283e-14,16.188944460424487,5.771892657288593e-18,-5.882402074290325e-18,5.771892657288526e-18,-37.102291733149087,16.188944460424487,0,0,2.4597852028140283e-14 -7,4.5137089598270004,2.6059910830000002,2.6059910830000002,-2.6059910830000002,1,1,16.188944460424477,1.6448792415275211e-14,-5.8824020742902664e-18,-1.6448792415275211e-14,16.188944460424477,5.7718926572885699e-18,-5.8824020742903565e-18,5.7718926572886346e-18,-37.102291733149094,16.188944460424477,0,0,1.6448792415275211e-14 -8,5.2119821660000003,0,0,5.2119821660000003,1,1,7.5758853182336781,-1.2593918704444517e-15,-1.7836103910155061e-18,1.2593918704444517e-15,7.5758853182336781,-1.9768995817738697e-18,-1.7836103910155269e-18,-1.9768995817738519e-18,14.252285789954746,7.5758853182336781,0,0,-1.2593918704444517e-15 -9,5.2119821660000003,0,-5.2119821660000003,0,1,1,7.5758853182336683,6.0813877707948298e-16,-1.7836103910155054e-18,-6.0813877707948298e-16,7.5758853182336683,-1.976899581773865e-18,-1.7836103910154946e-18,-1.9768995817738724e-18,14.252285789954742,7.5758853182336683,0,0,6.0813877707948298e-16 -10,5.2119821660000003,-5.2119821660000003,0,0,1,1,7.5758853182336701,-4.0300539854222454e-16,-1.7836103910155e-18,4.0300539854222454e-16,7.5758853182336701,-1.9768995817738519e-18,-1.7836103910155512e-18,-1.9768995817738204e-18,14.252285789954746,7.5758853182336701,0,0,-4.0300539854222454e-16 -11,5.2119821660000003,5.2119821660000003,0,0,1,1,7.5758853182336701,1.0528969871823886e-16,-1.7836103910155304e-18,-1.0528969871823886e-16,7.5758853182336701,-1.9768995817738851e-18,-1.7836103910155007e-18,-1.9768995817738554e-18,14.252285789954742,7.5758853182336701,0,0,1.0528969871823886e-16 -12,5.2119821660000003,0,5.2119821660000003,0,1,1,7.5758853182336701,-5.3915587102270583e-16,-1.7836103910155096e-18,5.3915587102270583e-16,7.5758853182336701,-1.976899581773865e-18,-1.7836103910154988e-18,-1.9768995817738777e-18,14.252285789954746,7.5758853182336701,0,0,-5.3915587102270583e-16 -13,5.2119821660000003,0,0,-5.2119821660000003,1,1,7.5758853182336781,-1.2593918704444517e-15,-1.7836103910155061e-18,1.2593918704444517e-15,7.5758853182336781,-1.9768995817738697e-18,-1.7836103910155269e-18,-1.9768995817738519e-18,14.252285789954746,7.5758853182336781,0,0,-1.2593918704444517e-15 +0,4.5137089598270004,2.6059910830000002,2.6059910830000002,2.6059910830000002,1(Unknown),1(Unknown),16.188944460424484,2.3870354670186245e-14,-5.8824020742903951e-18,-2.3870354670186245e-14,16.188944460424484,5.77189265728862e-18,-5.882402074290281e-18,5.7718926572886084e-18,-37.102291733149102,16.188944460424484,0,0,2.3870354670186245e-14 +1,4.5137089598270004,2.6059910830000002,-2.6059910830000002,-2.6059910830000002,1(Unknown),1(Unknown),16.18894446042448,1.7134536961668566e-14,-5.8824020742903242e-18,-1.7134536961668566e-14,16.18894446042448,5.7718926572886392e-18,-5.8824020742902656e-18,5.7718926572885907e-18,-37.102291733149094,16.18894446042448,0,0,1.7134536961668566e-14 +2,4.5137089598270004,-2.6059910830000002,2.6059910830000002,-2.6059910830000002,1(Unknown),1(Unknown),16.18894446042448,2.0486107759229747e-14,-5.8824020742903789e-18,-2.0486107759229747e-14,16.18894446042448,5.7718926572885514e-18,-5.8824020742903758e-18,5.7718926572886169e-18,-37.102291733149102,16.18894446042448,0,0,2.0486107759229747e-14 +3,4.5137089598270004,-2.6059910830000002,-2.6059910830000002,2.6059910830000002,1(Unknown),1(Unknown),16.188944460424484,2.5410216513940486e-14,-5.882402074290335e-18,-2.5410216513940486e-14,16.188944460424484,5.7718926572886023e-18,-5.8824020742903065e-18,5.7718926572886446e-18,-37.102291733149094,16.188944460424484,0,0,2.5410216513940486e-14 +4,4.5137089598270004,-2.6059910830000002,-2.6059910830000002,-2.6059910830000002,1(Unknown),1(Unknown),16.188944460424484,2.3870354670186245e-14,-5.8824020742903951e-18,-2.3870354670186245e-14,16.188944460424484,5.77189265728862e-18,-5.882402074290281e-18,5.7718926572886084e-18,-37.102291733149102,16.188944460424484,0,0,2.3870354670186245e-14 +5,4.5137089598270004,-2.6059910830000002,2.6059910830000002,2.6059910830000002,1(Unknown),1(Unknown),16.18894446042448,1.7134536961668566e-14,-5.8824020742903242e-18,-1.7134536961668566e-14,16.18894446042448,5.7718926572886392e-18,-5.8824020742902656e-18,5.7718926572885907e-18,-37.102291733149094,16.18894446042448,0,0,1.7134536961668566e-14 +6,4.5137089598270004,2.6059910830000002,-2.6059910830000002,2.6059910830000002,1(Unknown),1(Unknown),16.188944460424487,2.4597852028140283e-14,-5.8824020742903427e-18,-2.4597852028140283e-14,16.188944460424487,5.771892657288593e-18,-5.882402074290325e-18,5.771892657288526e-18,-37.102291733149087,16.188944460424487,0,0,2.4597852028140283e-14 +7,4.5137089598270004,2.6059910830000002,2.6059910830000002,-2.6059910830000002,1(Unknown),1(Unknown),16.188944460424477,1.6448792415275211e-14,-5.8824020742902664e-18,-1.6448792415275211e-14,16.188944460424477,5.7718926572885699e-18,-5.8824020742903565e-18,5.7718926572886346e-18,-37.102291733149094,16.188944460424477,0,0,1.6448792415275211e-14 +8,5.2119821660000003,0,0,5.2119821660000003,1(Unknown),1(Unknown),7.5758853182336781,-1.2593918704444517e-15,-1.7836103910155061e-18,1.2593918704444517e-15,7.5758853182336781,-1.9768995817738697e-18,-1.7836103910155269e-18,-1.9768995817738519e-18,14.252285789954746,7.5758853182336781,0,0,-1.2593918704444517e-15 +9,5.2119821660000003,0,-5.2119821660000003,0,1(Unknown),1(Unknown),7.5758853182336683,6.0813877707948298e-16,-1.7836103910155054e-18,-6.0813877707948298e-16,7.5758853182336683,-1.976899581773865e-18,-1.7836103910154946e-18,-1.9768995817738724e-18,14.252285789954742,7.5758853182336683,0,0,6.0813877707948298e-16 +10,5.2119821660000003,-5.2119821660000003,0,0,1(Unknown),1(Unknown),7.5758853182336701,-4.0300539854222454e-16,-1.7836103910155e-18,4.0300539854222454e-16,7.5758853182336701,-1.9768995817738519e-18,-1.7836103910155512e-18,-1.9768995817738204e-18,14.252285789954746,7.5758853182336701,0,0,-4.0300539854222454e-16 +11,5.2119821660000003,5.2119821660000003,0,0,1(Unknown),1(Unknown),7.5758853182336701,1.0528969871823886e-16,-1.7836103910155304e-18,-1.0528969871823886e-16,7.5758853182336701,-1.9768995817738851e-18,-1.7836103910155007e-18,-1.9768995817738554e-18,14.252285789954742,7.5758853182336701,0,0,1.0528969871823886e-16 +12,5.2119821660000003,0,5.2119821660000003,0,1(Unknown),1(Unknown),7.5758853182336701,-5.3915587102270583e-16,-1.7836103910155096e-18,5.3915587102270583e-16,7.5758853182336701,-1.976899581773865e-18,-1.7836103910154988e-18,-1.9768995817738777e-18,14.252285789954746,7.5758853182336701,0,0,-5.3915587102270583e-16 +13,5.2119821660000003,0,0,-5.2119821660000003,1(Unknown),1(Unknown),7.5758853182336781,-1.2593918704444517e-15,-1.7836103910155061e-18,1.2593918704444517e-15,7.5758853182336781,-1.9768995817738697e-18,-1.7836103910155269e-18,-1.9768995817738519e-18,14.252285789954746,7.5758853182336781,0,0,-1.2593918704444517e-15 diff --git a/tests/tools/test_jij/test_jij_tensor_max_shells.csv b/tests/tools/test_jij/test_jij_tensor_max_shells.csv index 9a4bc5d75..f5be86544 100644 --- a/tests/tools/test_jij/test_jij_tensor_max_shells.csv +++ b/tests/tools/test_jij/test_jij_tensor_max_shells.csv @@ -1,9 +1,9 @@ ,R,R_ij_x,R_ij_y,R_ij_z,Atom i,Atom j,J_xx,J_xy,J_xz,J_yx,J_yy,J_yz,J_zx,J_zy,J_zz -0,4.5137089598270004,2.6059910830000002,2.6059910830000002,2.6059910830000002,1,1,16.188944460424484,2.3870354670186245e-14,-5.8824020742903951e-18,-2.3870354670186245e-14,16.188944460424484,5.77189265728862e-18,-5.882402074290281e-18,5.7718926572886084e-18,-37.102291733149102 -1,4.5137089598270004,2.6059910830000002,-2.6059910830000002,-2.6059910830000002,1,1,16.18894446042448,1.7134536961668566e-14,-5.8824020742903242e-18,-1.7134536961668566e-14,16.18894446042448,5.7718926572886392e-18,-5.8824020742902656e-18,5.7718926572885907e-18,-37.102291733149094 -2,4.5137089598270004,-2.6059910830000002,2.6059910830000002,-2.6059910830000002,1,1,16.18894446042448,2.0486107759229747e-14,-5.8824020742903789e-18,-2.0486107759229747e-14,16.18894446042448,5.7718926572885514e-18,-5.8824020742903758e-18,5.7718926572886169e-18,-37.102291733149102 -3,4.5137089598270004,-2.6059910830000002,-2.6059910830000002,2.6059910830000002,1,1,16.188944460424484,2.5410216513940486e-14,-5.882402074290335e-18,-2.5410216513940486e-14,16.188944460424484,5.7718926572886023e-18,-5.8824020742903065e-18,5.7718926572886446e-18,-37.102291733149094 -4,4.5137089598270004,-2.6059910830000002,-2.6059910830000002,-2.6059910830000002,1,1,16.188944460424484,2.3870354670186245e-14,-5.8824020742903951e-18,-2.3870354670186245e-14,16.188944460424484,5.77189265728862e-18,-5.882402074290281e-18,5.7718926572886084e-18,-37.102291733149102 -5,4.5137089598270004,-2.6059910830000002,2.6059910830000002,2.6059910830000002,1,1,16.18894446042448,1.7134536961668566e-14,-5.8824020742903242e-18,-1.7134536961668566e-14,16.18894446042448,5.7718926572886392e-18,-5.8824020742902656e-18,5.7718926572885907e-18,-37.102291733149094 -6,4.5137089598270004,2.6059910830000002,-2.6059910830000002,2.6059910830000002,1,1,16.188944460424487,2.4597852028140283e-14,-5.8824020742903427e-18,-2.4597852028140283e-14,16.188944460424487,5.771892657288593e-18,-5.882402074290325e-18,5.771892657288526e-18,-37.102291733149087 -7,4.5137089598270004,2.6059910830000002,2.6059910830000002,-2.6059910830000002,1,1,16.188944460424477,1.6448792415275211e-14,-5.8824020742902664e-18,-1.6448792415275211e-14,16.188944460424477,5.7718926572885699e-18,-5.8824020742903565e-18,5.7718926572886346e-18,-37.102291733149094 +0,4.5137089598270004,2.6059910830000002,2.6059910830000002,2.6059910830000002,1(Unknown),1(Unknown),16.188944460424484,2.3870354670186245e-14,-5.8824020742903951e-18,-2.3870354670186245e-14,16.188944460424484,5.77189265728862e-18,-5.882402074290281e-18,5.7718926572886084e-18,-37.102291733149102 +1,4.5137089598270004,2.6059910830000002,-2.6059910830000002,-2.6059910830000002,1(Unknown),1(Unknown),16.18894446042448,1.7134536961668566e-14,-5.8824020742903242e-18,-1.7134536961668566e-14,16.18894446042448,5.7718926572886392e-18,-5.8824020742902656e-18,5.7718926572885907e-18,-37.102291733149094 +2,4.5137089598270004,-2.6059910830000002,2.6059910830000002,-2.6059910830000002,1(Unknown),1(Unknown),16.18894446042448,2.0486107759229747e-14,-5.8824020742903789e-18,-2.0486107759229747e-14,16.18894446042448,5.7718926572885514e-18,-5.8824020742903758e-18,5.7718926572886169e-18,-37.102291733149102 +3,4.5137089598270004,-2.6059910830000002,-2.6059910830000002,2.6059910830000002,1(Unknown),1(Unknown),16.188944460424484,2.5410216513940486e-14,-5.882402074290335e-18,-2.5410216513940486e-14,16.188944460424484,5.7718926572886023e-18,-5.8824020742903065e-18,5.7718926572886446e-18,-37.102291733149094 +4,4.5137089598270004,-2.6059910830000002,-2.6059910830000002,-2.6059910830000002,1(Unknown),1(Unknown),16.188944460424484,2.3870354670186245e-14,-5.8824020742903951e-18,-2.3870354670186245e-14,16.188944460424484,5.77189265728862e-18,-5.882402074290281e-18,5.7718926572886084e-18,-37.102291733149102 +5,4.5137089598270004,-2.6059910830000002,2.6059910830000002,2.6059910830000002,1(Unknown),1(Unknown),16.18894446042448,1.7134536961668566e-14,-5.8824020742903242e-18,-1.7134536961668566e-14,16.18894446042448,5.7718926572886392e-18,-5.8824020742902656e-18,5.7718926572885907e-18,-37.102291733149094 +6,4.5137089598270004,2.6059910830000002,-2.6059910830000002,2.6059910830000002,1(Unknown),1(Unknown),16.188944460424487,2.4597852028140283e-14,-5.8824020742903427e-18,-2.4597852028140283e-14,16.188944460424487,5.771892657288593e-18,-5.882402074290325e-18,5.771892657288526e-18,-37.102291733149087 +7,4.5137089598270004,2.6059910830000002,2.6059910830000002,-2.6059910830000002,1(Unknown),1(Unknown),16.188944460424477,1.6448792415275211e-14,-5.8824020742902664e-18,-1.6448792415275211e-14,16.188944460424477,5.7718926572885699e-18,-5.8824020742903565e-18,5.7718926572886346e-18,-37.102291733149094 diff --git a/tests/tools/test_jij/test_jij_tensor_x.csv b/tests/tools/test_jij/test_jij_tensor_x.csv index 05acd5016..f3a9d566e 100644 --- a/tests/tools/test_jij/test_jij_tensor_x.csv +++ b/tests/tools/test_jij/test_jij_tensor_x.csv @@ -1,15 +1,15 @@ ,R,R_ij_x,R_ij_y,R_ij_z,Atom i,Atom j,J_xx,J_xy,J_xz,J_yx,J_yy,J_yz,J_zx,J_zy,J_zz,J_ij,A_ij,S_ij,D_ij -0,4.5137089598270004,2.6059910830000002,2.6059910830000002,2.6059910830000002,1,1,-37.102292940080588,-7.4356311370673499e-15,2.7189686488135754e-10,3.717815568533675e-15,16.188964801782681,-1.8589077842668375e-15,2.7195820883823837e-10,5.4605416162838355e-15,16.188964801782745,16.188964801782713,-3.1974423109204508e-14,1.8008169160084992e-15,-3.6597247002753363e-15 -1,4.5137089598270004,2.6059910830000002,-2.6059910830000002,-2.6059910830000002,1,1,-37.102292940080552,-1.2779991016834508e-14,2.7190058269692608e-10,2.5559982033669018e-15,16.188964801782685,-1.3941808382001282e-15,2.7194519648374848e-10,3.8920881733086909e-15,16.188964801782742,16.188964801782713,-2.8421709430404007e-14,1.2489536675542814e-15,-2.6431345057544098e-15 -2,4.5137089598270004,-2.6059910830000002,2.6059910830000002,-2.6059910830000002,1,1,-37.102292940080567,5.5767233528005128e-15,2.7188199361908343e-10,-9.2945389213341886e-15,16.188964801782678,-3.2530886224669657e-15,2.719656444693754e-10,3.4273612272419821e-15,16.188964801782717,16.188964801782696,-1.9539925233402755e-14,8.7136302387508186e-17,-3.3402249248544737e-15 -3,4.5137089598270004,-2.6059910830000002,-2.6059910830000002,2.6059910830000002,1,1,-37.102292940080559,-4.4149059876337389e-15,2.7191452450530809e-10,3.717815568533675e-15,16.188964801782664,-4.6472694606670943e-15,2.7196006774602264e-10,5.1119964067338036e-15,16.188964801782731,16.188964801782696,-3.3750779948604759e-14,2.3236347303335464e-16,-4.8796329337004489e-15 -4,4.5137089598270004,-2.6059910830000002,-2.6059910830000002,-2.6059910830000002,1,1,-37.102292940080588,-7.4356311370673499e-15,2.7189686488135754e-10,3.717815568533675e-15,16.188964801782681,-1.8589077842668375e-15,2.7195820883823837e-10,5.4605416162838355e-15,16.188964801782745,16.188964801782713,-3.1974423109204508e-14,1.8008169160084992e-15,-3.6597247002753363e-15 -5,4.5137089598270004,-2.6059910830000002,2.6059910830000002,2.6059910830000002,1,1,-37.102292940080552,-1.2779991016834508e-14,2.7190058269692608e-10,2.5559982033669018e-15,16.188964801782685,-1.3941808382001282e-15,2.7194519648374848e-10,3.8920881733086909e-15,16.188964801782742,16.188964801782713,-2.8421709430404007e-14,1.2489536675542814e-15,-2.6431345057544098e-15 -6,4.5137089598270004,2.6059910830000002,-2.6059910830000002,2.6059910830000002,1,1,-37.102292940080567,4.6472694606670937e-16,2.7185875727178007e-10,-8.36508502920077e-15,16.188964801782664,0,2.7196192665380686e-10,5.5767233528005128e-15,16.188964801782717,16.188964801782689,-2.6645352591003757e-14,2.7883616764002564e-15,-2.7883616764002564e-15 -7,4.5137089598270004,2.6059910830000002,2.6059910830000002,-2.6059910830000002,1,1,-37.102292940080545,-5.5767233528005128e-15,2.7190894778195528e-10,8.1327215561674154e-15,16.188964801782664,-2.7883616764002564e-15,2.7196750337715967e-10,4.1244516463420464e-15,16.188964801782745,16.188964801782703,-4.0856207306205761e-14,6.6804498497089497e-16,-3.4564066613711514e-15 -8,5.2119821660000003,0,0,5.2119821660000003,1,1,14.252286687805961,-3.8339973050503523e-15,-3.4119555289798704e-11,-1.5103625747168055e-15,7.5758723189101502,3.4854520955003205e-16,-3.4122343651475104e-11,-6.7167566423704094e-16,7.5758723189101458,7.5758723189101485,2.2204460492503131e-15,-1.6156522734350444e-16,5.101104368935365e-16 -9,5.2119821660000003,0,-5.2119821660000003,0,1,1,14.252286687805949,1.1618173651667736e-15,-3.4118277290697021e-11,-1.6846351794918217e-15,7.5758723189101449,0,-3.4115372747284101e-11,3.5144975296294896e-15,7.575872318910152,7.5758723189101485,-3.5527136788005009e-15,1.7572487648147448e-15,-1.7572487648147448e-15 -10,5.2119821660000003,-5.2119821660000003,0,0,1,1,14.252286687805947,-1.452271706458467e-16,-3.4116883109858818e-11,-1.713680613620991e-15,7.5758723189101485,-1.6265443112334828e-15,-3.4116302201176237e-11,3.6016338320169984e-15,7.5758723189101529,7.5758723189101502,-2.2204460492503131e-15,9.8754476039175779e-16,-2.6140890716252404e-15 -11,5.2119821660000003,5.2119821660000003,0,0,1,1,14.252286687805949,-2.0331803890418536e-16,-3.4119787653271738e-11,-1.9460440866543455e-15,7.5758723189101449,-5.8090868258338679e-16,-3.4116069837703203e-11,3.2530886224669657e-15,7.5758723189101511,7.5758723189101485,-3.1086244689504383e-15,1.3360899699417895e-15,-1.9169986525251761e-15 -12,5.2119821660000003,0,5.2119821660000003,0,1,1,14.252286687805949,9.0040845800424961e-16,-3.411943910806219e-11,-1.7717714818793297e-15,7.5758723189101449,-2.3236347303335468e-16,-3.4114675656865006e-11,2.5269527692377324e-15,7.5758723189101529,7.5758723189101485,-3.9968028886505635e-15,1.1472946481021889e-15,-1.3796581211355435e-15 -13,5.2119821660000003,0,0,-5.2119821660000003,1,1,14.252286687805961,-3.8339973050503523e-15,-3.4119555289798704e-11,-1.5103625747168055e-15,7.5758723189101502,3.4854520955003205e-16,-3.4122343651475104e-11,-6.7167566423704094e-16,7.5758723189101458,7.5758723189101485,2.2204460492503131e-15,-1.6156522734350444e-16,5.101104368935365e-16 +0,4.5137089598270004,2.6059910830000002,2.6059910830000002,2.6059910830000002,1(Unknown),1(Unknown),-37.102292940080588,-7.4356311370673499e-15,2.7189686488135754e-10,3.717815568533675e-15,16.188964801782681,-1.8589077842668375e-15,2.7195820883823837e-10,5.4605416162838355e-15,16.188964801782745,16.188964801782713,-3.1974423109204508e-14,1.8008169160084992e-15,-3.6597247002753363e-15 +1,4.5137089598270004,2.6059910830000002,-2.6059910830000002,-2.6059910830000002,1(Unknown),1(Unknown),-37.102292940080552,-1.2779991016834508e-14,2.7190058269692608e-10,2.5559982033669018e-15,16.188964801782685,-1.3941808382001282e-15,2.7194519648374848e-10,3.8920881733086909e-15,16.188964801782742,16.188964801782713,-2.8421709430404007e-14,1.2489536675542814e-15,-2.6431345057544098e-15 +2,4.5137089598270004,-2.6059910830000002,2.6059910830000002,-2.6059910830000002,1(Unknown),1(Unknown),-37.102292940080567,5.5767233528005128e-15,2.7188199361908343e-10,-9.2945389213341886e-15,16.188964801782678,-3.2530886224669657e-15,2.719656444693754e-10,3.4273612272419821e-15,16.188964801782717,16.188964801782696,-1.9539925233402755e-14,8.7136302387508186e-17,-3.3402249248544737e-15 +3,4.5137089598270004,-2.6059910830000002,-2.6059910830000002,2.6059910830000002,1(Unknown),1(Unknown),-37.102292940080559,-4.4149059876337389e-15,2.7191452450530809e-10,3.717815568533675e-15,16.188964801782664,-4.6472694606670943e-15,2.7196006774602264e-10,5.1119964067338036e-15,16.188964801782731,16.188964801782696,-3.3750779948604759e-14,2.3236347303335464e-16,-4.8796329337004489e-15 +4,4.5137089598270004,-2.6059910830000002,-2.6059910830000002,-2.6059910830000002,1(Unknown),1(Unknown),-37.102292940080588,-7.4356311370673499e-15,2.7189686488135754e-10,3.717815568533675e-15,16.188964801782681,-1.8589077842668375e-15,2.7195820883823837e-10,5.4605416162838355e-15,16.188964801782745,16.188964801782713,-3.1974423109204508e-14,1.8008169160084992e-15,-3.6597247002753363e-15 +5,4.5137089598270004,-2.6059910830000002,2.6059910830000002,2.6059910830000002,1(Unknown),1(Unknown),-37.102292940080552,-1.2779991016834508e-14,2.7190058269692608e-10,2.5559982033669018e-15,16.188964801782685,-1.3941808382001282e-15,2.7194519648374848e-10,3.8920881733086909e-15,16.188964801782742,16.188964801782713,-2.8421709430404007e-14,1.2489536675542814e-15,-2.6431345057544098e-15 +6,4.5137089598270004,2.6059910830000002,-2.6059910830000002,2.6059910830000002,1(Unknown),1(Unknown),-37.102292940080567,4.6472694606670937e-16,2.7185875727178007e-10,-8.36508502920077e-15,16.188964801782664,0,2.7196192665380686e-10,5.5767233528005128e-15,16.188964801782717,16.188964801782689,-2.6645352591003757e-14,2.7883616764002564e-15,-2.7883616764002564e-15 +7,4.5137089598270004,2.6059910830000002,2.6059910830000002,-2.6059910830000002,1(Unknown),1(Unknown),-37.102292940080545,-5.5767233528005128e-15,2.7190894778195528e-10,8.1327215561674154e-15,16.188964801782664,-2.7883616764002564e-15,2.7196750337715967e-10,4.1244516463420464e-15,16.188964801782745,16.188964801782703,-4.0856207306205761e-14,6.6804498497089497e-16,-3.4564066613711514e-15 +8,5.2119821660000003,0,0,5.2119821660000003,1(Unknown),1(Unknown),14.252286687805961,-3.8339973050503523e-15,-3.4119555289798704e-11,-1.5103625747168055e-15,7.5758723189101502,3.4854520955003205e-16,-3.4122343651475104e-11,-6.7167566423704094e-16,7.5758723189101458,7.5758723189101485,2.2204460492503131e-15,-1.6156522734350444e-16,5.101104368935365e-16 +9,5.2119821660000003,0,-5.2119821660000003,0,1(Unknown),1(Unknown),14.252286687805949,1.1618173651667736e-15,-3.4118277290697021e-11,-1.6846351794918217e-15,7.5758723189101449,0,-3.4115372747284101e-11,3.5144975296294896e-15,7.575872318910152,7.5758723189101485,-3.5527136788005009e-15,1.7572487648147448e-15,-1.7572487648147448e-15 +10,5.2119821660000003,-5.2119821660000003,0,0,1(Unknown),1(Unknown),14.252286687805947,-1.452271706458467e-16,-3.4116883109858818e-11,-1.713680613620991e-15,7.5758723189101485,-1.6265443112334828e-15,-3.4116302201176237e-11,3.6016338320169984e-15,7.5758723189101529,7.5758723189101502,-2.2204460492503131e-15,9.8754476039175779e-16,-2.6140890716252404e-15 +11,5.2119821660000003,5.2119821660000003,0,0,1(Unknown),1(Unknown),14.252286687805949,-2.0331803890418536e-16,-3.4119787653271738e-11,-1.9460440866543455e-15,7.5758723189101449,-5.8090868258338679e-16,-3.4116069837703203e-11,3.2530886224669657e-15,7.5758723189101511,7.5758723189101485,-3.1086244689504383e-15,1.3360899699417895e-15,-1.9169986525251761e-15 +12,5.2119821660000003,0,5.2119821660000003,0,1(Unknown),1(Unknown),14.252286687805949,9.0040845800424961e-16,-3.411943910806219e-11,-1.7717714818793297e-15,7.5758723189101449,-2.3236347303335468e-16,-3.4114675656865006e-11,2.5269527692377324e-15,7.5758723189101529,7.5758723189101485,-3.9968028886505635e-15,1.1472946481021889e-15,-1.3796581211355435e-15 +13,5.2119821660000003,0,0,-5.2119821660000003,1(Unknown),1(Unknown),14.252286687805961,-3.8339973050503523e-15,-3.4119555289798704e-11,-1.5103625747168055e-15,7.5758723189101502,3.4854520955003205e-16,-3.4122343651475104e-11,-6.7167566423704094e-16,7.5758723189101458,7.5758723189101485,2.2204460492503131e-15,-1.6156522734350444e-16,5.101104368935365e-16 diff --git a/tests/tools/test_jij/test_jij_tensor_y.csv b/tests/tools/test_jij/test_jij_tensor_y.csv index d6c3cdd56..3103225fd 100644 --- a/tests/tools/test_jij/test_jij_tensor_y.csv +++ b/tests/tools/test_jij/test_jij_tensor_y.csv @@ -1,15 +1,15 @@ ,R,R_ij_x,R_ij_y,R_ij_z,Atom i,Atom j,J_xx,J_xy,J_xz,J_yx,J_yy,J_yz,J_zx,J_zy,J_zz,J_ij,A_ij,S_ij,D_ij -0,4.5137089598270004,2.6059910830000002,2.6059910830000002,2.6059910830000002,1,1,16.188964802352359,2.7198051573164957e-10,-4.182542514600385e-15,2.7199306335919333e-10,-37.102292939728208,2.7202512951847196e-10,6.970904191000641e-16,2.7177045915202739e-10,16.18896480235238,16.18896480235237,-1.0658141036401503e-14,-1.7427260477501606e-15,-2.4398164668502245e-15 -1,4.5137089598270004,2.6059910830000002,-2.6059910830000002,-2.6059910830000002,1,1,16.188964802352366,2.7200351971547981e-10,1.3941808382001282e-15,2.719863248184754e-10,-37.102292939728208,2.7200654044062931e-10,1.9750895207835148e-15,2.7174071662747911e-10,16.188964802352366,16.188964802352366,0,1.6846351794918215e-15,-2.9045434129169329e-16 -2,4.5137089598270004,-2.6059910830000002,2.6059910830000002,-2.6059910830000002,1,1,16.188964802352366,2.7198469827416414e-10,-6.5061772449339314e-15,2.720009637172765e-10,-37.102292939728194,2.7201304661787423e-10,-5.4605416162838355e-15,2.7173699881191062e-10,16.188964802352356,16.188964802352359,5.3290705182007514e-15,-5.9833594306088834e-15,-5.2281781432504793e-16 -3,4.5137089598270004,-2.6059910830000002,-2.6059910830000002,2.6059910830000002,1,1,16.188964802352366,2.7198446591069113e-10,4.6472694606670937e-16,2.7199190154182816e-10,-37.102292939728187,2.7200746989452142e-10,4.8215420654421103e-15,2.717128330107151e-10,16.188964802352373,16.18896480235237,-3.5527136788005009e-15,2.6431345057544098e-15,-2.1784075596877005e-15 -4,4.5137089598270004,-2.6059910830000002,-2.6059910830000002,-2.6059910830000002,1,1,16.188964802352359,2.7198051573164957e-10,-4.182542514600385e-15,2.7199306335919333e-10,-37.102292939728208,2.7202512951847196e-10,6.970904191000641e-16,2.7177045915202739e-10,16.18896480235238,16.18896480235237,-1.0658141036401503e-14,-1.7427260477501606e-15,-2.4398164668502245e-15 -5,4.5137089598270004,-2.6059910830000002,2.6059910830000002,2.6059910830000002,1,1,16.188964802352366,2.7200351971547981e-10,1.3941808382001282e-15,2.719863248184754e-10,-37.102292939728208,2.7200654044062931e-10,1.9750895207835148e-15,2.7174071662747911e-10,16.188964802352366,16.188964802352366,0,1.6846351794918215e-15,-2.9045434129169329e-16 -6,4.5137089598270004,2.6059910830000002,-2.6059910830000002,2.6059910830000002,1,1,16.188964802352366,2.7199445754003157e-10,-9.9916293404342509e-15,2.7198190991248771e-10,-37.102292939728208,2.7199166917835514e-10,-1.1618173651667734e-16,2.7173142208855781e-10,16.188964802352356,16.188964802352359,5.3290705182007514e-15,-5.0539055384754641e-15,-4.9377238019587868e-15 -7,4.5137089598270004,2.6059910830000002,2.6059910830000002,-2.6059910830000002,1,1,16.188964802352366,2.7199515463045062e-10,-4.182542514600385e-15,2.7199166917835514e-10,-37.102292939728173,2.7201304661787423e-10,-5.8090868258338671e-17,2.7173328099634203e-10,16.188964802352359,16.188964802352363,3.5527136788005009e-15,-2.1203166914293618e-15,-2.0622258231710232e-15 -8,5.2119821660000003,0,0,5.2119821660000003,1,1,7.57587231885954,-3.4019406632921326e-11,8.1327215561674142e-16,-3.4018012452083129e-11,14.252286687739629,-3.4124783467941956e-11,-6.7530634350318711e-16,-3.4123273105367239e-11,7.5758723188595312,7.5758723188595356,4.4408920985006262e-15,6.8982906056777157e-17,7.4428924955996426e-16 -9,5.2119821660000003,0,-5.2119821660000003,0,1,1,7.5758723188595098,-3.4023937720645476e-11,-2.9045434129169337e-15,-3.4021614085915144e-11,14.252286687739629,-3.4122576014948137e-11,1.5684534429751442e-15,-3.4124434922732408e-11,7.57587231885954,7.5758723188595249,-1.5099033134902129e-14,-6.6804498497089477e-16,-2.2364984279460392e-15 -10,5.2119821660000003,-5.2119821660000003,0,0,1,1,7.5758723188595143,-3.402448958389393e-11,5.8090868258338679e-16,-3.4021120313534949e-11,14.252286687739627,-3.4122692196684658e-11,3.7759064367920138e-16,-3.4125364376624537e-11,7.57587231885954,7.5758723188595276,-1.2878587085651816e-14,4.7924966313129413e-16,1.016590194520927e-16 -11,5.2119821660000003,5.2119821660000003,0,0,1,1,7.5758723188595178,-3.4023821538908962e-11,-2.6721799398835791e-15,-3.4020800813759529e-11,14.252286687739632,-3.4123273105367239e-11,6.3899955084172544e-16,-3.4126061467043639e-11,7.5758723188595418,7.5758723188595294,-1.1990408665951691e-14,-1.0165901945209269e-15,-1.6555897453626522e-15 -12,5.2119821660000003,0,5.2119821660000003,0,1,1,7.5758723188595098,-3.4022979221319214e-11,-3.2530886224669657e-15,-3.4021004131798429e-11,14.252286687739632,-3.4123040741894205e-11,6.0995411671255612e-16,-3.4124667286205436e-11,7.5758723188595374,7.5758723188595241,-1.3766765505351941e-14,-1.3215672528772049e-15,-1.9315213695897608e-15 -13,5.2119821660000003,0,0,-5.2119821660000003,1,1,7.57587231885954,-3.4019406632921326e-11,8.1327215561674142e-16,-3.4018012452083129e-11,14.252286687739629,-3.4124783467941956e-11,-6.7530634350318711e-16,-3.4123273105367239e-11,7.5758723188595312,7.5758723188595356,4.4408920985006262e-15,6.8982906056777157e-17,7.4428924955996426e-16 +0,4.5137089598270004,2.6059910830000002,2.6059910830000002,2.6059910830000002,1(Unknown),1(Unknown),16.188964802352359,2.7198051573164957e-10,-4.182542514600385e-15,2.7199306335919333e-10,-37.102292939728208,2.7202512951847196e-10,6.970904191000641e-16,2.7177045915202739e-10,16.18896480235238,16.18896480235237,-1.0658141036401503e-14,-1.7427260477501606e-15,-2.4398164668502245e-15 +1,4.5137089598270004,2.6059910830000002,-2.6059910830000002,-2.6059910830000002,1(Unknown),1(Unknown),16.188964802352366,2.7200351971547981e-10,1.3941808382001282e-15,2.719863248184754e-10,-37.102292939728208,2.7200654044062931e-10,1.9750895207835148e-15,2.7174071662747911e-10,16.188964802352366,16.188964802352366,0,1.6846351794918215e-15,-2.9045434129169329e-16 +2,4.5137089598270004,-2.6059910830000002,2.6059910830000002,-2.6059910830000002,1(Unknown),1(Unknown),16.188964802352366,2.7198469827416414e-10,-6.5061772449339314e-15,2.720009637172765e-10,-37.102292939728194,2.7201304661787423e-10,-5.4605416162838355e-15,2.7173699881191062e-10,16.188964802352356,16.188964802352359,5.3290705182007514e-15,-5.9833594306088834e-15,-5.2281781432504793e-16 +3,4.5137089598270004,-2.6059910830000002,-2.6059910830000002,2.6059910830000002,1(Unknown),1(Unknown),16.188964802352366,2.7198446591069113e-10,4.6472694606670937e-16,2.7199190154182816e-10,-37.102292939728187,2.7200746989452142e-10,4.8215420654421103e-15,2.717128330107151e-10,16.188964802352373,16.18896480235237,-3.5527136788005009e-15,2.6431345057544098e-15,-2.1784075596877005e-15 +4,4.5137089598270004,-2.6059910830000002,-2.6059910830000002,-2.6059910830000002,1(Unknown),1(Unknown),16.188964802352359,2.7198051573164957e-10,-4.182542514600385e-15,2.7199306335919333e-10,-37.102292939728208,2.7202512951847196e-10,6.970904191000641e-16,2.7177045915202739e-10,16.18896480235238,16.18896480235237,-1.0658141036401503e-14,-1.7427260477501606e-15,-2.4398164668502245e-15 +5,4.5137089598270004,-2.6059910830000002,2.6059910830000002,2.6059910830000002,1(Unknown),1(Unknown),16.188964802352366,2.7200351971547981e-10,1.3941808382001282e-15,2.719863248184754e-10,-37.102292939728208,2.7200654044062931e-10,1.9750895207835148e-15,2.7174071662747911e-10,16.188964802352366,16.188964802352366,0,1.6846351794918215e-15,-2.9045434129169329e-16 +6,4.5137089598270004,2.6059910830000002,-2.6059910830000002,2.6059910830000002,1(Unknown),1(Unknown),16.188964802352366,2.7199445754003157e-10,-9.9916293404342509e-15,2.7198190991248771e-10,-37.102292939728208,2.7199166917835514e-10,-1.1618173651667734e-16,2.7173142208855781e-10,16.188964802352356,16.188964802352359,5.3290705182007514e-15,-5.0539055384754641e-15,-4.9377238019587868e-15 +7,4.5137089598270004,2.6059910830000002,2.6059910830000002,-2.6059910830000002,1(Unknown),1(Unknown),16.188964802352366,2.7199515463045062e-10,-4.182542514600385e-15,2.7199166917835514e-10,-37.102292939728173,2.7201304661787423e-10,-5.8090868258338671e-17,2.7173328099634203e-10,16.188964802352359,16.188964802352363,3.5527136788005009e-15,-2.1203166914293618e-15,-2.0622258231710232e-15 +8,5.2119821660000003,0,0,5.2119821660000003,1(Unknown),1(Unknown),7.57587231885954,-3.4019406632921326e-11,8.1327215561674142e-16,-3.4018012452083129e-11,14.252286687739629,-3.4124783467941956e-11,-6.7530634350318711e-16,-3.4123273105367239e-11,7.5758723188595312,7.5758723188595356,4.4408920985006262e-15,6.8982906056777157e-17,7.4428924955996426e-16 +9,5.2119821660000003,0,-5.2119821660000003,0,1(Unknown),1(Unknown),7.5758723188595098,-3.4023937720645476e-11,-2.9045434129169337e-15,-3.4021614085915144e-11,14.252286687739629,-3.4122576014948137e-11,1.5684534429751442e-15,-3.4124434922732408e-11,7.57587231885954,7.5758723188595249,-1.5099033134902129e-14,-6.6804498497089477e-16,-2.2364984279460392e-15 +10,5.2119821660000003,-5.2119821660000003,0,0,1(Unknown),1(Unknown),7.5758723188595143,-3.402448958389393e-11,5.8090868258338679e-16,-3.4021120313534949e-11,14.252286687739627,-3.4122692196684658e-11,3.7759064367920138e-16,-3.4125364376624537e-11,7.57587231885954,7.5758723188595276,-1.2878587085651816e-14,4.7924966313129413e-16,1.016590194520927e-16 +11,5.2119821660000003,5.2119821660000003,0,0,1(Unknown),1(Unknown),7.5758723188595178,-3.4023821538908962e-11,-2.6721799398835791e-15,-3.4020800813759529e-11,14.252286687739632,-3.4123273105367239e-11,6.3899955084172544e-16,-3.4126061467043639e-11,7.5758723188595418,7.5758723188595294,-1.1990408665951691e-14,-1.0165901945209269e-15,-1.6555897453626522e-15 +12,5.2119821660000003,0,5.2119821660000003,0,1(Unknown),1(Unknown),7.5758723188595098,-3.4022979221319214e-11,-3.2530886224669657e-15,-3.4021004131798429e-11,14.252286687739632,-3.4123040741894205e-11,6.0995411671255612e-16,-3.4124667286205436e-11,7.5758723188595374,7.5758723188595241,-1.3766765505351941e-14,-1.3215672528772049e-15,-1.9315213695897608e-15 +13,5.2119821660000003,0,0,-5.2119821660000003,1(Unknown),1(Unknown),7.57587231885954,-3.4019406632921326e-11,8.1327215561674142e-16,-3.4018012452083129e-11,14.252286687739629,-3.4124783467941956e-11,-6.7530634350318711e-16,-3.4123273105367239e-11,7.5758723188595312,7.5758723188595356,4.4408920985006262e-15,6.8982906056777157e-17,7.4428924955996426e-16 From 0fa1a17111aa94af671503dca6ac8de0142602b7 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 4 Jul 2022 17:09:09 +0000 Subject: [PATCH 03/15] [pre-commit.ci] pre-commit autoupdate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/pre-commit/pre-commit-hooks: v4.2.0 → v4.3.0](https://github.com/pre-commit/pre-commit-hooks/compare/v4.2.0...v4.3.0) - [github.com/asottile/pyupgrade: v2.32.0 → v2.34.0](https://github.com/asottile/pyupgrade/compare/v2.32.0...v2.34.0) --- .pre-commit-config.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index c57088e12..9c3f92c57 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -5,7 +5,7 @@ ci: repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.2.0 + rev: v4.3.0 hooks: - id: double-quote-string-fixer types: [python] @@ -42,7 +42,7 @@ repos: ] - repo: https://github.com/asottile/pyupgrade - rev: v2.32.0 + rev: v2.34.0 hooks: - id: pyupgrade args: [ From 4e0ecc57e2139a121a3fc3e431be96b0d398c4dd Mon Sep 17 00:00:00 2001 From: janssenhenning Date: Wed, 6 Jul 2022 11:12:05 +0200 Subject: [PATCH 04/15] Fix literalinclude directive in docs --- docs/source/user_guide/hdf5_parser.md | 2 +- masci_tools/io/parsers/fleur/default_parse_tasks.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/source/user_guide/hdf5_parser.md b/docs/source/user_guide/hdf5_parser.md index 502da2363..2cdf8a5c9 100644 --- a/docs/source/user_guide/hdf5_parser.md +++ b/docs/source/user_guide/hdf5_parser.md @@ -67,7 +67,7 @@ The recipe for extracting bandstructure information form the `banddos.hdf` looks ```{literalinclude} ../../../masci_tools/io/parsers/hdf5/recipes.py :language: python :linenos: true -:lines: 170-323 +:pyobject: bands_recipe_format ``` Each recipe can define the `datasets` and `attributes` entry (if one is not defined, diff --git a/masci_tools/io/parsers/fleur/default_parse_tasks.py b/masci_tools/io/parsers/fleur/default_parse_tasks.py index 44ab89cfc..d4d0766ca 100644 --- a/masci_tools/io/parsers/fleur/default_parse_tasks.py +++ b/masci_tools/io/parsers/fleur/default_parse_tasks.py @@ -63,7 +63,7 @@ .. literalinclude:: ../../../../masci_tools/io/parsers/fleur/default_parse_tasks.py :language: python - :lines: 66- + :lines: 70- :linenos: """ From 0fc6f7fc27a51e5cf708f7f1053a45c2c417bf7c Mon Sep 17 00:00:00 2001 From: janssenhenning Date: Wed, 6 Jul 2022 11:20:31 +0200 Subject: [PATCH 05/15] Add pylint disable for cyclic imports that can be safely ignored --- masci_tools/io/parsers/fleur/__init__.py | 4 ++-- masci_tools/util/xml/common_functions.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/masci_tools/io/parsers/fleur/__init__.py b/masci_tools/io/parsers/fleur/__init__.py index b8f11dcd4..f1e1b50f8 100644 --- a/masci_tools/io/parsers/fleur/__init__.py +++ b/masci_tools/io/parsers/fleur/__init__.py @@ -15,7 +15,7 @@ from .fleur_inpxml_parser import inpxml_parser from .fleur_outxml_parser import outxml_parser, register_migration, conversion_function -from . import task_migrations #pylint: disable=unused-import -from . import outxml_conversions #pylint: disable=unused-import +from . import task_migrations #pylint: disable=unused-import,cyclic-import +from . import outxml_conversions #pylint: disable=unused-import,cyclic-import __all__ = ['inpxml_parser', 'outxml_parser', 'register_migration', 'conversion_function'] diff --git a/masci_tools/util/xml/common_functions.py b/masci_tools/util/xml/common_functions.py index b977a309e..2a2a8eb1b 100644 --- a/masci_tools/util/xml/common_functions.py +++ b/masci_tools/util/xml/common_functions.py @@ -132,7 +132,7 @@ def reverse_xinclude(xmltree, schema_dict, included_tags, **kwargs): :raises ValueError: if the tag can not be found in the given xmltree """ - from masci_tools.util.schema_dict_util import reverse_xinclude #pylint: disable=redefined-outer-name + from masci_tools.util.schema_dict_util import reverse_xinclude #pylint: disable=redefined-outer-name,cyclic-import warnings.warn('DEPRECATED: reverse_xinclude moved to masci_tools.util.schema_dict_util', DeprecationWarning) return reverse_xinclude(xmltree, schema_dict, included_tags, **kwargs) From 66a18acf24451536d2c487e6564d19dff7ad8013 Mon Sep 17 00:00:00 2001 From: janssenhenning Date: Wed, 6 Jul 2022 11:35:40 +0200 Subject: [PATCH 06/15] Fix two small pylint warnings --- masci_tools/io/cif2inp_ase.py | 2 +- masci_tools/io/parsers/fleur_schema/schema_dict.py | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/masci_tools/io/cif2inp_ase.py b/masci_tools/io/cif2inp_ase.py index 7e8703971..0d30b7138 100644 --- a/masci_tools/io/cif2inp_ase.py +++ b/masci_tools/io/cif2inp_ase.py @@ -28,7 +28,7 @@ Binv = np.linalg.inv(structure.cell) frac_coordinates = structure.arrays['positions'].dot(Binv) -with open(inpFilename, 'w+') as f: +with open(inpFilename, 'w+', encoding='utf-8') as f: natoms = len(structure.arrays['numbers']) f.write(structureFormula + '\r\n') f.write('&input film=F /\r\n') diff --git a/masci_tools/io/parsers/fleur_schema/schema_dict.py b/masci_tools/io/parsers/fleur_schema/schema_dict.py index 7c72303a9..b5551ef0c 100644 --- a/masci_tools/io/parsers/fleur_schema/schema_dict.py +++ b/masci_tools/io/parsers/fleur_schema/schema_dict.py @@ -143,10 +143,9 @@ def register_dec(func: F) -> F: def cond_func(version): if min_version is not None and max_version is not None: return min_version_tuple <= version <= max_version_tuple - elif min_version is not None: + if min_version is not None: return version >= min_version_tuple - else: - return version <= max_version_tuple + return version <= max_version_tuple registry[cond_func] = func From 040fcc687faaa521483a6b7d31ef9739cf6f102a Mon Sep 17 00:00:00 2001 From: janssenhenning Date: Wed, 6 Jul 2022 13:49:26 +0200 Subject: [PATCH 07/15] Convert atomDiff to Angstroem This way the greensfunction outputs, e.g. the Jij Dataframes mesh better with ase, pymatgen and AiiDA --- masci_tools/tools/greensfunction.py | 3 +- tests/tools/test_jij/test_jij.csv | 28 +++++++++---------- tests/tools/test_jij/test_jij_max_shells.csv | 16 +++++------ tests/tools/test_jij/test_jij_tensor.csv | 28 +++++++++---------- .../test_jij/test_jij_tensor_max_shells.csv | 16 +++++------ tests/tools/test_jij/test_jij_tensor_x.csv | 28 +++++++++---------- tests/tools/test_jij/test_jij_tensor_y.csv | 28 +++++++++---------- 7 files changed, 74 insertions(+), 73 deletions(-) diff --git a/masci_tools/tools/greensfunction.py b/masci_tools/tools/greensfunction.py index 420cb906d..b39a2439e 100644 --- a/masci_tools/tools/greensfunction.py +++ b/masci_tools/tools/greensfunction.py @@ -28,7 +28,7 @@ from masci_tools.io.parsers.hdf5 import HDF5Reader from masci_tools.io.parsers.hdf5.reader import Transformation, AttribTransformation, HDF5Recipe -from masci_tools.util.constants import HTR_TO_EV +from masci_tools.util.constants import BOHR_A, HTR_TO_EV from masci_tools.io.common_functions import get_spin_rotation, get_wigner_matrix from masci_tools.util.typing import FileLike @@ -426,6 +426,7 @@ def _read_element_header(hdffile: h5py.File, index: int) -> GreensfElement: kresolved = element.attrs.get('l_kresolved', [0])[0] == 1 atomDiff = np.array(element.attrs['atomDiff']) atomDiff[abs(atomDiff) < 1e-12] = 0.0 + atomDiff *= BOHR_A nLO = element.attrs['numLOs'][0] return GreensfElement(l, lp, atomType, atomTypep, sphavg, onsite, kresolved, contour, nLO, atomDiff) diff --git a/tests/tools/test_jij/test_jij.csv b/tests/tools/test_jij/test_jij.csv index 8e088a15c..98478739c 100644 --- a/tests/tools/test_jij/test_jij.csv +++ b/tests/tools/test_jij/test_jij.csv @@ -1,15 +1,15 @@ ,R,R_ij_x,R_ij_y,R_ij_z,Atom i,Atom j,J_ij -0,4.5137089598270004,2.6059910830000002,2.6059910830000002,2.6059910830000002,1(Unknown),1(Unknown),16.188944460424477 -1,4.5137089598270004,2.6059910830000002,-2.6059910830000002,-2.6059910830000002,1(Unknown),1(Unknown),16.188944460424473 -2,4.5137089598270004,-2.6059910830000002,2.6059910830000002,-2.6059910830000002,1(Unknown),1(Unknown),16.188944460424477 -3,4.5137089598270004,-2.6059910830000002,-2.6059910830000002,2.6059910830000002,1(Unknown),1(Unknown),16.188944460424473 -4,4.5137089598270004,-2.6059910830000002,-2.6059910830000002,-2.6059910830000002,1(Unknown),1(Unknown),16.188944460424477 -5,4.5137089598270004,-2.6059910830000002,2.6059910830000002,2.6059910830000002,1(Unknown),1(Unknown),16.188944460424473 -6,4.5137089598270004,2.6059910830000002,-2.6059910830000002,2.6059910830000002,1(Unknown),1(Unknown),16.18894446042448 -7,4.5137089598270004,2.6059910830000002,2.6059910830000002,-2.6059910830000002,1(Unknown),1(Unknown),16.188944460424473 -8,5.2119821660000003,0,0,5.2119821660000003,1(Unknown),1(Unknown),7.5758853182336745 -9,5.2119821660000003,0,-5.2119821660000003,0,1(Unknown),1(Unknown),7.5758853182336701 -10,5.2119821660000003,-5.2119821660000003,0,0,1(Unknown),1(Unknown),7.5758853182336736 -11,5.2119821660000003,5.2119821660000003,0,0,1(Unknown),1(Unknown),7.5758853182336745 -12,5.2119821660000003,0,5.2119821660000003,0,1(Unknown),1(Unknown),7.5758853182336727 -13,5.2119821660000003,0,0,-5.2119821660000003,1(Unknown),1(Unknown),7.5758853182336745 +0,2.388551917724,1.3790310926716114,1.3790310926716114,1.3790310926716114,1(Unknown),1(Unknown),16.188944460424477 +1,2.388551917724,1.3790310926716114,-1.3790310926716114,-1.3790310926716114,1(Unknown),1(Unknown),16.188944460424473 +2,2.388551917724,-1.3790310926716114,1.3790310926716114,-1.3790310926716114,1(Unknown),1(Unknown),16.188944460424477 +3,2.388551917724,-1.3790310926716114,-1.3790310926716114,1.3790310926716114,1(Unknown),1(Unknown),16.188944460424473 +4,2.388551917724,-1.3790310926716114,-1.3790310926716114,-1.3790310926716114,1(Unknown),1(Unknown),16.188944460424477 +5,2.388551917724,-1.3790310926716114,1.3790310926716114,1.3790310926716114,1(Unknown),1(Unknown),16.188944460424473 +6,2.388551917724,1.3790310926716114,-1.3790310926716114,1.3790310926716114,1(Unknown),1(Unknown),16.18894446042448 +7,2.388551917724,1.3790310926716114,1.3790310926716114,-1.3790310926716114,1(Unknown),1(Unknown),16.188944460424473 +8,2.7580621853429999,0,0,2.7580621853432228,1(Unknown),1(Unknown),7.5758853182336745 +9,2.7580621853429999,0,-2.7580621853432228,0,1(Unknown),1(Unknown),7.5758853182336701 +10,2.7580621853429999,-2.7580621853432228,0,0,1(Unknown),1(Unknown),7.5758853182336736 +11,2.7580621853429999,2.7580621853432228,0,0,1(Unknown),1(Unknown),7.5758853182336745 +12,2.7580621853429999,0,2.7580621853432228,0,1(Unknown),1(Unknown),7.5758853182336727 +13,2.7580621853429999,0,0,-2.7580621853432228,1(Unknown),1(Unknown),7.5758853182336745 diff --git a/tests/tools/test_jij/test_jij_max_shells.csv b/tests/tools/test_jij/test_jij_max_shells.csv index ab2f46e87..80291c454 100644 --- a/tests/tools/test_jij/test_jij_max_shells.csv +++ b/tests/tools/test_jij/test_jij_max_shells.csv @@ -1,9 +1,9 @@ ,R,R_ij_x,R_ij_y,R_ij_z,Atom i,Atom j,J_ij -0,4.5137089598270004,2.6059910830000002,2.6059910830000002,2.6059910830000002,1(Unknown),1(Unknown),16.188944460424477 -1,4.5137089598270004,2.6059910830000002,-2.6059910830000002,-2.6059910830000002,1(Unknown),1(Unknown),16.188944460424473 -2,4.5137089598270004,-2.6059910830000002,2.6059910830000002,-2.6059910830000002,1(Unknown),1(Unknown),16.188944460424477 -3,4.5137089598270004,-2.6059910830000002,-2.6059910830000002,2.6059910830000002,1(Unknown),1(Unknown),16.188944460424473 -4,4.5137089598270004,-2.6059910830000002,-2.6059910830000002,-2.6059910830000002,1(Unknown),1(Unknown),16.188944460424477 -5,4.5137089598270004,-2.6059910830000002,2.6059910830000002,2.6059910830000002,1(Unknown),1(Unknown),16.188944460424473 -6,4.5137089598270004,2.6059910830000002,-2.6059910830000002,2.6059910830000002,1(Unknown),1(Unknown),16.18894446042448 -7,4.5137089598270004,2.6059910830000002,2.6059910830000002,-2.6059910830000002,1(Unknown),1(Unknown),16.188944460424473 +0,2.388551917724,1.3790310926716114,1.3790310926716114,1.3790310926716114,1(Unknown),1(Unknown),16.188944460424477 +1,2.388551917724,1.3790310926716114,-1.3790310926716114,-1.3790310926716114,1(Unknown),1(Unknown),16.188944460424473 +2,2.388551917724,-1.3790310926716114,1.3790310926716114,-1.3790310926716114,1(Unknown),1(Unknown),16.188944460424477 +3,2.388551917724,-1.3790310926716114,-1.3790310926716114,1.3790310926716114,1(Unknown),1(Unknown),16.188944460424473 +4,2.388551917724,-1.3790310926716114,-1.3790310926716114,-1.3790310926716114,1(Unknown),1(Unknown),16.188944460424477 +5,2.388551917724,-1.3790310926716114,1.3790310926716114,1.3790310926716114,1(Unknown),1(Unknown),16.188944460424473 +6,2.388551917724,1.3790310926716114,-1.3790310926716114,1.3790310926716114,1(Unknown),1(Unknown),16.18894446042448 +7,2.388551917724,1.3790310926716114,1.3790310926716114,-1.3790310926716114,1(Unknown),1(Unknown),16.188944460424473 diff --git a/tests/tools/test_jij/test_jij_tensor.csv b/tests/tools/test_jij/test_jij_tensor.csv index aba353876..678f5af55 100644 --- a/tests/tools/test_jij/test_jij_tensor.csv +++ b/tests/tools/test_jij/test_jij_tensor.csv @@ -1,15 +1,15 @@ ,R,R_ij_x,R_ij_y,R_ij_z,Atom i,Atom j,J_xx,J_xy,J_xz,J_yx,J_yy,J_yz,J_zx,J_zy,J_zz,J_ij,A_ij,S_ij,D_ij -0,4.5137089598270004,2.6059910830000002,2.6059910830000002,2.6059910830000002,1(Unknown),1(Unknown),16.188944460424484,2.3870354670186245e-14,-5.8824020742903951e-18,-2.3870354670186245e-14,16.188944460424484,5.77189265728862e-18,-5.882402074290281e-18,5.7718926572886084e-18,-37.102291733149102,16.188944460424484,0,0,2.3870354670186245e-14 -1,4.5137089598270004,2.6059910830000002,-2.6059910830000002,-2.6059910830000002,1(Unknown),1(Unknown),16.18894446042448,1.7134536961668566e-14,-5.8824020742903242e-18,-1.7134536961668566e-14,16.18894446042448,5.7718926572886392e-18,-5.8824020742902656e-18,5.7718926572885907e-18,-37.102291733149094,16.18894446042448,0,0,1.7134536961668566e-14 -2,4.5137089598270004,-2.6059910830000002,2.6059910830000002,-2.6059910830000002,1(Unknown),1(Unknown),16.18894446042448,2.0486107759229747e-14,-5.8824020742903789e-18,-2.0486107759229747e-14,16.18894446042448,5.7718926572885514e-18,-5.8824020742903758e-18,5.7718926572886169e-18,-37.102291733149102,16.18894446042448,0,0,2.0486107759229747e-14 -3,4.5137089598270004,-2.6059910830000002,-2.6059910830000002,2.6059910830000002,1(Unknown),1(Unknown),16.188944460424484,2.5410216513940486e-14,-5.882402074290335e-18,-2.5410216513940486e-14,16.188944460424484,5.7718926572886023e-18,-5.8824020742903065e-18,5.7718926572886446e-18,-37.102291733149094,16.188944460424484,0,0,2.5410216513940486e-14 -4,4.5137089598270004,-2.6059910830000002,-2.6059910830000002,-2.6059910830000002,1(Unknown),1(Unknown),16.188944460424484,2.3870354670186245e-14,-5.8824020742903951e-18,-2.3870354670186245e-14,16.188944460424484,5.77189265728862e-18,-5.882402074290281e-18,5.7718926572886084e-18,-37.102291733149102,16.188944460424484,0,0,2.3870354670186245e-14 -5,4.5137089598270004,-2.6059910830000002,2.6059910830000002,2.6059910830000002,1(Unknown),1(Unknown),16.18894446042448,1.7134536961668566e-14,-5.8824020742903242e-18,-1.7134536961668566e-14,16.18894446042448,5.7718926572886392e-18,-5.8824020742902656e-18,5.7718926572885907e-18,-37.102291733149094,16.18894446042448,0,0,1.7134536961668566e-14 -6,4.5137089598270004,2.6059910830000002,-2.6059910830000002,2.6059910830000002,1(Unknown),1(Unknown),16.188944460424487,2.4597852028140283e-14,-5.8824020742903427e-18,-2.4597852028140283e-14,16.188944460424487,5.771892657288593e-18,-5.882402074290325e-18,5.771892657288526e-18,-37.102291733149087,16.188944460424487,0,0,2.4597852028140283e-14 -7,4.5137089598270004,2.6059910830000002,2.6059910830000002,-2.6059910830000002,1(Unknown),1(Unknown),16.188944460424477,1.6448792415275211e-14,-5.8824020742902664e-18,-1.6448792415275211e-14,16.188944460424477,5.7718926572885699e-18,-5.8824020742903565e-18,5.7718926572886346e-18,-37.102291733149094,16.188944460424477,0,0,1.6448792415275211e-14 -8,5.2119821660000003,0,0,5.2119821660000003,1(Unknown),1(Unknown),7.5758853182336781,-1.2593918704444517e-15,-1.7836103910155061e-18,1.2593918704444517e-15,7.5758853182336781,-1.9768995817738697e-18,-1.7836103910155269e-18,-1.9768995817738519e-18,14.252285789954746,7.5758853182336781,0,0,-1.2593918704444517e-15 -9,5.2119821660000003,0,-5.2119821660000003,0,1(Unknown),1(Unknown),7.5758853182336683,6.0813877707948298e-16,-1.7836103910155054e-18,-6.0813877707948298e-16,7.5758853182336683,-1.976899581773865e-18,-1.7836103910154946e-18,-1.9768995817738724e-18,14.252285789954742,7.5758853182336683,0,0,6.0813877707948298e-16 -10,5.2119821660000003,-5.2119821660000003,0,0,1(Unknown),1(Unknown),7.5758853182336701,-4.0300539854222454e-16,-1.7836103910155e-18,4.0300539854222454e-16,7.5758853182336701,-1.9768995817738519e-18,-1.7836103910155512e-18,-1.9768995817738204e-18,14.252285789954746,7.5758853182336701,0,0,-4.0300539854222454e-16 -11,5.2119821660000003,5.2119821660000003,0,0,1(Unknown),1(Unknown),7.5758853182336701,1.0528969871823886e-16,-1.7836103910155304e-18,-1.0528969871823886e-16,7.5758853182336701,-1.9768995817738851e-18,-1.7836103910155007e-18,-1.9768995817738554e-18,14.252285789954742,7.5758853182336701,0,0,1.0528969871823886e-16 -12,5.2119821660000003,0,5.2119821660000003,0,1(Unknown),1(Unknown),7.5758853182336701,-5.3915587102270583e-16,-1.7836103910155096e-18,5.3915587102270583e-16,7.5758853182336701,-1.976899581773865e-18,-1.7836103910154988e-18,-1.9768995817738777e-18,14.252285789954746,7.5758853182336701,0,0,-5.3915587102270583e-16 -13,5.2119821660000003,0,0,-5.2119821660000003,1(Unknown),1(Unknown),7.5758853182336781,-1.2593918704444517e-15,-1.7836103910155061e-18,1.2593918704444517e-15,7.5758853182336781,-1.9768995817738697e-18,-1.7836103910155269e-18,-1.9768995817738519e-18,14.252285789954746,7.5758853182336781,0,0,-1.2593918704444517e-15 +0,2.388551917724,1.3790310926716114,1.3790310926716114,1.3790310926716114,1(Unknown),1(Unknown),16.188944460424484,2.3870354670186245e-14,-5.8824020742903951e-18,-2.3870354670186245e-14,16.188944460424484,5.77189265728862e-18,-5.882402074290281e-18,5.7718926572886084e-18,-37.102291733149102,16.188944460424484,0,0,2.3870354670186245e-14 +1,2.388551917724,1.3790310926716114,-1.3790310926716114,-1.3790310926716114,1(Unknown),1(Unknown),16.18894446042448,1.7134536961668566e-14,-5.8824020742903242e-18,-1.7134536961668566e-14,16.18894446042448,5.7718926572886392e-18,-5.8824020742902656e-18,5.7718926572885907e-18,-37.102291733149094,16.18894446042448,0,0,1.7134536961668566e-14 +2,2.388551917724,-1.3790310926716114,1.3790310926716114,-1.3790310926716114,1(Unknown),1(Unknown),16.18894446042448,2.0486107759229747e-14,-5.8824020742903789e-18,-2.0486107759229747e-14,16.18894446042448,5.7718926572885514e-18,-5.8824020742903758e-18,5.7718926572886169e-18,-37.102291733149102,16.18894446042448,0,0,2.0486107759229747e-14 +3,2.388551917724,-1.3790310926716114,-1.3790310926716114,1.3790310926716114,1(Unknown),1(Unknown),16.188944460424484,2.5410216513940486e-14,-5.882402074290335e-18,-2.5410216513940486e-14,16.188944460424484,5.7718926572886023e-18,-5.8824020742903065e-18,5.7718926572886446e-18,-37.102291733149094,16.188944460424484,0,0,2.5410216513940486e-14 +4,2.388551917724,-1.3790310926716114,-1.3790310926716114,-1.3790310926716114,1(Unknown),1(Unknown),16.188944460424484,2.3870354670186245e-14,-5.8824020742903951e-18,-2.3870354670186245e-14,16.188944460424484,5.77189265728862e-18,-5.882402074290281e-18,5.7718926572886084e-18,-37.102291733149102,16.188944460424484,0,0,2.3870354670186245e-14 +5,2.388551917724,-1.3790310926716114,1.3790310926716114,1.3790310926716114,1(Unknown),1(Unknown),16.18894446042448,1.7134536961668566e-14,-5.8824020742903242e-18,-1.7134536961668566e-14,16.18894446042448,5.7718926572886392e-18,-5.8824020742902656e-18,5.7718926572885907e-18,-37.102291733149094,16.18894446042448,0,0,1.7134536961668566e-14 +6,2.388551917724,1.3790310926716114,-1.3790310926716114,1.3790310926716114,1(Unknown),1(Unknown),16.188944460424487,2.4597852028140283e-14,-5.8824020742903427e-18,-2.4597852028140283e-14,16.188944460424487,5.771892657288593e-18,-5.882402074290325e-18,5.771892657288526e-18,-37.102291733149087,16.188944460424487,0,0,2.4597852028140283e-14 +7,2.388551917724,1.3790310926716114,1.3790310926716114,-1.3790310926716114,1(Unknown),1(Unknown),16.188944460424477,1.6448792415275211e-14,-5.8824020742902664e-18,-1.6448792415275211e-14,16.188944460424477,5.7718926572885699e-18,-5.8824020742903565e-18,5.7718926572886346e-18,-37.102291733149094,16.188944460424477,0,0,1.6448792415275211e-14 +8,2.7580621853429999,0,0,2.7580621853432228,1(Unknown),1(Unknown),7.5758853182336781,-1.2593918704444517e-15,-1.7836103910155061e-18,1.2593918704444517e-15,7.5758853182336781,-1.9768995817738697e-18,-1.7836103910155269e-18,-1.9768995817738519e-18,14.252285789954746,7.5758853182336781,0,0,-1.2593918704444517e-15 +9,2.7580621853429999,0,-2.7580621853432228,0,1(Unknown),1(Unknown),7.5758853182336683,6.0813877707948298e-16,-1.7836103910155054e-18,-6.0813877707948298e-16,7.5758853182336683,-1.976899581773865e-18,-1.7836103910154946e-18,-1.9768995817738724e-18,14.252285789954742,7.5758853182336683,0,0,6.0813877707948298e-16 +10,2.7580621853429999,-2.7580621853432228,0,0,1(Unknown),1(Unknown),7.5758853182336701,-4.0300539854222454e-16,-1.7836103910155e-18,4.0300539854222454e-16,7.5758853182336701,-1.9768995817738519e-18,-1.7836103910155512e-18,-1.9768995817738204e-18,14.252285789954746,7.5758853182336701,0,0,-4.0300539854222454e-16 +11,2.7580621853429999,2.7580621853432228,0,0,1(Unknown),1(Unknown),7.5758853182336701,1.0528969871823886e-16,-1.7836103910155304e-18,-1.0528969871823886e-16,7.5758853182336701,-1.9768995817738851e-18,-1.7836103910155007e-18,-1.9768995817738554e-18,14.252285789954742,7.5758853182336701,0,0,1.0528969871823886e-16 +12,2.7580621853429999,0,2.7580621853432228,0,1(Unknown),1(Unknown),7.5758853182336701,-5.3915587102270583e-16,-1.7836103910155096e-18,5.3915587102270583e-16,7.5758853182336701,-1.976899581773865e-18,-1.7836103910154988e-18,-1.9768995817738777e-18,14.252285789954746,7.5758853182336701,0,0,-5.3915587102270583e-16 +13,2.7580621853429999,0,0,-2.7580621853432228,1(Unknown),1(Unknown),7.5758853182336781,-1.2593918704444517e-15,-1.7836103910155061e-18,1.2593918704444517e-15,7.5758853182336781,-1.9768995817738697e-18,-1.7836103910155269e-18,-1.9768995817738519e-18,14.252285789954746,7.5758853182336781,0,0,-1.2593918704444517e-15 diff --git a/tests/tools/test_jij/test_jij_tensor_max_shells.csv b/tests/tools/test_jij/test_jij_tensor_max_shells.csv index f5be86544..9fc0d52fe 100644 --- a/tests/tools/test_jij/test_jij_tensor_max_shells.csv +++ b/tests/tools/test_jij/test_jij_tensor_max_shells.csv @@ -1,9 +1,9 @@ ,R,R_ij_x,R_ij_y,R_ij_z,Atom i,Atom j,J_xx,J_xy,J_xz,J_yx,J_yy,J_yz,J_zx,J_zy,J_zz -0,4.5137089598270004,2.6059910830000002,2.6059910830000002,2.6059910830000002,1(Unknown),1(Unknown),16.188944460424484,2.3870354670186245e-14,-5.8824020742903951e-18,-2.3870354670186245e-14,16.188944460424484,5.77189265728862e-18,-5.882402074290281e-18,5.7718926572886084e-18,-37.102291733149102 -1,4.5137089598270004,2.6059910830000002,-2.6059910830000002,-2.6059910830000002,1(Unknown),1(Unknown),16.18894446042448,1.7134536961668566e-14,-5.8824020742903242e-18,-1.7134536961668566e-14,16.18894446042448,5.7718926572886392e-18,-5.8824020742902656e-18,5.7718926572885907e-18,-37.102291733149094 -2,4.5137089598270004,-2.6059910830000002,2.6059910830000002,-2.6059910830000002,1(Unknown),1(Unknown),16.18894446042448,2.0486107759229747e-14,-5.8824020742903789e-18,-2.0486107759229747e-14,16.18894446042448,5.7718926572885514e-18,-5.8824020742903758e-18,5.7718926572886169e-18,-37.102291733149102 -3,4.5137089598270004,-2.6059910830000002,-2.6059910830000002,2.6059910830000002,1(Unknown),1(Unknown),16.188944460424484,2.5410216513940486e-14,-5.882402074290335e-18,-2.5410216513940486e-14,16.188944460424484,5.7718926572886023e-18,-5.8824020742903065e-18,5.7718926572886446e-18,-37.102291733149094 -4,4.5137089598270004,-2.6059910830000002,-2.6059910830000002,-2.6059910830000002,1(Unknown),1(Unknown),16.188944460424484,2.3870354670186245e-14,-5.8824020742903951e-18,-2.3870354670186245e-14,16.188944460424484,5.77189265728862e-18,-5.882402074290281e-18,5.7718926572886084e-18,-37.102291733149102 -5,4.5137089598270004,-2.6059910830000002,2.6059910830000002,2.6059910830000002,1(Unknown),1(Unknown),16.18894446042448,1.7134536961668566e-14,-5.8824020742903242e-18,-1.7134536961668566e-14,16.18894446042448,5.7718926572886392e-18,-5.8824020742902656e-18,5.7718926572885907e-18,-37.102291733149094 -6,4.5137089598270004,2.6059910830000002,-2.6059910830000002,2.6059910830000002,1(Unknown),1(Unknown),16.188944460424487,2.4597852028140283e-14,-5.8824020742903427e-18,-2.4597852028140283e-14,16.188944460424487,5.771892657288593e-18,-5.882402074290325e-18,5.771892657288526e-18,-37.102291733149087 -7,4.5137089598270004,2.6059910830000002,2.6059910830000002,-2.6059910830000002,1(Unknown),1(Unknown),16.188944460424477,1.6448792415275211e-14,-5.8824020742902664e-18,-1.6448792415275211e-14,16.188944460424477,5.7718926572885699e-18,-5.8824020742903565e-18,5.7718926572886346e-18,-37.102291733149094 +0,2.388551917724,1.3790310926716114,1.3790310926716114,1.3790310926716114,1(Unknown),1(Unknown),16.188944460424484,2.3870354670186245e-14,-5.8824020742903951e-18,-2.3870354670186245e-14,16.188944460424484,5.77189265728862e-18,-5.882402074290281e-18,5.7718926572886084e-18,-37.102291733149102 +1,2.388551917724,1.3790310926716114,-1.3790310926716114,-1.3790310926716114,1(Unknown),1(Unknown),16.18894446042448,1.7134536961668566e-14,-5.8824020742903242e-18,-1.7134536961668566e-14,16.18894446042448,5.7718926572886392e-18,-5.8824020742902656e-18,5.7718926572885907e-18,-37.102291733149094 +2,2.388551917724,-1.3790310926716114,1.3790310926716114,-1.3790310926716114,1(Unknown),1(Unknown),16.18894446042448,2.0486107759229747e-14,-5.8824020742903789e-18,-2.0486107759229747e-14,16.18894446042448,5.7718926572885514e-18,-5.8824020742903758e-18,5.7718926572886169e-18,-37.102291733149102 +3,2.388551917724,-1.3790310926716114,-1.3790310926716114,1.3790310926716114,1(Unknown),1(Unknown),16.188944460424484,2.5410216513940486e-14,-5.882402074290335e-18,-2.5410216513940486e-14,16.188944460424484,5.7718926572886023e-18,-5.8824020742903065e-18,5.7718926572886446e-18,-37.102291733149094 +4,2.388551917724,-1.3790310926716114,-1.3790310926716114,-1.3790310926716114,1(Unknown),1(Unknown),16.188944460424484,2.3870354670186245e-14,-5.8824020742903951e-18,-2.3870354670186245e-14,16.188944460424484,5.77189265728862e-18,-5.882402074290281e-18,5.7718926572886084e-18,-37.102291733149102 +5,2.388551917724,-1.3790310926716114,1.3790310926716114,1.3790310926716114,1(Unknown),1(Unknown),16.18894446042448,1.7134536961668566e-14,-5.8824020742903242e-18,-1.7134536961668566e-14,16.18894446042448,5.7718926572886392e-18,-5.8824020742902656e-18,5.7718926572885907e-18,-37.102291733149094 +6,2.388551917724,1.3790310926716114,-1.3790310926716114,1.3790310926716114,1(Unknown),1(Unknown),16.188944460424487,2.4597852028140283e-14,-5.8824020742903427e-18,-2.4597852028140283e-14,16.188944460424487,5.771892657288593e-18,-5.882402074290325e-18,5.771892657288526e-18,-37.102291733149087 +7,2.388551917724,1.3790310926716114,1.3790310926716114,-1.3790310926716114,1(Unknown),1(Unknown),16.188944460424477,1.6448792415275211e-14,-5.8824020742902664e-18,-1.6448792415275211e-14,16.188944460424477,5.7718926572885699e-18,-5.8824020742903565e-18,5.7718926572886346e-18,-37.102291733149094 diff --git a/tests/tools/test_jij/test_jij_tensor_x.csv b/tests/tools/test_jij/test_jij_tensor_x.csv index f3a9d566e..164d61240 100644 --- a/tests/tools/test_jij/test_jij_tensor_x.csv +++ b/tests/tools/test_jij/test_jij_tensor_x.csv @@ -1,15 +1,15 @@ ,R,R_ij_x,R_ij_y,R_ij_z,Atom i,Atom j,J_xx,J_xy,J_xz,J_yx,J_yy,J_yz,J_zx,J_zy,J_zz,J_ij,A_ij,S_ij,D_ij -0,4.5137089598270004,2.6059910830000002,2.6059910830000002,2.6059910830000002,1(Unknown),1(Unknown),-37.102292940080588,-7.4356311370673499e-15,2.7189686488135754e-10,3.717815568533675e-15,16.188964801782681,-1.8589077842668375e-15,2.7195820883823837e-10,5.4605416162838355e-15,16.188964801782745,16.188964801782713,-3.1974423109204508e-14,1.8008169160084992e-15,-3.6597247002753363e-15 -1,4.5137089598270004,2.6059910830000002,-2.6059910830000002,-2.6059910830000002,1(Unknown),1(Unknown),-37.102292940080552,-1.2779991016834508e-14,2.7190058269692608e-10,2.5559982033669018e-15,16.188964801782685,-1.3941808382001282e-15,2.7194519648374848e-10,3.8920881733086909e-15,16.188964801782742,16.188964801782713,-2.8421709430404007e-14,1.2489536675542814e-15,-2.6431345057544098e-15 -2,4.5137089598270004,-2.6059910830000002,2.6059910830000002,-2.6059910830000002,1(Unknown),1(Unknown),-37.102292940080567,5.5767233528005128e-15,2.7188199361908343e-10,-9.2945389213341886e-15,16.188964801782678,-3.2530886224669657e-15,2.719656444693754e-10,3.4273612272419821e-15,16.188964801782717,16.188964801782696,-1.9539925233402755e-14,8.7136302387508186e-17,-3.3402249248544737e-15 -3,4.5137089598270004,-2.6059910830000002,-2.6059910830000002,2.6059910830000002,1(Unknown),1(Unknown),-37.102292940080559,-4.4149059876337389e-15,2.7191452450530809e-10,3.717815568533675e-15,16.188964801782664,-4.6472694606670943e-15,2.7196006774602264e-10,5.1119964067338036e-15,16.188964801782731,16.188964801782696,-3.3750779948604759e-14,2.3236347303335464e-16,-4.8796329337004489e-15 -4,4.5137089598270004,-2.6059910830000002,-2.6059910830000002,-2.6059910830000002,1(Unknown),1(Unknown),-37.102292940080588,-7.4356311370673499e-15,2.7189686488135754e-10,3.717815568533675e-15,16.188964801782681,-1.8589077842668375e-15,2.7195820883823837e-10,5.4605416162838355e-15,16.188964801782745,16.188964801782713,-3.1974423109204508e-14,1.8008169160084992e-15,-3.6597247002753363e-15 -5,4.5137089598270004,-2.6059910830000002,2.6059910830000002,2.6059910830000002,1(Unknown),1(Unknown),-37.102292940080552,-1.2779991016834508e-14,2.7190058269692608e-10,2.5559982033669018e-15,16.188964801782685,-1.3941808382001282e-15,2.7194519648374848e-10,3.8920881733086909e-15,16.188964801782742,16.188964801782713,-2.8421709430404007e-14,1.2489536675542814e-15,-2.6431345057544098e-15 -6,4.5137089598270004,2.6059910830000002,-2.6059910830000002,2.6059910830000002,1(Unknown),1(Unknown),-37.102292940080567,4.6472694606670937e-16,2.7185875727178007e-10,-8.36508502920077e-15,16.188964801782664,0,2.7196192665380686e-10,5.5767233528005128e-15,16.188964801782717,16.188964801782689,-2.6645352591003757e-14,2.7883616764002564e-15,-2.7883616764002564e-15 -7,4.5137089598270004,2.6059910830000002,2.6059910830000002,-2.6059910830000002,1(Unknown),1(Unknown),-37.102292940080545,-5.5767233528005128e-15,2.7190894778195528e-10,8.1327215561674154e-15,16.188964801782664,-2.7883616764002564e-15,2.7196750337715967e-10,4.1244516463420464e-15,16.188964801782745,16.188964801782703,-4.0856207306205761e-14,6.6804498497089497e-16,-3.4564066613711514e-15 -8,5.2119821660000003,0,0,5.2119821660000003,1(Unknown),1(Unknown),14.252286687805961,-3.8339973050503523e-15,-3.4119555289798704e-11,-1.5103625747168055e-15,7.5758723189101502,3.4854520955003205e-16,-3.4122343651475104e-11,-6.7167566423704094e-16,7.5758723189101458,7.5758723189101485,2.2204460492503131e-15,-1.6156522734350444e-16,5.101104368935365e-16 -9,5.2119821660000003,0,-5.2119821660000003,0,1(Unknown),1(Unknown),14.252286687805949,1.1618173651667736e-15,-3.4118277290697021e-11,-1.6846351794918217e-15,7.5758723189101449,0,-3.4115372747284101e-11,3.5144975296294896e-15,7.575872318910152,7.5758723189101485,-3.5527136788005009e-15,1.7572487648147448e-15,-1.7572487648147448e-15 -10,5.2119821660000003,-5.2119821660000003,0,0,1(Unknown),1(Unknown),14.252286687805947,-1.452271706458467e-16,-3.4116883109858818e-11,-1.713680613620991e-15,7.5758723189101485,-1.6265443112334828e-15,-3.4116302201176237e-11,3.6016338320169984e-15,7.5758723189101529,7.5758723189101502,-2.2204460492503131e-15,9.8754476039175779e-16,-2.6140890716252404e-15 -11,5.2119821660000003,5.2119821660000003,0,0,1(Unknown),1(Unknown),14.252286687805949,-2.0331803890418536e-16,-3.4119787653271738e-11,-1.9460440866543455e-15,7.5758723189101449,-5.8090868258338679e-16,-3.4116069837703203e-11,3.2530886224669657e-15,7.5758723189101511,7.5758723189101485,-3.1086244689504383e-15,1.3360899699417895e-15,-1.9169986525251761e-15 -12,5.2119821660000003,0,5.2119821660000003,0,1(Unknown),1(Unknown),14.252286687805949,9.0040845800424961e-16,-3.411943910806219e-11,-1.7717714818793297e-15,7.5758723189101449,-2.3236347303335468e-16,-3.4114675656865006e-11,2.5269527692377324e-15,7.5758723189101529,7.5758723189101485,-3.9968028886505635e-15,1.1472946481021889e-15,-1.3796581211355435e-15 -13,5.2119821660000003,0,0,-5.2119821660000003,1(Unknown),1(Unknown),14.252286687805961,-3.8339973050503523e-15,-3.4119555289798704e-11,-1.5103625747168055e-15,7.5758723189101502,3.4854520955003205e-16,-3.4122343651475104e-11,-6.7167566423704094e-16,7.5758723189101458,7.5758723189101485,2.2204460492503131e-15,-1.6156522734350444e-16,5.101104368935365e-16 +0,2.388551917724,1.3790310926716114,1.3790310926716114,1.3790310926716114,1(Unknown),1(Unknown),-37.102292940080588,-7.4356311370673499e-15,2.7189686488135754e-10,3.717815568533675e-15,16.188964801782681,-1.8589077842668375e-15,2.7195820883823837e-10,5.4605416162838355e-15,16.188964801782745,16.188964801782713,-3.1974423109204508e-14,1.8008169160084992e-15,-3.6597247002753363e-15 +1,2.388551917724,1.3790310926716114,-1.3790310926716114,-1.3790310926716114,1(Unknown),1(Unknown),-37.102292940080552,-1.2779991016834508e-14,2.7190058269692608e-10,2.5559982033669018e-15,16.188964801782685,-1.3941808382001282e-15,2.7194519648374848e-10,3.8920881733086909e-15,16.188964801782742,16.188964801782713,-2.8421709430404007e-14,1.2489536675542814e-15,-2.6431345057544098e-15 +2,2.388551917724,-1.3790310926716114,1.3790310926716114,-1.3790310926716114,1(Unknown),1(Unknown),-37.102292940080567,5.5767233528005128e-15,2.7188199361908343e-10,-9.2945389213341886e-15,16.188964801782678,-3.2530886224669657e-15,2.719656444693754e-10,3.4273612272419821e-15,16.188964801782717,16.188964801782696,-1.9539925233402755e-14,8.7136302387508186e-17,-3.3402249248544737e-15 +3,2.388551917724,-1.3790310926716114,-1.3790310926716114,1.3790310926716114,1(Unknown),1(Unknown),-37.102292940080559,-4.4149059876337389e-15,2.7191452450530809e-10,3.717815568533675e-15,16.188964801782664,-4.6472694606670943e-15,2.7196006774602264e-10,5.1119964067338036e-15,16.188964801782731,16.188964801782696,-3.3750779948604759e-14,2.3236347303335464e-16,-4.8796329337004489e-15 +4,2.388551917724,-1.3790310926716114,-1.3790310926716114,-1.3790310926716114,1(Unknown),1(Unknown),-37.102292940080588,-7.4356311370673499e-15,2.7189686488135754e-10,3.717815568533675e-15,16.188964801782681,-1.8589077842668375e-15,2.7195820883823837e-10,5.4605416162838355e-15,16.188964801782745,16.188964801782713,-3.1974423109204508e-14,1.8008169160084992e-15,-3.6597247002753363e-15 +5,2.388551917724,-1.3790310926716114,1.3790310926716114,1.3790310926716114,1(Unknown),1(Unknown),-37.102292940080552,-1.2779991016834508e-14,2.7190058269692608e-10,2.5559982033669018e-15,16.188964801782685,-1.3941808382001282e-15,2.7194519648374848e-10,3.8920881733086909e-15,16.188964801782742,16.188964801782713,-2.8421709430404007e-14,1.2489536675542814e-15,-2.6431345057544098e-15 +6,2.388551917724,1.3790310926716114,-1.3790310926716114,1.3790310926716114,1(Unknown),1(Unknown),-37.102292940080567,4.6472694606670937e-16,2.7185875727178007e-10,-8.36508502920077e-15,16.188964801782664,0,2.7196192665380686e-10,5.5767233528005128e-15,16.188964801782717,16.188964801782689,-2.6645352591003757e-14,2.7883616764002564e-15,-2.7883616764002564e-15 +7,2.388551917724,1.3790310926716114,1.3790310926716114,-1.3790310926716114,1(Unknown),1(Unknown),-37.102292940080545,-5.5767233528005128e-15,2.7190894778195528e-10,8.1327215561674154e-15,16.188964801782664,-2.7883616764002564e-15,2.7196750337715967e-10,4.1244516463420464e-15,16.188964801782745,16.188964801782703,-4.0856207306205761e-14,6.6804498497089497e-16,-3.4564066613711514e-15 +8,2.7580621853429999,0,0,2.7580621853432228,1(Unknown),1(Unknown),14.252286687805961,-3.8339973050503523e-15,-3.4119555289798704e-11,-1.5103625747168055e-15,7.5758723189101502,3.4854520955003205e-16,-3.4122343651475104e-11,-6.7167566423704094e-16,7.5758723189101458,7.5758723189101485,2.2204460492503131e-15,-1.6156522734350444e-16,5.101104368935365e-16 +9,2.7580621853429999,0,-2.7580621853432228,0,1(Unknown),1(Unknown),14.252286687805949,1.1618173651667736e-15,-3.4118277290697021e-11,-1.6846351794918217e-15,7.5758723189101449,0,-3.4115372747284101e-11,3.5144975296294896e-15,7.575872318910152,7.5758723189101485,-3.5527136788005009e-15,1.7572487648147448e-15,-1.7572487648147448e-15 +10,2.7580621853429999,-2.7580621853432228,0,0,1(Unknown),1(Unknown),14.252286687805947,-1.452271706458467e-16,-3.4116883109858818e-11,-1.713680613620991e-15,7.5758723189101485,-1.6265443112334828e-15,-3.4116302201176237e-11,3.6016338320169984e-15,7.5758723189101529,7.5758723189101502,-2.2204460492503131e-15,9.8754476039175779e-16,-2.6140890716252404e-15 +11,2.7580621853429999,2.7580621853432228,0,0,1(Unknown),1(Unknown),14.252286687805949,-2.0331803890418536e-16,-3.4119787653271738e-11,-1.9460440866543455e-15,7.5758723189101449,-5.8090868258338679e-16,-3.4116069837703203e-11,3.2530886224669657e-15,7.5758723189101511,7.5758723189101485,-3.1086244689504383e-15,1.3360899699417895e-15,-1.9169986525251761e-15 +12,2.7580621853429999,0,2.7580621853432228,0,1(Unknown),1(Unknown),14.252286687805949,9.0040845800424961e-16,-3.411943910806219e-11,-1.7717714818793297e-15,7.5758723189101449,-2.3236347303335468e-16,-3.4114675656865006e-11,2.5269527692377324e-15,7.5758723189101529,7.5758723189101485,-3.9968028886505635e-15,1.1472946481021889e-15,-1.3796581211355435e-15 +13,2.7580621853429999,0,0,-2.7580621853432228,1(Unknown),1(Unknown),14.252286687805961,-3.8339973050503523e-15,-3.4119555289798704e-11,-1.5103625747168055e-15,7.5758723189101502,3.4854520955003205e-16,-3.4122343651475104e-11,-6.7167566423704094e-16,7.5758723189101458,7.5758723189101485,2.2204460492503131e-15,-1.6156522734350444e-16,5.101104368935365e-16 diff --git a/tests/tools/test_jij/test_jij_tensor_y.csv b/tests/tools/test_jij/test_jij_tensor_y.csv index 3103225fd..d92eb1c14 100644 --- a/tests/tools/test_jij/test_jij_tensor_y.csv +++ b/tests/tools/test_jij/test_jij_tensor_y.csv @@ -1,15 +1,15 @@ ,R,R_ij_x,R_ij_y,R_ij_z,Atom i,Atom j,J_xx,J_xy,J_xz,J_yx,J_yy,J_yz,J_zx,J_zy,J_zz,J_ij,A_ij,S_ij,D_ij -0,4.5137089598270004,2.6059910830000002,2.6059910830000002,2.6059910830000002,1(Unknown),1(Unknown),16.188964802352359,2.7198051573164957e-10,-4.182542514600385e-15,2.7199306335919333e-10,-37.102292939728208,2.7202512951847196e-10,6.970904191000641e-16,2.7177045915202739e-10,16.18896480235238,16.18896480235237,-1.0658141036401503e-14,-1.7427260477501606e-15,-2.4398164668502245e-15 -1,4.5137089598270004,2.6059910830000002,-2.6059910830000002,-2.6059910830000002,1(Unknown),1(Unknown),16.188964802352366,2.7200351971547981e-10,1.3941808382001282e-15,2.719863248184754e-10,-37.102292939728208,2.7200654044062931e-10,1.9750895207835148e-15,2.7174071662747911e-10,16.188964802352366,16.188964802352366,0,1.6846351794918215e-15,-2.9045434129169329e-16 -2,4.5137089598270004,-2.6059910830000002,2.6059910830000002,-2.6059910830000002,1(Unknown),1(Unknown),16.188964802352366,2.7198469827416414e-10,-6.5061772449339314e-15,2.720009637172765e-10,-37.102292939728194,2.7201304661787423e-10,-5.4605416162838355e-15,2.7173699881191062e-10,16.188964802352356,16.188964802352359,5.3290705182007514e-15,-5.9833594306088834e-15,-5.2281781432504793e-16 -3,4.5137089598270004,-2.6059910830000002,-2.6059910830000002,2.6059910830000002,1(Unknown),1(Unknown),16.188964802352366,2.7198446591069113e-10,4.6472694606670937e-16,2.7199190154182816e-10,-37.102292939728187,2.7200746989452142e-10,4.8215420654421103e-15,2.717128330107151e-10,16.188964802352373,16.18896480235237,-3.5527136788005009e-15,2.6431345057544098e-15,-2.1784075596877005e-15 -4,4.5137089598270004,-2.6059910830000002,-2.6059910830000002,-2.6059910830000002,1(Unknown),1(Unknown),16.188964802352359,2.7198051573164957e-10,-4.182542514600385e-15,2.7199306335919333e-10,-37.102292939728208,2.7202512951847196e-10,6.970904191000641e-16,2.7177045915202739e-10,16.18896480235238,16.18896480235237,-1.0658141036401503e-14,-1.7427260477501606e-15,-2.4398164668502245e-15 -5,4.5137089598270004,-2.6059910830000002,2.6059910830000002,2.6059910830000002,1(Unknown),1(Unknown),16.188964802352366,2.7200351971547981e-10,1.3941808382001282e-15,2.719863248184754e-10,-37.102292939728208,2.7200654044062931e-10,1.9750895207835148e-15,2.7174071662747911e-10,16.188964802352366,16.188964802352366,0,1.6846351794918215e-15,-2.9045434129169329e-16 -6,4.5137089598270004,2.6059910830000002,-2.6059910830000002,2.6059910830000002,1(Unknown),1(Unknown),16.188964802352366,2.7199445754003157e-10,-9.9916293404342509e-15,2.7198190991248771e-10,-37.102292939728208,2.7199166917835514e-10,-1.1618173651667734e-16,2.7173142208855781e-10,16.188964802352356,16.188964802352359,5.3290705182007514e-15,-5.0539055384754641e-15,-4.9377238019587868e-15 -7,4.5137089598270004,2.6059910830000002,2.6059910830000002,-2.6059910830000002,1(Unknown),1(Unknown),16.188964802352366,2.7199515463045062e-10,-4.182542514600385e-15,2.7199166917835514e-10,-37.102292939728173,2.7201304661787423e-10,-5.8090868258338671e-17,2.7173328099634203e-10,16.188964802352359,16.188964802352363,3.5527136788005009e-15,-2.1203166914293618e-15,-2.0622258231710232e-15 -8,5.2119821660000003,0,0,5.2119821660000003,1(Unknown),1(Unknown),7.57587231885954,-3.4019406632921326e-11,8.1327215561674142e-16,-3.4018012452083129e-11,14.252286687739629,-3.4124783467941956e-11,-6.7530634350318711e-16,-3.4123273105367239e-11,7.5758723188595312,7.5758723188595356,4.4408920985006262e-15,6.8982906056777157e-17,7.4428924955996426e-16 -9,5.2119821660000003,0,-5.2119821660000003,0,1(Unknown),1(Unknown),7.5758723188595098,-3.4023937720645476e-11,-2.9045434129169337e-15,-3.4021614085915144e-11,14.252286687739629,-3.4122576014948137e-11,1.5684534429751442e-15,-3.4124434922732408e-11,7.57587231885954,7.5758723188595249,-1.5099033134902129e-14,-6.6804498497089477e-16,-2.2364984279460392e-15 -10,5.2119821660000003,-5.2119821660000003,0,0,1(Unknown),1(Unknown),7.5758723188595143,-3.402448958389393e-11,5.8090868258338679e-16,-3.4021120313534949e-11,14.252286687739627,-3.4122692196684658e-11,3.7759064367920138e-16,-3.4125364376624537e-11,7.57587231885954,7.5758723188595276,-1.2878587085651816e-14,4.7924966313129413e-16,1.016590194520927e-16 -11,5.2119821660000003,5.2119821660000003,0,0,1(Unknown),1(Unknown),7.5758723188595178,-3.4023821538908962e-11,-2.6721799398835791e-15,-3.4020800813759529e-11,14.252286687739632,-3.4123273105367239e-11,6.3899955084172544e-16,-3.4126061467043639e-11,7.5758723188595418,7.5758723188595294,-1.1990408665951691e-14,-1.0165901945209269e-15,-1.6555897453626522e-15 -12,5.2119821660000003,0,5.2119821660000003,0,1(Unknown),1(Unknown),7.5758723188595098,-3.4022979221319214e-11,-3.2530886224669657e-15,-3.4021004131798429e-11,14.252286687739632,-3.4123040741894205e-11,6.0995411671255612e-16,-3.4124667286205436e-11,7.5758723188595374,7.5758723188595241,-1.3766765505351941e-14,-1.3215672528772049e-15,-1.9315213695897608e-15 -13,5.2119821660000003,0,0,-5.2119821660000003,1(Unknown),1(Unknown),7.57587231885954,-3.4019406632921326e-11,8.1327215561674142e-16,-3.4018012452083129e-11,14.252286687739629,-3.4124783467941956e-11,-6.7530634350318711e-16,-3.4123273105367239e-11,7.5758723188595312,7.5758723188595356,4.4408920985006262e-15,6.8982906056777157e-17,7.4428924955996426e-16 +0,2.388551917724,1.3790310926716114,1.3790310926716114,1.3790310926716114,1(Unknown),1(Unknown),16.188964802352359,2.7198051573164957e-10,-4.182542514600385e-15,2.7199306335919333e-10,-37.102292939728208,2.7202512951847196e-10,6.970904191000641e-16,2.7177045915202739e-10,16.18896480235238,16.18896480235237,-1.0658141036401503e-14,-1.7427260477501606e-15,-2.4398164668502245e-15 +1,2.388551917724,1.3790310926716114,-1.3790310926716114,-1.3790310926716114,1(Unknown),1(Unknown),16.188964802352366,2.7200351971547981e-10,1.3941808382001282e-15,2.719863248184754e-10,-37.102292939728208,2.7200654044062931e-10,1.9750895207835148e-15,2.7174071662747911e-10,16.188964802352366,16.188964802352366,0,1.6846351794918215e-15,-2.9045434129169329e-16 +2,2.388551917724,-1.3790310926716114,1.3790310926716114,-1.3790310926716114,1(Unknown),1(Unknown),16.188964802352366,2.7198469827416414e-10,-6.5061772449339314e-15,2.720009637172765e-10,-37.102292939728194,2.7201304661787423e-10,-5.4605416162838355e-15,2.7173699881191062e-10,16.188964802352356,16.188964802352359,5.3290705182007514e-15,-5.9833594306088834e-15,-5.2281781432504793e-16 +3,2.388551917724,-1.3790310926716114,-1.3790310926716114,1.3790310926716114,1(Unknown),1(Unknown),16.188964802352366,2.7198446591069113e-10,4.6472694606670937e-16,2.7199190154182816e-10,-37.102292939728187,2.7200746989452142e-10,4.8215420654421103e-15,2.717128330107151e-10,16.188964802352373,16.18896480235237,-3.5527136788005009e-15,2.6431345057544098e-15,-2.1784075596877005e-15 +4,2.388551917724,-1.3790310926716114,-1.3790310926716114,-1.3790310926716114,1(Unknown),1(Unknown),16.188964802352359,2.7198051573164957e-10,-4.182542514600385e-15,2.7199306335919333e-10,-37.102292939728208,2.7202512951847196e-10,6.970904191000641e-16,2.7177045915202739e-10,16.18896480235238,16.18896480235237,-1.0658141036401503e-14,-1.7427260477501606e-15,-2.4398164668502245e-15 +5,2.388551917724,-1.3790310926716114,1.3790310926716114,1.3790310926716114,1(Unknown),1(Unknown),16.188964802352366,2.7200351971547981e-10,1.3941808382001282e-15,2.719863248184754e-10,-37.102292939728208,2.7200654044062931e-10,1.9750895207835148e-15,2.7174071662747911e-10,16.188964802352366,16.188964802352366,0,1.6846351794918215e-15,-2.9045434129169329e-16 +6,2.388551917724,1.3790310926716114,-1.3790310926716114,1.3790310926716114,1(Unknown),1(Unknown),16.188964802352366,2.7199445754003157e-10,-9.9916293404342509e-15,2.7198190991248771e-10,-37.102292939728208,2.7199166917835514e-10,-1.1618173651667734e-16,2.7173142208855781e-10,16.188964802352356,16.188964802352359,5.3290705182007514e-15,-5.0539055384754641e-15,-4.9377238019587868e-15 +7,2.388551917724,1.3790310926716114,1.3790310926716114,-1.3790310926716114,1(Unknown),1(Unknown),16.188964802352366,2.7199515463045062e-10,-4.182542514600385e-15,2.7199166917835514e-10,-37.102292939728173,2.7201304661787423e-10,-5.8090868258338671e-17,2.7173328099634203e-10,16.188964802352359,16.188964802352363,3.5527136788005009e-15,-2.1203166914293618e-15,-2.0622258231710232e-15 +8,2.7580621853429999,0,0,2.7580621853432228,1(Unknown),1(Unknown),7.57587231885954,-3.4019406632921326e-11,8.1327215561674142e-16,-3.4018012452083129e-11,14.252286687739629,-3.4124783467941956e-11,-6.7530634350318711e-16,-3.4123273105367239e-11,7.5758723188595312,7.5758723188595356,4.4408920985006262e-15,6.8982906056777157e-17,7.4428924955996426e-16 +9,2.7580621853429999,0,-2.7580621853432228,0,1(Unknown),1(Unknown),7.5758723188595098,-3.4023937720645476e-11,-2.9045434129169337e-15,-3.4021614085915144e-11,14.252286687739629,-3.4122576014948137e-11,1.5684534429751442e-15,-3.4124434922732408e-11,7.57587231885954,7.5758723188595249,-1.5099033134902129e-14,-6.6804498497089477e-16,-2.2364984279460392e-15 +10,2.7580621853429999,-2.7580621853432228,0,0,1(Unknown),1(Unknown),7.5758723188595143,-3.402448958389393e-11,5.8090868258338679e-16,-3.4021120313534949e-11,14.252286687739627,-3.4122692196684658e-11,3.7759064367920138e-16,-3.4125364376624537e-11,7.57587231885954,7.5758723188595276,-1.2878587085651816e-14,4.7924966313129413e-16,1.016590194520927e-16 +11,2.7580621853429999,2.7580621853432228,0,0,1(Unknown),1(Unknown),7.5758723188595178,-3.4023821538908962e-11,-2.6721799398835791e-15,-3.4020800813759529e-11,14.252286687739632,-3.4123273105367239e-11,6.3899955084172544e-16,-3.4126061467043639e-11,7.5758723188595418,7.5758723188595294,-1.1990408665951691e-14,-1.0165901945209269e-15,-1.6555897453626522e-15 +12,2.7580621853429999,0,2.7580621853432228,0,1(Unknown),1(Unknown),7.5758723188595098,-3.4022979221319214e-11,-3.2530886224669657e-15,-3.4021004131798429e-11,14.252286687739632,-3.4123040741894205e-11,6.0995411671255612e-16,-3.4124667286205436e-11,7.5758723188595374,7.5758723188595241,-1.3766765505351941e-14,-1.3215672528772049e-15,-1.9315213695897608e-15 +13,2.7580621853429999,0,0,-2.7580621853432228,1(Unknown),1(Unknown),7.57587231885954,-3.4019406632921326e-11,8.1327215561674142e-16,-3.4018012452083129e-11,14.252286687739629,-3.4124783467941956e-11,-6.7530634350318711e-16,-3.4123273105367239e-11,7.5758723188595312,7.5758723188595356,4.4408920985006262e-15,6.8982906056777157e-17,7.4428924955996426e-16 From d4afa0a579dc5e04bfdd11260bbbfd492300ca95 Mon Sep 17 00:00:00 2001 From: janssenhenning Date: Thu, 7 Jul 2022 10:33:39 +0200 Subject: [PATCH 08/15] Simplify `inpxml_todict` function used in the `inpxml_parser` Reduced nesting and simplified handling of text on tags and omitted tags --- .../io/parsers/fleur/fleur_inpxml_parser.py | 154 +- tests/parsers/test_fleur_inpxml_parser.py | 20 +- .../test_inpxml_kpoint_labels.yml | 1739 +++++++++++++++++ .../test_inpxml_max6_0_compatibility.yml | 2 +- .../test_inpxml_newer_version.yml | 4 +- .../test_inpxml_todict_Fe_film_SSFT_LO_.yml | 4 +- .../test_inpxml_todict_warnings.yml | 4 +- 7 files changed, 1833 insertions(+), 94 deletions(-) create mode 100644 tests/parsers/test_fleur_inpxml_parser/test_inpxml_kpoint_labels.yml diff --git a/masci_tools/io/parsers/fleur/fleur_inpxml_parser.py b/masci_tools/io/parsers/fleur/fleur_inpxml_parser.py index 58e16ace9..f06f189a3 100644 --- a/masci_tools/io/parsers/fleur/fleur_inpxml_parser.py +++ b/masci_tools/io/parsers/fleur/fleur_inpxml_parser.py @@ -128,104 +128,92 @@ def inpxml_todict(parent: etree._Element, :return: a python dictionary """ + #These keys have to never appear as an attribute/tag name + #The underscores should guarantee that + _TEXT_PLACEHOLDER = '__text__' + _OMIT_PLACEHOLDER = '__omit__' #Check if this is the first call to this routine if base_xpath is None: base_xpath = f'/{parent.tag}' - return_dict: dict[str, Any] = {} - if list(parent.items()): - return_dict = {str(key): val for key, val in parent.items()} - # Now we have to convert lazy fortran style into pretty things for the Database - for key in return_dict: - if key in schema_dict['attrib_types']: - return_dict[key], suc = convert_from_xml(return_dict[key], + content: dict[str, Any] = {} + # Now we have to convert lazy fortran style into pretty things for the Database + for key, value in parent.items(): + attrib_name, value = str(key), str(value) + if attrib_name in schema_dict['attrib_types']: + content[attrib_name], suc = convert_from_xml(value, schema_dict, - key, + attrib_name, text=False, constants=constants, logger=logger) - if not suc and logger is not None: - logger.warning("Failed to convert attribute '%s' Got: '%s'", key, return_dict[key]) - - if parent.text: - # has text, but we don't want all the '\n' s and empty strings in the database - if parent.text.strip() != '': # might not be the best solutions - if parent.tag not in schema_dict['text_tags']: - if logger is not None: - logger.error('Something is wrong in the schema_dict: %s is not in text_tags, but it has text', - parent.tag) - raise ValueError( - f'Something is wrong in the schema_dict: {parent.tag} is not in text_tags, but it has text') - - converted_text, suc = convert_from_xml(str(parent.text), - schema_dict, - parent.tag, - text=True, - constants=constants, - logger=logger) - if not suc and logger is not None: - logger.warning("Failed to text of '%s' Got: '%s'", parent.tag, parent.text) + logger.warning("Failed to convert attribute '%s' Got: '%s'", attrib_name, value) + + # has text, but we don't want all the '\n' s and empty strings in the database + if parent.text and parent.text.strip() != '': + + if parent.tag not in schema_dict['text_tags']: + if logger is not None: + logger.error('Something is wrong in the schema_dict: %s is not in text_tags, but it has text', + parent.tag) + raise ValueError( + f'Something is wrong in the schema_dict: {parent.tag} is not in text_tags, but it has text') - if not return_dict: - return_dict = converted_text #type:ignore - else: - return_dict['text_value'] = converted_text - if 'label' in return_dict: - return_dict['text_label'] = return_dict['label'] - return_dict.pop('label') + converted_text, suc = convert_from_xml(str(parent.text), + schema_dict, + parent.tag, + text=True, + constants=constants, + logger=logger) + + if not suc and logger is not None: + logger.warning("Failed to text of '%s' Got: '%s'", parent.tag, parent.text) + + content[_TEXT_PLACEHOLDER] = converted_text tag_info = schema_dict['tag_info'].get(base_xpath, EMPTY_TAG_INFO) for element in parent: - new_base_xpath = f'{base_xpath}/{element.tag}' - omitt_contained_tags = element.tag in schema_dict['omitt_contained_tags'] - new_return_dict = inpxml_todict(element, - schema_dict, - constants, - base_xpath=new_base_xpath, - omitted_tags=omitt_contained_tags, - logger=logger) - - if element.tag in tag_info['several']: - # make a list, otherwise the tag will be overwritten in the dict - if element.tag not in return_dict: # is this the first occurrence? - if omitted_tags: - if len(return_dict) == 0: - return_dict = [] #type:ignore - else: - return_dict[element.tag] = [] - if omitted_tags: - return_dict.append(new_return_dict) #type:ignore - elif 'text_value' in new_return_dict: - for key, value in new_return_dict.items(): - if key == 'text_value': - return_dict[element.tag].append(value) - elif key == 'text_label': - if 'labels' not in return_dict: - return_dict['labels'] = {} - return_dict['labels'][value] = new_return_dict['text_value'] - else: - if key not in return_dict: - return_dict[key] = [] - elif not isinstance(return_dict[key], list): #Key seems to be defined already - if logger is not None: - logger.error('%s cannot be extracted to the next level', key) - raise ValueError(f'{key} cannot be extracted to the next level') - return_dict[key].append(value) - for key in new_return_dict.keys(): - if key in ['text_value', 'text_label']: - continue - if len(return_dict[key]) != len(return_dict[element.tag]): + child_content = inpxml_todict(element, + schema_dict, + constants, + base_xpath=f'{base_xpath}/{element.tag}', + omitted_tags=element.tag in schema_dict['omitt_contained_tags'], + logger=logger) + + if _OMIT_PLACEHOLDER in child_content: + #We knoe that there is only one key here + child_content = child_content.pop(_OMIT_PLACEHOLDER) + + tag_name = element.tag + if omitted_tags: + tag_name = _OMIT_PLACEHOLDER + + if element.tag in tag_info['several']\ + and _TEXT_PLACEHOLDER in child_content: + #The text is stored under the name of the tag + text_value = child_content.pop(_TEXT_PLACEHOLDER) + content.setdefault(tag_name, []).append(text_value) + child_tag_info = schema_dict['tag_info'].get(f'{base_xpath}/{element.tag}', EMPTY_TAG_INFO) + for key, value in child_content.items(): + if key not in child_tag_info['optional_attribs']: + #All required attributes are stored as lists + if key in content and \ + not isinstance(content[key], list): #Key seems to be defined already if logger is not None: - logger.error( - 'Extracted optional argument %s at the moment only label is supported correctly', key) - raise ValueError( - f'Extracted optional argument {key} at the moment only label is supported correctly') - else: - return_dict[element.tag].append(new_return_dict) + logger.error('%s cannot be extracted to the next level', key) + raise ValueError(f'{key} cannot be extracted to the next level') + content.setdefault(key, []).append(value) + else: + #All optional attributes are stored as dicts pointing to the text + content.setdefault(key, {})[value] = text_value + elif element.tag in tag_info['several']: + content.setdefault(tag_name, []).append(child_content) + elif _TEXT_PLACEHOLDER in child_content: + content[tag_name] = child_content.pop(_TEXT_PLACEHOLDER) else: - return_dict[element.tag] = new_return_dict + content[tag_name] = child_content - return return_dict + return content diff --git a/tests/parsers/test_fleur_inpxml_parser.py b/tests/parsers/test_fleur_inpxml_parser.py index e53a3c2ba..672dd2e75 100644 --- a/tests/parsers/test_fleur_inpxml_parser.py +++ b/tests/parsers/test_fleur_inpxml_parser.py @@ -74,7 +74,7 @@ def test_inpxml_valid_inpxml(inpxmlfilepath): assert inp_dict is not None assert isinstance(inp_dict, dict) - assert inp_dict != {} + assert inp_dict #Parse before parser = etree.XMLParser(attribute_defaults=True, encoding='utf-8') @@ -83,7 +83,7 @@ def test_inpxml_valid_inpxml(inpxmlfilepath): assert inp_dict is not None assert isinstance(inp_dict, dict) - assert inp_dict != {} + assert inp_dict #Pass file handle with open(inpxmlfilepath, encoding='utf-8') as inpfile: @@ -91,7 +91,7 @@ def test_inpxml_valid_inpxml(inpxmlfilepath): assert inp_dict is not None assert isinstance(inp_dict, dict) - assert inp_dict != {} + assert inp_dict #Pass file content with open(inpxmlfilepath, 'rb') as inpfile: @@ -101,7 +101,7 @@ def test_inpxml_valid_inpxml(inpxmlfilepath): assert inp_dict is not None assert isinstance(inp_dict, dict) - assert inp_dict != {} + assert inp_dict @pytest.mark.parametrize('inpxmlfilepath', inpxmlfilelist2) @@ -160,3 +160,15 @@ def test_inpxml_newer_version(data_regression, clean_parser_log, test_file): #The parser shoul not raise and just log all the failed conversions inp_dict = inpxml_parser(INPXML_FILEPATH, parser_info_out=warnings) data_regression.check({'input_dict': inp_dict, 'warnings': clean_parser_log(warnings)}) + + +def test_inpxml_kpoint_labels(data_regression, clean_parser_log, test_file): + """ + test if valid inp.xml files with text and attributes on the text nodes are parsed correctly + """ + + INPXML_FILEPATH = test_file('fleur/Max-R6/inp_film.xml') + warnings = {} + #The parser shoul not raise and just log all the failed conversions + inp_dict = inpxml_parser(INPXML_FILEPATH, parser_info_out=warnings) + data_regression.check({'input_dict': inp_dict, 'warnings': clean_parser_log(warnings)}) diff --git a/tests/parsers/test_fleur_inpxml_parser/test_inpxml_kpoint_labels.yml b/tests/parsers/test_fleur_inpxml_parser/test_inpxml_kpoint_labels.yml new file mode 100644 index 000000000..1efb52035 --- /dev/null +++ b/tests/parsers/test_fleur_inpxml_parser/test_inpxml_kpoint_labels.yml @@ -0,0 +1,1739 @@ +input_dict: + atomGroups: + - filmPos: + - - 0.0 + - 0.0 + - -1.9928500005 + force: + calculate: true + relaxXYZ: TTT + label: + ' 123': + - 0.0 + - 0.0 + - -1.9928500005 + nocoParams: + alpha: 0.0 + beta: 1.57079 + species: Fe-1 + - filmPos: + - - 0.5 + - 0.5 + - 0.0 + force: + calculate: true + relaxXYZ: TTT + label: + ' 2': + - 0.5 + - 0.5 + - 0.0 + nocoParams: + alpha: 0.0 + beta: 1.57079 + species: Pt-1 + - filmPos: + - - 0.0 + - 0.0 + - 2.6505900006 + force: + calculate: true + relaxXYZ: TTT + label: + ' 3': + - 0.0 + - 0.0 + - 2.6505900006 + nocoParams: + alpha: 0.0 + beta: 1.57079 + species: Pt-1 + atomSpecies: + - atomicCutoffs: + lmax: 6 + lnonsphr: 4 + atomicNumber: 26 + electronConfig: + coreConfig: + - (1s1/2) + - (2s1/2) + - (2p1/2) + - (2p3/2) + flipSpins: false + stateOccupation: + - spinDown: 1.2 + spinUp: 1.2 + state: (3d3/2) + - spinDown: 0.7 + spinUp: 2.9 + state: (3d5/2) + valenceConfig: + - (3s1/2) + - (3p1/2) + - (3p3/2) + - (4s1/2) + - (3d3/2) + - (3d5/2) + element: Fe + energyParameters: + d: 3 + f: 4 + p: 4 + s: 4 + lo: + - eDeriv: 0 + l: 0 + n: 3 + type: SCLO + - eDeriv: 0 + l: 1 + n: 3 + type: SCLO + modInitDen: + flipSpinPhi: 0.0 + flipSpinScale: false + flipSpinTheta: 0.0 + mtSphere: + gridPoints: 731 + logIncrement: 0.017 + radius: 2.21 + name: Fe-1 + prodBasis: + lcutm: 4 + lcutwf: 6 + select: 4 0 4 2 + - atomicCutoffs: + lmax: 6 + lnonsphr: 4 + atomicNumber: 78 + electronConfig: + coreConfig: + - (1s1/2) + - (2s1/2) + - (2p1/2) + - (2p3/2) + - (3s1/2) + - (3p1/2) + - (3p3/2) + - (4s1/2) + - (3d3/2) + - (3d5/2) + - (4p1/2) + - (4p3/2) + - (5s1/2) + - (4d3/2) + - (4d5/2) + - (4f5/2) + - (4f7/2) + flipSpins: false + stateOccupation: + - spinDown: 0.5 + spinUp: 0.5 + state: (6s1/2) + - spinDown: 1.8 + spinUp: 1.8 + state: (5d3/2) + - spinDown: 2.7 + spinUp: 2.7 + state: (5d5/2) + valenceConfig: + - (5p1/2) + - (5p3/2) + - (6s1/2) + - (5d3/2) + - (5d5/2) + element: Pt + energyParameters: + d: 5 + f: 5 + p: 6 + s: 6 + lo: + - eDeriv: 0 + l: 1 + n: 5 + type: SCLO + modInitDen: + flipSpinPhi: 0.0 + flipSpinScale: false + flipSpinTheta: 0.0 + mtSphere: + gridPoints: 731 + logIncrement: 0.018 + radius: 2.21 + name: Pt-1 + prodBasis: + lcutm: 4 + lcutwf: 6 + select: 4 0 4 2 + calculationSetup: + coreElectrons: + coretail_lmax: 0 + ctail: false + frcor: false + kcrel: 0 + cutoffs: + Gmax: 9.6 + GmaxXC: 9.6 + Kmax: 3.2 + numbands: 0 + expertModes: + secvar: false + spex: 0 + geometryOptimization: + epsdisp: 1.0e-05 + epsforce: 1.0e-05 + forcealpha: 1.0 + forcemix: BFGS + l_f: false + ldaHIA: + beta: 100.0 + dftspinpol: false + itmaxHubbard1: 5 + minmatDistance: 0.001 + minoccDistance: 0.01 + ldaU: + l_linMix: false + mixParam: 0.05 + spinf: 1.0 + magnetism: + jspins: 2 + l_noco: true + l_ss: true + mtNocoParams: + l_constrained: false + l_mperp: false + l_mtNocoPot: false + l_relaxSQA: false + mag_mixing_scheme: 0 + mix_RelaxWeightOffD: 1.0 + mix_constr: 1.0 + qss: + - 0.0 + - 0.0 + - 0.0 + sourceFreeMag: + l_scaleMag: false + l_sourceFree: false + mag_scale: 1.0 + prodBasis: + bands: 0 + ewaldlambda: 3 + fftcut: 1.0 + gcutm: 2.7 + lexp: 16 + tolerance: 0.0001 + scfLoop: + alpha: 0.05 + imix: Anderson + itmax: 1 + maxIterBroyd: 15 + minDistance: 0.3 + precondParam: 0.0 + spinf: 2.0 + soc: + l_soc: false + phi: 0.0 + spav: true + theta: 0.0 + xcFunctional: + name: pbe + relativisticCorrections: false + cell: + bzIntegration: + fermiSmearingEnergy: 0.001 + kPointListSelection: + listName: default-1 + kPointLists: + - count: 96 + kPoint: + - - -0.4375 + - -0.4583333333333333 + - 0.0 + - - -0.3125 + - -0.4583333333333333 + - 0.0 + - - -0.1875 + - -0.4583333333333333 + - 0.0 + - - -0.0625 + - -0.4583333333333333 + - 0.0 + - - 0.0625 + - -0.4583333333333333 + - 0.0 + - - 0.1875 + - -0.4583333333333333 + - 0.0 + - - 0.3125 + - -0.4583333333333333 + - 0.0 + - - 0.4375 + - -0.4583333333333333 + - 0.0 + - - -0.4375 + - -0.375 + - 0.0 + - - -0.3125 + - -0.375 + - 0.0 + - - -0.1875 + - -0.375 + - 0.0 + - - -0.0625 + - -0.375 + - 0.0 + - - 0.0625 + - -0.375 + - 0.0 + - - 0.1875 + - -0.375 + - 0.0 + - - 0.3125 + - -0.375 + - 0.0 + - - 0.4375 + - -0.375 + - 0.0 + - - -0.4375 + - -0.29166666666666663 + - 0.0 + - - -0.3125 + - -0.29166666666666663 + - 0.0 + - - -0.1875 + - -0.29166666666666663 + - 0.0 + - - -0.0625 + - -0.29166666666666663 + - 0.0 + - - 0.0625 + - -0.29166666666666663 + - 0.0 + - - 0.1875 + - -0.29166666666666663 + - 0.0 + - - 0.3125 + - -0.29166666666666663 + - 0.0 + - - 0.4375 + - -0.29166666666666663 + - 0.0 + - - -0.4375 + - -0.20833333333333331 + - 0.0 + - - -0.3125 + - -0.20833333333333331 + - 0.0 + - - -0.1875 + - -0.20833333333333331 + - 0.0 + - - -0.0625 + - -0.20833333333333331 + - 0.0 + - - 0.0625 + - -0.20833333333333331 + - 0.0 + - - 0.1875 + - -0.20833333333333331 + - 0.0 + - - 0.3125 + - -0.20833333333333331 + - 0.0 + - - 0.4375 + - -0.20833333333333331 + - 0.0 + - - -0.4375 + - -0.125 + - 0.0 + - - -0.3125 + - -0.125 + - 0.0 + - - -0.1875 + - -0.125 + - 0.0 + - - -0.0625 + - -0.125 + - 0.0 + - - 0.0625 + - -0.125 + - 0.0 + - - 0.1875 + - -0.125 + - 0.0 + - - 0.3125 + - -0.125 + - 0.0 + - - 0.4375 + - -0.125 + - 0.0 + - - -0.4375 + - -0.041666666666666664 + - 0.0 + - - -0.3125 + - -0.041666666666666664 + - 0.0 + - - -0.1875 + - -0.041666666666666664 + - 0.0 + - - -0.0625 + - -0.041666666666666664 + - 0.0 + - - 0.0625 + - -0.041666666666666664 + - 0.0 + - - 0.1875 + - -0.041666666666666664 + - 0.0 + - - 0.3125 + - -0.041666666666666664 + - 0.0 + - - 0.4375 + - -0.041666666666666664 + - 0.0 + - - -0.4375 + - 0.041666666666666664 + - 0.0 + - - -0.3125 + - 0.041666666666666664 + - 0.0 + - - -0.1875 + - 0.041666666666666664 + - 0.0 + - - -0.0625 + - 0.041666666666666664 + - 0.0 + - - 0.0625 + - 0.041666666666666664 + - 0.0 + - - 0.1875 + - 0.041666666666666664 + - 0.0 + - - 0.3125 + - 0.041666666666666664 + - 0.0 + - - 0.4375 + - 0.041666666666666664 + - 0.0 + - - -0.4375 + - 0.125 + - 0.0 + - - -0.3125 + - 0.125 + - 0.0 + - - -0.1875 + - 0.125 + - 0.0 + - - -0.0625 + - 0.125 + - 0.0 + - - 0.0625 + - 0.125 + - 0.0 + - - 0.1875 + - 0.125 + - 0.0 + - - 0.3125 + - 0.125 + - 0.0 + - - 0.4375 + - 0.125 + - 0.0 + - - -0.4375 + - 0.20833333333333331 + - 0.0 + - - -0.3125 + - 0.20833333333333331 + - 0.0 + - - -0.1875 + - 0.20833333333333331 + - 0.0 + - - -0.0625 + - 0.20833333333333331 + - 0.0 + - - 0.0625 + - 0.20833333333333331 + - 0.0 + - - 0.1875 + - 0.20833333333333331 + - 0.0 + - - 0.3125 + - 0.20833333333333331 + - 0.0 + - - 0.4375 + - 0.20833333333333331 + - 0.0 + - - -0.4375 + - 0.29166666666666663 + - 0.0 + - - -0.3125 + - 0.29166666666666663 + - 0.0 + - - -0.1875 + - 0.29166666666666663 + - 0.0 + - - -0.0625 + - 0.29166666666666663 + - 0.0 + - - 0.0625 + - 0.29166666666666663 + - 0.0 + - - 0.1875 + - 0.29166666666666663 + - 0.0 + - - 0.3125 + - 0.29166666666666663 + - 0.0 + - - 0.4375 + - 0.29166666666666663 + - 0.0 + - - -0.4375 + - 0.375 + - 0.0 + - - -0.3125 + - 0.375 + - 0.0 + - - -0.1875 + - 0.375 + - 0.0 + - - -0.0625 + - 0.375 + - 0.0 + - - 0.0625 + - 0.375 + - 0.0 + - - 0.1875 + - 0.375 + - 0.0 + - - 0.3125 + - 0.375 + - 0.0 + - - 0.4375 + - 0.375 + - 0.0 + - - -0.4375 + - 0.4583333333333333 + - 0.0 + - - -0.3125 + - 0.4583333333333333 + - 0.0 + - - -0.1875 + - 0.4583333333333333 + - 0.0 + - - -0.0625 + - 0.4583333333333333 + - 0.0 + - - 0.0625 + - 0.4583333333333333 + - 0.0 + - - 0.1875 + - 0.4583333333333333 + - 0.0 + - - 0.3125 + - 0.4583333333333333 + - 0.0 + - - 0.4375 + - 0.4583333333333333 + - 0.0 + name: default-1 + nx: 8 + ny: 12 + nz: 1 + type: mesh + weight: + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - count: 240 + kPoint: + - - 0.0 + - 0.0 + - 0.0 + - - 0.0071428571428571 + - 0.0 + - 0.0 + - - 0.0142857142857143 + - 0.0 + - 0.0 + - - 0.0214285714285714 + - 0.0 + - 0.0 + - - 0.0285714285714286 + - 0.0 + - 0.0 + - - 0.0357142857142857 + - 0.0 + - 0.0 + - - 0.0428571428571429 + - 0.0 + - 0.0 + - - 0.05 + - 0.0 + - 0.0 + - - 0.0571428571428571 + - 0.0 + - 0.0 + - - 0.0642857142857143 + - 0.0 + - 0.0 + - - 0.0714285714285714 + - 0.0 + - 0.0 + - - 0.0785714285714286 + - 0.0 + - 0.0 + - - 0.0857142857142857 + - 0.0 + - 0.0 + - - 0.0928571428571429 + - 0.0 + - 0.0 + - - 0.1 + - 0.0 + - 0.0 + - - 0.1071428571428571 + - 0.0 + - 0.0 + - - 0.1142857142857143 + - 0.0 + - 0.0 + - - 0.1214285714285714 + - 0.0 + - 0.0 + - - 0.1285714285714286 + - 0.0 + - 0.0 + - - 0.1357142857142857 + - 0.0 + - 0.0 + - - 0.1428571428571428 + - 0.0 + - 0.0 + - - 0.15 + - 0.0 + - 0.0 + - - 0.1571428571428571 + - 0.0 + - 0.0 + - - 0.1642857142857143 + - 0.0 + - 0.0 + - - 0.1714285714285714 + - 0.0 + - 0.0 + - - 0.1785714285714286 + - 0.0 + - 0.0 + - - 0.1857142857142857 + - 0.0 + - 0.0 + - - 0.1928571428571428 + - 0.0 + - 0.0 + - - 0.2 + - 0.0 + - 0.0 + - - 0.2071428571428571 + - 0.0 + - 0.0 + - - 0.2142857142857143 + - 0.0 + - 0.0 + - - 0.2214285714285714 + - 0.0 + - 0.0 + - - 0.2285714285714286 + - 0.0 + - 0.0 + - - 0.2357142857142857 + - 0.0 + - 0.0 + - - 0.2428571428571429 + - 0.0 + - 0.0 + - - 0.25 + - 0.0 + - 0.0 + - - 0.2571428571428571 + - 0.0 + - 0.0 + - - 0.2642857142857143 + - 0.0 + - 0.0 + - - 0.2714285714285714 + - 0.0 + - 0.0 + - - 0.2785714285714286 + - 0.0 + - 0.0 + - - 0.2857142857142857 + - 0.0 + - 0.0 + - - 0.2928571428571429 + - 0.0 + - 0.0 + - - 0.3 + - 0.0 + - 0.0 + - - 0.3071428571428571 + - 0.0 + - 0.0 + - - 0.3142857142857143 + - 0.0 + - 0.0 + - - 0.3214285714285714 + - 0.0 + - 0.0 + - - 0.3285714285714286 + - 0.0 + - 0.0 + - - 0.3357142857142857 + - 0.0 + - 0.0 + - - 0.3428571428571429 + - 0.0 + - 0.0 + - - 0.35 + - 0.0 + - 0.0 + - - 0.3571428571428572 + - 0.0 + - 0.0 + - - 0.3642857142857143 + - 0.0 + - 0.0 + - - 0.3714285714285714 + - 0.0 + - 0.0 + - - 0.3785714285714286 + - 0.0 + - 0.0 + - - 0.3857142857142857 + - 0.0 + - 0.0 + - - 0.3928571428571428 + - 0.0 + - 0.0 + - - 0.4 + - 0.0 + - 0.0 + - - 0.4071428571428571 + - 0.0 + - 0.0 + - - 0.4142857142857143 + - 0.0 + - 0.0 + - - 0.4214285714285714 + - 0.0 + - 0.0 + - - 0.4285714285714285 + - 0.0 + - 0.0 + - - 0.4357142857142857 + - 0.0 + - 0.0 + - - 0.4428571428571428 + - 0.0 + - 0.0 + - - 0.45 + - 0.0 + - 0.0 + - - 0.4571428571428571 + - 0.0 + - 0.0 + - - 0.4642857142857142 + - 0.0 + - 0.0 + - - 0.4714285714285714 + - 0.0 + - 0.0 + - - 0.4785714285714285 + - 0.0 + - 0.0 + - - 0.4857142857142857 + - 0.0 + - 0.0 + - - 0.4928571428571428 + - 0.0 + - 0.0 + - - 0.5 + - 0.0 + - 0.0 + - - 0.5 + - 0.0102040816326531 + - 0.0 + - - 0.5 + - 0.0204081632653061 + - 0.0 + - - 0.5 + - 0.0306122448979592 + - 0.0 + - - 0.5 + - 0.0408163265306122 + - 0.0 + - - 0.5 + - 0.0510204081632653 + - 0.0 + - - 0.5 + - 0.0612244897959184 + - 0.0 + - - 0.5 + - 0.0714285714285714 + - 0.0 + - - 0.5 + - 0.0816326530612245 + - 0.0 + - - 0.5 + - 0.0918367346938775 + - 0.0 + - - 0.5 + - 0.1020408163265306 + - 0.0 + - - 0.5 + - 0.1122448979591837 + - 0.0 + - - 0.5 + - 0.1224489795918367 + - 0.0 + - - 0.5 + - 0.1326530612244898 + - 0.0 + - - 0.5 + - 0.1428571428571428 + - 0.0 + - - 0.5 + - 0.1530612244897959 + - 0.0 + - - 0.5 + - 0.163265306122449 + - 0.0 + - - 0.5 + - 0.173469387755102 + - 0.0 + - - 0.5 + - 0.1836734693877551 + - 0.0 + - - 0.5 + - 0.1938775510204082 + - 0.0 + - - 0.5 + - 0.2040816326530612 + - 0.0 + - - 0.5 + - 0.2142857142857143 + - 0.0 + - - 0.5 + - 0.2244897959183673 + - 0.0 + - - 0.5 + - 0.2346938775510204 + - 0.0 + - - 0.5 + - 0.2448979591836735 + - 0.0 + - - 0.5 + - 0.2551020408163265 + - 0.0 + - - 0.5 + - 0.2653061224489796 + - 0.0 + - - 0.5 + - 0.2755102040816326 + - 0.0 + - - 0.5 + - 0.2857142857142857 + - 0.0 + - - 0.5 + - 0.2959183673469388 + - 0.0 + - - 0.5 + - 0.3061224489795918 + - 0.0 + - - 0.5 + - 0.3163265306122449 + - 0.0 + - - 0.5 + - 0.3265306122448979 + - 0.0 + - - 0.5 + - 0.336734693877551 + - 0.0 + - - 0.5 + - 0.3469387755102041 + - 0.0 + - - 0.5 + - 0.3571428571428571 + - 0.0 + - - 0.5 + - 0.3673469387755102 + - 0.0 + - - 0.5 + - 0.3775510204081632 + - 0.0 + - - 0.5 + - 0.3877551020408163 + - 0.0 + - - 0.5 + - 0.3979591836734693 + - 0.0 + - - 0.5 + - 0.4081632653061224 + - 0.0 + - - 0.5 + - 0.4183673469387755 + - 0.0 + - - 0.5 + - 0.4285714285714285 + - 0.0 + - - 0.5 + - 0.4387755102040816 + - 0.0 + - - 0.5 + - 0.4489795918367346 + - 0.0 + - - 0.5 + - 0.4591836734693877 + - 0.0 + - - 0.5 + - 0.4693877551020408 + - 0.0 + - - 0.5 + - 0.4795918367346939 + - 0.0 + - - 0.5 + - 0.4897959183673469 + - 0.0 + - - 0.5 + - 0.5 + - 0.0 + - - 0.4928571428571429 + - 0.5 + - 0.0 + - - 0.4857142857142857 + - 0.5 + - 0.0 + - - 0.4785714285714286 + - 0.5 + - 0.0 + - - 0.4714285714285714 + - 0.5 + - 0.0 + - - 0.4642857142857143 + - 0.5 + - 0.0 + - - 0.4571428571428571 + - 0.5 + - 0.0 + - - 0.45 + - 0.5 + - 0.0 + - - 0.4428571428571428 + - 0.5 + - 0.0 + - - 0.4357142857142857 + - 0.5 + - 0.0 + - - 0.4285714285714286 + - 0.5 + - 0.0 + - - 0.4214285714285714 + - 0.5 + - 0.0 + - - 0.4142857142857143 + - 0.5 + - 0.0 + - - 0.4071428571428571 + - 0.5 + - 0.0 + - - 0.4 + - 0.5 + - 0.0 + - - 0.3928571428571428 + - 0.5 + - 0.0 + - - 0.3857142857142857 + - 0.5 + - 0.0 + - - 0.3785714285714286 + - 0.5 + - 0.0 + - - 0.3714285714285714 + - 0.5 + - 0.0 + - - 0.3642857142857143 + - 0.5 + - 0.0 + - - 0.3571428571428572 + - 0.5 + - 0.0 + - - 0.35 + - 0.5 + - 0.0 + - - 0.3428571428571429 + - 0.5 + - 0.0 + - - 0.3357142857142857 + - 0.5 + - 0.0 + - - 0.3285714285714286 + - 0.5 + - 0.0 + - - 0.3214285714285714 + - 0.5 + - 0.0 + - - 0.3142857142857143 + - 0.5 + - 0.0 + - - 0.3071428571428572 + - 0.5 + - 0.0 + - - 0.3 + - 0.5 + - 0.0 + - - 0.2928571428571429 + - 0.5 + - 0.0 + - - 0.2857142857142857 + - 0.5 + - 0.0 + - - 0.2785714285714286 + - 0.5 + - 0.0 + - - 0.2714285714285715 + - 0.5 + - 0.0 + - - 0.2642857142857143 + - 0.5 + - 0.0 + - - 0.2571428571428571 + - 0.5 + - 0.0 + - - 0.25 + - 0.5 + - 0.0 + - - 0.2428571428571429 + - 0.5 + - 0.0 + - - 0.2357142857142857 + - 0.5 + - 0.0 + - - 0.2285714285714286 + - 0.5 + - 0.0 + - - 0.2214285714285714 + - 0.5 + - 0.0 + - - 0.2142857142857143 + - 0.5 + - 0.0 + - - 0.2071428571428571 + - 0.5 + - 0.0 + - - 0.2 + - 0.5 + - 0.0 + - - 0.1928571428571429 + - 0.5 + - 0.0 + - - 0.1857142857142857 + - 0.5 + - 0.0 + - - 0.1785714285714286 + - 0.5 + - 0.0 + - - 0.1714285714285714 + - 0.5 + - 0.0 + - - 0.1642857142857143 + - 0.5 + - 0.0 + - - 0.1571428571428571 + - 0.5 + - 0.0 + - - 0.15 + - 0.5 + - 0.0 + - - 0.1428571428571428 + - 0.5 + - 0.0 + - - 0.1357142857142857 + - 0.5 + - 0.0 + - - 0.1285714285714286 + - 0.5 + - 0.0 + - - 0.1214285714285714 + - 0.5 + - 0.0 + - - 0.1142857142857143 + - 0.5 + - 0.0 + - - 0.1071428571428572 + - 0.5 + - 0.0 + - - 0.1 + - 0.5 + - 0.0 + - - 0.0928571428571429 + - 0.5 + - 0.0 + - - 0.0857142857142857 + - 0.5 + - 0.0 + - - 0.0785714285714286 + - 0.5 + - 0.0 + - - 0.0714285714285715 + - 0.5 + - 0.0 + - - 0.0642857142857143 + - 0.5 + - 0.0 + - - 0.0571428571428572 + - 0.5 + - 0.0 + - - 0.05 + - 0.5 + - 0.0 + - - 0.0428571428571429 + - 0.5 + - 0.0 + - - 0.0357142857142858 + - 0.5 + - 0.0 + - - 0.0285714285714286 + - 0.5 + - 0.0 + - - 0.0214285714285715 + - 0.5 + - 0.0 + - - 0.0142857142857143 + - 0.5 + - 0.0 + - - 0.0071428571428572 + - 0.5 + - 0.0 + - - 0.0 + - 0.5 + - 0.0 + - - 0.0 + - 0.49 + - 0.0 + - - 0.0 + - 0.48 + - 0.0 + - - 0.0 + - 0.47 + - 0.0 + - - 0.0 + - 0.46 + - 0.0 + - - 0.0 + - 0.45 + - 0.0 + - - 0.0 + - 0.44 + - 0.0 + - - 0.0 + - 0.43 + - 0.0 + - - 0.0 + - 0.42 + - 0.0 + - - 0.0 + - 0.41 + - 0.0 + - - 0.0 + - 0.4 + - 0.0 + - - 0.0 + - 0.39 + - 0.0 + - - 0.0 + - 0.38 + - 0.0 + - - 0.0 + - 0.37 + - 0.0 + - - 0.0 + - 0.36 + - 0.0 + - - 0.0 + - 0.35 + - 0.0 + - - 0.0 + - 0.34 + - 0.0 + - - 0.0 + - 0.33 + - 0.0 + - - 0.0 + - 0.32 + - 0.0 + - - 0.0 + - 0.31 + - 0.0 + - - 0.0 + - 0.3 + - 0.0 + - - 0.0 + - 0.29 + - 0.0 + - - 0.0 + - 0.28 + - 0.0 + - - 0.0 + - 0.27 + - 0.0 + - - 0.0 + - 0.26 + - 0.0 + - - 0.0 + - 0.25 + - 0.0 + - - 0.0 + - 0.24 + - 0.0 + - - 0.0 + - 0.23 + - 0.0 + - - 0.0 + - 0.22 + - 0.0 + - - 0.0 + - 0.21 + - 0.0 + - - 0.0 + - 0.2 + - 0.0 + - - 0.0 + - 0.19 + - 0.0 + - - 0.0 + - 0.18 + - 0.0 + - - 0.0 + - 0.17 + - 0.0 + - - 0.0 + - 0.16 + - 0.0 + - - 0.0 + - 0.15 + - 0.0 + - - 0.0 + - 0.14 + - 0.0 + - - 0.0 + - 0.13 + - 0.0 + - - 0.0 + - 0.12 + - 0.0 + - - 0.0 + - 0.11 + - 0.0 + - - 0.0 + - 0.1 + - 0.0 + - - 0.0 + - 0.09 + - 0.0 + - - 0.0 + - 0.08 + - 0.0 + - - 0.0 + - 0.07 + - 0.0 + - - 0.0 + - 0.06 + - 0.0 + - - 0.0 + - 0.05 + - 0.0 + - - 0.0 + - 0.04 + - 0.0 + - - 0.0 + - 0.03 + - 0.0 + - - 0.0 + - 0.02 + - 0.0 + - - 0.0 + - 0.01 + - 0.0 + - - 0.0 + - 0.0 + - 0.0 + label: + S: + - 0.5 + - 0.5 + - 0.0 + X: + - 0.5 + - 0.0 + - 0.0 + Y: + - 0.0 + - 0.5 + - 0.0 + g: + - 0.0 + - 0.0 + - 0.0 + name: path-2 + type: path + weight: + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + - 1.0 + mode: hist + valenceElectrons: 48.0 + filmLattice: + bravaisMatrixFilm: + row-1: + - 5.301179681 + - 0.0 + row-2: + - 0.0 + - 7.497000002 + dTilda: 12.42 + dVac: 9.92 + scale: 1.0 + vacuumEnergyParameters: + - spinDown: -0.25 + spinUp: -0.25 + vacuum: 1 + - spinDown: -0.25 + spinUp: -0.25 + vacuum: 2 + symmetryOperations: + - row-1: + - 1.0 + - 0.0 + - 0.0 + - 0.0 + row-2: + - 0.0 + - 1.0 + - 0.0 + - 0.0 + row-3: + - 0.0 + - 0.0 + - 1.0 + - 0.0 + comment: A Fleur input generator calculation with aiida + fleurInputVersion: '0.35' + forceTheorem: + DMI: + phi: + - 0.0 + - 0.0 + - 1.57079 + qVectors: + - - 0.0 + - 0.0 + - 0.0 + - - 0.125 + - 0.0 + - 0.0 + - - 0.25 + - 0.0 + - 0.0 + - - 0.375 + - 0.0 + - 0.0 + theta: + - 0.0 + - 1.57079 + - 1.57079 + output: + band: false + bandDOS: + maxEnergy: 0.5 + minEnergy: -0.5 + sigma: 0.015 + storeEVData: true + chargeDensitySlicing: + maxEigenval: 0.0 + minEigenval: 0.0 + nnne: 0 + numkpt: 0 + pallst: false + checks: + cdinf: false + vchk: false + dos: false + magneticCircularDichroism: + energyLo: -10.0 + energyUp: 0.0 + mcd: false + plotting: + iplot: 0 + plot: + - TwoD: true + file: plot + vec1: ' 1.0 0.0 0.0' + vec2: ' 0.0 1.0 0.0' + vec3: ' 0.0 0.0 1.0' + zero: ' 0.0 0.0 -0.5' + polar: false + slice: false + specialOutput: + bmt: false + eonly: false + unfoldingBand: + supercellX: 1 + supercellY: 1 + supercellZ: 1 + unfoldBand: false + vacuumDOS: + integ: false + locx1: 0.0 + locx2: 0.0 + locy1: 0.0 + locy2: 0.0 + nstars: 0 + nstm: 0 + star: false + tworkf: 0.0 + vacdos: false +warnings: + parser_errors: [] + parser_info: + - Masci-Tools Fleur inp.xml Parser v0.3.0 + - Got Fleur input file with file version 0.35 + parser_warnings: [] diff --git a/tests/parsers/test_fleur_inpxml_parser/test_inpxml_max6_0_compatibility.yml b/tests/parsers/test_fleur_inpxml_parser/test_inpxml_max6_0_compatibility.yml index 9911f46d6..1bf0f211f 100644 --- a/tests/parsers/test_fleur_inpxml_parser/test_inpxml_max6_0_compatibility.yml +++ b/tests/parsers/test_fleur_inpxml_parser/test_inpxml_max6_0_compatibility.yml @@ -3,7 +3,7 @@ input_dict: - force: calculate: true relaxXYZ: TTT - labels: + label: ' 1': - 0.125 - 0.125 diff --git a/tests/parsers/test_fleur_inpxml_parser/test_inpxml_newer_version.yml b/tests/parsers/test_fleur_inpxml_parser/test_inpxml_newer_version.yml index cff1060e7..6d79ef730 100644 --- a/tests/parsers/test_fleur_inpxml_parser/test_inpxml_newer_version.yml +++ b/tests/parsers/test_fleur_inpxml_parser/test_inpxml_newer_version.yml @@ -7,7 +7,7 @@ input_dict: force: calculate: true relaxXYZ: TTT - labels: + label: ' 222': - 0.0 - 0.0 @@ -23,7 +23,7 @@ input_dict: force: calculate: true relaxXYZ: TTT - labels: + label: ' 2': - 0.5 - 0.5 diff --git a/tests/parsers/test_fleur_inpxml_parser/test_inpxml_todict_Fe_film_SSFT_LO_.yml b/tests/parsers/test_fleur_inpxml_parser/test_inpxml_todict_Fe_film_SSFT_LO_.yml index cf9df265d..85ffcbc00 100644 --- a/tests/parsers/test_fleur_inpxml_parser/test_inpxml_todict_Fe_film_SSFT_LO_.yml +++ b/tests/parsers/test_fleur_inpxml_parser/test_inpxml_todict_Fe_film_SSFT_LO_.yml @@ -6,7 +6,7 @@ atomGroups: force: calculate: true relaxXYZ: TTT - labels: + label: ' 222': - 0.0 - 0.0 @@ -22,7 +22,7 @@ atomGroups: force: calculate: true relaxXYZ: TTT - labels: + label: ' 2': - 0.5 - 0.5 diff --git a/tests/parsers/test_fleur_inpxml_parser/test_inpxml_todict_warnings.yml b/tests/parsers/test_fleur_inpxml_parser/test_inpxml_todict_warnings.yml index 00d8dd534..e9b1cf5b7 100644 --- a/tests/parsers/test_fleur_inpxml_parser/test_inpxml_todict_warnings.yml +++ b/tests/parsers/test_fleur_inpxml_parser/test_inpxml_todict_warnings.yml @@ -7,7 +7,7 @@ input_dict: force: calculate: true relaxXYZ: TTT - labels: + label: ' 222': - 0.0 - 0.0 @@ -23,7 +23,7 @@ input_dict: force: calculate: true relaxXYZ: TTT - labels: + label: ' 2': - 0.5 - 0.5 From 60d7dc038eb89cb03b6c1a8ced8cdf411edb75d5 Mon Sep 17 00:00:00 2001 From: janssenhenning Date: Thu, 7 Jul 2022 11:00:11 +0200 Subject: [PATCH 09/15] Some small simplifications in fleur parsing functions Found these places by activating the pylint warnings `too-many-nested-blocks` and `too-many-local-variables` --- .../io/parsers/fleur/fleur_outxml_parser.py | 10 ++-- .../fleur_schema_parser_functions.py | 52 ++++++++----------- 2 files changed, 26 insertions(+), 36 deletions(-) diff --git a/masci_tools/io/parsers/fleur/fleur_outxml_parser.py b/masci_tools/io/parsers/fleur/fleur_outxml_parser.py index f53c49d63..6ba1d1e3f 100644 --- a/masci_tools/io/parsers/fleur/fleur_outxml_parser.py +++ b/masci_tools/io/parsers/fleur/fleur_outxml_parser.py @@ -218,14 +218,12 @@ def outxml_parser(outxmlfile: XMLFileLike, if not list_return: #Convert one item lists to simple values for key, value in out_dict.items(): - if isinstance(value, list): - if len(value) == 1: - out_dict[key] = value[0] + if isinstance(value, list) and len(value) == 1: + out_dict[key] = value[0] elif isinstance(value, dict): for subkey, subvalue in value.items(): - if isinstance(subvalue, list): - if len(subvalue) == 1: - out_dict[key][subkey] = subvalue[0] + if isinstance(subvalue, list) and len(subvalue) == 1: + out_dict[key][subkey] = subvalue[0] if parser_log_handler is not None: if logger is not None: diff --git a/masci_tools/io/parsers/fleur_schema/fleur_schema_parser_functions.py b/masci_tools/io/parsers/fleur_schema/fleur_schema_parser_functions.py index e7778f6c9..b0cca95f9 100644 --- a/masci_tools/io/parsers/fleur_schema/fleur_schema_parser_functions.py +++ b/masci_tools/io/parsers/fleur_schema/fleur_schema_parser_functions.py @@ -476,11 +476,8 @@ def _get_xpath(xmlschema_evaluator: etree.XPathDocumentEvaluator, name=tag_name, type=enforce_end_type) if stop_non_unique: - startPoints_copy = startPoints.copy() - for point in startPoints_copy: - if 'maxOccurs' in point.attrib: - if point.attrib['maxOccurs'] != '1': - startPoints.remove(point) + startPoints = [elem for elem in startPoints if elem.attrib.get('maxOccurs', '1') == '1'] + for elem in startPoints: currentelem = elem currentTag = tag_name @@ -1182,32 +1179,27 @@ def get_omittable_tags(xmlschema_evaluator: etree.XPathDocumentEvaluator, **kwar tag_type = tag.attrib['type'] tag_name = tag.attrib['name'] - if tag_name not in omittable_tags: - type_elem = _xpath_eval(xmlschema_evaluator, '//xsd:complexType[@name=$name]', name=tag_type) - if len(type_elem) == 0: - continue - type_elem = type_elem[0] - - omittable = False - for child in type_elem: - child_type = _normalized_name(child.tag) - - if child_type == 'sequence': - allowed_tags = 0 - for sequence_elem in child: - elem_type = _normalized_name(sequence_elem.tag) - if elem_type == 'element': - allowed_tags += 1 - else: - allowed_tags = 0 #So that it is not unintentionally accepted - break - if allowed_tags == 1: - omittable = True - else: - omittable = False + if tag_name in omittable_tags: + continue + + type_elem = _xpath_eval(xmlschema_evaluator, '//xsd:complexType[@name=$name]', name=tag_type) + if len(type_elem) == 0: + continue + type_elem = type_elem[0] + + omittable = False + for child in type_elem: + child_type = _normalized_name(child.tag) + + if child_type == 'sequence': + if len(child) == 1 \ + and all(_normalized_name(elem.tag)=='element' for elem in child): + omittable = True + else: + omittable = False - if omittable: - omittable_tags.append(tag_name) + if omittable: + omittable_tags.append(tag_name) return omittable_tags From 0fd7ebdac08c170136a05c7ef9a299f53d038557 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philipp=20R=C3=BC=C3=9Fmann?= Date: Wed, 13 Jul 2022 09:05:45 +0000 Subject: [PATCH 10/15] Prepare KKR dispersionplot for use with aiida>=2.0 --- masci_tools/vis/kkr_plot_bandstruc_qdos.py | 141 +++++++++++++-------- 1 file changed, 88 insertions(+), 53 deletions(-) diff --git a/masci_tools/vis/kkr_plot_bandstruc_qdos.py b/masci_tools/vis/kkr_plot_bandstruc_qdos.py index 106509ed2..6107dbc77 100644 --- a/masci_tools/vis/kkr_plot_bandstruc_qdos.py +++ b/masci_tools/vis/kkr_plot_bandstruc_qdos.py @@ -13,64 +13,29 @@ dispersionplot function for plotting KKR bandstructures (i.e. qdos) files """ +import numpy as np -def dispersionplot( + +def load_data( p0='./', - totonly=True, - s=20, - ls_ef=':', - lw_ef=1, - units='eV_rel', - noefline=False, - color='', reload_data=False, - clrbar=True, - logscale=True, nosave=False, atoms=None, ratios=False, atoms2=None, - noscale=False, - newfig=False, - cmap=None, - alpha=1.0, - qcomponent=-2, - clims=None, - xscale=1., - raster=True, atoms3=None, - alpha_reverse=False, - return_data=False, - xshift=0., - yshift=0., - plotmode='pcolor', - ptitle=None, ef=None, - as_e_dimension=None, - scale_alpha_data=False, - shading='gouraud', ): - """ plotting routine for qdos files - dispersion (E vs. q) """ - # import dependencies - from numpy import loadtxt, load, save, log, abs, sum, sort, pi, shape, array # pylint: disable=redefined-builtin - from matplotlib.pyplot import figure, plot, axvline, scatter, axhline, xlabel, ylabel, title, colorbar, pcolormesh, cm, xlim, ylim, clim - from os import listdir, getcwd - from os.path import isdir, getctime - from time import ctime + """load the qdos data""" + import numpy as np + from os import listdir + from os.path import isdir from subprocess import check_output - from numpy import linspace - from matplotlib.colors import ListedColormap # deal with input of file handle instead of path (see plot_kkr of aiida_kkr) if not isinstance(p0, str): pathname_with_file = p0.name p0 = pathname_with_file.replace('/qdos.01.1.dat', '') #dos.atom1 - - if cmap is None: - cmap = cm.viridis - if newfig: - figure() - # read in data if p0[-1] != '/': p0 += '/' @@ -82,22 +47,21 @@ def dispersionplot( ef = 0 alat = float( check_output('grep ALATBASIS ' + p0 + 'inputcard', shell=True).decode('utf-8').split('=')[1].split()[0]) - a0 = 2 * pi / alat / 0.52918 - if noscale: - a0 = 1. - if reload_data or 'saved_data_dispersion.npy' not in sort(listdir(p0)): + a0 = 2 * np.pi / alat / 0.52918 + + if reload_data or 'saved_data_dispersion.npy' not in np.sort(listdir(p0)): first = True first2 = True first3 = True print('reading qdos') j = 0 - for i in sort(listdir(p0)): + for i in np.sort(listdir(p0)): if 'qdos.' in i[:5] and not isdir(p0 + i): iatom = i.replace('qdos.', '').split('.')[0] if atoms is None or int(iatom) in atoms: j += 1 print(j, p0, i) - tmp = loadtxt(p0 + i) + tmp = np.loadtxt(p0 + i) tmp[:, 2:5] = tmp[:, 2:5] if first: d = tmp @@ -107,7 +71,7 @@ def dispersionplot( if ratios and (atoms2 is None or int(iatom) in atoms2): j += 1 print(j, p0, i, 'atoms2=', atoms2) - tmp = loadtxt(p0 + i) + tmp = np.loadtxt(p0 + i) tmp[:, 2:5] = tmp[:, 2:5] if first2: d2 = tmp @@ -117,7 +81,7 @@ def dispersionplot( if (atoms3 is None or int(iatom) in atoms3) and ratios: j += 1 print(j, p0, i, 'atoms3=', atoms3) - tmp = loadtxt(p0 + i) + tmp = np.loadtxt(p0 + i) tmp[:, 2:5] = tmp[:, 2:5] if first3: d3 = tmp @@ -125,12 +89,83 @@ def dispersionplot( else: d3[:, 5:] += tmp[:, 5:] if not nosave: - save(p0 + 'saved_data_dispersion', d) + np.save(p0 + 'saved_data_dispersion', d) else: print( 'loading data' ) #,'qdos files created on:',ctime(getctime('qdos.01.1.dat')), '.npy file created on:', ctime(getctime('saved_data_dispersion.npy')) - d = load(p0 + 'saved_data_dispersion.npy') + d = np.load(p0 + 'saved_data_dispersion.npy') + + return a0, d, d2, d3, ef + + +def dispersionplot( + p0='./', + data_all = None, # alternative way, skips loading data with the load_data function + totonly=True, + s=20, + ls_ef=':', + lw_ef=1, + units='eV_rel', + noefline=False, + color='', + reload_data=False, + clrbar=True, + logscale=True, + nosave=False, + atoms=None, + ratios=False, + atoms2=None, + noscale=False, + newfig=False, + cmap=None, + alpha=1.0, + qcomponent=-2, + clims=None, + xscale=1., + raster=True, + atoms3=None, + alpha_reverse=False, + return_data=False, + xshift=0., + yshift=0., + plotmode='pcolor', + ptitle=None, + ef=None, + as_e_dimension=None, + scale_alpha_data=False, + shading='gouraud', +): + """ plotting routine for qdos files - dispersion (E vs. q) """ + # import dependencies + from numpy import log, abs, sum, sort, pi, shape, array # pylint: disable=redefined-builtin + from matplotlib.pyplot import figure, plot, axvline, scatter, axhline, xlabel, ylabel, title, colorbar, pcolormesh, cm, xlim, ylim, clim + from os import listdir, getcwd + from os.path import getctime + from time import ctime + from numpy import linspace + from matplotlib.colors import ListedColormap + + if data_all is None: + a0, d, d2, d3, ef = load_data(p0=p0, + reload_data=reload_data, + nosave=nosave, + atoms=atoms, + ratios=ratios, + atoms2=atoms2, + atoms3=atoms3, + ef=ef) + else: + a0, d, d2, d3, ef = data_all + + if cmap is None: + cmap = cm.viridis + + if newfig: + figure() + + if noscale: + a0 = 1. d[:, 2:5] = d[:, 2:5] * a0 if ratios: @@ -173,7 +208,7 @@ def dispersionplot( y = d[:, 2 + as_e_dimension] el = len(set(y)) ylab = r'k (1/Ang.)' - x = array([[i for i in range(len(d) // el)] for j in range(el)]) # pylint: disable=unnecessary-comprehension + x = array([[i for i in range(len(d) // el)] for j in range(el)]) elif qcomponent != -1: x = xscale * d[:, 2:5][:, qcomponent] From d4806d34d31b48c627af3af268d7545441d41636 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philipp=20R=C3=BC=C3=9Fmann?= Date: Wed, 13 Jul 2022 13:47:07 +0000 Subject: [PATCH 11/15] Bugfix in kkr dispersion plotter --- masci_tools/vis/kkr_plot_bandstruc_qdos.py | 138 ++++++++++++--------- tests/test_kkr_plotting.py | 4 +- 2 files changed, 78 insertions(+), 64 deletions(-) diff --git a/masci_tools/vis/kkr_plot_bandstruc_qdos.py b/masci_tools/vis/kkr_plot_bandstruc_qdos.py index 6107dbc77..b03212797 100644 --- a/masci_tools/vis/kkr_plot_bandstruc_qdos.py +++ b/masci_tools/vis/kkr_plot_bandstruc_qdos.py @@ -16,18 +16,16 @@ import numpy as np -def load_data( - p0='./', - reload_data=False, - nosave=False, - atoms=None, - ratios=False, - atoms2=None, - atoms3=None, - ef=None, -): +def load_data(p0='./', + reload_data=False, + nosave=False, + atoms=None, + ratios=False, + atoms2=None, + atoms3=None, + ef=None, + verbose=False): """load the qdos data""" - import numpy as np from os import listdir from os.path import isdir from subprocess import check_output @@ -42,25 +40,29 @@ def load_data( # read EF if not given as input if ef is None: if 'potential' in listdir(p0): - ef = float(open(p0 + 'potential').readlines()[3].split()[1]) + with open(p0 + 'potential', encoding='utf-8') as _f: + ef = float(_f.readlines()[3].split()[1]) else: ef = 0 alat = float( check_output('grep ALATBASIS ' + p0 + 'inputcard', shell=True).decode('utf-8').split('=')[1].split()[0]) a0 = 2 * np.pi / alat / 0.52918 + d2, d3 = None, None if reload_data or 'saved_data_dispersion.npy' not in np.sort(listdir(p0)): first = True first2 = True first3 = True - print('reading qdos') + if verbose: + print('reading qdos') j = 0 for i in np.sort(listdir(p0)): if 'qdos.' in i[:5] and not isdir(p0 + i): iatom = i.replace('qdos.', '').split('.')[0] if atoms is None or int(iatom) in atoms: j += 1 - print(j, p0, i) + if verbose: + print(j, p0, i) tmp = np.loadtxt(p0 + i) tmp[:, 2:5] = tmp[:, 2:5] if first: @@ -70,72 +72,75 @@ def load_data( d[:, 5:] += tmp[:, 5:] if ratios and (atoms2 is None or int(iatom) in atoms2): j += 1 - print(j, p0, i, 'atoms2=', atoms2) + if verbose: + print(j, p0, i, 'atoms2=', atoms2) tmp = np.loadtxt(p0 + i) tmp[:, 2:5] = tmp[:, 2:5] if first2: d2 = tmp first2 = False else: - d2[:, 5:] += tmp[:, 5:] + d2[:, 5:] += tmp[:, 5:] # pylint: disable=unsupported-assignment-operation if (atoms3 is None or int(iatom) in atoms3) and ratios: j += 1 - print(j, p0, i, 'atoms3=', atoms3) + if verbose: + print(j, p0, i, 'atoms3=', atoms3) tmp = np.loadtxt(p0 + i) tmp[:, 2:5] = tmp[:, 2:5] if first3: d3 = tmp first3 = False else: - d3[:, 5:] += tmp[:, 5:] + d3[:, 5:] += tmp[:, 5:] # pylint: disable=unsupported-assignment-operation if not nosave: + if verbose: + print('saving data') np.save(p0 + 'saved_data_dispersion', d) else: - print( - 'loading data' - ) #,'qdos files created on:',ctime(getctime('qdos.01.1.dat')), '.npy file created on:', ctime(getctime('saved_data_dispersion.npy')) + if verbose: + print('loading data') d = np.load(p0 + 'saved_data_dispersion.npy') return a0, d, d2, d3, ef -def dispersionplot( - p0='./', - data_all = None, # alternative way, skips loading data with the load_data function - totonly=True, - s=20, - ls_ef=':', - lw_ef=1, - units='eV_rel', - noefline=False, - color='', - reload_data=False, - clrbar=True, - logscale=True, - nosave=False, - atoms=None, - ratios=False, - atoms2=None, - noscale=False, - newfig=False, - cmap=None, - alpha=1.0, - qcomponent=-2, - clims=None, - xscale=1., - raster=True, - atoms3=None, - alpha_reverse=False, - return_data=False, - xshift=0., - yshift=0., - plotmode='pcolor', - ptitle=None, - ef=None, - as_e_dimension=None, - scale_alpha_data=False, - shading='gouraud', -): +def dispersionplot( # pylint: disable=inconsistent-return-statements + p0='./', + data_all=None, # alternative way, skips loading data with the load_data function + totonly=True, + s=20, + ls_ef=':', + lw_ef=1, + units='eV_rel', + noefline=False, + color='', + reload_data=False, + clrbar=True, + logscale=True, + nosave=False, + atoms=None, + ratios=False, + atoms2=None, + noscale=False, + newfig=False, + cmap=None, + alpha=1.0, + qcomponent=-2, + clims=None, + xscale=1., + raster=True, + atoms3=None, + alpha_reverse=False, + return_data=False, + xshift=0., + yshift=0., + plotmode='pcolor', + ptitle=None, + ef=None, + as_e_dimension=None, + scale_alpha_data=False, + shading='gouraud', + verbose=False): """ plotting routine for qdos files - dispersion (E vs. q) """ # import dependencies from numpy import log, abs, sum, sort, pi, shape, array # pylint: disable=redefined-builtin @@ -147,6 +152,7 @@ def dispersionplot( from matplotlib.colors import ListedColormap if data_all is None: + # load data from files a0, d, d2, d3, ef = load_data(p0=p0, reload_data=reload_data, nosave=nosave, @@ -154,14 +160,21 @@ def dispersionplot( ratios=ratios, atoms2=atoms2, atoms3=atoms3, - ef=ef) + ef=ef, + verbose=verbose) else: + # simply unpack the data_all input a0, d, d2, d3, ef = data_all + if verbose: + print('loaded/unpacked data') + if cmap is None: cmap = cm.viridis if newfig: + if verbose: + print('open new figure') figure() if noscale: @@ -208,7 +221,7 @@ def dispersionplot( y = d[:, 2 + as_e_dimension] el = len(set(y)) ylab = r'k (1/Ang.)' - x = array([[i for i in range(len(d) // el)] for j in range(el)]) + x = array([list(range(len(d) // el)) for j in range(el)]) elif qcomponent != -1: x = xscale * d[:, 2:5][:, qcomponent] @@ -297,9 +310,10 @@ def dispersionplot( if return_data: data = abs(sum(d[:, 5:], axis=1)) + if ratios: data2 = abs(sum(d2[:, 5:], axis=1)) data3 = abs(sum(d3[:, 5:], axis=1)) return x, y, data, data2, data3 - else: - return x, y, data + + return x, y, data diff --git a/tests/test_kkr_plotting.py b/tests/test_kkr_plotting.py index 283740cba..ccad7680d 100644 --- a/tests/test_kkr_plotting.py +++ b/tests/test_kkr_plotting.py @@ -84,7 +84,7 @@ def test_plot_dos4(): @pytest.mark.mpl_image_compare(baseline_dir=DIR / Path('files/kkr/kkr_run_qdos/'), filename='test.png') def test_plot_qdos(): gcf().clear() - dispersionplot(os.fspath(DIR / Path('files/kkr/kkr_run_qdos')), reload_data=True) + dispersionplot(p0=os.fspath(DIR / Path('files/kkr/kkr_run_qdos')), reload_data=True) title('') return gcf() @@ -93,7 +93,7 @@ def test_plot_qdos(): @pytest.mark.mpl_image_compare(baseline_dir=DIR / Path('files/kkr/kkr_run_qdos/'), filename='test2.png') def test_plot_qdos2(): gcf().clear() - dispersionplot(os.fspath(DIR / Path('files/kkr/kkr_run_qdos')), + dispersionplot(p0=os.fspath(DIR / Path('files/kkr/kkr_run_qdos')), reload_data=True, ratios=False, units='eV_rel', From e2732c4cb0fbc0f6162cab3ce83d23d04928d7f4 Mon Sep 17 00:00:00 2001 From: janssenhenning Date: Thu, 14 Jul 2022 15:07:54 +0200 Subject: [PATCH 12/15] Split docs job One nitpicky one, that fails when there is any warning One relaxed one, that only fails if there is a large error --- .github/workflows/ci.yml | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 68f95bfc0..83c6dcdda 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -8,6 +8,19 @@ jobs: runs-on: ubuntu-latest + strategy: + matrix: + include: + - name: docs + sphinx-options: '' + strict: true + - name: docs-nitpicky + sphinx-options: '-nW' + strict: false + + name: ${{ matrix.name }} + continue-on-error: ${{ matrix.strict }} + steps: - uses: actions/checkout@v3 @@ -37,8 +50,9 @@ jobs: - name: Build documentation env: READTHEDOCS: 'True' + SPHINXOPTS: ${{ matrix.sphinx-options }} run: | - SPHINXOPTS='-nW' make -C docs html + make -C docs html pre-commit: runs-on: ubuntu-latest From 805fe3d57c8b698348b1873abbaa9bb3e3930175 Mon Sep 17 00:00:00 2001 From: janssenhenning Date: Thu, 14 Jul 2022 15:17:00 +0200 Subject: [PATCH 13/15] Further cleanup of CI --- .github/workflows/cd.yml | 22 ++++++++++++++++++---- .github/workflows/ci.yml | 12 ++++++------ 2 files changed, 24 insertions(+), 10 deletions(-) diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index c148ed6a4..c7d374989 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -14,6 +14,19 @@ jobs: runs-on: ubuntu-latest + strategy: + matrix: + include: + - name: docs + sphinx-options: '' + allow-failure: false + - name: docs-nitpicky + sphinx-options: '-nW' + allow-failure: true + + name: ${{ matrix.name }} + continue-on-error: ${{ matrix.allow-failure }} + steps: - uses: actions/checkout@v3 @@ -43,8 +56,9 @@ jobs: - name: Build documentation env: READTHEDOCS: 'True' + SPHINXOPTS: ${{ matrix.sphinx-options }} run: | - SPHINXOPTS='-nW' make -C docs html + make -C docs html pre-commit: runs-on: ubuntu-latest @@ -55,13 +69,13 @@ jobs: include: - name: pre-commit-errors skip-hooks: pylint-warnings - strict: false + allow-failure: false - name: pre-commit-warnings skip-hooks: pylint-errors - strict: true + allow-failure: true name: ${{ matrix.name }} - continue-on-error: ${{ matrix.strict }} + continue-on-error: ${{ matrix.allow-failure }} steps: - uses: actions/checkout@v3 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 83c6dcdda..a7c9123da 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -13,13 +13,13 @@ jobs: include: - name: docs sphinx-options: '' - strict: true + allow-failure: false - name: docs-nitpicky sphinx-options: '-nW' - strict: false + allow-failure: true name: ${{ matrix.name }} - continue-on-error: ${{ matrix.strict }} + continue-on-error: ${{ matrix.allow-failure }} steps: - uses: actions/checkout@v3 @@ -63,13 +63,13 @@ jobs: include: - name: pre-commit-errors skip-hooks: pylint-warnings - strict: false + allow-failure: false - name: pre-commit-warnings skip-hooks: pylint-errors - strict: true + allow-failure: true name: ${{ matrix.name }} - continue-on-error: ${{ matrix.strict }} + continue-on-error: ${{ matrix.allow-failure }} steps: - uses: actions/checkout@v3 From 92e871a9546a86ba13243430d6f3f8734bf29a22 Mon Sep 17 00:00:00 2001 From: janssenhenning Date: Wed, 13 Jul 2022 15:39:02 +0200 Subject: [PATCH 14/15] bump version 0.11.2 -> 0.11.3 --- masci_tools/__init__.py | 2 +- pyproject.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/masci_tools/__init__.py b/masci_tools/__init__.py index f4128644b..2ebff8e21 100644 --- a/masci_tools/__init__.py +++ b/masci_tools/__init__.py @@ -21,7 +21,7 @@ __copyright__ = ('Copyright (c), Forschungszentrum Jülich GmbH, IAS-1/PGI-1, Germany. ' 'All rights reserved.') __license__ = 'MIT license, see LICENSE.txt file.' -__version__ = '0.11.2' +__version__ = '0.11.3' __authors__ = 'The JuDFT team. Also see AUTHORS.txt file.' logging.getLogger(__name__).addHandler(logging.NullHandler()) diff --git a/pyproject.toml b/pyproject.toml index df5f55f4d..bd1b8fa6b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -202,7 +202,7 @@ split_arguments_when_comma_terminated = true indent_dictionary_value = false [bumpver] -current_version = "0.11.2" +current_version = "0.11.3" version_pattern = "MAJOR.MINOR.PATCH[TAGNUM]" commit_message = "bump version {old_version} -> {new_version}" commit = true From 62a1b48ac76f3e990b1fc330e4a64932f908d445 Mon Sep 17 00:00:00 2001 From: janssenhenning Date: Wed, 13 Jul 2022 15:40:15 +0200 Subject: [PATCH 15/15] Update Changelog --- CHANGELOG.md | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index dc0abffa3..2771954d8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,10 +1,20 @@ # Changelog ## latest -[full changelog](https://github.com/JuDFTteam/masci-tools/compare/v0.11.2...develop) +[full changelog](https://github.com/JuDFTteam/masci-tools/compare/v0.11.3...develop) Nothing here yet +## v.0.11.3 +[full changelog](https://github.com/JuDFTteam/masci-tools/compare/v0.11.2...v0.11.3) + +### Improvements +- Changes to KKR plotting routine `dispersionplot` for compatibility with AiiDA v2.0 +- Connecting vectors for intersite `GreensFunction` are now saved in Angstroem. For better interoperability with ase, pymatgen, AiiDA + +### For Developers +- Relaxed CI requirements for docs build. Nitpicky mode is no longer required to pass but is treated as a hint to look into the warnings + ## v.0.11.2 [full changelog](https://github.com/JuDFTteam/masci-tools/compare/v0.11.1...v0.11.2)