Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
PhilippRue committed Nov 27, 2018
2 parents 1989db0 + 618e5f7 commit 8a2febe
Show file tree
Hide file tree
Showing 67 changed files with 3,964 additions and 4,077 deletions.
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Byte-compiled / optimized / DLL files
__pycache__/
.pytest_cache/
*.py[cod]
*$py.class

Expand Down Expand Up @@ -105,3 +106,10 @@ ENV/

# mypy
.mypy_cache/

# mac stuff
.DS_Store
**/.DS_Store
.AppleDouble
.LSOverride

11 changes: 9 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ notifications:

services:
- postgresql
- rabbitmq

addons:
postgresql: "9.5"
Expand All @@ -20,18 +21,24 @@ before_install: # copied from pgtest's travis.yml
- sudo apt-get install locate
- sudo service postgresql stop
- sudo apt-get remove postgresql
- sudo apt-get install postgresql
- sudo apt-get install postgresql-9.5
- sudo updatedb

install:
- pip install -U pip wheel setuptools
- pip install -e git+https://github.com/aiidateam/aiida_core@develop#egg=aiida-core[testing]
- pip install -e git+https://github.com/JuDFTteam/masci-tools@master#egg=masci-tools
- pip install -e .
- pip install codecov

env:
- TEST_TYPE="unittests"

script: cd ./aiida_kkr/tests/ && ./run_all.sh
script:
- cd ./aiida_kkr/tests/ && ./run_all.sh

after_success:
- codecov

git:
depth: 3
41 changes: 0 additions & 41 deletions CHANGELOG.md

This file was deleted.

19 changes: 18 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,29 @@
[![Documentation Status](https://readthedocs.org/projects/aiida-kkr/badge/?version=latest)](https://aiida-kkr.readthedocs.io/en/latest/?badge=latest)
[![Build Status](https://travis-ci.org/JuDFTteam/aiida-kkr.svg?branch=master)](https://travis-ci.org/JuDFTteam/aiida-kkr)
[![codecov](https://codecov.io/gh/JuDFTteam/aiida-kkr/branch/master/graph/badge.svg)](https://codecov.io/gh/JuDFTteam/aiida-kkr)
[![MIT license](http://img.shields.io/badge/license-MIT-brightgreen.svg)](http://opensource.org/licenses/MIT)
[![GitHub version](https://badge.fury.io/gh/JuDFTteam%2Faiida-kkr.svg)](https://badge.fury.io/gh/JuDFTteam%2Faiida-kkr)
[![PyPI version](https://badge.fury.io/py/aiida-kkr.svg)](https://badge.fury.io/py/aiida-kkr)


# aiida-kkr

AiiDA plugin for the KKR codes plus workflows and utility.

## Features

* KKR calculations for bulk and interfaces
* treatment of alloys using VCA or CPA
* self-consistency, DOS and bandstructure calculations
* extraction of magnetic exchange coupling parameters (*J_ij*, *D_ij*)
* impurity embedding solving the Dyson equation
* ~~import old calculations using the calculation importer~~ (only working with aiida-core<1.0, i.e. in aiida-kkr v0.1.2)


# Installation

```shell
$ git clone https://github.com/broeder-j/aiida-kkr
$ git clone https://github.com/JuDFTteam/aiida-kkr

$ cd aiida-kkr
$ pip install -e . # also installs aiida, if missing (but not postgres)
Expand Down
2 changes: 1 addition & 1 deletion aiida_kkr/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
"""

__version__ = "0.1.0"
__version__ = "1.0.0"
4 changes: 2 additions & 2 deletions aiida_kkr/calculations/kkr.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
from aiida_kkr.tools.common_workfunctions import (generate_inputcard_from_structure,
check_2Dinput_consistency, update_params_wf,
vca_check)
from aiida_kkr.tools.common_functions import get_alat_from_bravais, get_Ang2aBohr
from masci_tools.io.common_functions import get_alat_from_bravais, get_Ang2aBohr
from aiida_kkr.tools.tools_kkrimp import make_scoef
from aiida_kkr.tools.kkr_params import __kkr_default_params__
from masci_tools.io.kkr_params import __kkr_default_params__

#define aiida structures from DataFactory of aiida
RemoteData = DataFactory('remote')
Expand Down
93 changes: 83 additions & 10 deletions aiida_kkr/calculations/kkrimp.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@
from aiida.common.exceptions import (InputValidationError, ValidationError, UniquenessError)
from aiida.common.datastructures import (CalcInfo, CodeInfo)
from aiida.orm import DataFactory
from aiida_kkr.tools.kkr_params import kkrparams
from masci_tools.io.kkr_params import kkrparams
from aiida_kkr.calculations.kkr import KkrCalculation
from aiida_kkr.tools.tools_kkrimp import modify_potential
from aiida_kkr.tools.tools_kkrimp import make_scoef
from aiida_kkr.tools.common_functions import search_string
from masci_tools.io.common_functions import search_string
from aiida_kkr.calculations.voro import VoronoiCalculation
import os
from numpy import array, sqrt, sum, where
Expand Down Expand Up @@ -109,28 +109,38 @@ def _use_methods(cls):
'additional_parameter': None,
'linkname': 'parameters',
'docstring':
("Use a node that specifies the input parameters (calculation settings)")
("Use a node that specifies the input parameters (calculation settings).")
},
"host_Greenfunction_folder": {
'valid_types': RemoteData,
'additional_parameter': None,
'linkname': 'GFhost_folder',
'docstring':
("Use a node that specifies the host KKR calculation contaning the host Green function and tmatrix (KkrCalculation with impurity_info input)")
("Use a node that specifies the host KKR calculation contaning "
"the host Green function and tmatrix (KkrCalculation with "
"impurity_info input).")
},
"impurity_potential": {
'valid_types': SinglefileData,
'additional_parameter': None,
'linkname': 'potential',
'docstring':
("Use a node contains the input potential")
("Use a node contains the input potential.")
},
"parent_calc_folder": {
'valid_types': RemoteData,
'additional_parameter': None,
'linkname': 'parent_calc_folder',
'docstring':
("Use a node that specifies a parent KKRimp calculation")
("Use a node that specifies a parent KKRimp calculation.")
},
"impurity_info": {
'valid_types': ParameterData,
'additional_parameter': None,
'linkname': 'impurity_info',
'docstring':
("Use a Parameter node that specifies properties "
"for a impurity calculation.")
}
})
return use_dict
Expand Down Expand Up @@ -210,6 +220,28 @@ def _prepare_for_submission(self, tempfolder, inputdict):
retrieve_list.append((self._OUT_LDOS_INTERPOL_BASE%(iatom, ispin)).replace(' ', '0'))
retrieve_list.append((self._OUT_LMDOS_BASE%(iatom, ispin)).replace(' ', '0'))
retrieve_list.append((self._OUT_LMDOS_INTERPOL_BASE%(iatom, ispin)).replace(' ', '0'))

file = open(tempfolder.get_abs_path(self._CONFIG))
config = file.readlines()
file.close()
itmp = search_string('NSPIN', config)
if itmp>=0:
nspin = int(config[itmp].split()[-1])
else:
raise ValueError("Could not extract NSPIN value from config.cfg")
if 'tmatnew' in allopts and nspin>1:
retrieve_list.append(self._OUT_MAGNETICMOMENTS)
file = open(tempfolder.get_abs_path(self._CONFIG))
outorb = file.readlines()
file.close()
itmp = search_string('CALCORBITALMOMENT', outorb)
if itmp>=0:
calcorb = int(outorb[itmp].split()[-1])
else:
calcorb = 0
if calcorb==1:
retrieve_list.append(self._OUT_ORBITALMOMENTS)


# Prepare CalcInfo to be returned to aiida (e.g. retreive_list etc.)
calcinfo = CalcInfo()
Expand Down Expand Up @@ -267,10 +299,51 @@ def _get_and_verify_hostfiles(self, inputdict):
parent_calc = parent_calcs[0]

# extract impurity_info
imp_info = parent_calc.get_inputs_dict().get('impurity_info', None)
if imp_info is None:
raise InputValidationError("host_Greenfunction calculation does not have an input node impurity_info")

try:
imp_info_inputnode = inputdict.pop(self.get_linkname('impurity_info'))
if not isinstance(imp_info_inputnode, ParameterData):
raise InputValidationError("impurity_info not of type ParameterData")
imp_info = parent_calc.get_inputs_dict().get('impurity_info', None)
if imp_info is None:
raise InputValidationError("host_Greenfunction calculation does not have an input node impurity_info")
found_impurity_inputnode = True
found_impurity_parent = True
except KeyError:
imp_info = parent_calc.get_inputs_dict().get('impurity_info', None)
if imp_info is None:
raise InputValidationError("host_Greenfunction calculation does not have an input node impurity_info")
found_impurity_inputnode = False
# if impurity input is seperate input, check if it is the same as
# the one from the parent calc (except for 'Zimp'). If that's not the
# case, raise an error
if found_impurity_inputnode and found_impurity_parent:
if (imp_info_inputnode.get_attr('ilayer_center') == imp_info.get_attr('ilayer_center')
and imp_info_inputnode.get_attr('Rcut') == imp_info.get_attr('Rcut')):
check_consistency_imp_info = True
try:
if (imp_info_inputnode.get_attr('hcut') == imp_info.get_attr('hcut')
and imp_info_inputnode.get_attr('cylinder_orient') == imp_info.get_attr('cylinder_orient')
and imp_info_inputnode.get_attr('Rimp_rel') == imp_info.get_attr('Rimp_rel')
and imp_info_inputnode.get_attr('imp_cls') == imp_info.get_attr('imp_cls')):
print('impurity_info node from input and from previous GF calculation are compatible')
check_consistency_imp_info = True
else:
print('impurity_info node from input and from previous GF calculation are NOT compatible!. '
'Please check your impurity_info nodes for consistency.')
check_consistency_imp_info = False
except AttributeError:
print("Non default values of the impurity_info node from input and from previous "
"GF calculation are compatible. Default values haven't been checked")
check_consistency_imp_info = True
else:
print('impurity_info node from input and from previous GF calculation are NOT compatible!. '
'Please check your impurity_info nodes for consistency.')
check_consistency_imp_info = False
if check_consistency_imp_info:
imp_info = imp_info_inputnode
else:
raise InputValidationError("impurity_info nodes (input and GF calc) are not compatible")

# check if host parent was KKRFLEX calculation
hostfolderpath = parent_calc.out.retrieved.folder.abspath
hostfolderpath = os.path.join(hostfolderpath, 'path')
Expand Down
4 changes: 2 additions & 2 deletions aiida_kkr/calculations/kkrimporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from aiida.common.datastructures import calc_states
from aiida.common.links import LinkType
from aiida_kkr.calculations.kkr import KkrCalculation
from aiida_kkr.tools.kkr_params import kkrparams
from masci_tools.io.kkr_params import kkrparams
from aiida_kkr.tools.common_workfunctions import structure_from_params


Expand Down Expand Up @@ -474,4 +474,4 @@ def _OUTPUT_FILE_NAMES(self):
@_OUTPUT_FILE_NAMES.setter
def _OUTPUT_FILE_NAMES(self, value):
self._set_attr('output_file_names', value)


4 changes: 2 additions & 2 deletions aiida_kkr/parsers/kkr.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
from aiida.orm.data.parameter import ParameterData
from aiida_kkr.calculations.kkr import KkrCalculation
from aiida.common.exceptions import InputValidationError
from aiida_kkr.tools.kkrparser_functions import parse_kkr_outputfile, check_error_category
from aiida_kkr.tools.common_functions import search_string
from masci_tools.io.parsers.kkrparser_functions import parse_kkr_outputfile, check_error_category
from masci_tools.io.common_functions import search_string

__copyright__ = (u"Copyright (c), 2017, Forschungszentrum Jülich GmbH, "
"IAS-1/PGI-1, Germany. All rights reserved.")
Expand Down
4 changes: 2 additions & 2 deletions aiida_kkr/parsers/kkrimp.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from aiida.orm.data.parameter import ParameterData
from aiida_kkr.calculations.kkrimp import KkrimpCalculation
from aiida.common.exceptions import InputValidationError
from aiida_kkr.tools.kkrparser_functions import check_error_category
from masci_tools.io.parsers.kkrparser_functions import check_error_category
from aiida_kkr.tools.tools_kkrimp import kkrimp_parser_functions


Expand Down Expand Up @@ -129,7 +129,7 @@ def parse_with_retrieved(self, retrieved):
filepath = out_folder.get_abs_path(fname)
files['kkrflex_llyfac'] = filepath
except OSError:
file_errors.append((2, "Critical error! file '{}' not found ".format(fname)))
file_errors.append((2, "Warning! file '{}' not found ".format(fname)))
files['kkrflex_llyfac'] = None
try:
fname = self._calc._KKRFLEX_ANGLE
Expand Down
4 changes: 2 additions & 2 deletions aiida_kkr/parsers/voro.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from aiida.orm.data.parameter import ParameterData
from aiida_kkr.calculations.voro import VoronoiCalculation
from aiida.common.exceptions import InputValidationError
from aiida_kkr.tools.voroparser_functions import parse_voronoi_output
from masci_tools.io.parsers.voroparser_functions import parse_voronoi_output



Expand Down Expand Up @@ -125,4 +125,4 @@ def parse_with_retrieved(self, retrieved):

return success, node_list



27 changes: 27 additions & 0 deletions aiida_kkr/tests/codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
codecov:
notify:
require_ci_to_pass: yes

coverage:
precision: 2
round: down
range: "0...100"

status:
project: yes
patch: yes
changes: no

parsers:
gcov:
branch_detection:
conditional: yes
loop: yes
method: no
macro: no

comment:
layout: "header, diff"
behavior: default
require_changes: no

13 changes: 9 additions & 4 deletions aiida_kkr/tests/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,13 @@ computers:
queue_name: test_queue_name

codes:
tinpgen:
description: test inpgen code object
default_plugin: fleur.inpgen
voronoi:
description: test voronoi calculation
default_plugin: kkr.voro
remote_computer: localhost
remote_abspath: /Users/broeder/codes/fleur_git_v27/fleur/build/inpgen
remote_abspath: /Users/ruess/sourcecodes/voronoi/voronoi.exe
kkr:
description: test KKRhost calculation
default_plugin: kkr.kkr
remote_computer: localhost
remote_abspath: /Users/ruess/sourcecodes/KKRcode/kkr.x
Loading

0 comments on commit 8a2febe

Please sign in to comment.