Skip to content

Commit

Permalink
Merge branch 'main' into cp2k
Browse files Browse the repository at this point in the history
# Conflicts:
#	.ci_support/environment.yml
#	pyiron_contrib/__init__.py
#	setup.py
  • Loading branch information
liamhuber committed Dec 5, 2022
2 parents d8e3cf4 + 00449c5 commit da0b20f
Show file tree
Hide file tree
Showing 41 changed files with 5,623 additions and 604 deletions.
20 changes: 10 additions & 10 deletions .ci_support/environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ dependencies:
- coveralls
- coverage
- codacy-coverage
- matplotlib =3.5.1
- numpy =1.22.2
- pyiron_base =0.5.5
- pyiron_atomistics =0.2.37
- pyparsing =3.0.7
- scipy =1.8.0
- seaborn =0.11.2
- scikit-image =0.19.2
- matplotlib =3.6.1
- numpy =1.23.4
- pyiron_base =0.5.26
- pyiron_atomistics =0.2.58
- pyparsing =3.0.9
- scipy =1.9.3
- seaborn =0.12.0
- scikit-image =0.19.3
- randspg =0.0.1
- boto3 =1.24.96
- moto =4.0.8
- pycp2k =0.2.2
- boto3 =1.21.3
- moto =3.0.4
2 changes: 1 addition & 1 deletion .github/delete-merged-branch-config.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
exclude:
- master
- main
delete_closed_pr: false
2 changes: 1 addition & 1 deletion .github/workflows/UpdateDependabotPR.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: UpdateDependabotPR

on:
pull_request_target:
branches: [ master ]
branches: [ main ]

jobs:
build:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ name: Coverage

on:
push:
branches: [ master ]
branches: [ main ]
pull_request:
branches: [ master ]
branches: [ main ]

jobs:
build:
Expand Down
37 changes: 37 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# This workflow is used to test, if the documentation can build

name: Docs

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: conda-incubator/setup-miniconda@v2
with:
python-version: "3.10"
mamba-version: "*"
channels: conda-forge
channel-priority: strict
auto-update-conda: true
environment-file: .ci_support/environment.yml
- name: Setup
shell: bash -l {0}
run: |
python .ci_support/pyironconfig.py
pip install --no-deps .
conda env update --name test --file docs/environment.yml
- name: Documentation
shell: bash -l {0}
run: |
mkdir public_html; cd docs
sphinx-build -b html ./ ../public_html || exit 1;
cd ..
34 changes: 12 additions & 22 deletions .github/workflows/notebooks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,30 +2,20 @@ name: Notebooks

on:
push:
branches: [ master ]
branches: [ main ]
pull_request:
branches: [ master ]
branches: [ main ]

jobs:
build:

build-notebooks:
needs: commit-updated-env
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: conda-incubator/setup-miniconda@v2
with:
python-version: "3.10"
mamba-version: "*"
channels: conda-forge
channel-priority: strict
auto-update-conda: true
environment-file: .ci_support/environment.yml
- name: Setup
shell: bash -l {0}
run: |
pip install --no-deps .
conda install papermill
- name: Tests
shell: bash -l {0}
run: ./.ci_support/build_notebooks.sh
- uses: actions/checkout@v3
- uses: pyiron/actions/build-notebooks@main
with:
python-version: '3.10'
env-prefix: /usr/share/miniconda3/envs/my-env
env-label: linux-64-py-3-10
env-files: .ci_support/environment.yml
exclusion-file: .ci_support/exclude
4 changes: 2 additions & 2 deletions .github/workflows/pypicheck.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ name: Pip check

on:
push:
branches: [ master ]
branches: [ main ]
pull_request:
branches: [ master ]
branches: [ main ]

jobs:
build:
Expand Down
36 changes: 22 additions & 14 deletions .github/workflows/unittests.yml
Original file line number Diff line number Diff line change
@@ -1,35 +1,43 @@
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions

name: Python package

name: Unit Tests
on:
push:
branches: [ master ]
branches: [ main ]
pull_request:
branches: [ master ]
branches: [ main ]

jobs:
build:
env:
CONDA_PREFIX: /usr/share/miniconda/

runs-on: ${{ matrix.operating-system }}
strategy:
matrix:
operating-system: [ubuntu-latest]
python-version: ["3.8", "3.9", "3.10"]
include:
- operating-system: ubuntu-latest
python-version: '3.10'
label: linux-64-py-3-10
prefix: /usr/share/miniconda3/envs/my-env

- operating-system: ubuntu-latest
python-version: 3.9
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
- uses: conda-incubator/setup-miniconda@v2
- uses: pyiron/actions/cached-mamba@main
with:
python-version: ${{ matrix.python-version }}
mamba-version: "*"
channels: conda-forge
channel-priority: strict
auto-update-conda: true
environment-file: .ci_support/environment.yml
env-prefix: ${{ matrix.prefix }}
env-label: ${{ matrix.label }}
env-files: .ci_support/environment.yml
- name: Setup
shell: bash -l {0}
run: |
Expand Down
9 changes: 5 additions & 4 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,21 @@
# Required
version: 2

build:
os: "ubuntu-20.04"
tools:
python: "mambaforge-4.10"

# Build documentation in the docs/ directory with Sphinx
sphinx:
configuration: docs/conf.py

# Optionally build your docs in additional formats such as PDF and ePub
formats: []

# Install pyiron from conda
conda:
environment: docs/environment.yml

# Optionally set the version of Python and requirements required to build your docs
python:
version: 3.7
install:
- method: pip
path: .
2 changes: 1 addition & 1 deletion pyiron_contrib/RDM/storagejob.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import shutil

from pyiron_base import GenericJob, DataContainer
from pyiron_base.generic.filedata import FileData
from pyiron_base import FileData
from pyiron_contrib.generic.s3io import FileS3IO


Expand Down
2 changes: 2 additions & 0 deletions pyiron_contrib/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@
JOB_CLASS_DICT['Atomicrex'] = 'pyiron_contrib.atomistics.atomicrex.atomicrex_job'
JOB_CLASS_DICT['StructureMasterInt'] = 'pyiron_contrib.atomistics.atomistics.job.structurelistmasterinteractive'
JOB_CLASS_DICT['StorageJob'] = 'pyiron_contrib.RDM.storagejob'
JOB_CLASS_DICT['PacemakerJob'] = 'pyiron_contrib.atomistics.pacemaker.job'
JOB_CLASS_DICT['MeamFit'] = 'pyiron_contrib.atomistics.meamfit.meamfit'
JOB_CLASS_DICT['Cp2kJob'] = 'pyiron_contrib.atomistics.cp2k.job'


Expand Down
42 changes: 30 additions & 12 deletions pyiron_contrib/atomistics/atomicrex/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@

"""Pyiron interface to atomicrex"""
import numpy as np
import pandas as pd

from pyiron_base import state, GenericJob, Executable
from pyiron_base import state, GenericJob, Executable, FlattenedStorage

from pyiron_contrib.atomistics.atomicrex.general_input import (
GeneralARInput,
Expand All @@ -15,16 +16,14 @@
from pyiron_contrib.atomistics.atomicrex.potential_factory import ARPotFactory
from pyiron_contrib.atomistics.atomicrex.output import Output
from pyiron_contrib.atomistics.atomicrex.function_factory import FunctionFactory
from pyiron_contrib.atomistics.ml.potentialfit import PotentialFit
from pyiron_contrib.atomistics.atomistics.job.trainingcontainer import (
TrainingContainer,
TrainingStorage,
)


## Class defined for future addition of other codes
## Not sure which functionality (if any) can be extracted yet, but a similar pattern is followed in other pyiron modules
class PotentialFittingBase(GenericJob):
def __init__(self, project, job_name):
super().__init__(project, job_name)


class AtomicrexBase(PotentialFittingBase):
class AtomicrexBase(GenericJob, PotentialFit):
__version__ = "0.1.0"
__hdf_version__ = "0.1.0"
"""Class to set up and run atomicrex jobs"""
Expand Down Expand Up @@ -217,7 +216,7 @@ def write_input(self, directory=None):
"""
if directory is None:
directory = self.working_directory
self.input._write_xml_file(directory=directory)
self.input._write_xml_file(directory=directory, job=self)
self.potential.write_xml_file(directory=directory)
self.structures.write_xml_file(directory=directory)

Expand Down Expand Up @@ -248,8 +247,7 @@ def _executable_activate(self, enforce=False):
# instead of the potential_as_pd_df function
@property
def lammps_potential(self):
pot = self.potential_as_pd_df()
return pot
return self.potential_as_pd_df()

def potential_as_pd_df(self):
"""
Expand All @@ -258,6 +256,26 @@ def potential_as_pd_df(self):
"""
return self.potential._potential_as_pd_df(job=self)

#### PotentialFit methods
def _add_training_data(self, container: TrainingContainer) -> None:
self.structures.add_training_data(container)

def _get_training_data(self) -> TrainingStorage:
return self.structures.get_training_data()

def _get_predicted_data(self) -> FlattenedStorage:
return self.structures.get_predicted_data()

def get_lammps_potential(self) -> pd.DataFrame:
"""
Return a pyiron compatible dataframe that defines a potential to be used with a Lammps job (or subclass
thereof).
Returns:
DataFrame: contains potential information to be used with a Lammps job.
"""
return self.potential_as_pd_df()


class Factories:
"""
Expand Down
2 changes: 1 addition & 1 deletion pyiron_contrib/atomistics/atomicrex/fit_properties.py
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ def __init__(self, num_chunks=1, num_elements=1, **kwargs):
super().__init__(num_chunks=num_chunks, num_elements=num_elements, **kwargs)
self._per_chunk_arrays = {}
self.add_array("fit", dtype=bool, per="chunk", fill=False)
self.add_array("relative_weight", per="chunk", fill=np.nan)
self.add_array("relative_weight", per="chunk", fill=1.0)
self.add_array("relax", dtype=bool, per="chunk")
self.add_array("residual_style", per="chunk", dtype=np.ubyte, fill=0)
self.add_array("output", dtype=bool, per="chunk", fill=False)
Expand Down
Loading

0 comments on commit da0b20f

Please sign in to comment.