Skip to content

Commit 96574cf

Browse files
authored
Update CI infrastructure (#14)
1 parent acd31af commit 96574cf

File tree

6 files changed

+60
-12
lines changed

6 files changed

+60
-12
lines changed

.codecov.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
comment: false

.github/dependabot.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
2+
version: 2
3+
updates:
4+
- package-ecosystem: "github-actions"
5+
directory: "/" # Location of package manifests
6+
schedule:
7+
interval: "weekly"

.github/workflows/CI.yml

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,26 +26,31 @@ jobs:
2626
arch:
2727
- x64
2828
steps:
29-
- uses: actions/checkout@v3
30-
- uses: julia-actions/setup-julia@v1
29+
- uses: actions/checkout@v4
30+
- uses: julia-actions/setup-julia@v2
3131
with:
3232
version: ${{ matrix.version }}
3333
arch: ${{ matrix.arch }}
34-
- uses: julia-actions/cache@v1
34+
- uses: julia-actions/cache@v2
3535
- uses: julia-actions/julia-buildpkg@v1
3636
- uses: julia-actions/julia-runtest@v1
37+
- uses: julia-actions/julia-processcoverage@v1
38+
- uses: codecov/codecov-action@v4
39+
with:
40+
files: lcov.info
41+
token: ${{ secrets.CODECOV_TOKEN }}
3742
docs:
3843
name: Documentation
3944
runs-on: ubuntu-latest
4045
permissions:
4146
contents: write
4247
statuses: write
4348
steps:
44-
- uses: actions/checkout@v3
45-
- uses: julia-actions/setup-julia@v1
49+
- uses: actions/checkout@v4
50+
- uses: julia-actions/setup-julia@v2
4651
with:
4752
version: '1'
48-
- name: Configure doc environment
53+
- name: Install documentation dependencies
4954
run: |
5055
julia --project=docs/ -e '
5156
using Pkg

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ UnitfulAtomic = "a7773ee8-282e-5fa2-be4e-bd808c38a91a"
1717

1818
[compat]
1919
AtomsBase = "0.3"
20-
AtomsBuilder = "=0.0.4"
20+
AtomsBuilder = "0.1"
2121
AtomsCalculators = "0.2"
2222
DocStringExtensions = "0.9"
2323
LineSearches = "7"

README.md

Lines changed: 37 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,44 @@
33
[![Stable](https://img.shields.io/badge/docs-stable-blue.svg)](https://JuliaMolSim.github.io/GeometryOptimization.jl/stable/)
44
[![Dev](https://img.shields.io/badge/docs-dev-blue.svg)](https://JuliaMolSim.github.io/GeometryOptimization.jl/dev/)
55
[![Build Status](https://github.com/JuliaMolSim/GeometryOptimization.jl/actions/workflows/CI.yml/badge.svg?branch=main)](https://github.com/JuliaMolSim/GeometryOptimization.jl/actions/workflows/CI.yml?query=branch%3Amain)
6+
[![Coverage](https://codecov.io/gh/JuliaMolSim/GeometryOptimization.jl/branch/master/graph/badge.svg)](https://codecov.io/gh/JuliaMolSim/GeometryOptimization.jl)
67

7-
A geometry optimization package for
8+
A package for optimising the structural parameters of an atomistic system,
9+
i.e. the step usually referred to as
10+
**geometry optimisation** or **structural relaxation**
11+
in electronic structure theory and atomistic modelling.
12+
13+
The package is generic in the datastructures used to represent the geometry,
14+
the calculator used to evaluate energies and forces as well as the solver algorithm.
15+
Generally all
816
[AtomsBase structures](https://github.com/JuliaMolSim/AtomsBase.jl)
9-
and [AtomsCalculator calculators](https://github.com/JuliaMolSim/AtomsCalculators.jl).
17+
and [AtomsCalculator calculators](https://github.com/JuliaMolSim/AtomsCalculators.jl)
18+
should work out of the box.
19+
1020
See the [documentation](https://JuliaMolSim.github.io/GeometryOptimization.jl/stable/)
1121
for examples and further details.
22+
23+
## Motivating example
24+
25+
We consider the optimisation of the bondlength of a hydrogen
26+
molecule using a simple Lennard Jones potential:
27+
28+
```julia
29+
using AtomsBase
30+
using EmpiricalPotentials
31+
using GeometryOptimization
32+
using Unitful
33+
using UnitfulAtomic
34+
35+
# Setup system and calculator
36+
system = isolated_system([:H => [0, 0, 0.0]u"bohr",
37+
:H => [0, 0, 1.9]u"bohr"])
38+
calc = LennardJones(-1.17u"hartree", 0.743u"angstrom", 1, 1, 0.6u"nm")
39+
40+
# Run the geometry optimisation
41+
results = minimize_energy!(system, calc)
42+
43+
# Inspect the results
44+
optimised = results.system
45+
bondlength = norm(position(optimised[1]) - position(optimised[2]))
46+
```

src/optimization.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ function _minimize_energy!(system, calculator, solver;
131131

132132
energy_converged = austrip(abs(geoopt_state.energy - Eold)) < austrip(tol_energy)
133133
force_converged = austrip(maximum(norm, geoopt_state.forces)) < austrip(tol_force)
134-
virial_converged = austrip(maximum(abs, geoopt_state.virial)) < austrip(tol_virial)
134+
virial_converged = austrip(maximum(abs, geoopt_state.virial)) < austrip(tol_virial)
135135

136136
Eold = geoopt_state.energy
137137
converged = energy_converged && force_converged && virial_converged
@@ -140,8 +140,8 @@ function _minimize_energy!(system, calculator, solver;
140140

141141
optimres = solve(problem, solver; maxiters, callback=inner_callback, kwargs...)
142142
(; system=update_not_clamped_positions(system, optimres.u * u"bohr"), converged,
143-
energy=optimres.objective, state=geoopt_state.calc_state,
144-
optimres.stats, optimres.alg, optimres)
143+
energy=optimres.objective, geoopt_state.forces, geoopt_state.virial,
144+
state=geoopt_state.calc_state, optimres.stats, optimres.alg, optimres)
145145
end
146146

147147
# Default setup_solver function just passes things through

0 commit comments

Comments
 (0)