Skip to content

Commit 20d4f2b

Browse files
authored
Merge pull request #166 from pyiron/main
Merge main
2 parents b2831c3 + 7cc3ad7 commit 20d4f2b

26 files changed

+1715
-394
lines changed

.ci_support/environment-lammps.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
channels:
2+
- conda-forge
3+
dependencies:
4+
- lammps =2023.11.21

.ci_support/environment.yml

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,20 @@
11
channels:
22
- conda-forge
33
dependencies:
4-
- aimsgb =1.1.0
4+
- aimsgb =1.1.1
55
- ase =3.22.1
66
- coverage
7-
- matplotlib-base =3.8.2
8-
- nglview =3.1.1
7+
- dscribe =2.1.0
8+
- matplotlib-base =3.8.4
9+
- nglview =3.1.2
910
- notebook
10-
- numpy =1.26.3
11-
- phonopy =2.21.0
12-
- plotly =5.18.0
13-
- pymatgen =2024.1.27
11+
- numpy =1.26.4
12+
- phonopy =2.22.1
13+
- plotly =5.19.0
14+
- pymatgen =2024.3.1
1415
- pyscal =2.10.18
1516
- pyxtal =0.6.2
16-
- scikit-learn =1.4.0
17-
- scipy =1.12.0
18-
- spglib =2.3.0
17+
- scikit-learn =1.4.2
18+
- scipy =1.13.0
19+
- spglib =2.4.0
1920
- sqsgenerator =0.3

.ci_support/environment_mini.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@ channels:
33
dependencies:
44
- ase =3.22.1
55
- coverage
6-
- numpy =1.26.3
7-
- scipy =1.12.0
6+
- numpy =1.26.4
7+
- scipy =1.13.0

.github/dependabot.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,5 @@ updates:
33
- package-ecosystem: pip
44
directory: "/"
55
schedule:
6-
interval: weekly
7-
day: monday
8-
open-pull-requests-limit: 10
6+
interval: "daily"
7+
open-pull-requests-limit: 10

.github/workflows/unittests.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,9 @@ jobs:
5151

5252
steps:
5353
- uses: actions/checkout@v4
54+
- name: Merge conda environment
55+
if: matrix.operating-system != 'windows-latest'
56+
run: tail --lines=+4 .ci_support/environment-lammps.yml >> .ci_support/environment.yml
5457
- name: Setup Mambaforge
5558
uses: conda-incubator/setup-miniconda@v2
5659
with:
@@ -67,7 +70,7 @@ jobs:
6770
run: |
6871
pip install versioneer[toml]==0.29
6972
pip install . --no-deps --no-build-isolation
70-
coverage run --omit structuretoolkit/_version.py -m unittest discover tests
73+
coverage run --omit="structuretoolkit/_version.py,tests/*" -m unittest discover tests
7174
- name: Coverage
7275
if: matrix.label == 'linux-64-py-3-12'
7376
uses: coverallsapp/github-action@v2

pyproject.toml

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ classifiers = [
2525
]
2626
dependencies = [
2727
"ase==3.22.1",
28-
"numpy==1.26.3",
29-
"scipy==1.12.0",
28+
"numpy==1.26.4",
29+
"scipy==1.13.0",
3030
]
3131
dynamic = ["version"]
3232

@@ -36,23 +36,24 @@ Documentation = "https://github.com/pyiron/structuretoolkit"
3636
Repository = "https://github.com/pyiron/structuretoolkit"
3737

3838
[project.optional-dependencies]
39+
dscribe = ["dscribe==2.1.0"]
3940
grainboundary = [
40-
"aimsgb==1.1.0",
41-
"pymatgen==2024.1.27",
41+
"aimsgb==1.1.1",
42+
"pymatgen==2024.3.1",
4243
]
4344
pyscal = ["pyscal2==2.10.18"]
44-
nglview = ["nglview==3.1.1"]
45-
matplotlib = ["matplotlib==3.8.2"]
46-
plotly = ["plotly==5.18.0"]
47-
clusters = ["scikit-learn==1.4.0"]
48-
symmetry = ["spglib==2.3.0"]
45+
nglview = ["nglview==3.1.2"]
46+
matplotlib = ["matplotlib==3.8.4"]
47+
plotly = ["plotly==5.19.0"]
48+
clusters = ["scikit-learn==1.4.2"]
49+
symmetry = ["spglib==2.4.0"]
4950
surface = [
50-
"spglib==2.3.0",
51-
"pymatgen==2024.1.27",
51+
"spglib==2.4.0",
52+
"pymatgen==2024.3.1",
5253
]
5354
phonopy = [
54-
"phonopy==2.21.0",
55-
"spglib==2.3.0",
55+
"phonopy==2.22.1",
56+
"spglib==2.4.0",
5657
]
5758
pyxtal = ["pyxtal==0.6.2"]
5859

structuretoolkit/analyse/__init__.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import numpy as np
22

33
from structuretoolkit.analyse.distance import find_mic, get_distances_array
4+
from structuretoolkit.analyse.dscribe import soap_descriptor_per_atom
45
from structuretoolkit.analyse.neighbors import get_neighborhood, get_neighbors
56
from structuretoolkit.analyse.phonopy import get_equivalent_atoms
67
from structuretoolkit.analyse.pyscal import (
@@ -22,6 +23,11 @@
2223
get_voronoi_vertices,
2324
)
2425
from structuretoolkit.analyse.strain import get_strain
26+
from structuretoolkit.analyse.snap import (
27+
get_snap_descriptor_names,
28+
get_snap_descriptors_per_atom,
29+
get_snap_descriptor_derivatives,
30+
)
2531

2632

2733
def get_symmetry(

structuretoolkit/analyse/distance.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,15 @@
1+
from typing import Optional
2+
from ase.atoms import Atoms
13
import numpy as np
24

35

4-
def get_distances_array(structure, p1=None, p2=None, mic=True, vectors=False):
6+
def get_distances_array(
7+
structure: Atoms,
8+
p1: Optional[np.ndarray] = None,
9+
p2: Optional[np.ndarray] = None,
10+
mic: bool = True,
11+
vectors: bool = False,
12+
):
513
"""
614
Return distance matrix of every position in p1 with every position in
715
p2. If p2 is not set, it is assumed that distances between all
@@ -39,7 +47,7 @@ def get_distances_array(structure, p1=None, p2=None, mic=True, vectors=False):
3947
return find_mic(structure=structure, v=diff_relative, vectors=vectors)
4048

4149

42-
def find_mic(structure, v, vectors=True):
50+
def find_mic(structure: Atoms, v: np.ndarray, vectors: bool = True):
4351
"""
4452
Find vectors following minimum image convention (mic). In principle this
4553
function does the same as ase.geometry.find_mic

structuretoolkit/analyse/dscribe.py

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
import numpy as np
2+
from ase.atoms import Atoms
3+
from typing import Optional
4+
5+
6+
def soap_descriptor_per_atom(
7+
structure: Atoms,
8+
r_cut: Optional[float] = None,
9+
n_max: Optional[int] = None,
10+
l_max: Optional[int] = None,
11+
sigma: Optional[float] = 1.0,
12+
rbf: str = "gto",
13+
weighting: Optional[np.ndarray] = None,
14+
average: str = "off",
15+
compression: dict = {"mode": "off", "species_weighting": None},
16+
species: Optional[list] = None,
17+
periodic: bool = True,
18+
sparse: bool = False,
19+
dtype: str = "float64",
20+
centers: Optional[np.ndarray] = None,
21+
n_jobs: int = 1,
22+
only_physical_cores: bool = False,
23+
verbose: bool = False,
24+
) -> np.ndarray:
25+
from dscribe.descriptors import SOAP
26+
27+
if species is None:
28+
species = list(set(structure.get_chemical_symbols()))
29+
periodic_soap = SOAP(
30+
r_cut=r_cut,
31+
n_max=n_max,
32+
l_max=l_max,
33+
sigma=sigma,
34+
rbf=rbf,
35+
weighting=weighting,
36+
average=average,
37+
compression=compression,
38+
species=species,
39+
periodic=periodic,
40+
sparse=sparse,
41+
dtype=dtype,
42+
)
43+
return periodic_soap.create(
44+
system=structure,
45+
centers=centers,
46+
n_jobs=n_jobs,
47+
only_physical_cores=only_physical_cores,
48+
verbose=verbose,
49+
)

0 commit comments

Comments
 (0)