Skip to content

Commit 613f243

Browse files
Merge pull request #210 from JuDFTteam/release-0.13.0
🚀 Release `0.13.0`
2 parents cc8301f + 40fe363 commit 613f243

File tree

99 files changed

+81216
-204
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

99 files changed

+81216
-204
lines changed

.github/workflows/ci.yml

+4-3
Original file line numberDiff line numberDiff line change
@@ -112,8 +112,9 @@ jobs:
112112
- python-version: '3.7'
113113
experimental: false
114114
pytest-cmdline: '-o addopts="--cov=masci_tools --cov=tests --cov-report xml"'
115-
# - python-version: '3.11-dev'
116-
# experimental: true
115+
#- python-version: '3.11.0-rc.2'
116+
# experimental: true
117+
# pytest-cmdline: ""
117118
fail-fast: false
118119

119120
name: tests-python-${{ matrix.python-version }}
@@ -140,7 +141,7 @@ jobs:
140141
if: ${{ matrix.experimental }}
141142
run: |
142143
sudo apt-get update
143-
sudo apt-get install -y libxml2-dev libxslt-dev libhdf5-serial-dev
144+
sudo apt-get install -y libxml2-dev libxslt-dev libhdf5-serial-dev libopenblas-dev
144145
pip install --upgrade pip setuptools wheel
145146
pip install --upgrade cython
146147
pip list

CHANGELOG.md

+12-1
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,21 @@
11
# Changelog
22

33
## latest
4-
[full changelog](https://github.com/JuDFTteam/masci-tools/compare/v0.12.0...develop)
4+
[full changelog](https://github.com/JuDFTteam/masci-tools/compare/v0.13.0...develop)
55

66
Nothing here yet
77

8+
## v.0.13.0
9+
[full changelog](https://github.com/JuDFTteam/masci-tools/compare/v0.12.0...v0.13.0)
10+
11+
### Improvements
12+
- `set_kpointmesh` now also writes out the `nx/ny/nz` attributes fro the dimensions of the kpoint mesh
13+
- `get_structure_data`, `get_parameter_data` and `get_kpoints_data` are renamed to `get_structuredata`, `get_parameterdata` and `get_kpointsdata` to match the names of the corresponding functions in aiida-fleur. Old names are available with deprecations [[#208]](https://github.com/JuDFTteam/masci-tools/pull/208)
14+
- `FleurXMLModifier` now supports changes to input files with not yet available Fleur schemas, if the changes are compatible with the last available file schema [[#209]](https://github.com/JuDFTteam/masci-tools/pull/209)
15+
### Bugfixes
16+
- Bugfix in XML setters `set_inpchanges` and `set_attrib_value`, setting the `xcFunctional` key was previously not case-insensitive in constrast with all other keys
17+
- Fixed crash in `get_parameter_data`. This function would previously crash if a kpoint mesh without `nx/ny/nz` attributes was used and the first point in the list was the gamma point
18+
819
## v.0.12.0
920
[full changelog](https://github.com/JuDFTteam/masci-tools/compare/v0.11.3...v0.12.0)
1021

docs/source/devel_guide/fleur_parser.md

+6
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,12 @@
66
.. currentmodule:: masci_tools.io.parsers.fleur_schema
77
```
88

9+
:::{note}
10+
A more detailed walkthrough of the important design decisions concerning the implementation
11+
Fleur XML parsers and IO capabilities can be found in this
12+
[document](https://python-fleur-xml-design.readthedocs.io/en/latest/)
13+
:::
14+
915
Each input and output file for Fleur has a correspong XML-Schema, where the structure
1016
of these files are defined.
1117

docs/source/user_guide/fleur_parser.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -104,11 +104,11 @@ in the {py:mod}`~masci_tools.util.xml.xml_getters` module. The following are ava
104104
- {py:func}`get_nkpts()`: Get the (for older versions approximate if not `kPointList` is
105105
used) number of kpoints to be used in the calculation
106106
- {py:func}`get_cell()`: Get the Bravais matrix of the system
107-
- {py:func}`get_parameter_data()`: Get the information about the calculation parameters
107+
- {py:func}`get_parameterdata()`: Get the information about the calculation parameters
108108
needed to reproduce a calculation starting from the inpgen
109-
- {py:func}`get_structure_data()`: Get the structure from the xml file
109+
- {py:func}`get_structuredata()`: Get the structure from the xml file
110110
(atom positions + unit cell)
111-
- {py:func}`get_kpoints_data()`: Get the defined kpoint sets (single/multiple)
111+
- {py:func}`get_kpointsdata()`: Get the defined kpoint sets (single/multiple)
112112
from the xml file (kpoints + weights + unit cell)
113113
- {py:func}`get_relaxation_information()`: Get the relaxation history and current displacements
114114
- {py:func}`get_symmetry_information()`: Get the symmetry operations used in the calculation

masci_tools/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
__copyright__ = ('Copyright (c), Forschungszentrum Jülich GmbH, IAS-1/PGI-1, Germany. '
2222
'All rights reserved.')
2323
__license__ = 'MIT license, see LICENSE.txt file.'
24-
__version__ = '0.12.0'
24+
__version__ = '0.13.0'
2525
__authors__ = 'The JuDFT team. Also see AUTHORS.txt file.'
2626

2727
logging.getLogger(__name__).addHandler(logging.NullHandler())

masci_tools/cmdline/commands/parse.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -103,11 +103,11 @@ def parse_structure_data(xml_file):
103103
"""
104104
Parse the structure information in the given Fleur xml file
105105
"""
106-
from masci_tools.util.xml.xml_getters import get_structure_data
106+
from masci_tools.util.xml.xml_getters import get_structuredata
107107

108108
xmltree, schema_dict = _load_xml_file(xml_file)
109109

110-
atoms, cell, pbc = get_structure_data(xmltree, schema_dict)
110+
atoms, cell, pbc = get_structuredata(xmltree, schema_dict)
111111

112112
echo.echo_info('Atoms found:')
113113
echo.echo_formatted_list(atoms, ['symbol', 'kind', 'position'])
@@ -139,11 +139,11 @@ def parse_parameter_data(xml_file):
139139
"""
140140
Parse the calculation parameters of the given xml file
141141
"""
142-
from masci_tools.util.xml.xml_getters import get_parameter_data
142+
from masci_tools.util.xml.xml_getters import get_parameterdata
143143

144144
xmltree, schema_dict = _load_xml_file(xml_file)
145145

146-
params = get_parameter_data(xmltree, schema_dict)
146+
params = get_parameterdata(xmltree, schema_dict)
147147

148148
echo.echo_info('LAPW parameters:')
149149
echo.echo_dictionary(params)
@@ -169,10 +169,10 @@ def parse_kpoints_data(xml_file):
169169
"""
170170
Parse the used kpoints from the given xml-file
171171
"""
172-
from masci_tools.util.xml.xml_getters import get_kpoints_data
172+
from masci_tools.util.xml.xml_getters import get_kpointsdata
173173

174174
xmltree, schema_dict = _load_xml_file(xml_file)
175-
kpoints, weights, cell, pbc = get_kpoints_data(xmltree, schema_dict, only_used=True)
175+
kpoints, weights, cell, pbc = get_kpointsdata(xmltree, schema_dict, only_used=True)
176176

177177
echo.echo_info('Bravais matrix:')
178178
echo.echo(str(cell))

masci_tools/io/fleurxmlmodifier.py

+25-8
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@
2929
from typing_extensions import Literal #type: ignore
3030

3131
from masci_tools.util.xml.collect_xml_setters import XPATH_SETTERS, SCHEMA_DICT_SETTERS, NMMPMAT_SETTERS
32-
from masci_tools.util.xml.common_functions import clear_xml
32+
from masci_tools.util.xml.xml_setters_names import set_attrib_value
33+
from masci_tools.util.xml.common_functions import clear_xml, eval_xpath_one
3334
from masci_tools.util.schema_dict_util import ensure_relaxation_xinclude
3435
from masci_tools.io.fleur_xml import load_inpxml
3536
from masci_tools.util.typing import XMLFileLike, FileLike
@@ -217,7 +218,8 @@ def apply_modifications(cls,
217218
xmltree: etree._ElementTree,
218219
nmmp_lines: list[str] | None,
219220
modification_tasks: list[ModifierTask],
220-
validate_changes: bool = True) -> tuple[etree._ElementTree, list[str] | None]:
221+
validate_changes: bool = True,
222+
adjust_version_for_dev_version: bool = True) -> tuple[etree._ElementTree, list[str] | None]:
221223
"""
222224
Applies given modifications to the fleurinp lxml tree.
223225
It also checks if a new lxml tree is validated against schema.
@@ -228,6 +230,10 @@ def apply_modifications(cls,
228230
:param modification_tasks: a list of modification tuples
229231
:param validate_changes: bool optional (default True), if True after all tasks are performed
230232
both the xmltree and nmmp_lines are checked for consistency
233+
:param adjust_version_for_dev_version: bool optional (default True), if True and the schema_dict
234+
and file version differ, e.g. a development version is used
235+
the version is temporarily modified to swallow the validation
236+
error that would occur
231237
232238
:returns: a modified lxml tree and a modified n_mmp_mat file
233239
"""
@@ -236,6 +242,9 @@ def apply_modifications(cls,
236242
xmltree, schema_dict = load_inpxml(xmltree)
237243
xmltree, _ = clear_xml(xmltree)
238244

245+
file_version = eval_xpath_one(xmltree, '//@fleurInputVersion', str)
246+
is_dev_version = schema_dict['inp_version'] != file_version
247+
239248
for task in modification_tasks:
240249
if task.name in cls.xpath_functions:
241250
action = cls.xpath_functions[task.name]
@@ -253,7 +262,12 @@ def apply_modifications(cls,
253262
raise ValueError(f'Unknown task {task.name}')
254263

255264
if validate_changes:
256-
schema_dict.validate(xmltree, header='Changes were not valid')
265+
if is_dev_version and adjust_version_for_dev_version:
266+
set_attrib_value(xmltree, schema_dict, 'fleurinputversion', schema_dict['inp_version'])
267+
schema_dict.validate(xmltree, header='Changes were not valid')
268+
set_attrib_value(xmltree, schema_dict, 'fleurinputversion', file_version)
269+
else:
270+
schema_dict.validate(xmltree, header='Changes were not valid')
257271
try:
258272
validate_nmmpmat(xmltree, nmmp_lines, schema_dict)
259273
except ValueError as exc:
@@ -349,7 +363,8 @@ def changes(self) -> list[ModifierTask]:
349363
def modify_xmlfile(self,
350364
original_inpxmlfile: XMLFileLike,
351365
original_nmmp_file: FileLike | list[str] | None = None,
352-
validate_changes: bool = True) -> tuple[etree._ElementTree, dict[str, str]]:
366+
validate_changes: bool = True,
367+
adjust_version_for_dev_version: bool = True) -> tuple[etree._ElementTree, dict[str, str]]:
353368
"""
354369
Applies the registered modifications to a given inputfile
355370
@@ -375,10 +390,12 @@ def modify_xmlfile(self,
375390
else:
376391
original_nmmp_lines = None
377392

378-
new_xmltree, new_nmmp_lines = self.apply_modifications(original_xmltree,
379-
original_nmmp_lines,
380-
self._tasks,
381-
validate_changes=validate_changes)
393+
new_xmltree, new_nmmp_lines = self.apply_modifications(
394+
original_xmltree,
395+
original_nmmp_lines,
396+
self._tasks,
397+
validate_changes=validate_changes,
398+
adjust_version_for_dev_version=adjust_version_for_dev_version)
382399

383400
ensure_relaxation_xinclude(new_xmltree, schema_dict)
384401
etree.indent(new_xmltree)

masci_tools/io/kkr_params.py

+25-11
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
__copyright__ = ('Copyright (c), 2017, Forschungszentrum Jülich GmbH,'
1919
'IAS-1/PGI-1, Germany. All rights reserved.')
2020
__license__ = 'MIT license, see LICENSE.txt file'
21-
__version__ = '1.8.7'
21+
__version__ = '1.8.8'
2222
__contributors__ = 'Philipp Rüßmann'
2323

2424
# This defines the default parameters for KKR used in the aiida plugin:
@@ -448,6 +448,8 @@ def __init__(self, **kwargs):
448448
None, '%f', False,
449449
'Superconductivity: Scaling factor for lambda_BdG (e.g. used to deactivate BdG coupling in some layers by setting the value to 0)'
450450
]),
451+
('<PHASE_BDG>',
452+
[None, '%f', False, 'Superconductivity: Atom dependent phase factor for superconducting coupling.']),
451453
('<MIXFAC_BDG>', [
452454
None, '%f', False,
453455
'Superconductivity: Mixing factor used in the mixing of the BdG Delta (defaults to 0.1)'
@@ -489,6 +491,7 @@ def __init__(self, **kwargs):
489491
None, '%f', False,
490492
'Renormalization factor for energy integration weights (can be used to shift the Fermi level around).'
491493
]),
494+
('NQDOSMAXPOINTS', [None, '%i', False, 'Max number of q-points per batch.']),
492495
# array dimensions
493496
('NSHELD', [None, '%i', False, 'Array dimension: number of shells (default: 300)']),
494497
('IEMXD', [None, '%i', False, 'Array dimension: number of energy points (default: 101)']),
@@ -556,6 +559,8 @@ def __init__(self, **kwargs):
556559
None, '%l', False,
557560
"Run option: do not add some energy terms (coulomb, XC, eff. pot.) to total energy (former: 'NoMadel')"
558561
]),
562+
('<NONCOBFIELD>', [None, '%l', False,
563+
'Run option: use non-collinear exteranl fields read from bfield.dat']),
559564
('<PRINT_GIJ>',
560565
[None, '%l', False, "Run option: print cluster G_ij matrices to outfile (former: 'Gmatij')"]),
561566
('<PRINT_GMAT>', [None, '%l', False, "Run option: print Gmat to outfile (former: 'Gmat')"]),
@@ -1256,16 +1261,23 @@ def _check_input_consistency(self, set_lists_only=False, verbose=False):
12561261

12571262
#yapf: disable
12581263
listargs = dict([
1259-
['<RBASIS>', naez], ['<RBLEFT>', nlbasis], ['<RBRIGHT>', nrbasis], ['<SHAPE>', natyp],
1260-
['<ZATOM>', natyp], ['<SOCSCL>', natyp], ['<SITE>', natyp], ['<CPA-CONC>', natyp],
1261-
['<KAOEZL>', nlbasis], ['<KAOEZR>', nrbasis], ['XINIPOL', natyp], ['<RMTREF>', natyp],
1262-
['<RMTREFL>', nlbasis], ['<RMTREFR>', nrbasis], ['<FPRADIUS>', natyp], ['BZDIVIDE', 3],
1263-
['<RBLEFT>', nlbasis], ['ZPERIODL', 3], ['<RBRIGHT>', nrbasis], ['ZPERIODR', 3],
1264-
['LDAU_PARA', 5], ['CPAINFO', 2], ['<DELTAE>', 2], ['FILES', 2], ['DECIFILES', 2],
1265-
['<RMTCORE>', naez], ['<MTWAU>', naez], ['<RTMTWAU>',nrbasis ], ['<LFMTWAU>', nlbasis],
1266-
['<MTWAL>', naez], ['<RTMTWAL>',nrbasis ], ['<LFMTWAL>', nlbasis],
1267-
['<AT_SCALE_BDG>', natyp], ['<LM_SCALE_BDG>', (lmax + 1)**2],
1264+
['BZDIVIDE', 3], ['ZPERIODL', 3], ['ZPERIODR', 3], ['LDAU_PARA', 5],
1265+
['CPAINFO', 2], ['<DELTAE>', 2], ['FILES', 2], ['DECIFILES', 2],
12681266
])
1267+
if naez is not None:
1268+
for key in ['<RBASIS>', '<RMTCORE>', '<MTWAU>', '<MTWAL>']:
1269+
listargs[key] = naez
1270+
if natyp is not None:
1271+
for key in ['<SHAPE>', '<ZATOM>', '<SOCSCL>', '<SITE>', '<CPA-CONC>', 'XINIPOL', '<RMTREF>', '<FPRADIUS>', '<AT_SCALE_BDG>', '<PHASE_BDG>']:
1272+
listargs[key] = natyp
1273+
if nlbasis is not None:
1274+
for key in ['<RBLEFT>', '<KAOEZL>', '<RMTREFL>', '<RBLEFT>', '<LFMTWAU>', '<LFMTWAL>']:
1275+
listargs[key] = nlbasis
1276+
if nrbasis is not None:
1277+
for key in ['<RBRIGHT>', '<KAOEZR>', '<RMTREFR>', '<RBRIGHT>', '<RTMTWAU>', '<RTMTWAL>']:
1278+
listargs[key] = nrbasis
1279+
if lmax is not None:
1280+
listargs['<LM_SCALE_BDG>'] = (lmax + 1)**2
12691281
#yapf: enable
12701282

12711283
# deal with special stuff for voronoi:
@@ -1799,7 +1811,9 @@ def read_keywords_from_inputcard(self, inputcard='inputcard', verbose=False):
17991811
rbr = self.get_value('<RBRIGHT>')
18001812
zper_l = self.get_value('ZPERIODL')
18011813
zper_r = self.get_value('ZPERIODR')
1802-
alat2ang = self.get_value('ALATBASIS') * get_aBohr2Ang()
1814+
alat2ang = self.get_value('ALATBASIS')
1815+
if alat2ang is not None:
1816+
alat2ang *= get_aBohr2Ang()
18031817
if rbl is not None:
18041818
self.set_value('<RBLEFT>', array(rbl) * alat2ang)
18051819
if rbr is not None:

masci_tools/io/parsers/fleur/default_parse_tasks.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@
256256
'_conversions': [Conversion(name='convert_relax_info')],
257257
'parsed_relax_info': {
258258
'parse_type': 'xmlGetter',
259-
'name': 'get_structure_data',
259+
'name': 'get_structuredata',
260260
'kwargs': {
261261
'convert_to_angstroem': False,
262262
'include_relaxations': False

0 commit comments

Comments
 (0)