Skip to content

Commit 39dec6b

Browse files
Merge pull request #216 from JuDFTteam/release-0.14.0
🚀 Release `0.14.0`
2 parents 613f243 + 5958b3d commit 39dec6b

File tree

64 files changed

+1663
-90
lines changed

Some content is hidden

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

64 files changed

+1663
-90
lines changed

.github/workflows/cd.yml

+10-8
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,13 @@ jobs:
3131
- uses: actions/checkout@v3
3232

3333
- name: Set up Python 3.10
34-
uses: actions/setup-python@v4.2.0
34+
uses: actions/setup-python@v4.3.0
3535
with:
3636
python-version: '3.10'
3737

3838
- name: Cache python dependencies
3939
id: cache-pip
40-
uses: actions/[email protected].6
40+
uses: actions/[email protected].9
4141
with:
4242
path: ~/.cache/pip
4343
key: pip-docs-${{ hashFiles('**/pyproject.toml') }}
@@ -82,15 +82,15 @@ jobs:
8282

8383
- name: Cache python dependencies
8484
id: cache-pip
85-
uses: actions/[email protected].6
85+
uses: actions/[email protected].9
8686
with:
8787
path: ~/.cache/pip
8888
key: pip-pre-commit-${{ hashFiles('**/pyproject.toml') }}
8989
restore-keys: |
9090
pip-pre-commit-
9191
9292
- name: Set up Python 3.8
93-
uses: actions/setup-python@v4.2.0
93+
uses: actions/setup-python@v4.3.0
9494
with:
9595
python-version: 3.8
9696

@@ -112,10 +112,12 @@ jobs:
112112
matrix:
113113
python-version: ['3.10','3.9', '3.8']
114114
experimental: [false]
115+
extra-dependencies: ['testing,bokeh-plots,cmdline-extras']
115116
pytest-cmdline: ['']
116117
include:
117118
- python-version: '3.7'
118119
experimental: false
120+
extra-dependencies: 'testing,bokeh-plots'
119121
pytest-cmdline: '-o addopts="--cov=masci_tools --cov=tests --cov-report xml"'
120122
# include:
121123
# - python-version: '3.11-dev'
@@ -130,22 +132,22 @@ jobs:
130132

131133
- name: Cache python dependencies
132134
id: cache-pip
133-
uses: actions/[email protected].6
135+
uses: actions/[email protected].9
134136
with:
135137
path: ~/.cache/pip
136138
key: pip-${{ matrix.python-version }}-tests-${{ hashFiles('**/pyproject.toml') }}
137139
restore-keys: |
138140
pip-${{ matrix.python-version }}-tests
139141
140142
- name: Set up Python ${{ matrix.python-version }}
141-
uses: actions/setup-python@v4.2.0
143+
uses: actions/setup-python@v4.3.0
142144
with:
143145
python-version: ${{ matrix.python-version }}
144146

145147

146148
- name: Install python dependencies
147149
run: |
148-
pip install -e .[testing,bokeh-plots]
150+
pip install -e .[${{ matrix.extra-dependencies }}]
149151
pip install pyhull
150152
151153
- name: Run pytest
@@ -170,7 +172,7 @@ jobs:
170172
steps:
171173
- uses: actions/checkout@v3
172174
- name: Set up Python 3.7
173-
uses: actions/setup-python@v4.2.0
175+
uses: actions/setup-python@v4.3.0
174176
with:
175177
python-version: 3.7
176178
- name: Install flit

.github/workflows/ci.yml

+9-7
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,13 @@ jobs:
2525
- uses: actions/checkout@v3
2626

2727
- name: Set up Python 3.10
28-
uses: actions/setup-python@v4.2.0
28+
uses: actions/setup-python@v4.3.0
2929
with:
3030
python-version: '3.10'
3131

3232
- name: Cache python dependencies
3333
id: cache-pip
34-
uses: actions/[email protected].6
34+
uses: actions/[email protected].9
3535
with:
3636
path: ~/.cache/pip
3737
key: pip-docs-${{ hashFiles('**/pyproject.toml') }}
@@ -76,15 +76,15 @@ jobs:
7676

7777
- name: Cache python dependencies
7878
id: cache-pip
79-
uses: actions/[email protected].6
79+
uses: actions/[email protected].9
8080
with:
8181
path: ~/.cache/pip
8282
key: pip-pre-commit-${{ hashFiles('**/pyproject.toml') }}
8383
restore-keys: |
8484
pip-pre-commit-
8585
8686
- name: Set up Python 3.8
87-
uses: actions/setup-python@v4.2.0
87+
uses: actions/setup-python@v4.3.0
8888
with:
8989
python-version: 3.8
9090

@@ -107,10 +107,12 @@ jobs:
107107
matrix:
108108
python-version: ['3.10','3.9', '3.8']
109109
experimental: [false]
110+
extra-dependencies: ['testing,bokeh-plots,cmdline-extras']
110111
pytest-cmdline: [""]
111112
include:
112113
- python-version: '3.7'
113114
experimental: false
115+
extra-dependencies: 'testing,bokeh-plots'
114116
pytest-cmdline: '-o addopts="--cov=masci_tools --cov=tests --cov-report xml"'
115117
#- python-version: '3.11.0-rc.2'
116118
# experimental: true
@@ -125,15 +127,15 @@ jobs:
125127

126128
- name: Cache python dependencies
127129
id: cache-pip
128-
uses: actions/[email protected].6
130+
uses: actions/[email protected].9
129131
with:
130132
path: ~/.cache/pip
131133
key: pip-${{ matrix.python-version }}-tests-${{ hashFiles('**/pyproject.toml') }}
132134
restore-keys: |
133135
pip-${{ matrix.python-version }}-tests
134136
135137
- name: Set up Python ${{ matrix.python-version }}
136-
uses: actions/setup-python@v4.2.0
138+
uses: actions/setup-python@v4.3.0
137139
with:
138140
python-version: ${{ matrix.python-version }}
139141

@@ -148,7 +150,7 @@ jobs:
148150
149151
- name: Install python dependencies
150152
run: |
151-
pip install -e .[testing,bokeh-plots]
153+
pip install -e .[${{ matrix.extra-dependencies }}]
152154
pip install pyhull
153155
154156
- name: Run pytest

.github/workflows/fleur-release.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
- uses: actions/checkout@v3
1515

1616
- name: Set up Python 3.8
17-
uses: actions/setup-python@v4.2.0
17+
uses: actions/setup-python@v4.3.0
1818
with:
1919
python-version: 3.8
2020

@@ -40,7 +40,7 @@ jobs:
4040
run: exit 1
4141

4242
- name: Create Pull Request
43-
uses: peter-evans/create-pull-request@v4.0.4
43+
uses: peter-evans/create-pull-request@v4.1.3
4444
with:
4545
commit-message: "[fleur release] Fleur schema update"
4646
branch: fleur-release/schema

.pre-commit-config.yaml

+3-3
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ ci:
55

66
repos:
77
- repo: https://github.com/pre-commit/pre-commit-hooks
8-
rev: v4.3.0
8+
rev: v4.4.0
99
hooks:
1010
- id: double-quote-string-fixer
1111
types: [python]
@@ -33,7 +33,7 @@ repos:
3333
additional_dependencies: ['toml']
3434

3535
- repo: https://github.com/ikamensh/flynt/
36-
rev: '0.76'
36+
rev: '0.77'
3737
hooks:
3838
- id: flynt
3939
args: [
@@ -42,7 +42,7 @@ repos:
4242
]
4343

4444
- repo: https://github.com/asottile/pyupgrade
45-
rev: v2.37.3
45+
rev: v3.3.0
4646
hooks:
4747
- id: pyupgrade
4848
args: [

CHANGELOG.md

+20-1
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,29 @@
11
# Changelog
22

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

66
Nothing here yet
77

8+
## v.0.14.0
9+
[full changelog](https://github.com/JuDFTteam/masci-tools/compare/v0.13.0...v0.14.0)
10+
11+
### Added
12+
- Command `masci-tools convert-inpgen` to transform common structure formats, e.g. `cif` into inpgen files. Uses `ase` or `pymatgen` with the corresponding fleur plugins `ase-fleur` and `pymatgen-io-fleur` (install additional dependencies `cmdline-extras`)[[#215]](https://github.com/JuDFTteam/masci-tools/pull/215)
13+
- Functions `get_inpgen_comments` and `readd_inpgen_comments` to keep the comments of the inp.xml file containing the inpgen commandline and file content through functions using `clear_xml`
14+
15+
### Improvements
16+
- `write/read_fleur_inpgen` now supports the magnetic moment definitions in the inpgen input file introduced in MaX-6.1 (also the `scf` namelist) [[#213]](https://github.com/JuDFTteam/masci-tools/pull/213)
17+
- `get_structuredata` also reads out the magnetic moments [[#213]](https://github.com/JuDFTteam/masci-tools/pull/213)
18+
- `FleurXMLModifier.modify_xmlfile` now keeps the inpgen comments by default (controlled by option `keep_inpgen_comments`)
19+
20+
### Bugfixes
21+
- Serveral fixes for Fleur DOS plots [[#212]](https://github.com/JuDFTteam/masci-tools/pull/212):
22+
- Fixed wrong summation of atom weights for files containing 10 or more atomtypes
23+
- Fixed crashes using a custom weight not conforming to the naming scheme of weights in the `banddos.hdf`
24+
- Fixed specification of parameters by DOS label not working if the spin suffix is omitted
25+
26+
827
## v.0.13.0
928
[full changelog](https://github.com/JuDFTteam/masci-tools/compare/v0.12.0...v0.13.0)
1029

codecov.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -26,5 +26,5 @@ comment:
2626
require_changes: no
2727

2828
ignore:
29-
- "masci_tools/util/kkr_rms_tracker.py"
30-
- "masci_tools/util/modifypotential.py"
29+
- "masci_tools/tools/kkr_rms_tracker.py"
30+
- "masci_tools/tools/modifypotential.py"

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.13.0'
24+
__version__ = '0.14.0'
2525
__authors__ = 'The JuDFT team. Also see AUTHORS.txt file.'
2626

2727
logging.getLogger(__name__).addHandler(logging.NullHandler())
+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
"""
22
Import all the command groups to include in the cli
33
"""
4-
from . import (fleur_schema, parse, plot, tools)
4+
from . import (convert_inpgen, fleur_schema, parse, plot, tools)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
"""
2+
CLI commands for converting common structure definition formats to fleur inpgen files
3+
"""
4+
from .root import cli
5+
import click
6+
7+
from pathlib import Path
8+
import os
9+
10+
from masci_tools.cmdline.utils import echo
11+
12+
try:
13+
import pymatgen
14+
from pymatgen.core import Structure
15+
except ImportError:
16+
pymatgen = None
17+
18+
try:
19+
import ase
20+
from ase.io import read, write
21+
except ImportError:
22+
ase = None
23+
24+
25+
@cli.command('convert-inpgen')
26+
@click.argument('input-file', type=click.Path(exists=True, path_type=Path, resolve_path=True))
27+
@click.argument('output-file', type=click.Path(path_type=Path, resolve_path=True))
28+
@click.option('-c',
29+
'--converter',
30+
type=click.Choice(['ase', 'pymatgen']),
31+
help='Which library is used to read in the given file format',
32+
default='pymatgen')
33+
def convert_inpgen(input_file, output_file, converter):
34+
"""Convert the given file to an fleur inpgen file
35+
"""
36+
37+
input_file = os.fspath(input_file)
38+
output_file = os.fspath(output_file)
39+
40+
if converter == 'ase':
41+
if ase is None:
42+
echo.echo_critical('ase is not installed. Please install the packages ase and ase-fleur')
43+
44+
atoms = read(input_file)
45+
write(output_file, atoms, format='fleur-inpgen')
46+
elif converter == 'pymatgen':
47+
if pymatgen is None:
48+
echo.echo_critical('pymatgen is not installed. Please install the packages pymatgen and pymatgen-io-fleur')
49+
50+
struc = Structure.from_file(os.fspath(input_file))
51+
struc.to(output_file, fmt='fleur-inpgen')

masci_tools/io/cif2inp_ase.py

+5
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,11 @@
1414
Independent utility script to convert cif file formats to input for the inpgen code
1515
Usage: `python cif2inp_ase.py <filename.cif>`
1616
"""
17+
import warnings
18+
19+
warnings.warn(
20+
'The cif2inp_ase.py script is deprecated. Use the command'
21+
'masci-tools convert-inpgen <filename.cif> <out-filename> --converter ase', DeprecationWarning)
1722

1823
import sys
1924
import ase.io

masci_tools/io/common_functions.py

+4-3
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@
2222
from typing import TypeAlias
2323
else:
2424
from typing_extensions import TypeAlias
25-
try:
25+
if sys.version_info >= (3, 8):
2626
from typing import Literal
27-
except ImportError:
28-
from typing_extensions import Literal #type:ignore[misc]
27+
else:
28+
from typing_extensions import Literal
2929
import numpy as np
3030
from collections.abc import Sequence
3131
from masci_tools.util.typing import FileLike
@@ -652,6 +652,7 @@ class AtomSiteProperties(NamedTuple):
652652
position: list[float] #TODO could be made generic with VectorType
653653
symbol: str
654654
kind: str
655+
magnetic_moment: Literal['up', 'down'] | float | list[float] | None = None
655656

656657

657658
def get_wigner_matrix(l: int, alpha: float, beta: float, gamma: float = 0.0, inverse: bool = False) -> np.ndarray:

0 commit comments

Comments
 (0)