-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
87d339e
commit dd0f3da
Showing
3 changed files
with
110 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
channels: | ||
- conda-forge | ||
dependencies: | ||
- siesta =4.1.5 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
name: Siesta Unittest Linux 3.11 | ||
|
||
on: | ||
push: | ||
branches: [ main ] | ||
pull_request: | ||
branches: [ main ] | ||
|
||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
CODACY_PROJECT_TOKEN: ${{ secrets.CODACY_PROJECT_TOKEN }} | ||
|
||
jobs: | ||
build: | ||
|
||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Merge Notebook environment | ||
run: | | ||
python .ci_support/condamerge.py --base .ci_support/environment.yml --add .ci_support/environment-siesta.yml > environment.yml | ||
- name: Setup Mambaforge | ||
uses: conda-incubator/setup-miniconda@v2 | ||
with: | ||
python-version: '3.11' | ||
miniforge-variant: Mambaforge | ||
channels: conda-forge | ||
channel-priority: strict | ||
activate-environment: my-env | ||
use-mamba: true | ||
- name: Update environment | ||
run: mamba env update -n my-env -f environment.yml | ||
- name: Setup | ||
shell: bash -l {0} | ||
run: | | ||
pip install --no-deps . | ||
- name: Test | ||
shell: bash -l {0} | ||
timeout-minutes: 30 | ||
run: python -m unittest tests/test_evcurve_siesta.py |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
import os | ||
import shutil | ||
|
||
from ase.build import bulk | ||
from ase.calculators.siesta import Siesta | ||
from ase.units import Ry | ||
import unittest | ||
|
||
from atomistics.calculators.ase import evaluate_with_ase | ||
from atomistics.workflows.evcurve.workflow import EnergyVolumeCurveWorkflow | ||
|
||
|
||
siesta_command = "siesta" | ||
if shutil.which(siesta_command) is not None: | ||
skip_siesta_test = False | ||
else: | ||
skip_siesta_test = True | ||
|
||
|
||
def validate_fitdict(fit_dict): | ||
lst = [ | ||
fit_dict['b_prime_eq'] > 3.0, | ||
fit_dict['b_prime_eq'] < 9.0, | ||
fit_dict['bulkmodul_eq'] > 52, | ||
fit_dict['bulkmodul_eq'] < 60, | ||
fit_dict['energy_eq'] > -2148.2, | ||
fit_dict['energy_eq'] < -2148.1, | ||
fit_dict['volume_eq'] > 70, | ||
fit_dict['volume_eq'] < 71, | ||
] | ||
if not all(lst): | ||
print(fit_dict) | ||
return lst | ||
|
||
|
||
@unittest.skipIf( | ||
skip_siesta_test, "siesta is not installed, so the siesta tests are skipped." | ||
) | ||
class TestEvCurve(unittest.TestCase): | ||
def test_calc_evcurve(self): | ||
calculator = EnergyVolumeCurveWorkflow( | ||
structure=bulk("Al", a=4.15, cubic=True), | ||
num_points=11, | ||
fit_type='polynomial', | ||
fit_order=3, | ||
vol_range=0.05, | ||
axes=['x', 'y', 'z'], | ||
strains=None, | ||
) | ||
structure_dict = calculator.generate_structures() | ||
result_dict = evaluate_with_ase( | ||
task_dict=structure_dict, | ||
ase_calculator=Siesta( | ||
label="siesta", | ||
xc="PBE", | ||
mesh_cutoff=200 * Ry, | ||
energy_shift=0.01 * Ry, | ||
basis_set="DZ", | ||
kpts=(5, 5, 5), | ||
fdf_arguments={"DM.MixingWeight": 0.1, "MaxSCFIterations": 100}, | ||
pseudo_path=os.path.abspath("static/siesta"), | ||
pseudo_qualifier="", | ||
) | ||
) | ||
fit_dict = calculator.analyse_structures(output_dict=result_dict) | ||
self.assertTrue(all(validate_fitdict(fit_dict=fit_dict))) |