Skip to content

Commit 1ff6f97

Browse files
authored
Merge branch 'hackingmaterials:main' into fix_magwf_static_2
2 parents 104e0a8 + 842641d commit 1ff6f97

File tree

239 files changed

+185056
-646
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

239 files changed

+185056
-646
lines changed

.circleci/config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
export PATH=$HOME/miniconda3/bin:$PATH
1616
conda create --name test_env python=3.8
1717
source activate test_env
18-
conda install -c conda-forge openbabel pymatgen
18+
conda install -c conda-forge openbabel gcc_linux-64
1919
pip install -r requirements-ci.txt
2020
pip install .
2121
no_output_timeout: 1h

.github/workflows/test.yml

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Testing
1+
name: Tests
22

33
on:
44
push:
@@ -18,11 +18,15 @@ jobs:
1818

1919
steps:
2020
- name: Checkout repo
21-
uses: actions/checkout@v2
21+
uses: actions/checkout@v3
2222

2323
- name: Setup Python
24-
uses: actions/setup-python@v2
24+
uses: actions/setup-python@v4
2525
with:
26+
cache: pip
27+
cache-dependency-path: |
28+
setup.py
29+
requirements-ci.txt
2630
python-version: 3.8
2731

2832
- name: Install OpenBabel
@@ -32,14 +36,6 @@ jobs:
3236
# https://github.com/openbabel/openbabel/issues/2408#issuecomment-1014466193
3337
sudo ln -s /usr/include/openbabel3 /usr/local/include/openbabel3
3438
35-
- name: Cache pip
36-
uses: actions/cache@v2
37-
with:
38-
path: ~/.cache/pip
39-
key: ${{ runner.os }}-pip-${{ hashFiles('requirements-ci.txt', 'setup.py') }}
40-
restore-keys: |
41-
${{ runner.os }}-pip-
42-
4339
- name: Install dependencies
4440
run: |
4541
pip install -r requirements-ci.txt

.pre-commit-config.yaml

Lines changed: 31 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,59 @@
1+
ci:
2+
autoupdate_schedule: quarterly
3+
skip: [mypy]
4+
5+
default_stages: [commit]
6+
7+
default_install_hook_types: [pre-commit, commit-msg]
8+
19
exclude: ^(docs/|.*test_files/|.*tests/)
210

311
repos:
4-
- repo: https://github.com/myint/autoflake
12+
- repo: https://github.com/PyCQA/autoflake
513
rev: v1.4
614
hooks:
715
- id: autoflake
8-
args: [--in-place, --remove-all-unused-imports, --remove-unused-variable, --ignore-init-module-imports]
916

1017
- repo: https://github.com/psf/black
11-
rev: 21.11b1
18+
rev: 22.6.0
1219
hooks:
1320
- id: black
1421

15-
- repo: https://github.com/pycqa/flake8
16-
rev: 4.0.1
22+
- repo: https://github.com/PyCQA/flake8
23+
rev: 5.0.4
1724
hooks:
1825
- id: flake8
19-
args: [--max-line-length=125]
26+
additional_dependencies: [flake8-bugbear]
27+
28+
- repo: https://github.com/pre-commit/mirrors-mypy
29+
rev: v0.971
30+
hooks:
31+
- id: mypy
32+
additional_dependencies: [types-requests]
2033

2134
- repo: https://github.com/pre-commit/pre-commit-hooks
22-
rev: v4.0.1
35+
rev: v4.3.0
2336
hooks:
37+
- id: check-case-conflict
38+
- id: check-symlinks
2439
- id: check-yaml
40+
- id: destroyed-symlinks
2541
- id: end-of-file-fixer
42+
- id: mixed-line-ending
2643
- id: trailing-whitespace
2744

2845
- repo: https://github.com/asottile/pyupgrade
29-
rev: v2.31.0
46+
rev: v2.37.3
3047
hooks:
3148
- id: pyupgrade
3249
args: [--py38-plus]
3350

51+
- repo: https://github.com/codespell-project/codespell
52+
rev: v2.2.1
53+
hooks:
54+
- id: codespell
55+
stages: [commit, commit-msg]
56+
3457
- repo: https://github.com/PyCQA/isort
3558
rev: 5.10.1
3659
hooks:

README.md

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,15 @@
1-
# <img alt="atomate" src="docs_rst/_static/atomate_logo_small.png" width="250">
1+
# <img alt="atomate" src="https://raw.githubusercontent.com/hackingmaterials/atomate/main/docs_rst/_static/atomate_logo_small.png" width="250">
2+
3+
[![Tests](https://github.com/hackingmaterials/atomate/actions/workflows/test.yml/badge.svg)](https://github.com/hackingmaterials/atomate/actions/workflows/test.yml)
4+
[![PyPI Downloads](https://img.shields.io/pypi/dm/atomate?label=PyPI%20Downloads)](https://pypi.org/project/atomate)
5+
[![PyPI](https://img.shields.io/pypi/v/atomate?logo=pypi&logoColor=white)](https://pypi.org/project/atomate)
6+
[![Requires Python 3.8+](https://img.shields.io/badge/Python-3.8+-blue.svg?logo=python&logoColor=white)](https://python.org/downloads)
27

38
atomate is a software for computational materials science that contains pre-built workflows to compute and analyze the properties of materials.
49

5-
- **Website (including documentation):** https://hackingmaterials.github.io/atomate/
6-
- **Help/Support:** https://discuss.matsci.org/c/atomate
7-
- **Source:** https://github.com/hackingmaterials/atomate
10+
- **Website (including documentation):** <https://hackingmaterials.github.io/atomate/>
11+
- **Help/Support:** <https://discuss.matsci.org/c/atomate>
12+
- **Source:** <https://github.com/hackingmaterials/atomate>
813

914
If you find atomate useful, please encourage its development by citing the following paper in your research output:
1015

atomate/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "1.0.2"
1+
__version__ = "1.0.3"

atomate/common/firetasks/glue_tasks.py

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,10 +95,17 @@ class CopyFilesFromCalcLoc(FiretaskBase):
9595
name_append (str): string to append to destination filenames.
9696
exclude_files (list): list of file names to be excluded. Accepts glob
9797
patterns.
98+
decompress (bool): if True, files are decompressed after copy.
9899
"""
99100

100101
required_params = ["calc_loc"]
101-
optional_params = ["filenames", "name_prepend", "name_append", "exclude_files"]
102+
optional_params = [
103+
"filenames",
104+
"name_prepend",
105+
"name_append",
106+
"exclude_files",
107+
"decompress",
108+
]
102109

103110
def run_task(self, fw_spec=None):
104111
calc_loc = get_calc_loc(self["calc_loc"], fw_spec["calc_locs"])
@@ -142,10 +149,15 @@ def run_task(self, fw_spec=None):
142149

143150
for f in files_to_copy:
144151
prev_path_full = os.path.join(calc_dir, f)
145-
dest_fname = self.get("name_prepend", "") + f + self.get("name_append", "")
152+
f, ext = os.path.splitext(f)
153+
dest_fname = (
154+
self.get("name_prepend", "") + f + self.get("name_append", "") + ext
155+
)
146156
dest_path = os.path.join(os.getcwd(), dest_fname)
147157

148158
fileclient.copy(prev_path_full, dest_path)
159+
if self.get("decompress", False):
160+
monty.shutil.decompress_file(dest_path)
149161

150162

151163
@explicit_serialize

atomate/common/powerups.py

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,14 +61,18 @@ def add_tags(original_wf, tags_list):
6161

6262
# WF metadata
6363
if "tags" in original_wf.metadata:
64-
original_wf.metadata["tags"].extend(tags_list)
64+
for t in tags_list:
65+
if t not in original_wf.metadata["tags"]:
66+
original_wf.metadata["tags"].append(t)
6567
else:
6668
original_wf.metadata["tags"] = tags_list
6769

6870
# FW metadata
6971
for idx_fw in range(len(original_wf.fws)):
7072
if "tags" in original_wf.fws[idx_fw].spec:
71-
original_wf.fws[idx_fw].spec["tags"].extend(tags_list)
73+
for t in tags_list:
74+
if t not in original_wf.fws[idx_fw].spec["tags"]:
75+
original_wf.fws[idx_fw].spec["tags"].append(t)
7276
else:
7377
original_wf.fws[idx_fw].spec["tags"] = tags_list
7478

@@ -77,9 +81,16 @@ def add_tags(original_wf, tags_list):
7781
for idx_fw, idx_t in idxs:
7882
if "additional_fields" in original_wf.fws[idx_fw].tasks[idx_t].optional_params:
7983
if "tags" in original_wf.fws[idx_fw].tasks[idx_t]["additional_fields"]:
80-
original_wf.fws[idx_fw].tasks[idx_t]["additional_fields"][
81-
"tags"
82-
].extend(tags_list)
84+
for t in tags_list:
85+
if (
86+
t
87+
not in original_wf.fws[idx_fw].tasks[idx_t][
88+
"additional_fields"
89+
]["tags"]
90+
):
91+
original_wf.fws[idx_fw].tasks[idx_t]["additional_fields"][
92+
"tags"
93+
].append(t)
8394
else:
8495
original_wf.fws[idx_fw].tasks[idx_t]["additional_fields"][
8596
"tags"

atomate/feff/workflows/tests/test_eels_workflows.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,8 @@
1414

1515
module_dir = os.path.dirname(os.path.abspath(__file__))
1616
db_dir = os.path.join(module_dir, "..", "..", "..", "common", "test_files")
17-
DEBUG_MODE = (
18-
False # If true, retains the database and output dirs at the end of the test
19-
)
17+
# If DEBUG_MODE = true, retains the database and output dirs at the end of the test
18+
DEBUG_MODE = False
2019

2120

2221
class TestEELSWorkflow(AtomateTest):

atomate/feff/workflows/tests/test_exafs_scattering_paths.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ def test_feff_input_sets(self):
4141
"nkpts": 1000,
4242
"radius": 10.0,
4343
"user_tag_settings": {},
44-
"structure": self.struct.as_dict(),
4544
}
4645
ans_fis_fw2 = {
4746
"@class": "MPEXAFSSet",
@@ -51,13 +50,14 @@ def test_feff_input_sets(self):
5150
"nkpts": 1000,
5251
"radius": 10.0,
5352
"user_tag_settings": {"CONTROL": "0 0 0 0 1 1", "PRINT": "0 0 0 1 0 3"},
54-
"structure": self.struct.as_dict(),
5553
}
5654
fis_fw1 = self.fw1_dict["spec"]["_tasks"][0]["feff_input_set"]
5755
fis_fw2 = self.fw2_dict["spec"]["_tasks"][1]["feff_input_set"]
5856

5957
fis_fw1.pop("@version")
6058
fis_fw2.pop("@version")
59+
fis_fw1.pop("structure")
60+
fis_fw2.pop("structure")
6161

6262
self.assertDictEqual(fis_fw1, ans_fis_fw1)
6363
self.assertDictEqual(fis_fw2, ans_fis_fw2)

atomate/feff/workflows/tests/test_xas_workflows.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,8 @@
1616
module_dir = os.path.dirname(os.path.abspath(__file__))
1717
db_dir = os.path.join(module_dir, "..", "..", "..", "common", "test_files")
1818

19-
DEBUG_MODE = (
20-
False # If true, retains the database and output dirs at the end of the test
21-
)
19+
# If DEBUG_MODE = true, retains the database and output dirs at the end of the test
20+
DEBUG_MODE = False
2221
FEFF_CMD = None # "feff"
2322

2423

0 commit comments

Comments
 (0)