Skip to content

Commit

Permalink
Merge pull request #176 from JuDFTteam/release-0.11.2
Browse files Browse the repository at this point in the history
🚀 Release `0.11.2`
  • Loading branch information
janssenhenning authored Jun 29, 2022
2 parents ceb763f + f525fcb commit 83b35b4
Show file tree
Hide file tree
Showing 63 changed files with 2,501 additions and 2,458 deletions.
7 changes: 7 additions & 0 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,15 @@ jobs:
strategy:
matrix:
python-version: ['3.10','3.9', '3.8', '3.7']
experimental: [false]
# include:
# - python-version: '3.11-dev'
# experimental: true
fail-fast: false

name: tests-python-${{ matrix.python-version }}
continue-on-error: ${{ matrix.experimental }}

steps:
- uses: actions/checkout@v3

Expand Down
11 changes: 11 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,9 @@ jobs:
matrix:
python-version: ['3.10','3.9', '3.8', '3.7']
experimental: [false]
# include:
# - python-version: '3.11-dev'
# experimental: true
fail-fast: false

name: tests-python-${{ matrix.python-version }}
Expand All @@ -115,6 +118,14 @@ jobs:
with:
python-version: ${{ matrix.python-version }}

- name: Install Build dependecies (for experimental builds)
if: ${{ matrix.experimental }}
run: |
sudo apt-get update
sudo apt-get install -y libxml2-dev libxslt-dev libhdf5-serial-dev
pip install --upgrade pip setuptools wheel
pip install --upgrade cython
pip list
- name: Install python dependencies
run: |
Expand Down
1 change: 1 addition & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ repos:
masci_tools/util/fleur_calculate_expression.py|
masci_tools/tools/fleur_inpxml_converter.py|
masci_tools/tools/greensfunction.py|
masci_tools/tools/greensf_calculations.py|
masci_tools/cmdline/parameters/slice.py|
masci_tools/vis/parameters.py|
masci_tools/util/ipython.py|
Expand Down
15 changes: 14 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,26 @@
# Changelog

## v.0.11.2
[full changelog](https://github.com/JuDFTteam/masci-tools/compare/v0.11.1...v0.11.2)

### Improvements
- Several changes in KKR IO functions to make them compatible with `aiida-core>=2.0` [[#175]](https://github.com/JuDFTteam/masci-tools/pull/175)
- Add function to calculate fourier transform of e.g. `J_ij` constants calculated from Green's functions (`masci_tools.tools.greensf_calculations.heisenberg_reciprocal`)

### Bugfixes
- Fixed nondeterministic order in bokeh regression tests if multiple dictionaries with the same values but differing keys in the same list (e.g. Providing the same data for different columns)
- Fixed wrong names for columns entered in `decompose_jij_tensor`, i.e. `J_ji` -> `J_ij`

### Deprecations
- Deprecated the unused modules `util/kkr_rms_tracker.py` and `util/modify_potential.py`

## v.0.11.1

[full changelog](https://github.com/JuDFTteam/masci-tools/compare/v0.11.0...v0.11.1)

### Bugfixes
- Bugfix in `reverse_xinclude`. Version `0.11.0` broke this function for versions, where the `relaxation` tag was not allowed.


## v.0.11.0
[full changelog](https://github.com/JuDFTteam/masci-tools/compare/v0.10.1...v0.11.0)

Expand Down
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.11.1'
__version__ = '0.11.2'
__authors__ = 'The JuDFT team. Also see AUTHORS.txt file.'

logging.getLogger(__name__).addHandler(logging.NullHandler())
Expand Down
28 changes: 20 additions & 8 deletions masci_tools/io/common_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,27 @@ def open_general(filename_or_handle: FileLike, iomode: str | None = None) -> IO[
if iomode is None:
f = open(f.name, f.mode, encoding='utf8')
else:
f = open(f.name, iomode, encoding='utf8')
f = open(f.name, iomode, encoding='utf8') #pylint: disable=consider-using-with
else: # make sure reading the file now starts at the beginning again
f.seek(0)

return f


def get_outfile_txt(outfile):
"""Get the content of a file
In case the outfile is a file handle, we just roll it back and read everything in again.
For an ordinary file path we open the file in a context manager and then read it.
"""
if getattr(outfile, 'readlines', None) is not None:
outfile.seek(0)
tmptxt = outfile.readlines()
else:
with open_general(outfile) as f:
tmptxt = f.readlines()
return tmptxt


def skipHeader(seq: Iterable[Any], n: int) -> Generator[Any, None, None]:
"""Iterate over a sequence skipping the first n elements
Expand Down Expand Up @@ -204,8 +219,7 @@ def vec_to_angles(vec: np.ndarray) -> tuple[np.ndarray, np.ndarray, np.ndarray]


def get_version_info(outfile: FileLike) -> tuple[str, str, str]:
with open_general(outfile) as f:
tmptxt = f.readlines()
tmptxt = get_outfile_txt(outfile)
itmp = search_string('Code version:', tmptxt)
if itmp == -1: # try to find serial number from header of file
itmp = search_string('# serial:', tmptxt)
Expand All @@ -223,8 +237,7 @@ def get_version_info(outfile: FileLike) -> tuple[str, str, str]:

def get_corestates_from_potential(potfile: FileLike = 'potential') -> tuple[list, list, list]:
"""Read core states from potential file"""
with open_general(potfile) as f:
txt = f.readlines()
txt = get_outfile_txt(potfile)

#get start of each potential part
istarts = [iline for iline in range(len(txt)) if 'POTENTIAL' in txt[iline]]
Expand Down Expand Up @@ -361,9 +374,8 @@ def get_ef_from_potfile(potfile: FileLike) -> float:
"""
extract fermi energy from potfile
"""
with open_general(potfile) as f:
txt = f.readlines()
ef = float(txt[3].split()[1])
tmptxt = get_outfile_txt(potfile)
ef = float(tmptxt[3].split()[1])
return ef


Expand Down
14 changes: 7 additions & 7 deletions masci_tools/io/io_nmmpmat.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,25 +135,25 @@ def write_nmmpmat_from_orbitals(orbital: int,
phi: float | None = None,
theta: float | None = None,
inverse: bool = False) -> list[str]:
"""
r"""
Generate list of str for n_mmp_mat file from orbital occupations
orbital occupations are provided in the following order
(expressed as the spherical harmonics since it can be used for all orbitals):
- Y_l^0
- 1/sqrt(2) (Y_l^-1 + Y_l^1)
- i/sqrt(2) (Y_l^-1 - Y_l^1)
- 1/sqrt(2) (Y_l^-2 + Y_l^2)
- i/sqrt(2) (Y_l^-2 - Y_l^2)
- :math:`Y_l^0`
- :math:`\frac{1}{\sqrt{2}} \left(Y_l^{-1} + Y_l^1\right)`
- :math:`\frac{i}{\sqrt{2}} \left(Y_l^{-1} - Y_l^1\right)`
- :math:`\frac{1}{\sqrt{2}} \left(Y_l^{-2} + Y_l^2\right)`
- :math:`\frac{i}{\sqrt{2}} \left(Y_l^{-2} - Y_l^2\right)`
- and so on ...
:param orbital: int of the orbital for the current block
:param orbital_occupations: list like with length 2*orbital+1 with the occupations of the orbitals
:param phi: float, angle (radian), by which to rotate the density matrix
:param theta: float, angle (radian), by which to rotate the density matrix
:returns: list of str formatted in lines for the n_mmp_mat file
:returns: list of str formatted in lines for the `n_mmp_mat` file
"""

denmat = np.zeros((2 * orbital + 1, 2 * orbital + 1), dtype=complex)
Expand Down
32 changes: 13 additions & 19 deletions masci_tools/io/modify_potential.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,6 @@
"""
Tools for the impurity caluclation plugin and its workflows
"""
from sys import version_info
if version_info[0] >= 3:

def raw_input(msg):
return eval(eval(input(msg)))


__copyright__ = ('Copyright (c), 2018, Forschungszentrum Jülich GmbH,'
'IAS-1/PGI-1, Germany. All rights reserved.')
Expand All @@ -43,7 +37,7 @@ def _check_potstart(self, str1, mode='pot', shape_ver='new'):

def _read_input(self, filepath):
#print(filepath)
with open(filepath) as file:
with open(filepath, encoding='utf8') as file:
data = file.readlines()

if 'shapefun' in filepath:
Expand All @@ -56,8 +50,8 @@ def _read_input(self, filepath):
# read file
index1 = []
index2 = []
for i in range(len(data)):
if self._check_potstart(data[i], mode=mode):
for i, d in enumerate(data):
if self._check_potstart(d, mode=mode):
index1.append(i)
if len(index1) > 1:
index2.append(i - 1)
Expand All @@ -67,8 +61,8 @@ def _read_input(self, filepath):
if mode == 'shape' and len(index1) < 1:
index1 = []
index2 = []
for i in range(len(data)):
if self._check_potstart(data[i], mode=mode, shape_ver='old'):
for i, d in enumerate(data):
if self._check_potstart(d, mode=mode, shape_ver='old'):
index1.append(i)
if len(index1) > 1:
index2.append(i - 1)
Expand Down Expand Up @@ -97,7 +91,7 @@ def shapefun_from_scoef(self, scoefpath, shapefun_path, atom2shapes, shapefun_ne

order = list(range(len(index1)))

with open(scoefpath) as f:
with open(scoefpath, encoding='utf8') as f:
lines = f.readlines()
natomtemp = int(lines[0])
filedata = lines[1:natomtemp + 1]
Expand All @@ -109,8 +103,8 @@ def shapefun_from_scoef(self, scoefpath, shapefun_path, atom2shapes, shapefun_ne
order = listnew

datanew = []
for i in range(len(order)):
for ii in range(index1[order[i]], index2[order[i]] + 1):
for i in order:
for ii in range(index1[i], index2[i] + 1):
datanew.append(data[ii])

# add header to shapefun_new
Expand Down Expand Up @@ -155,10 +149,10 @@ def neworder_potential(self, potfile_in, potfile_out, neworder, potfile_2=None,
# check if also replace_from_pot2 is given correctly
if replace_from_pot2 is None:
raise ValueError('replace_from_pot2 not given')
else:
replace_from_pot2 = array(replace_from_pot2)
if shape(replace_from_pot2)[1] != 2:
raise ValueError('replace_from_pot2 needs to be a 2D array!')

replace_from_pot2 = array(replace_from_pot2)
if shape(replace_from_pot2)[1] != 2:
raise ValueError('replace_from_pot2 needs to be a 2D array!')
else:
if replace_from_pot2 is not None:
raise ValueError('replace_from_pot2 given but potfile_2 not given')
Expand All @@ -179,5 +173,5 @@ def neworder_potential(self, potfile_in, potfile_out, neworder, potfile_2=None,
datanew.append(data[ii])

# write out new potential
with open(potfile_out, 'w') as f:
with open(potfile_out, 'w', encoding='utf8') as f:
f.writelines(datanew)
Loading

0 comments on commit 83b35b4

Please sign in to comment.