Skip to content

Commit

Permalink
Merge pull request #216 from JuDFTteam/release-0.14.0
Browse files Browse the repository at this point in the history
🚀 Release `0.14.0`
  • Loading branch information
janssenhenning authored Dec 8, 2022
2 parents 613f243 + 5958b3d commit 39dec6b
Show file tree
Hide file tree
Showing 64 changed files with 1,663 additions and 90 deletions.
18 changes: 10 additions & 8 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,13 @@ jobs:
- uses: actions/checkout@v3

- name: Set up Python 3.10
uses: actions/setup-python@v4.2.0
uses: actions/setup-python@v4.3.0
with:
python-version: '3.10'

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

- name: Cache python dependencies
id: cache-pip
uses: actions/[email protected].6
uses: actions/[email protected].9
with:
path: ~/.cache/pip
key: pip-pre-commit-${{ hashFiles('**/pyproject.toml') }}
restore-keys: |
pip-pre-commit-
- name: Set up Python 3.8
uses: actions/setup-python@v4.2.0
uses: actions/setup-python@v4.3.0
with:
python-version: 3.8

Expand All @@ -112,10 +112,12 @@ jobs:
matrix:
python-version: ['3.10','3.9', '3.8']
experimental: [false]
extra-dependencies: ['testing,bokeh-plots,cmdline-extras']
pytest-cmdline: ['']
include:
- python-version: '3.7'
experimental: false
extra-dependencies: 'testing,bokeh-plots'
pytest-cmdline: '-o addopts="--cov=masci_tools --cov=tests --cov-report xml"'
# include:
# - python-version: '3.11-dev'
Expand All @@ -130,22 +132,22 @@ jobs:

- name: Cache python dependencies
id: cache-pip
uses: actions/[email protected].6
uses: actions/[email protected].9
with:
path: ~/.cache/pip
key: pip-${{ matrix.python-version }}-tests-${{ hashFiles('**/pyproject.toml') }}
restore-keys: |
pip-${{ matrix.python-version }}-tests
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4.2.0
uses: actions/setup-python@v4.3.0
with:
python-version: ${{ matrix.python-version }}


- name: Install python dependencies
run: |
pip install -e .[testing,bokeh-plots]
pip install -e .[${{ matrix.extra-dependencies }}]
pip install pyhull
- name: Run pytest
Expand All @@ -170,7 +172,7 @@ jobs:
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.7
uses: actions/setup-python@v4.2.0
uses: actions/setup-python@v4.3.0
with:
python-version: 3.7
- name: Install flit
Expand Down
16 changes: 9 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@ jobs:
- uses: actions/checkout@v3

- name: Set up Python 3.10
uses: actions/setup-python@v4.2.0
uses: actions/setup-python@v4.3.0
with:
python-version: '3.10'

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

- name: Cache python dependencies
id: cache-pip
uses: actions/[email protected].6
uses: actions/[email protected].9
with:
path: ~/.cache/pip
key: pip-pre-commit-${{ hashFiles('**/pyproject.toml') }}
restore-keys: |
pip-pre-commit-
- name: Set up Python 3.8
uses: actions/setup-python@v4.2.0
uses: actions/setup-python@v4.3.0
with:
python-version: 3.8

Expand All @@ -107,10 +107,12 @@ jobs:
matrix:
python-version: ['3.10','3.9', '3.8']
experimental: [false]
extra-dependencies: ['testing,bokeh-plots,cmdline-extras']
pytest-cmdline: [""]
include:
- python-version: '3.7'
experimental: false
extra-dependencies: 'testing,bokeh-plots'
pytest-cmdline: '-o addopts="--cov=masci_tools --cov=tests --cov-report xml"'
#- python-version: '3.11.0-rc.2'
# experimental: true
Expand All @@ -125,15 +127,15 @@ jobs:

- name: Cache python dependencies
id: cache-pip
uses: actions/[email protected].6
uses: actions/[email protected].9
with:
path: ~/.cache/pip
key: pip-${{ matrix.python-version }}-tests-${{ hashFiles('**/pyproject.toml') }}
restore-keys: |
pip-${{ matrix.python-version }}-tests
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4.2.0
uses: actions/setup-python@v4.3.0
with:
python-version: ${{ matrix.python-version }}

Expand All @@ -148,7 +150,7 @@ jobs:
- name: Install python dependencies
run: |
pip install -e .[testing,bokeh-plots]
pip install -e .[${{ matrix.extra-dependencies }}]
pip install pyhull
- name: Run pytest
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/fleur-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
- uses: actions/checkout@v3

- name: Set up Python 3.8
uses: actions/setup-python@v4.2.0
uses: actions/setup-python@v4.3.0
with:
python-version: 3.8

Expand All @@ -40,7 +40,7 @@ jobs:
run: exit 1

- name: Create Pull Request
uses: peter-evans/create-pull-request@v4.0.4
uses: peter-evans/create-pull-request@v4.1.3
with:
commit-message: "[fleur release] Fleur schema update"
branch: fleur-release/schema
Expand Down
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ ci:

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.3.0
rev: v4.4.0
hooks:
- id: double-quote-string-fixer
types: [python]
Expand Down Expand Up @@ -33,7 +33,7 @@ repos:
additional_dependencies: ['toml']

- repo: https://github.com/ikamensh/flynt/
rev: '0.76'
rev: '0.77'
hooks:
- id: flynt
args: [
Expand All @@ -42,7 +42,7 @@ repos:
]

- repo: https://github.com/asottile/pyupgrade
rev: v2.37.3
rev: v3.3.0
hooks:
- id: pyupgrade
args: [
Expand Down
21 changes: 20 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,29 @@
# Changelog

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

Nothing here yet

## v.0.14.0
[full changelog](https://github.com/JuDFTteam/masci-tools/compare/v0.13.0...v0.14.0)

### Added
- 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)
- 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`

### Improvements
- `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)
- `get_structuredata` also reads out the magnetic moments [[#213]](https://github.com/JuDFTteam/masci-tools/pull/213)
- `FleurXMLModifier.modify_xmlfile` now keeps the inpgen comments by default (controlled by option `keep_inpgen_comments`)

### Bugfixes
- Serveral fixes for Fleur DOS plots [[#212]](https://github.com/JuDFTteam/masci-tools/pull/212):
- Fixed wrong summation of atom weights for files containing 10 or more atomtypes
- Fixed crashes using a custom weight not conforming to the naming scheme of weights in the `banddos.hdf`
- Fixed specification of parameters by DOS label not working if the spin suffix is omitted


## v.0.13.0
[full changelog](https://github.com/JuDFTteam/masci-tools/compare/v0.12.0...v0.13.0)

Expand Down
4 changes: 2 additions & 2 deletions codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,5 @@ comment:
require_changes: no

ignore:
- "masci_tools/util/kkr_rms_tracker.py"
- "masci_tools/util/modifypotential.py"
- "masci_tools/tools/kkr_rms_tracker.py"
- "masci_tools/tools/modifypotential.py"
2 changes: 1 addition & 1 deletion masci_tools/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.13.0'
__version__ = '0.14.0'
__authors__ = 'The JuDFT team. Also see AUTHORS.txt file.'

logging.getLogger(__name__).addHandler(logging.NullHandler())
Expand Down
2 changes: 1 addition & 1 deletion masci_tools/cmdline/commands/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""
Import all the command groups to include in the cli
"""
from . import (fleur_schema, parse, plot, tools)
from . import (convert_inpgen, fleur_schema, parse, plot, tools)
51 changes: 51 additions & 0 deletions masci_tools/cmdline/commands/convert_inpgen.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
"""
CLI commands for converting common structure definition formats to fleur inpgen files
"""
from .root import cli
import click

from pathlib import Path
import os

from masci_tools.cmdline.utils import echo

try:
import pymatgen
from pymatgen.core import Structure
except ImportError:
pymatgen = None

try:
import ase
from ase.io import read, write
except ImportError:
ase = None


@cli.command('convert-inpgen')
@click.argument('input-file', type=click.Path(exists=True, path_type=Path, resolve_path=True))
@click.argument('output-file', type=click.Path(path_type=Path, resolve_path=True))
@click.option('-c',
'--converter',
type=click.Choice(['ase', 'pymatgen']),
help='Which library is used to read in the given file format',
default='pymatgen')
def convert_inpgen(input_file, output_file, converter):
"""Convert the given file to an fleur inpgen file
"""

input_file = os.fspath(input_file)
output_file = os.fspath(output_file)

if converter == 'ase':
if ase is None:
echo.echo_critical('ase is not installed. Please install the packages ase and ase-fleur')

atoms = read(input_file)
write(output_file, atoms, format='fleur-inpgen')
elif converter == 'pymatgen':
if pymatgen is None:
echo.echo_critical('pymatgen is not installed. Please install the packages pymatgen and pymatgen-io-fleur')

struc = Structure.from_file(os.fspath(input_file))
struc.to(output_file, fmt='fleur-inpgen')
5 changes: 5 additions & 0 deletions masci_tools/io/cif2inp_ase.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@
Independent utility script to convert cif file formats to input for the inpgen code
Usage: `python cif2inp_ase.py <filename.cif>`
"""
import warnings

warnings.warn(
'The cif2inp_ase.py script is deprecated. Use the command'
'masci-tools convert-inpgen <filename.cif> <out-filename> --converter ase', DeprecationWarning)

import sys
import ase.io
Expand Down
7 changes: 4 additions & 3 deletions masci_tools/io/common_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@
from typing import TypeAlias
else:
from typing_extensions import TypeAlias
try:
if sys.version_info >= (3, 8):
from typing import Literal
except ImportError:
from typing_extensions import Literal #type:ignore[misc]
else:
from typing_extensions import Literal
import numpy as np
from collections.abc import Sequence
from masci_tools.util.typing import FileLike
Expand Down Expand Up @@ -652,6 +652,7 @@ class AtomSiteProperties(NamedTuple):
position: list[float] #TODO could be made generic with VectorType
symbol: str
kind: str
magnetic_moment: Literal['up', 'down'] | float | list[float] | None = None


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

0 comments on commit 39dec6b

Please sign in to comment.