Skip to content

Commit

Permalink
grad test tolerances
Browse files Browse the repository at this point in the history
  • Loading branch information
jgreener64 committed Jan 6, 2022
1 parent 5d4ce41 commit 01ef4a3
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 20 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ Enter the package mode by pressing `]` and run `add Molly`.

Some examples are given here, see [the documentation](https://juliamolsim.github.io/Molly.jl/stable/docs) for more on how to use the package.

Simulation of a Lennard-Jones gas:
Simulation of a Lennard-Jones fluid:
```julia
using Molly

Expand Down
2 changes: 1 addition & 1 deletion docs/src/differentiable.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Differentiable simulation does not currently work with units, user-defined types

## General interactions

First, we show how taking gradients through a simulation can be used to optimise an atom property in a [Lennard-Jones](https://en.wikipedia.org/wiki/Lennard-Jones_potential) gas.
First, we show how taking gradients through a simulation can be used to optimise an atom property in a [Lennard-Jones](https://en.wikipedia.org/wiki/Lennard-Jones_potential) fluid.
In this type of simulation each atom has a σ value that determines how close it likes to get to other atoms.
We are going to find the σ value that results in a desired distance of each atom to its closest neighbor.
First we need a function to obtain the mean distance of each atom to its closest neighbor:
Expand Down
4 changes: 2 additions & 2 deletions docs/src/docs.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ To run a simulation you create a [`System`](@ref) object and call [`simulate!`](
The different components of the system and simulation can be used as defined by the package, or you can define your own versions.
An important principle of the package is that your custom components, particularly force functions, should be easy to define and just as performant as the built-in versions.

## Simulating a gas
## Simulation basics

Let's look at the simulation of a gas acting under the [Lennard-Jones](https://en.wikipedia.org/wiki/Lennard-Jones_potential) potential to start with.
Let's look at the simulation of a fluid acting under the [Lennard-Jones](https://en.wikipedia.org/wiki/Lennard-Jones_potential) potential to start with.
First, we'll need some atoms with the relevant parameters defined.
```julia
using Molly
Expand Down
2 changes: 1 addition & 1 deletion test/energy_conservation.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ using Base.Threads
using Statistics
using Test

@testset "Lennard-Jones gas energy conservation" begin
@testset "Lennard-Jones energy conservation" begin
temp = 1.0u"K"
n_steps = 10_000
box_size = SVector(50.0, 50.0, 50.0)u"nm"
Expand Down
13 changes: 6 additions & 7 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,17 @@ using Test

# Allow testing of particular components
const GROUP = get(ENV, "GROUP", "All")
if GROUP == "Zygote"
@warn "Only running Zygote tests as GROUP is set to Zygote"
end

# GLMakie doesn't work on CI
run_visualize_tests = !haskey(ENV, "CI")

if run_visualize_tests
using GLMakie
@info "The visualization tests will be run as run_visualize_tests is set to true"
@info "The visualization tests will be run as this is not CI"
else
@warn "The visualization tests will not be run as run_visualize_tests is set to false"
@warn "The visualization tests will not be run as this is CI"
end

run_parallel_tests = nthreads() > 1
Expand All @@ -49,7 +51,7 @@ data_dir = normpath(@__DIR__, "..", "data")
temp_fp_pdb = tempname(cleanup=true) * ".pdb"
temp_fp_viz = tempname(cleanup=true) * ".mp4"

if GROUP == "All" || GROUP == "Basic"
if GROUP == "All"
# Some failures due to dependencies but there is an unbound args error
Aqua.test_all(
Molly;
Expand All @@ -59,9 +61,6 @@ if GROUP == "All" || GROUP == "Basic"
)

include("basic.jl")
end

if GROUP == "All"
include("simulation.jl")
include("protein.jl")
include("agent.jl")
Expand Down
6 changes: 3 additions & 3 deletions test/simulation.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@testset "Lennard-Jones gas 2D" begin
@testset "Lennard-Jones 2D" begin
n_atoms = 10
n_steps = 20_000
temp = 298.0u"K"
Expand Down Expand Up @@ -30,7 +30,7 @@
run_visualize_tests && visualize(s.loggers["coords"], box_size, temp_fp_viz)
end

@testset "Lennard-Jones gas" begin
@testset "Lennard-Jones" begin
n_atoms = 100
n_steps = 20_000
temp = 298.0u"K"
Expand Down Expand Up @@ -77,7 +77,7 @@ end
end
end

@testset "Lennard-Jones gas Störmer-Verlet" begin
@testset "Lennard-Jones Störmer-Verlet" begin
n_atoms = 100
n_steps = 20_000
box_size = SVector(2.0, 2.0, 2.0)u"nm"
Expand Down
10 changes: 5 additions & 5 deletions test/zygote.jl
Original file line number Diff line number Diff line change
Expand Up @@ -123,17 +123,17 @@
end

runs = [
("cpu" , [false, false, false, true , true ], 0.1 , 0.2 ),
("cpu" , [false, false, false, true , true ], 0.1 , 0.25),
("cpu forward" , [false, true , false, true , true ], 0.01, 0.01),
("cpu f32" , [false, false, true , true , true ], 0.2 , 5.0 ),
("cpu nospecific", [false, false, false, true , false], 0.1 , 0.0 ),
("cpu nogeneral" , [false, false, false, false, true ], 0.0 , 0.2 ),
("cpu nogeneral" , [false, false, false, false, true ], 0.0 , 0.25),
]
if run_gpu_tests
push!(runs, ("gpu" , [true , false, false, true , true ], 0.2 , 5.0 ))
push!(runs, ("gpu" , [true , false, false, true , true ], 0.25, 5.0 ))
push!(runs, ("gpu forward" , [true , true , false, true , true ], 0.01, 0.01))
push!(runs, ("gpu f32" , [true , false, true , true , true ], 0.5 , 10.0))
push!(runs, ("gpu nospecific", [true , false, false, true , false], 0.2 , 0.0 ))
push!(runs, ("gpu f32" , [true , false, true , true , true ], 0.5 , 50.0))
push!(runs, ("gpu nospecific", [true , false, false, true , false], 0.25, 0.0 ))
push!(runs, ("gpu nogeneral" , [true , false, false, false, true ], 0.0 , 10.0))
end

Expand Down

2 comments on commit 01ef4a3

@jgreener64
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/51810

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.6.0 -m "<description of version>" 01ef4a365b9067ccbc14ab43b98b30b0226e8e3f
git push origin v0.6.0

Please sign in to comment.