Skip to content

Commit

Permalink
Merge pull request #361 from SCM-NV/rel
Browse files Browse the repository at this point in the history
REL: Prepare for Nano-QMFlows 0.12.3
  • Loading branch information
BvB93 authored Mar 11, 2022
2 parents 7e4d299 + cef0fea commit 25d4272
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 39 deletions.
13 changes: 6 additions & 7 deletions .github/workflows/pythonapp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ on:
pull_request:
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

jobs:
test:
name: ${{ matrix.os }}; py ${{ matrix.python-version }}; CP2K ${{ matrix.cp2k }}; gcc ${{ matrix.gcc }}; pre-release ${{ matrix.pre_release }}
Expand Down Expand Up @@ -74,11 +78,6 @@ jobs:
CP2K_DATA_DIR: /usr/share/cp2k/data

steps:
- name: Cancel Previous Runs
uses: styfle/[email protected]
with:
access_token: ${{ github.token }}

- uses: actions/checkout@v2

- name: Install CP2K
Expand Down Expand Up @@ -170,7 +169,7 @@ jobs:
python-version: "3.10"

- name: Install linters
run: pip install pydocstyle pycodestyle mypy qmflows "numpy>=1.21" types-pyyaml types-pkg_resources
run: pip install pydocstyle pycodestyle mypy qmflows "numpy>=1.21" types-pyyaml types-pkg_resources types-setuptools

- name: Python info
run: |
Expand All @@ -187,5 +186,5 @@ jobs:
run: pydocstyle nanoqm

- name: Run mypy
run: mypy nanoqm
run: mypy nanoqm setup.py
continue-on-error: true
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
# Change Log

# 0.12.3 (11/03/2022)

## Changed
* Do not hard code basis set names for compution of the HOMO index.
* Do not overwrite explicit `basis_set_file_name` and `potential_file_name` CP2K settings.
* Add the `basis_file_name` and `potential_file_name` options.
* Do not hard-code the `BASIS_MOLOPT` coefficients in the .hdf5 file.
* Always use the `-q` suffix when reading basis sets from .hdf5.
* Add settings for manual choice of XC functionals for GGA, MGGA and hybrids.
* Remove the upper version bound of noodles.
* Formally set the minimum python version to >= 3.7.


# 0.12.2 (17/11/2021)

## Changed
Expand Down
2 changes: 1 addition & 1 deletion nanoqm/__version__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
"""The Nano-QMFlows version."""

__version__ = '0.12.2'
__version__ = '0.12.3'
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[build-system]
# Minimum requirements for the build system to execute.
requires = ['Cython', 'setuptools', 'wheel', 'pybind11>=2.2.4']
requires = ['Cython', 'setuptools>=48.0', 'wheel', 'pybind11>=2.2.4']

[tool.mypy]
plugins = "numpy.typing.mypy_plugin"
Expand Down
50 changes: 20 additions & 30 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,22 @@
import os
import sys
from os.path import join
from typing import Dict, List, Tuple, TYPE_CHECKING
from typing import TYPE_CHECKING

import setuptools
from Cython.Distutils import build_ext
from setuptools import Extension, find_packages, setup

if TYPE_CHECKING:
from distutils.ccompiler import CCompiler
from distutils.errors import CompileError
else:
CCompiler = setuptools.distutils.ccompiler.CCompiler
CompileError = setuptools.distutils.errors.CompileError

here = os.path.abspath(os.path.dirname(__file__))

version: Dict[str, str] = {}
version: "dict[str, str]" = {}
with open(os.path.join(here, 'nanoqm', '__version__.py')) as f:
exec(f.read(), version)

Expand Down Expand Up @@ -51,7 +55,7 @@ def has_flag(compiler: "CCompiler", flagname: str) -> bool:
f.write('int main (int argc, char **argv) { return 0; }')
try:
compiler.compile([f.name], extra_postargs=[flagname])
except setuptools.distutils.errors.CompileError:
except CompileError:
return False
return True

Expand All @@ -62,7 +66,6 @@ def cpp_flag(compiler: "CCompiler") -> str:
The newer version is prefered over c++11 (when it is available).
"""
flags = ['-std=c++17', '-std=c++14', '-std=c++11']

for flag in flags:
if has_flag(compiler, flag):
return flag
Expand All @@ -74,11 +77,11 @@ def cpp_flag(compiler: "CCompiler") -> str:
class BuildExt(build_ext):
"""A custom build extension for adding compiler-specific options."""

c_opts: Dict[str, List[str]] = {
c_opts: "dict[str, list[str]]" = {
'msvc': ['/EHsc'],
'unix': [],
}
l_opts: Dict[str, List[str]] = {
l_opts: "dict[str, list[str]]" = {
'msvc': [],
'unix': [],
}
Expand Down Expand Up @@ -108,41 +111,28 @@ def build_extensions(self) -> None:
build_ext.build_extensions(self)


def get_includes() -> Tuple[str, str]:
"""Get the include directories of the ``eigen`` and ``libint`` C++ libraries.
# Set path to the conda libraries
conda_prefix = os.environ["CONDA_PREFIX"]
if conda_prefix is None:
raise RuntimeError(
"No conda module found. A Conda environment is required")

Use the paths specified in the ``$EIGEN3_INCLUDE_DIR`` and ``$LIBINT_INCLUDE_DIR``
environment variables if specified; use ``$CONDA_PREFIX`` otherwise.
"""
conda_prefix = os.environ.get("CONDA_PREFIX")
eigen_dir = os.environ.get("EIGEN3_INCLUDE_DIR")
libint_dir = os.environ.get("LIBINT_INCLUDE_DIR")
if conda_prefix is None and (None in (eigen_dir, libint_dir)):
raise RuntimeError(
"No conda module found. A Conda environment is required "
"or one must set both the `$EIGEN3_INCLUDE_DIR` and `$LIBINT_INCLUDE_DIR` "
"environment variables"
)

if conda_prefix is not None:
return join(conda_prefix, 'include', 'eigen3'), join(conda_prefix, 'include')
else:
return eigen_dir, libint_dir


eigen_include, libint_include = get_includes()
conda_include = join(conda_prefix, 'include')
conda_lib = join(conda_prefix, 'lib')
ext_pybind = Extension(
'compute_integrals',
sources=['libint/compute_integrals.cc'],
include_dirs=[
# Path to pybind11 headers
'libint/include',
libint_include,
eigen_include,
conda_include,
join(conda_include, 'eigen3'),
get_pybind_include(),
get_pybind_include(user=True),
'/usr/include/eigen3'
],
libraries=['hdf5', 'int2'],
library_dirs=[conda_lib],
language='c++',
)

Expand Down

0 comments on commit 25d4272

Please sign in to comment.