Skip to content

Commit

Permalink
Bugfix in output arguments for hybrid functionals (#32)
Browse files Browse the repository at this point in the history
* Fix hybrid output argument assignment

* up

* Update .gitlab-ci.yml
  • Loading branch information
mfherbst authored Jan 4, 2024
1 parent 528756b commit f140595
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 19 deletions.
16 changes: 8 additions & 8 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,27 @@ stages:
# This job tests DFTK.jl with Julia 1.9 on Noctua 2
# It only runs when:
# - Commit in master
# - PR from branch with name ending in "gpu"
# - PR from branch with name ending in 'gpu'
# - Manual run triggered
julia/1.9-n2:
stage: test
variables:
SCHEDULER_PARAMETERS: "-N 1 -n 1 -c 16 --gres=gpu:a100:1 --qos=devel -p dgx -t 00:20:00 -A hpc-prf-dftkjl"
JULIA_DEPOT_PATH: "/scratch/hpc-prf-dftkjl/dftkjl01/.julia-ci"
JULIA_NUM_THREADS: "1" # GPU and multi-threading not yet compatible
SCHEDULER_PARAMETERS: -N 1 -n 1 -c 16 --gres=gpu:a100:1 --qos=devel -p dgx -t 01:30:00 -A hpc-prf-dftkjl
JULIA_DEPOT_PATH: /scratch/hpc-prf-dftkjl/dftkjl01/.julia-ci
JULIA_NUM_THREADS: 1 # GPU and multi-threading not yet compatible
coverage: '/\(\d+.\d+\%\) covered/'
rules:
- if: $CI_COMMIT_BRANCH == "master"
- if: $CI_PIPELINE_SOURCE == "external_pull_request_event" && $CI_EXTERNAL_PULL_REQUEST_SOURCE_BRANCH_NAME =~ /gpu$/
- if: $CI_PIPELINE_SOURCE == "external_pull_request_event"
- if: $CI_COMMIT_BRANCH == 'master'
- if: $CI_PIPELINE_SOURCE == 'external_pull_request_event' && $CI_EXTERNAL_PULL_REQUEST_SOURCE_BRANCH_NAME =~ /gpu$/
- if: $CI_PIPELINE_SOURCE == 'external_pull_request_event'
when: manual
script:
- module load lang/JuliaHPC/1.9.3-foss-2022a-CUDA-11.7.0
- julia --project=. -e '
using Pkg; Pkg.instantiate();
Pkg.add("CUDA");
using CUDA;
CUDA.set_runtime_version!(v"11.7"; local_toolkit=true)
CUDA.set_runtime_version!(v"11.7"; local_toolkit=true);
'
- julia --color=yes --project=. -e '
using Pkg;
Expand Down
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
authors = ["Jason Eu <[email protected]>", "Michael F. Herbst <[email protected]>"]
name = "Libxc"
uuid = "66e17ffc-8502-11e9-23b5-c9248d0eb96d"
version = "0.3.17"
version = "0.3.18"

[compat]
CUDA = "5"
Expand Down
4 changes: 2 additions & 2 deletions src/evaluate.jl
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ const ARGUMENTS = Dict(

# Hybrid or not, the arguments are the same
ARGUMENTS[:hyb_lda] = ARGUMENTS[:lda]
ARGUMENTS[:hyb_gga] = ARGUMENTS[:lda]
ARGUMENTS[:hyb_mgga] = ARGUMENTS[:lda]
ARGUMENTS[:hyb_gga] = ARGUMENTS[:gga]
ARGUMENTS[:hyb_mgga] = ARGUMENTS[:mgga]

const INPUT = Dict(
:lda => [:rho],
Expand Down
16 changes: 8 additions & 8 deletions test/cpu.jl
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ using Libxc

# LDA
lda_x = Functional(:lda_x)
result = evaluate(lda_x, rho=rho, derivatives=0).zk
@test result [-0.342809, -0.431912, -0.494416, -0.544175, -0.586194] atol=1e-5
result = evaluate(lda_x, rho=rho, derivatives=0:1)
@test result.zk [-0.342809, -0.431912, -0.494416, -0.544175, -0.586194] atol=1e-5

# GGA
gga_x = Functional(:gga_x_pbe)
result = evaluate(gga_x, rho=rho, sigma=sigma, derivatives=0).zk
@test result [-0.452598, -0.478878, -0.520674, -0.561428, -0.598661] atol=1e-5
result = evaluate(gga_x, rho=rho, sigma=sigma, derivatives=0:1)
@test result.zk [-0.452598, -0.478878, -0.520674, -0.561428, -0.598661] atol=1e-5
end

@testset "Hybrid LDA and Hybrid GGA evaluate" begin
Expand All @@ -24,13 +24,13 @@ end

# LDA
hyb_lda_xc = Functional(:hyb_lda_xc_bn05)
result = evaluate(hyb_lda_xc, rho=rho, derivatives=0).zk
@test result [-0.162837, -0.234719, -0.286980, -0.329442, -0.365816] atol=1e-5
result = evaluate(hyb_lda_xc, rho=rho, derivatives=0:1)
@test result.zk [-0.162837, -0.234719, -0.286980, -0.329442, -0.365816] atol=1e-5

# GGA
gga_x = Functional(:hyb_gga_x_s12h)
result = evaluate(gga_x, rho=rho, sigma=sigma, derivatives=0).zk
@test result [-0.350425, -0.362603, -0.389472, -0.421598, -0.452075] atol=1e-5
result = evaluate(gga_x, rho=rho, sigma=sigma, derivatives=0:1)
@test result.zk [-0.350425, -0.362603, -0.389472, -0.421598, -0.452075] atol=1e-5
end

@testset "LDA and GGA evaluate!" begin
Expand Down

2 comments on commit f140595

@mfherbst
Copy link
Member 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/98190

Tip: Release Notes

Did you know you can add release notes too? Just add markdown formatted text underneath the comment after the text
"Release notes:" and it will be added to the registry PR, and if TagBot is installed it will also be added to the
release that TagBot creates. i.e.

@JuliaRegistrator register

Release notes:

## Breaking changes

- blah

To add them here just re-invoke and the PR will be updated.

Tagging

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.3.18 -m "<description of version>" f140595be3bf1812dec0c5879e68efe3fb8895f8
git push origin v0.3.18

Please sign in to comment.