Skip to content

Commit

Permalink
Merge pull request #81 from albgar/Rel1.1.1
Browse files Browse the repository at this point in the history
Rel1.1.1
  • Loading branch information
bosonie authored Nov 7, 2020
2 parents 4d835ad + 4ed023f commit acf1214
Show file tree
Hide file tree
Showing 51 changed files with 3,764 additions and 210 deletions.
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
aiida_siesta/docs/* linguist-documentation
.ipynb linguist-documentation
81 changes: 81 additions & 0 deletions .github/workflows/develop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
name: Nightly Build

on:
schedule:
- cron: '0 0 * * *' # Run every day at midnight

jobs:

tests:

if: github.repository == 'albgar/aiida_siesta_plugin' # Prevent running the builds on forks as well

runs-on: ubuntu-latest

strategy:
matrix:
python-version: [3.6, 3.7, 3.8]

services:
postgres:
image: postgres:10
env:
POSTGRES_DB: test_${{ matrix.backend }}
POSTGRES_PASSWORD: ''
POSTGRES_HOST_AUTH_METHOD: trust
ports:
- 5432:5432
rabbitmq:
image: rabbitmq:latest
ports:
- 5672:5672

steps:
- uses: actions/checkout@v2

- name: Cache python dependencies
id: cache-pip
uses: actions/cache@v1
with:
path: ~/.cache/pip
key: pip-${{ matrix.python-version }}-tests-${{ hashFiles('**/setup.json') }}
restore-keys:
pip-${{ matrix.python-version }}-tests

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}

- name: Install system dependencies
run: |
sudo apt update
sudo apt install postgresql-10
- name: Install python dependencies
continue-on-error: true
id: install
run: |
pip install --upgrade setuptools
pip install -e .[tests]
pip install git+https://github.com/aiidateam/aiida-core@develop
reentry scan
- name: Run pytest
continue-on-error: true
id: tests
run:
pytest -sv tests

- name: Slack notification
if: steps.install.outcome == 'Failure' || steps.tests.outcome == 'Failure'
uses: rtCamp/action-slack-notify@master
env:
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
SLACK_ICON: https://www.materialscloud.org/discover/images/0ba0a17d.aiida-logo-128.png
SLACK_USERNAME: aiida-siesta
SLACK_CHANNEL: actions
SLACK_COLOR: b60205
SLACK_TITLE: "Nightly build against `aiida-core/develop` failed"
SLACK_MESSAGE: "The tests fail with the current version of `aiida-core/develop`."

24 changes: 24 additions & 0 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# .readthedocs.yml
# Read the Docs configuration file
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details

# Required
version: 2

# Build documentation in the docs/ directory with Sphinx
sphinx:
configuration: aiida_siesta/docs/conf.py

# Build documentation with MkDocs
#mkdocs:
# configuration: mkdocs.yml

# Optionally build your docs in additional formats such as PDF
formats:
- pdf

# Optionally set the version of Python and requirements required to build your docs
python:
version: 3.7
install:
- requirements: aiida_siesta/docs/requirements.txt
41 changes: 41 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,46 @@
# Changelog

## v1.1.1

Version compatible with aiida-core>=1.3.0,<2.0.0.

### Improvements
- Improvement in the `BandGapWorkChain`. A new feature has been introduced:
when no `bandskpoints` are set in input, the workchain automatically calculates the bands
using a k-space path automatically selected by SeeK-path.
In particular, if a molecular dynamics run was also requested (usually a relaxation),
the dynamics is run first and the bands are calculated on a separate Siesta run. This
allows to select the k-space path for bands automatically using the output structure.
When the `bandskpoints` is selected in input, the behavior is the same of previous versions.
- Added an output of the `SiestaSequentialConverger` listing, if any,
the unconverged parameters. More explicit warnings are returned when a parameter
does not converge.
- A tutorial is now available in the documentation, covering the submission of simple siesta
calculations, the use of protocols, the use of the iterator/converger workchains and
a simple example on how to create custom workchains.

### Bug fixes
- A bug was reported regarding the wrong selection of the kpoints path for bands
when a relaxation with variable cell was also requested. The energy values were correct,
but the distance between kpoints was not corresponding to the one of the Siesta
file ".bands". The bug is now fixed.
- The method `inputs_generator().get_inputs_dict` (available for `SiestaCalculations` and
all the workchains in the package) had a minor bug. In case the kpoints or bandskpoints
were not requested, the dictionary was anyway returning items for "bandskpoints"
and "kpoints" with value "None". This has been fixed.
The method `inputs_generator().get_filled_builder` was instead correct.
- A bug was leading to the failure of `SiestaSequentialConverger` in case one of
the parameters to coverge in the sequential process was not reacing convergence.
It is now fixed and, in addition, an output listing the unconverged parameters has been
added.

### For developers
- Set up a nightly built in GitHub actions that tests the plugin (run all its tests)
against the develop branch of `aiida-core`.
- The `BandGapWorkChain` has been refactored almost entirely.
- The abstract class `SequentialConverger` has been modified to fix the bug
of `SiestaSequentialConverger` described above.

## v1.1.0

Version compatible with aiida-core>=1.3.0,<2.0.0. Previous versions of aiida-core do not have a working `BaseRestartWorkChain`, which is the building piece of many workchain in aiida-siesta.
Expand Down
4 changes: 3 additions & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
include *.rst *.json *.txt *.md
include *.rst *.json *.txt *.md *.yml
recursive-include aiida_siesta/docs/ *.rst
recursive-include aiida_siesta/examples/ *.txt *.psf *.psml *.cif 00_README
recursive-include aiida_siesta/utils *.yaml
prune tests
prune aiida_siesta/docs/tutorialis/first_workchain
prune aiida_siesta/docs/tutorialis/data_icn2_2020
2 changes: 1 addition & 1 deletion aiida_siesta/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
"""The official AiiDA plugin for Siesta."""
__version__ = '1.1.0'
__version__ = '1.1.1'
74 changes: 51 additions & 23 deletions aiida_siesta/calculations/siesta.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,17 @@ class SiestaCalculation(CalcJob):
###################################################################

# Parameters stored as class variables
# 1) Keywords that cannot be set (need to canonoze this?)
# 1) Keywords that cannot be set (already canonized by FDFDict)
# 2) Filepaths of certain outputs
_aiida_blocked_keywords = ['system-name', 'system-label']
_aiida_blocked_keywords.append('number-of-species')
_aiida_blocked_keywords.append('number-of-atoms')
_aiida_blocked_keywords.append('lattice-constant')
_aiida_blocked_keywords.append('atomic-coordinates-format')
_aiida_blocked_keywords.append('use-tree-timer')
_aiida_blocked_keywords.append('xml-write')
_aiida_blocked_keywords.append('dm-use-save-dm')
_aiida_blocked_keywords.append('geometry-must-converge')
_aiida_blocked_keywords = [FDFDict.translate_key('system-name'), FDFDict.translate_key('system-label')]
_aiida_blocked_keywords.append(FDFDict.translate_key('number-of-species'))
_aiida_blocked_keywords.append(FDFDict.translate_key('number-of-atoms'))
_aiida_blocked_keywords.append(FDFDict.translate_key('lattice-constant'))
_aiida_blocked_keywords.append(FDFDict.translate_key('atomic-coordinates-format'))
_aiida_blocked_keywords.append(FDFDict.translate_key('use-tree-timer'))
_aiida_blocked_keywords.append(FDFDict.translate_key('xml-write'))
_aiida_blocked_keywords.append(FDFDict.translate_key('dm-use-save-dm'))
_aiida_blocked_keywords.append(FDFDict.translate_key('geometry-must-converge'))
_PSEUDO_SUBFOLDER = './'
_OUTPUT_SUBFOLDER = './'
_JSON_FILE = 'time.json'
Expand Down Expand Up @@ -169,19 +169,17 @@ def prepare_for_submission(self, folder): # noqa: MC0001 - is mccabe too compl
input_params = FDFDict(parameters.get_dict())

# Look for blocked keywords and add the proper values to the dictionary
for blocked_key in self._aiida_blocked_keywords:
canonical_blocked = FDFDict.translate_key(blocked_key)
for key in input_params:
if key == canonical_blocked:
raise InputValidationError(
"You cannot specify explicitly the '{}' flag in the "
"input parameters".format(input_params.get_last_untranslated_key(key))
)
if "pao" in key:
raise InputValidationError(
"You can not put PAO options in the parameters input port "
"they belong to the basis input port "
)
for key in input_params:
if "pao" in key:
raise InputValidationError(
"You can not put PAO options in the parameters input port "
"they belong to the basis input port "
)
if key in self._aiida_blocked_keywords:
raise InputValidationError(
"You cannot specify explicitly the '{}' flag in the "
"input parameters".format(input_params.get_last_untranslated_key(key))
)

input_params.update({'system-name': self.inputs.metadata.options.prefix})
input_params.update({'system-label': self.inputs.metadata.options.prefix})
Expand Down Expand Up @@ -286,13 +284,43 @@ def prepare_for_submission(self, folder): # noqa: MC0001 - is mccabe too compl
#BandLinesScale =pi/a is not supported at the moment because currently
#a=1 always. BandLinesScale ReciprocalLatticeVectors is always set
if bandskpoints is not None:
#first, we check that the user constracted the kpoints using the cell
#of the input structure, and not a random cell. This helps parsing
kpcell = bandskpoints.get_attribute("cell", None)
if kpcell:
if kpcell != structure.cell:
raise ValueError(
'The cell used for `bandskpoints` must be the same of the input structure.'
'Alternatively do not set any cell to the bandskpoints.'
)
#second we rise a warning about consequences when the cell is relaxed
var_cell_keys = [FDFDict.translate_key("md-variable-cell"), FDFDict.translate_key("md-constant-volume")]
var_cell_keys.append(FDFDict.translate_key("md-relax-cell-only"))
for key in input_params:
if key in var_cell_keys:
logline = (
"Requested calculation of bands after a relaxation with variable cell! " +
"If the symmetry of the cell will change, the kpoints path for bands will be wrong. " +
"It is suggested to use the `BandGapWorkChain` instead."
)
if isinstance(input_params[key], str):
if FDFDict.translate_key(input_params[key]) in ["t", "true", "yes"]:
self.logger.warning(logline)
break
else:
if input_params[key] is True:
self.logger.warning(logline)
break
#the band line scale
bandskpoints_card_list = ["BandLinesScale ReciprocalLatticeVectors\n"]
#set the BandPoints
if bandskpoints.labels is None:
bandskpoints_card_list.append("%block BandPoints\n")
for kpo in bandskpoints.get_kpoints():
bandskpoints_card_list.append("{0:8.3f} {1:8.3f} {2:8.3f} \n".format(kpo[0], kpo[1], kpo[2]))
fbkpoints_card = "".join(bandskpoints_card_list)
fbkpoints_card += "%endblock BandPoints\n"
#set the BandLines
else:
bandskpoints_card_list.append("%block BandLines\n")
savindx = []
Expand Down
4 changes: 2 additions & 2 deletions aiida_siesta/calculations/tkdict.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,12 @@ def __init__(self, inp_dict=None): #*args, **kw):
# _storage is internal dictionary stored as: {<translated_key>: (<value>, <initial_key>), }
self._storage = {}

if inp_dict:
if inp_dict is not None:
if not isinstance(inp_dict, dict):
message = 'invalid argument for `{}`: it only accepts a dictionary'.format(self.__class__.__name__)
raise RuntimeError(message)

if inp_dict:
if inp_dict is not None:
for inp_key in inp_dict:
self[inp_key] = inp_dict[inp_key]

Expand Down
2 changes: 1 addition & 1 deletion aiida_siesta/data/psf.py
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,7 @@ def get_psf_groups(cls, filter_elements=None, user=None):
query = QueryBuilder()
query.append(PsfFamily, tag='group', project='*')

if user:
if user is not None:
query.append(User, filters={'email': {'==': user}}, with_group='group')

if isinstance(filter_elements, str):
Expand Down
2 changes: 1 addition & 1 deletion aiida_siesta/data/psml.py
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,7 @@ def get_psml_groups(cls, filter_elements=None, user=None):

query.append(PsmlFamily, tag='group', project='*')

if user:
if user is not None:
query.append(User, filters={'email': {'==': user}}, with_group='group')

if isinstance(filter_elements, str):
Expand Down
5 changes: 3 additions & 2 deletions aiida_siesta/docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = [
'sphinx_copybutton',
"sphinx_rtd_theme",
'sphinx.ext.viewcode',
'sphinx.ext.githubpages',
Expand Down Expand Up @@ -70,9 +71,9 @@
# built documents.
#
# The short X.Y version.
version = u'1.1.0'
version = u'1.1.1'
# The full version, including alpha/beta/rc tags.
release = u'1.1.0'
release = u'1.1.1'

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
Expand Down
9 changes: 9 additions & 0 deletions aiida_siesta/docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,15 @@ Workflows
workflows/index
..
Tutorials
=========

.. toctree::
:maxdepth: 4

tutorials/index



Indices and tables
==================
Expand Down
Loading

0 comments on commit acf1214

Please sign in to comment.