Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
9738ea5
Updates to pyxtal
jan-janssen Jul 19, 2023
2aecef2
Separate minimal environment and full environment
jan-janssen Jul 19, 2023
9d60033
Separate minimal environment and full environment
jan-janssen Jul 19, 2023
d58c6fe
Add dependabot
jan-janssen Jul 19, 2023
fb6a06d
Merge pull request #28 from pyiron/dependabo
jan-janssen Jul 19, 2023
9050d57
Bump aimsgb from 0.1.3 to 1.0.1
dependabot[bot] Jul 19, 2023
1d538ae
Bump plotly from 5.14.1 to 5.15.0
dependabot[bot] Jul 19, 2023
32ab2ed
Bump phonopy from 2.19.1 to 2.20.0
dependabot[bot] Jul 19, 2023
8c6e60f
Bump numpy from 1.24.3 to 1.25.1
dependabot[bot] Jul 19, 2023
5345ccf
Bump scikit-learn from 1.2.2 to 1.3.0
dependabot[bot] Jul 19, 2023
2390f62
Bump pymatgen from 2023.5.31 to 2023.7.17
dependabot[bot] Jul 19, 2023
e17a674
Bump nglview from 3.0.5 to 3.0.6
dependabot[bot] Jul 19, 2023
98386a5
Bump matplotlib from 3.7.1 to 3.7.2
dependabot[bot] Jul 19, 2023
41ceaf1
Update environment.yml
jan-janssen Jul 19, 2023
4422f40
Update environment.yml
jan-janssen Jul 19, 2023
69ff51a
Update environment.yml
jan-janssen Jul 19, 2023
c62d299
Update environment.yml
jan-janssen Jul 19, 2023
7e685a5
Update environment.yml
jan-janssen Jul 19, 2023
4e085e9
Update environment.yml
jan-janssen Jul 19, 2023
1893e52
Update environment.yml
jan-janssen Jul 19, 2023
69d0fe0
Update environment.yml
jan-janssen Jul 19, 2023
4a76a37
Merge pull request #27 from pyiron/minimal_test_fix
jan-janssen Jul 19, 2023
109267b
Drop Python 3.8
jan-janssen Jul 19, 2023
781390b
Merge pull request #29 from pyiron/dependabot/pip/aimsgb-1.0.1
jan-janssen Jul 19, 2023
db5dffe
Merge pull request #32 from pyiron/dependabot/pip/phonopy-2.20.0
jan-janssen Jul 19, 2023
ede4dc8
Merge pull request #34 from pyiron/dependabot/pip/scikit-learn-1.3.0
jan-janssen Jul 19, 2023
337f7c3
Merge branch 'main' into dependabot/pip/plotly-5.15.0
jan-janssen Jul 19, 2023
31f7ee3
Merge pull request #30 from pyiron/dependabot/pip/plotly-5.15.0
jan-janssen Jul 19, 2023
7f41366
Merge branch 'main' into dependabot/pip/nglview-3.0.6
jan-janssen Jul 19, 2023
73169a5
Merge pull request #37 from pyiron/dependabot/pip/matplotlib-3.7.2
jan-janssen Jul 19, 2023
944eff9
Merge pull request #39 from pyiron/drop_python_38
jan-janssen Jul 19, 2023
aafe35f
Merge branch 'main' into dependabot/pip/pymatgen-2023.7.17
jan-janssen Jul 19, 2023
2020259
Bump scipy from 1.10.1 to 1.11.1
dependabot[bot] Jul 19, 2023
809a621
Merge branch 'main' into dependabot/pip/numpy-1.25.1
jan-janssen Jul 19, 2023
ebf1fc4
Update environment.yml
jan-janssen Jul 19, 2023
4fcb954
Update environment_mini.yml
jan-janssen Jul 19, 2023
d9c6c7f
Merge pull request #33 from pyiron/dependabot/pip/numpy-1.25.1
jan-janssen Jul 20, 2023
7d121bb
Merge pull request #35 from pyiron/dependabot/pip/pymatgen-2023.7.17
jan-janssen Jul 20, 2023
3b75196
Merge branch 'main' into dependabot/pip/nglview-3.0.6
jan-janssen Jul 20, 2023
e931cf2
Merge branch 'main' into dependabot/pip/scipy-1.11.1
jan-janssen Jul 20, 2023
4233338
Merge pull request #38 from pyiron/dependabot/pip/scipy-1.11.1
jan-janssen Jul 20, 2023
1c2d984
Merge pull request #36 from pyiron/dependabot/pip/nglview-3.0.6
jan-janssen Jul 20, 2023
326588c
Update environment_mini.yml
jan-janssen Jul 20, 2023
ef8ec6d
Merge pull request #40 from pyiron/Mini
jan-janssen Jul 20, 2023
b8693ab
Merge branch 'pyxtal_patch' into merge_main
jan-janssen Jul 20, 2023
5279abf
Merge pull request #41 from pyiron/merge_main
jan-janssen Jul 20, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 9 additions & 7 deletions .ci_support/environment.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
channels:
- conda-forge
dependencies:
- aimsgb =0.1.3
- aimsgb =1.0.1
- ase =3.22.1
- coveralls
- coverage
- codacy-coverage
- matplotlib-base =3.7.1
- numpy =1.24.3
- phonopy =2.19.1
- pymatgen =2023.5.31
- matplotlib-base =3.7.2
- nglview =3.0.6
- numpy =1.25.1
- phonopy =2.20.0
- plotly =5.15.0
- pymatgen =2023.7.17
- pyscal =2.10.18
- scikit-learn =1.2.2
- scipy =1.10.1
- scikit-learn =1.3.0
- scipy =1.11.1
- spglib =2.0.2
- sqsgenerator =0.2
- pyxtal =0.5.8
10 changes: 10 additions & 0 deletions .ci_support/environment_mini.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
channels:
- conda-forge
dependencies:
- ase =3.22.1
- coveralls
- coverage
- codacy-coverage
- matplotlib-base =3.7.2
- numpy =1.25.1
- scipy =1.11.1
8 changes: 8 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
version: 2
updates:
- package-ecosystem: pip
directory: "/"
schedule:
interval: weekly
day: monday
open-pull-requests-limit: 10
2 changes: 1 addition & 1 deletion .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: "3.10"
python-version: "3.11"

- name: Install dependencies
run: >-
Expand Down
10 changes: 1 addition & 9 deletions .github/workflows/mini.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,7 @@ jobs:
steps:
- uses: actions/checkout@v2
- name: Setup environment
run: |
cp .ci_support/environment.yml environment.yml
sed -i '/aimsgb/d' environment.yml
sed -i '/phonopy/d' environment.yml
sed -i '/pymatgen/d' environment.yml
sed -i '/pyscal/d' environment.yml
sed -i '/scikit-learn/d' environment.yml
sed -i '/spglib/d' environment.yml
sed -i '/sqsgenerator/d' environment.yml
run: cp .ci_support/environment_mini.yml environment.yml
- name: Setup Mambaforge
uses: conda-incubator/setup-miniconda@v2
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pypicheck.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
- name: Setup Mambaforge
uses: conda-incubator/setup-miniconda@v2
with:
python-version: '3.10'
python-version: '3.11'
miniforge-variant: Mambaforge
channels: conda-forge
channel-priority: strict
Expand Down
5 changes: 0 additions & 5 deletions .github/workflows/unittests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,6 @@ jobs:
label: linux-64-py-3-9
prefix: /usr/share/miniconda3/envs/my-env

- operating-system: ubuntu-latest
python-version: '3.8'
label: linux-64-py-3-8
prefix: /usr/share/miniconda3/envs/my-env

steps:
- uses: actions/checkout@v2
- name: Setup environment
Expand Down
18 changes: 9 additions & 9 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,19 +31,19 @@
packages=find_packages(exclude=["*tests*", "*docs*", "*binder*", "*conda*", "*notebooks*", "*.ci_support*"]),
install_requires=[
'ase==3.22.1',
'matplotlib==3.7.1', # ase already requires matplotlib
'numpy==1.24.3', # ase already requires numpy
'scipy==1.10.1', # ase already requires scipy
'matplotlib==3.7.2', # ase already requires matplotlib
'numpy==1.25.1', # ase already requires numpy
'scipy==1.11.1', # ase already requires scipy
],
extras_require={
"grainboundary": ['aimsgb==0.1.3', 'pymatgen==2023.5.31'],
"grainboundary": ['aimsgb==1.0.1', 'pymatgen==2023.7.17'],
"pyscal": ['pyscal2==2.10.18'],
"nglview": ['nglview==3.0.5'],
"plotly": ['plotly==5.14.1'],
"clusters": ['scikit-learn==1.2.2'],
"nglview": ['nglview==3.0.6'],
"plotly": ['plotly==5.15.0'],
"clusters": ['scikit-learn==1.3.0'],
"symmetry": ['spglib==2.0.2'],
"surface": ['spglib==2.0.2', 'pymatgen==2023.5.31'],
"phonopy": ['phonopy==2.19.1', 'spglib==2.0.2'],
"surface": ['spglib==2.0.2', 'pymatgen==2023.7.17'],
"phonopy": ['phonopy==2.20.0', 'spglib==2.0.2'],
"pyxtal": ['pyxtal==0.5.8']
},
cmdclass=versioneer.get_cmdclass(),
Expand Down
1 change: 1 addition & 0 deletions structuretoolkit/build/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
get_grainboundary_info
)
from structuretoolkit.build.compound import B2, C14, C15, C36, D03
from structuretoolkit.build.random import pyxtal
from structuretoolkit.build.sqs import sqs_structures
from structuretoolkit.build.surface import (
high_index_surface,
Expand Down
109 changes: 0 additions & 109 deletions structuretoolkit/build/pyxtal.py

This file was deleted.

107 changes: 107 additions & 0 deletions structuretoolkit/build/random.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
# coding: utf-8
# Copyright (c) Max-Planck-Institut für Eisenforschung GmbH - Computational Materials Design (CM) Department
# Distributed under the terms of "New BSD License", see the LICENSE file.

from typing import Union, List, Tuple
import warnings

try:
from tqdm.auto import tqdm
except ImportError:
tqdm = lambda x: x

from ase import Atoms
from structuretoolkit.common.helper import center_coordinates_in_unit_cell


def pyxtal(
group: Union[int, List[int]],
species: Tuple[str],
num_ions: Tuple[int],
dim=3,
repeat=1,
allow_exceptions=True,
**kwargs,
) -> Union[Atoms, List[dict]]:
"""
Generate random crystal structures with PyXtal.

`group` must be between 1 and the largest possible value for the given dimensionality:
dim=3 => 1 - 230 (space groups)
dim=2 => 1 - 80 (layer groups)
dim=1 => 1 - 75 (rod groups)
dim=0 => 1 - 58 (point groups)

When `group` is passed as a list of integers or `repeat>1`, generate multiple structures and return them in a list
of dicts containing the keys `atoms`, `symmetry` and `repeat` for the ASE structure, the symmetry group
number and which iteration it is, respectively.

Args:
group (list of int, or int): the symmetry group to generate or a list of them
species (tuple of str): which species to include, defines the stoichiometry together with `num_ions`
num_ions (tuple of int): how many of each species to include, defines the stoichiometry together with `species`
dim (int): dimensionality of the symmetry group, 0 is point groups, 1 is rod groups, 2 is layer groups and 3 is space groups
repeat (int): how many random structures to generate
allow_exceptions (bool): when generating multiple structures, silence errors when the requested stoichiometry and symmetry group are incompatible
**kwargs: passed to `pyxtal.pyxtal` function verbatim

Returns:
:class:`~.Atoms`: the generated structure, if repeat==1 and only one symmetry group is requested
list of dict of all generated structures, if repeat>1 or multiple symmetry groups are requested

Raises:
ValueError: if `species` and `num_ions` are not of the same length
ValueError: if stoichiometry and symmetry group are incompatible and allow_exceptions==False or only one structure is requested
"""
from pyxtal import pyxtal as _pyxtal
from pyxtal.msg import Comp_CompatibilityError

if len(species) != len(num_ions):
raise ValueError(
"species and num_ions must be of same length, "
f"not {species} and {num_ions}!"
)
stoich = "".join(f"{s}{n}" for s, n in zip(species, num_ions))

def generate(group):
s = _pyxtal()
try:
s.from_random(
dim=dim, group=group, species=species, numIons=num_ions, **kwargs
)
except Comp_CompatibilityError as e:
if not allow_exceptions:
raise ValueError(
f"Symmetry group {group} incompatible with stoichiometry {stoich}!"
) from None
else:
return None
s = s.to_ase()
s = center_coordinates_in_unit_cell(structure=s)
return s

# return a single structure
if repeat == 1 and isinstance(group, int):
allow_exceptions = False
return generate(group)
else:
structures = []
if isinstance(group, int):
group = [group]
failed_groups = []
for g in tqdm(group, desc="Spacegroups"):
for i in range(repeat):
s = generate(g)
if s is None:
failed_groups.append(g)
continue
structures.append({
"atoms": s,
"symmetry": g,
"repeat": i
})
if len(failed_groups) > 0:
warnings.warn(
f'Groups [{", ".join(map(str,failed_groups))}] could not be generated with stoichiometry {stoich}!'
)
return structures
Loading