Skip to content

Commit

Permalink
Merge pull request #173 from JuDFTteam/pre-commit-ci-update-config
Browse files Browse the repository at this point in the history
[pre-commit.ci] pre-commit autoupdate
  • Loading branch information
janssenhenning committed May 3, 2023
2 parents 03b593b + 07e6505 commit 3c00326
Show file tree
Hide file tree
Showing 10 changed files with 47 additions and 31 deletions.
15 changes: 13 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -88,34 +88,45 @@ jobs:
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10"]
aiida: [{version: 'aiida-core==2.0.1', name: '2.0.1'},{version: 'aiida-core==2.1.2', name: '2.1.2'}]
aiida: [{version: 'aiida-core==2.0.1', name: '2.0.1'},{version: 'aiida-core==2.3.0', name: '2.3.0'}]
masci-tools: [{version: 'masci-tools', name: 'stable'}]
bokeh-version: ['bokeh==3.0.3']
mpl-version: ['matplotlib==3.6.3']
add-name: ['']
allowed-to-fail: [false]
include:
- python-version: "3.11"
aiida: {version: 'aiida-core==2.3.0', name: '2.3.0'}
masci-tools: {version: 'masci-tools', name: 'stable'}
bokeh-version: 'bokeh==3.0.3'
mpl-version: 'matplotlib==3.6.3'
add-name: ''
allowed-to-fail: false
- python-version: 3.9
aiida: {version: 'git+https://github.com/aiidateam/aiida-core.git@main', name: 'latest'}
masci-tools: {version: 'masci-tools', name: 'stable'}
bokeh-version: 'bokeh==3.0.3'
mpl-version: 'matplotlib==3.6.3'
add-name: ''
allowed-to-fail: true
- python-version: 3.9
aiida: {version: 'aiida-core==2.0.1', name: '2.0.1'}
masci-tools: {version: 'git+https://github.com/JuDFTteam/masci-tools.git@develop', name: 'develop'}
bokeh-version: 'bokeh==3.0.3'
mpl-version: 'matplotlib==3.6.3'
add-name: ''
allowed-to-fail: true
- python-version: 3.9
aiida: {version: 'aiida-core==2.0.1', name: '2.0.1'}
masci-tools: {version: 'masci-tools', name: 'stable'}
bokeh-version: 'bokeh'
mpl-version: 'matplotlib'
add-name: '-latest-bokeh/mpl'
allowed-to-fail: true

fail-fast: false

name: tests-python-${{ matrix.python-version }}-aiida-${{ matrix.aiida.name }}-masci-${{ matrix.masci-tools.name }}
name: ${{ matrix.python-version }}-aiida-${{ matrix.aiida.name }}-masci-${{ matrix.masci-tools.name }}${{ matrix.add-name }}
continue-on-error: ${{ matrix.allowed-to-fail }}

services:
Expand Down
10 changes: 5 additions & 5 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.1.0
rev: v4.4.0
hooks:
- id: double-quote-string-fixer
types: [python]
Expand All @@ -15,8 +15,8 @@ repos:
- id: trailing-whitespace
types: [python]

- repo: https://github.com/pre-commit/mirrors-yapf
rev: v0.32.0
- repo: https://github.com/google/yapf
rev: v0.33.0
hooks:
- id: yapf
name: yapf
Expand All @@ -29,7 +29,7 @@ repos:
additional_dependencies: ['toml']

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

- repo: https://github.com/asottile/pyupgrade
rev: v2.31.1
rev: v3.3.2
hooks:
- id: pyupgrade
args: [
Expand Down
2 changes: 1 addition & 1 deletion .readthedocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ python:
build:
os: ubuntu-20.04
tools:
python: "3.10"
python: "3.10"
17 changes: 9 additions & 8 deletions aiida_fleur/tools/StructureData_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -1474,7 +1474,7 @@ def adjust_sym_film_relaxation(structure,
structure = sort_atoms_z_value(structure)

suggestion = deepcopy(suggestion)
if not (ILD is None):
if ILD is not None:
ILD = deepcopy(ILD)
if scale_as:
norm = suggestion[scale_as][scale_as]
Expand Down Expand Up @@ -1542,12 +1542,12 @@ def suggest_distance_to_previous(num_layer):
rebuilt_structure.append_atom(symbols=atom[1], position=(atom[0][0], atom[0][1], atom[0][2]), name=atom[1])

prev_distance = 0
if ILD!=None:
if len(ILD.keys())>0:
#Init Counting
keyILD=list(ILD)#List of keys
if ILD is not None:
if len(ILD.keys()) > 0:
#Init Counting
keyILD = list(ILD) #List of keys
else:
keyILD=0
keyILD = 0
#Now iterate over all other layers
for i, layer in enumerate(sorted_layers[1:]):
layer_copy = deepcopy(layer)
Expand All @@ -1562,12 +1562,13 @@ def suggest_distance_to_previous(num_layer):
prev_distance = max(add_distance1, add_distance2)

if i == len(sorted_layers) - 2 and last_layer_factor:
if ILD is None: prev_distance = prev_distance * last_layer_factor # last layer should be closer
if ILD is None:
prev_distance = prev_distance * last_layer_factor # last layer should be closer

prev_layer_z = max(x.position[2] for x in rebuilt_structure.sites)

for atom in layer_copy:
if ILD==None:
if ILD is None:
atom[0][2] = prev_layer_z + prev_distance
else:
if ILD[keyILD[i]] == 0.0:
Expand Down
20 changes: 11 additions & 9 deletions aiida_fleur/workflows/create_magnetic_film.py
Original file line number Diff line number Diff line change
Expand Up @@ -274,14 +274,14 @@ def prepare_relax(self):
# print(eos_output.get_dict())
scaling_param = eos_output.get_dict()['scaling_gs']
if 'interlayer_dist' in self.inputs:
ild=self.inputs.interlayer_dist
ild = self.inputs.interlayer_dist
else:
ild=None
ild = None
out_create_structure = create_film_to_relax(wf_dict_node=Dict(dict=self.ctx.wf_dict),
scaling_parameter=Float(scaling_param),
suggestion_node=self.inputs.distance_suggestion,
ild=ild)

inputs.scf.structure = out_create_structure['structure']
substrate = out_create_structure['substrate']
# TODO: error handling might be needed
Expand Down Expand Up @@ -451,18 +451,20 @@ def create_film_to_relax(wf_dict_node, scaling_parameter, suggestion_node, ild=N
decimals=decimals)

bond_length = find_min_distance_unary_structure(tmp_substrate)
if ild==None:
ILD=None
if ild is None:
ILD = None
else:
ILD = ild.get_dict()
suggestion = suggestion_node.get_dict()

if adjustment_needed:
if has_z_reflection(structure):
if not (ild is None):
structure = adjust_sym_film_relaxation(structure, suggestion, host_symbol, bond_length, last_layer_factor,ILD)
else:
structure = adjust_sym_film_relaxation(structure, suggestion, host_symbol, bond_length, last_layer_factor)
if ild is not None:
structure = adjust_sym_film_relaxation(structure, suggestion, host_symbol, bond_length,
last_layer_factor, ILD)
else:
structure = adjust_sym_film_relaxation(structure, suggestion, host_symbol, bond_length,
last_layer_factor)
sym_film = True
else:
structure = adjust_film_relaxation(structure, suggestion, host_symbol, bond_length, last_layer_factor,
Expand Down
4 changes: 2 additions & 2 deletions aiida_fleur/workflows/orbcontrol.py
Original file line number Diff line number Diff line change
Expand Up @@ -1000,8 +1000,8 @@ def return_results(self):
converged_minimum_energy = np.nanmin(energy[converged_mask])
if len(energy[non_converged_mask]) != 0:
if np.nanmin(energy[non_converged_mask]) < converged_minimum_energy:
lower_non_converged = np.array(non_converged_configs)[
energy[non_converged_mask] < converged_minimum_energy]
lower_non_converged = np.array(non_converged_configs)[energy[non_converged_mask] <
converged_minimum_energy]
out['warnings'].extend(f"Configuration 'Relaxed_{index}' did not converge "
'but is lower in energy than the lowest converged configuration'
for index in lower_non_converged)
Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ classifiers = [
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Environment :: Plugins",
"Intended Audience :: Science/Research",
"Topic :: Scientific/Engineering :: Physics",
Expand Down
1 change: 1 addition & 0 deletions tests/.aiida-testing-config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ archive_cache:
ignore:
calcjob_attributes:
- environment_variables_double_quotes
- metadata_inputs
4 changes: 2 additions & 2 deletions tests/tools/test_StructureData_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -991,8 +991,8 @@ def test_create_slap(generate_structure):
film_struc = create_slap(structure, [1, 1, 1], 2)
cell_should = [[3.839589821842953, 0.0, 2.351070692679364e-16],
[1.9197949109214756, 3.3251823258281643, 2.351070692679364e-16], [0.0, 0.0, 9.405035885099004]]
sites_should = [(3.839589821842953, 2.216788217218776, 3.135011961699669), (0.0, 0.0, 0.0),
(1.9197949109214758, 1.1083941086093878, 6.270023923399337)]
sites_should = [(0.0, 0.0, 0.0), (1.9197949109214758, 1.1083941086093878, 3.135011961699669),
(3.8395898218429525, 2.216788217218776, 6.270023923399337)]
# since this depends on pymatgen we round here the last digits.
assert (np.round(film_struc.cell, 8) == np.round(cell_should, 8)).all()
assert (np.round(film_struc.sites[0].position, 8) == np.round(sites_should[0], 8)).all()
Expand Down
4 changes: 2 additions & 2 deletions tests/tools/test_common_fleur_wf.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ def test_test_and_get_codenode_inpgen(fixture_code):
test_and_get_codenode(code, nonexpected)
assert str(msg.value) == ('Expected Code of type fleur.fleur. Got: fleur.inpgen\n'
'Valid labels for a fleur.fleur executable are:\n'
'* fleur_test@localhost-test')
f'* {code_fleur.full_label}')

with pytest.raises(ValueError) as msg:
test_and_get_codenode(code, not_existing)
Expand Down Expand Up @@ -336,7 +336,7 @@ def test_performance_extract_calcs(fixture_localhost, generate_calc_job_node):
'walltime_sec_per_it': [3.909090909090909],
'n_iterations_total': [11],
'density_distance': [0.0682602474],
'computer': ['localhost-test'],
'computer': [fixture_localhost.label],
'n_atoms': [4],
'kmax': [4.2],
'cost': [75866.11200000001],
Expand Down

0 comments on commit 3c00326

Please sign in to comment.