Skip to content

Commit

Permalink
Merge pull request #177 from atomec-project/develop
Browse files Browse the repository at this point in the history
Make new release 1.3.0
  • Loading branch information
timcallow committed May 9, 2023
2 parents 47327f6 + 7c00b66 commit f98caca
Show file tree
Hide file tree
Showing 13 changed files with 411 additions and 97 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/gh-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ on:

jobs:
python-style-checks:
runs-on: ubuntu-18.04
runs-on: ubuntu-22.04
steps:
- name: Check out repository
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Setup Python
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: '3.8'

Expand All @@ -36,13 +36,13 @@ jobs:

build-and-deploy-pages:
needs: python-style-checks
runs-on: ubuntu-18.04
runs-on: ubuntu-22.04
steps:
- name: Check out repository
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Setup Python
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: '3.8'

Expand Down
10 changes: 6 additions & 4 deletions .github/workflows/mirror.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,15 @@ on: [push, delete]

jobs:
mirror-to-CASUS:
runs-on: ubuntu-18.04
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: mirror-repository
uses: spyoungtech/mirror-action@v0.4.0
uses: spyoungtech/mirror-action@v0.6.0
with:
REMOTE: git@github.com:casus/atoMEC.git
REMOTE: 'ssh://git@github.com/casus/atoMEC.git'
GIT_SSH_PRIVATE_KEY: ${{ secrets.GIT_SSH_KEY }}
GIT_SSH_NO_VERIFY_HOST: "true"
DEBUG: "true"
6 changes: 3 additions & 3 deletions .github/workflows/publish-to-pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ on:
jobs:
build-n-publish:
name: Build and publish Python 🐍 distributions 📦 to PyPI and TestPyPI
runs-on: ubuntu-18.04
runs-on: ubuntu-22.04
steps:
- name: Check out repository
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Set up Python 3.8
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: '3.8'

Expand Down
31 changes: 17 additions & 14 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,38 +9,41 @@ on:
branches:
- master
- develop

jobs:
run-test-suite:
runs-on: ubuntu-18.04
runs-on: ubuntu-22.04
timeout-minutes: 15
steps:
- name: Check out repository
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Setup Python
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: '3.8'

- name: Upgrade pip
run: python3 -m pip install --upgrade pip

- name : Install pipenv
run : python -m pip install --upgrade pipenv
run : python3 -m pip install --upgrade pipenv

- id: cache-pipenv
uses: actions/cache@v1
uses: actions/cache@v3
with:
path: ~/.local/share/virtualenvs
key: ${{ runner.os }}-pipenv-${{ hashFiles('**/Pipfile.lock') }}

- name: Install dependencies
if: steps.cache-pipenv.outputs.cache-hit != 'true'
run: pipenv install --dev
run: pipenv --python 3.8 install --dev

- name: Install atoMEC
run: pipenv run python -m pip install -e .
run: pipenv run python3 -m pip install -e .

- name: Run test suite
run: pipenv run pytest --cov=atoMEC --random-order tests/
run: pipenv run pytest --cov=atoMEC --cov-report=xml --random-order tests/

- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
[![PyPI version](https://badge.fury.io/py/atoMEC.svg)](https://badge.fury.io/py/atoMEC)
[![Python 3.8](https://img.shields.io/badge/python-3.8-blue.svg)](https://www.python.org/downloads/release/python-380/)
[![codecov](https://codecov.io/gh/atomec-project/atoMEC/branch/develop/graph/badge.svg?token=V66CJJ3KPI)](https://codecov.io/gh/atomec-project/atoMEC)

atoMEC is a python-based average-atom code for simulations of high energy density phenomena such as in warm dense matter.
It is designed as an open-source and modular python package.
Expand Down
37 changes: 31 additions & 6 deletions atoMEC/check_inputs.py
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ def radius_to_dens(self, atom, radius):
# radius in cm
rad_cm = radius / unitconv.cm_to_bohr
# volume in cm
vol_cm = (4.0 * pi * rad_cm ** 3) / 3.0
vol_cm = (4.0 * pi * rad_cm**3) / 3.0
# atomic mass in g
mass_g = config.mp_g * atom.at_mass
# density in g cm^-3
Expand Down Expand Up @@ -752,10 +752,11 @@ def check_conv_params(input_params):
conv_params : dict of floats
dictionary of convergence parameters as follows:
{
`econv` (``float``) : convergence for total energy,
`nconv` (``float``) : convergence for density,
`vconv` (``float``) : convergence for electron number,
`eigtol` (``float``) : tolerance for eigenvalues
`econv` (``float``) : convergence for total energy,
`nconv` (``float``) : convergence for density,
`vconv` (``float``) : convergence for electron number,
`eigtol` (``float``) : tolerance for eigenvalues,
`bandtol` (``float``) : tolerance for n(l)max warning
}
Raises
Expand All @@ -765,7 +766,7 @@ def check_conv_params(input_params):
"""
conv_params = {}
# loop through the convergence parameters
for conv in ["econv", "nconv", "vconv", "eigtol"]:
for conv in ["econv", "nconv", "vconv", "eigtol", "bandtol"]:
# assign value if not given
try:
x_conv = input_params[conv]
Expand Down Expand Up @@ -1171,3 +1172,27 @@ def ngrid_warning(err1, err2):
" convergence \n"
)
return warning

def norbs_warning(quantum_num):
"""
Warn if either nmax or lmax is too low for convergence.
Parameters
----------
quantum_num : str
lmax or nmax
Returns
-------
warning : str
full error message
"""
warning = (
"Warning: "
+ quantum_num
+ " appears to be too low. Proceeding anyway, but suggest to increase "
+ quantum_num
+ " and restart calculation"
)

return warning
8 changes: 7 additions & 1 deletion atoMEC/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,13 @@
# numerical grid for static calculations
grid_params = {"ngrid": 1000, "x0": -12, "ngrid_coarse": 300}
# convergence parameters for static calculations
conv_params = {"econv": 1.0e-5, "nconv": 1.0e-4, "vconv": 1.0e-4, "eigtol": 1.0e-4}
conv_params = {
"econv": 1.0e-5,
"nconv": 1.0e-4,
"vconv": 1.0e-4,
"eigtol": 1.0e-4,
"bandtol": 1.0e-3,
}
# scf parameters
scf_params = {"maxscf": 50, "mixfrac": 0.3}
# band parameters for massacrier band model
Expand Down
5 changes: 4 additions & 1 deletion atoMEC/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,8 @@ def CalcEnergy(
`econv` (``float``) : convergence for total energy,
`nconv` (``float``) : convergence for density,
`vconv` (``float``) : convergence for electron number,
`eigtol` (``float``) : convergence for eigenvalues
`eigtol` (``float``) : convergence for eigenvalues,
`bandtol` (``float``) : tolerance for n(l)max warning
}
scf_params : dict, optional
dictionary for scf cycle parameters as follows:
Expand Down Expand Up @@ -458,6 +459,7 @@ def CalcPressure(
write_info=False,
verbosity=0,
dR=0.01,
method="A",
):
r"""
Calculate the electronic pressure using the finite differences method.
Expand Down Expand Up @@ -523,6 +525,7 @@ def CalcPressure(
write_info,
verbosity,
dR,
method,
)

return P_e
Loading

0 comments on commit f98caca

Please sign in to comment.