Skip to content

Commit

Permalink
Rely on AtomsIO for structure parsing (#802)
Browse files Browse the repository at this point in the history
  • Loading branch information
mfherbst authored Dec 20, 2022
1 parent a8061f5 commit a9764b4
Show file tree
Hide file tree
Showing 35 changed files with 476 additions and 731 deletions.
79 changes: 28 additions & 51 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,17 @@ jobs:
# Unit tests
#
test:
name: Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.payload }}
name: Julia stable - ${{ matrix.os }} - ${{ matrix.payload }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- {version: '1.6', os: ubuntu-latest, payload: serial}
- {version: '1.6', os: macOS-latest, payload: serial}
- {version: '1.6', os: windows-latest, payload: serial}
- {version: '1.6', os: ubuntu-latest, payload: mpi }
- {version: nightly, os: ubuntu-latest, payload: serial}
- {os: ubuntu-latest, payload: "fast,example" }
- {os: macOS-latest, payload: fast }
- {os: windows-latest, payload: fast }
- {os: ubuntu-latest, payload: mpi }
env:
PYTHON: "" # Force using Conda in PyCall
GKS_ENCODING: "utf8"
GKSwstype: "100" # Needed for Plots-related tests
PLOTS_TEST: "true" # Needed for Plots-related tests
Expand All @@ -40,34 +38,15 @@ jobs:
- uses: actions/checkout@v2
- uses: julia-actions/setup-julia@v1
with:
version: ${{ matrix.version }}
version: '1.6'
arch: x64
- uses: actions/cache@v1
env:
cache-name: cache-artifacts
with:
path: ~/.julia/artifacts
key: ${{ runner.os }}-test-${{ env.cache-name }}-${{ hashFiles('**/Project.toml') }}
restore-keys: |
${{ runner.os }}-test-${{ env.cache-name }}-
${{ runner.os }}-test-
${{ runner.os }}-
- name: Install Conda dependencies
shell: bash
run: |
julia -e '
using Pkg; Pkg.add("Conda"); using Conda
pkgs = ["ase", "pymatgen"]
!Sys.iswindows() && (pkgs = append!(["libblas=*=*netlib", "nomkl"], pkgs))
Conda.add(pkgs; channel="conda-forge")
'
- uses: julia-actions/cache@v1
- uses: julia-actions/julia-buildpkg@v1

- name: Execute serial tests
uses: julia-actions/julia-runtest@v1
if: ${{ matrix.payload == 'serial' }}
continue-on-error: ${{ matrix.version == 'nightly' }}

- uses: julia-actions/julia-runtest@v1
if: ${{ matrix.payload != 'mpi' }}
env:
DFTK_TEST_ARGS: ${{ matrix.payload }}
- name: Execute MPI-parallel tests
run: |
julia --project -e '
Expand All @@ -77,40 +56,38 @@ jobs:
'
$HOME/.julia/bin/mpiexecjl -np 2 julia --check-bounds=yes --depwarn=yes --project --color=yes -e 'using Pkg; Pkg.test(coverage=true)'
if: ${{ matrix.payload == 'mpi' }}
continue-on-error: ${{ matrix.version == 'nightly' }}
env:
DFTK_TEST_ARGS: fast

- uses: julia-actions/julia-processcoverage@v1
- uses: codecov/codecov-action@v2
with:
file: lcov.info
#
# Examples
# Nightly
#
examples:
name: Run examples
nightly:
name: Julia nightly - ubuntu-latest
runs-on: ubuntu-latest
strategy:
fail-fast: false
env:
GKS_ENCODING: "utf8"
GKSwstype: "100" # Needed for Plots-related tests
PLOTS_TEST: "true" # Needed for Plots-related tests

steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: '3.7'
- name: Install python dependencies
run: pip install ase
- uses: julia-actions/setup-julia@v1
with:
version: '1.6'
- uses: actions/cache@v1
version: nightly
arch: x64
- uses: julia-actions/cache@v1
- uses: julia-actions/julia-buildpkg@v1
- uses: julia-actions/julia-runtest@v1
env:
cache-name: cache-artifacts
DFTK_TEST_ARGS: fast
- uses: julia-actions/julia-processcoverage@v1
- uses: codecov/codecov-action@v2
with:
path: ~/.julia/artifacts
key: ${{ runner.os }}-test-${{ env.cache-name }}-${{ hashFiles('**/Project.toml') }}
restore-keys: |
${{ runner.os }}-test-${{ env.cache-name }}-
${{ runner.os }}-test-
${{ runner.os }}-
- run: julia --color=yes --project -e 'using Pkg; Pkg.test(test_args=["example"])'
file: lcov.info
34 changes: 15 additions & 19 deletions .github/workflows/documentation.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,33 +18,29 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: '3.7'
- name: Install python dependencies
run: pip install ase pymatgen
- uses: julia-actions/setup-julia@v1
with:
version: '1'
- name: Instantiate and build packages
- uses: julia-actions/julia-buildpkg@v1
- uses: julia-actions/julia-docdeploy@v1
timeout-minutes: 40
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
DOCUMENTER_KEY: ${{ secrets.DOCUMENTER_KEY }}
- name: Setup PyCall to use python executable from PythonCall
# Note: This is needed to ensure PyCall and PythonCall are using
# exactly the same python version.
run: |
julia --project=docs -e '
using Pkg
Pkg.develop(PackageSpec(path=pwd()))
Pkg.instantiate()
Pkg.precompile()
Pkg.build("DFTK")
'
julia --project -e '
import Pkg
Pkg.add(["PyCall", "PythonCall"])
import PythonCall
ENV["PYTHON"] = PythonCall.C.CTX.exe_path
Pkg.build("PyCall")'
- name: Run doctests
run: |
julia --project=docs -e '
using Documenter: DocMeta, doctest
using DFTK
DocMeta.setdocmeta!(DFTK, :DocTestSetup, :(using DFTK); recursive=true)
doctest(DFTK)'
- name: Generate docs
run: julia --project=docs docs/make.jl
timeout-minutes: 30
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
DOCUMENTER_KEY: ${{ secrets.DOCUMENTER_KEY }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@
deps/deps.jl
Manifest.toml
.vscode
.CondaPkg
24 changes: 9 additions & 15 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -1,27 +1,21 @@
stages:
- test

# TODO More fine-grained rule setup

# This job tests DFTK.jl with Julia 1.8 on Noctua 2
# It only runs when:
# - Commit in master
# - PR from branch with name ending in "gpu"
# - Manual run triggered
julia/1.8-n2:
stage: test
variables:
SCHEDULER_PARAMETERS: "-N 1 -n 1 -c 16 --gres=gpu:a100:1 -t 00:15:00 -A hpc-prf-dftkjl -p gpu"
SCHEDULER_PARAMETERS: "-N 1 -n 1 -c 16 --gres=gpu:a100:1 --qos=devel -p dgx -t 00:15:00 -A hpc-prf-dftkjl"
JULIA_NUM_THREADS: "1" # GPU and multi-threading not yet compatible
coverage: '/\(\d+.\d+\%\) covered/'
only:
- external_pull_requests
- tags
- master
# rules:
# - changes:
# - "README.md"
# # - "docs/**/*.md"
# # - "docs/make.jl"
# # - "docs/build_docs.jl"
# # when: never
# - when: on_success
rules:
- if: $CI_COMMIT_BRANCH == "master"
- if: $CI_PIPELINE_SOURCE == "external_pull_request_event" && $CI_EXTERNAL_PULL_REQUEST_SOURCE_BRANCH_NAME =~ /gpu$/
- when: manual
script:
- module load lang/JuliaHPC/1.8.3-foss-2022a-CUDA-11.7.0
- julia --color=yes --project=. -e '
Expand Down
10 changes: 5 additions & 5 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@ authors = ["Michael F. Herbst <[email protected]>", "Antoine Levitt <antoi
version = "0.5.15"

[deps]
ASEconvert = "3da9722f-58c2-4165-81be-b4d7253e8fd2"
AbstractFFTs = "621f4979-c628-5d54-868e-fcf4e3e8185c"
AtomsBase = "a963bdd2-2df7-4f54-a1ee-49d51e6be12a"
AtomsIO = "1692102d-eeb4-4df9-807b-c9517f998d44"
Brillouin = "23470ee3-d0df-4052-8b1a-8cbd6363e7f0"
ChainRulesCore = "d360d2e6-b24c-11e9-a2a3-2a2ae2dbcce4"
Conda = "8f4d0f93-b110-5947-807f-2305c1781a2d"
Dates = "ade2ca70-3891-5945-98fb-dc099432e06a"
DftFunctionals = "6bd331d2-b28d-4fd3-880e-1a1c7f37947f"
Downloads = "f43a241f-c20a-4ad4-852c-f6b1247861c6"
Expand All @@ -33,7 +34,6 @@ Primes = "27ebfcd6-29c5-5fa9-bf4b-fb8fc14df3ae"
Printf = "de0858da-6303-5e67-8744-51eddeeeb8d7"
ProgressMeter = "92933f4c-e287-5a05-a399-4b506db050ca"
PseudoPotentialIO = "cb339c56-07fa-4cb2-923a-142469552264"
PyCall = "438e738f-606a-5dbb-bf0a-cddfbfd45ab0"
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
Requires = "ae029012-a4dd-5104-9daa-d747884805df"
Roots = "f2b01f46-fcfa-551c-844a-d8ac1e96c665"
Expand All @@ -48,11 +48,12 @@ UnitfulAtomic = "a7773ee8-282e-5fa2-be4e-bd808c38a91a"
spglib_jll = "ac4a9f1e-bdb2-5204-990c-47c8b2f70d4e"

[compat]
ASEconvert = "0.1"
AbstractFFTs = "1"
AtomsBase = "0.2.2"
Brillouin = "0.5.10"
AtomsIO = "0.1.1"
Brillouin = "0.5.11"
ChainRulesCore = "1.15"
Conda = "1"
DftFunctionals = "0.2"
FFTW = "1"
ForwardDiff = "0.10"
Expand All @@ -72,7 +73,6 @@ Polynomials = "3"
Primes = "0.5"
ProgressMeter = "1"
PseudoPotentialIO = "0.1"
PyCall = "1"
Requires = "1"
Roots = "2"
SpecialFunctions = "2"
Expand Down
2 changes: 2 additions & 0 deletions docs/Project.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
[deps]
ASEconvert = "3da9722f-58c2-4165-81be-b4d7253e8fd2"
AtomsBase = "a963bdd2-2df7-4f54-a1ee-49d51e6be12a"
AtomsIO = "1692102d-eeb4-4df9-807b-c9517f998d44"
Brillouin = "23470ee3-d0df-4052-8b1a-8cbd6363e7f0"
DFTK = "acf6eb54-70d9-11e9-0013-234b7a5f5337"
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
Expand Down
34 changes: 5 additions & 29 deletions docs/make.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# To manually generate the docs:
# 1. Install all python dependencies from the PYDEPS array below.
# 2. Run "julia make.jl"
# 1. Run "julia make.jl"
#
# To add a new example to the docs:
# 1. Add the *.jl file to /examples, along with assets you require (e.g. input files,
Expand Down Expand Up @@ -85,9 +84,7 @@ PAGES = [

# Files from the /examples folder that need to be copied over to the docs
# (typically images, input or data files etc.)
EXAMPLE_ASSETS = [
"examples/Fe_afm.pwi",
]
EXAMPLE_ASSETS = ["examples/Fe_afm.pwi", "examples/Si.extxyz"]

#
# Configuration and setup
Expand All @@ -105,9 +102,6 @@ DFTKREV = LibGit2.head(ROOTPATH)
DFTKBRANCH = try LibGit2.branch(LibGit2.GitRepo(ROOTPATH)) catch end
DFTKREPO = "github.com/JuliaMolSim/DFTK.jl.git"

# Python dependencies needed for running the notebooks
PYDEPS = ["ase"]

# Setup julia dependencies for docs generation if not yet done
Pkg.activate(@__DIR__)
if !isfile(joinpath(@__DIR__, "Manifest.toml"))
Expand Down Expand Up @@ -185,20 +179,16 @@ end
# Generate the docs in BUILDPATH
makedocs(;
modules=[DFTK],
repo="https://" * DFTKREPO * "/blob/{commit}{path}#{line}",
format=Documenter.HTML(
# Use clean URLs, unless built as a "local" build
prettyurls = CONTINUOUS_INTEGRATION,
canonical = "https://docs.dftk.org/stable/",
edit_link = "master",
assets = ["assets/favicon.ico"],
),
sitename = "DFTK.jl",
authors = "Michael F. Herbst, Antoine Levitt and contributors.",
linkcheck = false, # TODO
linkcheck_ignore = [
# Ignore links that point to GitHub's edit pages, as they redirect to the
# login screen and cause a warning:
r"https://github.com/([A-Za-z0-9_.-]+)/([A-Za-z0-9_.-]+)/edit(.*)",
],
pages=transform_to_md(PAGES),
checkdocs=:exports,
strict=!DEBUG,
Expand All @@ -207,20 +197,6 @@ makedocs(;
# Dump files for managing dependencies in binder
if CONTINUOUS_INTEGRATION && DFTKBRANCH == "master"
cd(BUILDPATH) do
open("environment.yml", "w") do io
print(io,
"""
name: dftk
channels:
- defaults
- conda-forge
dependencies:
""")
for dep in PYDEPS
println(io, " - " * dep)
end
end

# Install Julia dependencies into build
Pkg.activate(".")
Pkg.add(Pkg.PackageSpec(url="https://" * DFTKREPO, rev=DFTKREV))
Expand All @@ -230,7 +206,7 @@ if CONTINUOUS_INTEGRATION && DFTKBRANCH == "master"
end

# Deploy docs to gh-pages branch
deploydocs(; repo=DFTKREPO)
deploydocs(; repo=DFTKREPO, devbranch="master")

# Remove generated example files
if !DEBUG
Expand Down
2 changes: 1 addition & 1 deletion docs/src/features.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
- Seamless integration with many standard [Input and output formats](@ref).
- Integration with [ASE](https://wiki.fysik.dtu.dk/ase/) and
[AtomsBase](https://github.com/JuliaMolSim/AtomsBase.jl) for passing
atomic structures.
atomic structures (see [AtomsBase integration](@ref)).
- [Wannierization using Wannier90](@ref)


Expand Down
Loading

0 comments on commit a9764b4

Please sign in to comment.