-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into adapt_supercell_algo
- Loading branch information
Showing
9 changed files
with
213 additions
and
96 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{ | ||
"name": "DeveloperEnv", | ||
"image": "ghcr.io/jageo/autoplex/autoplex:python-3.10", | ||
"hostRequirements": { | ||
"cpus": 4, | ||
"memory": "16gb", | ||
"storage": "32gb" | ||
}, | ||
"customizations": { | ||
"vscode": { | ||
"extensions": [ | ||
"ms-python.python", | ||
"ms-azuretools.vscode-docker"] | ||
}, | ||
}, | ||
"postCreateCommand": "pip cache purge && uv pip install -e .[strict,docs] && uv pip install ase==3.23.0 && pre-commit install", | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
name: Build and Push Docker Image | ||
|
||
on: | ||
workflow_dispatch: | ||
release: | ||
types: [ created ] # Runs only when a new release is created | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
if: github.repository_owner == 'JaGeo' && github.ref == 'refs/heads/main' | ||
permissions: | ||
contents: read | ||
packages: write | ||
attestations: write | ||
id-token: write | ||
strategy: | ||
matrix: | ||
python-version: [ "3.10", "3.11", "3.12" ] | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
- name: Log in to the GitHub Container Registry | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.repository_owner }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: lowercase github.repository | ||
run: | | ||
echo "IMAGE_NAME=`echo ${{github.repository}} | tr '[:upper:]' '[:lower:]'`" >>${GITHUB_ENV} | ||
# Build Docker image with a custom Python version | ||
- name: Build Docker image (Python ${{ matrix.python-version }}) | ||
run: | | ||
docker build \ | ||
--build-arg PYTHON_VERSION=${{ matrix.python-version }} \ | ||
-t ghcr.io/${{ env.IMAGE_NAME }}/autoplex:python-${{ matrix.python-version }} . | ||
# Push Docker image to GHCR | ||
- name: Push Docker image to GHCR (Python ${{ matrix.python-version }}) | ||
run: | | ||
docker push ghcr.io/${{ env.IMAGE_NAME }}/autoplex:python-${{ matrix.python-version }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -83,6 +83,9 @@ target/ | |
# Pycharm | ||
.idea/* | ||
|
||
# VSCode | ||
.vscode/ | ||
|
||
# Jupyter Notebook | ||
.ipynb_checkpoints | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# Guidelines for contributions to autoplex | ||
- Please write unit tests; this is a requirement for any added code to be accepted. (Automated testing will be performed using `pytest`; you can look into the `tests` folder for examples). | ||
- Please ensure high coverage of the code based on the tests (you can test this with `coverage`). | ||
- Please use numpy docstrings (use an IDE and switch on this docstring type; you can check examples in our code base; the docstring should be useful for other people) | ||
- Please ensure that type hints are added for each variable, function, class, and method (this helps code readability, especially if someone else wants to build on your code). | ||
- Please write the code in a way that gives users the option to change parameters (this is mainly applicable, for example, fitting protocols/flows). In other words, please avoid hardcoding settings or physical properties. | ||
Reasonable default values should be set, but the user needs to have the opportunity to modify them if they wish. | ||
|
||
## General code structure | ||
- We are currently aiming to follow the code structure below for each submodule (This is an initial idea; of course, this could change depending on the needs in the future) | ||
- autoplex/submodule/job.py (any jobs defined will be inside this module) | ||
- autoplex/submodule/flows.py (workflows defined will be hosted in this module) | ||
- autoplex/submodule/utils.py (all functions that act as utilities for defining flow or job, for example, a small subtask to calculate some metric or plotting, will be hosted in this module) | ||
|
||
## Formatting requirements | ||
- Variable names should be descriptive and should use snake case (`variable_name`, not `VariableName`). | ||
- If you define a `Maker`, please use python class naming convention (e.g., `PhononMaker`, `RssMaker`). | ||
|
||
## Commit guidelines | ||
1. `pip install pre-commit`. | ||
2. Next, run `pre-commit install` (this will install all the hooks from pre-commit-config.yaml) | ||
3. Step 1 and 2 needs to be done only once in the local repository | ||
4. Proceed with modifying the code and adding commits as usual. This should automatically run the linters. | ||
5. To manually run the pre-commit hooks on all files, just use `pre-commit run --all-files` | ||
6. To run pre-commit on a specific file, use `pre-commit run --files path/to/your/modified/module/` | ||
|
||
Please check out atomate2 for example code (https://github.com/materialsproject/atomate2) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
# Use an official micromamba image as the base image | ||
ARG PYTHON_VERSION=3.10 | ||
|
||
FROM mambaorg/micromamba:1.5.10 | ||
|
||
|
||
# Set environment variables for micromamba | ||
ENV MAMBA_DOCKERFILE_ACTIVATE=1 | ||
ENV MAMBA_ROOT_PREFIX=/opt/conda | ||
|
||
# Switch to root to install all dependencies (using non-root user causes permission issues) | ||
USER root | ||
|
||
# Make arg accessible to the rest of the Dockerfile | ||
ARG PYTHON_VERSION | ||
|
||
# Install system dependencies | ||
RUN apt-get update && apt-get install -y \ | ||
build-essential \ | ||
bash \ | ||
bc \ | ||
unzip \ | ||
wget \ | ||
gfortran \ | ||
liblapack-dev \ | ||
libblas-dev \ | ||
cmake \ | ||
make \ | ||
curl \ | ||
git \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
# Install Python | ||
RUN micromamba install -y -n base -c conda-forge \ python=${PYTHON_VERSION} && \ | ||
micromamba clean --all --yes | ||
|
||
# Install testing dependencies | ||
RUN python -m pip install --upgrade pip \ | ||
&& pip install uv \ | ||
&& uv pip install flake8 pre-commit pytest pytest-mock pytest-split pytest-cov types-setuptools | ||
|
||
# Install Julia | ||
RUN curl -fsSL https://julialang-s3.julialang.org/bin/linux/x64/1.9/julia-1.9.2-linux-x86_64.tar.gz | tar -xz -C /opt \ | ||
&& ln -s /opt/julia-1.9.2/bin/julia /usr/local/bin/julia | ||
|
||
|
||
# Set up Julia environment (ACEpotentials.jl interface) | ||
RUN julia -e 'using Pkg; Pkg.Registry.add("General"); Pkg.Registry.add(Pkg.Registry.RegistrySpec(url="https://github.com/ACEsuit/ACEregistry")); Pkg.add("ACEpotentials"); Pkg.add("DataFrames"); Pkg.add("CSV")' | ||
|
||
# Install Buildcell (airss) | ||
RUN curl -fsSL https://www.mtg.msm.cam.ac.uk/files/airss-0.9.3.tgz -o /opt/airss-0.9.3.tgz \ | ||
&& tar -xf /opt/airss-0.9.3.tgz -C /opt \ | ||
&& rm /opt/airss-0.9.3.tgz \ | ||
&& cd /opt/airss \ | ||
&& make \ | ||
&& make install \ | ||
&& make neat | ||
|
||
# Add Buildcell to PATH | ||
ENV PATH="${PATH}:/opt/airss/bin" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,2 @@ | ||
# Guidelines for contributions | ||
- Please write unit tests; this is a requirement for any added code to be accepted. (Automated testing will be performed using `pytest`; you can look into the `tests` folder for examples). | ||
- Please ensure high coverage of the code based on the tests (you can test this with `coverage`). | ||
- Please use numpy docstrings (use an IDE and switch on this docstring type; you can check examples in our code base; the docstring should be useful for other people) | ||
- Please ensure that type hints are added for each variable, function, class, and method (this helps code readability, especially if someone else wants to build on your code). | ||
- Please write the code in a way that gives users the option to change parameters (this is mainly applicable, for example, fitting protocols/flows). In other words, please avoid hardcoding settings or physical properties. | ||
Reasonable default values should be set, but the user needs to have the opportunity to modify them if they wish. | ||
|
||
## General code structure | ||
- We are currently aiming to follow the code structure below for each submodule (This is an initial idea; of course, this could change depending on the needs in the future) | ||
- autoplex/submodule/job.py (any jobs defined will be inside this module) | ||
- autoplex/submodule/flows.py (workflows defined will be hosted in this module) | ||
- autoplex/submodule/utils.py (all functions that act as utilities for defining flow or job, for example, a small subtask to calculate some metric or plotting, will be hosted in this module) | ||
|
||
## Formatting requirements | ||
- Variable names should be descriptive and should use snake case (`variable_name`, not `VariableName`). | ||
- If you define a `Maker`, please use python class naming convention (e.g., `PhononMaker`, `RssMaker`). | ||
|
||
## Commit guidelines | ||
1. `pip install pre-commit`. | ||
2. Next, run `pre-commit install` (this will install all the hooks from pre-commit-config.yaml) | ||
3. Step 1 and 2 needs to be done only once in the local repository | ||
4. Proceed with modifying the code and adding commits as usual. This should automatically run the linters. | ||
5. To manually run the pre-commit hooks on all files, just use `pre-commit run --all-files` | ||
6. To run pre-commit on a specific file, use `pre-commit run --files path/to/your/modified/module/` | ||
|
||
Please check out atomate2 for example code (https://github.com/materialsproject/atomate2) | ||
```{include} ../../CONTRIBUTING.md | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters