Skip to content

Commit

Permalink
List covalent atomic radii
Browse files Browse the repository at this point in the history
  • Loading branch information
LaurentRDC committed Jun 30, 2021
1 parent fa4a329 commit 8bada9c
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ jobs:
run: |
python setup.py install
cd ~
python -Wa -m pytest --pyargs crystals
python -Wa -m pytest --pyargs crystals --full-trace
- name: Build documentation
run: |
Expand Down
2 changes: 2 additions & 0 deletions crystals/atom_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -517,6 +517,8 @@

# from Cordero et al, 'Covalent radii revisited' (2008).
# Dalton Transactions. DOI: 10.1039/B801115J
# TODO: implement bond perception based on something like this:
# https://www.ncbi.nlm.nih.gov/pmc/articles/PMC3557220/
covalent_radii = {
"H": 0.31,
"He": 0.28,
Expand Down
7 changes: 6 additions & 1 deletion crystals/parsers.py
Original file line number Diff line number Diff line change
Expand Up @@ -939,7 +939,12 @@ def download_cif(self, api_key, query, download_dir, overwrite=False):
}

with requests.get(endpoint, headers=headers) as response:
if response.status_code != 200:
if response.status_code == 403: # Forbidden access
raise ConnectionError(
"Materials Project API key is not authorized to do this operation."
/ f"status code {response.status_code}"
)
elif response.status_code != 200:
raise ConnectionError(
f"Would not connect: status code {response.status_code}"
)
Expand Down
6 changes: 3 additions & 3 deletions crystals/tests/test_parsers.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
else:
WITH_BIOPYTHON = True

# API key to test Materails Project-related things
# API key to test Materials Project-related things
MPJ_API_KEY = os.environ.get("MATERIALS_PROJECT_API_KEY", None)

CIF_FILES = [Crystal.from_database(name).source for name in Crystal.builtins]
Expand Down Expand Up @@ -201,7 +201,7 @@ def test_cif_site_occupancy():
for atm in filter(is_element("C"), atoms):
assert atm.occupancy == 0.85


@pytest.mark.xfail(reason="Bad SSL certificates")
@pytest.mark.skipif(
MPJ_API_KEY is None,
reason="Materials Project API key not defined in the environment.",
Expand All @@ -218,7 +218,7 @@ def test_mpj_example():
)
assert isinstance(cryst, Crystal)


@pytest.mark.xfail(reason="Bad SSL certificates")
@pytest.mark.skipif(
MPJ_API_KEY is None,
reason="Materials Project API key not defined in the environment.",
Expand Down

0 comments on commit 8bada9c

Please sign in to comment.