diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..700707c --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,7 @@ +# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates +version: 2 +updates: + - package-ecosystem: "github-actions" + directory: "/" # Location of package manifests + schedule: + interval: "weekly" diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 3e06aaf..ff21261 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -27,12 +27,12 @@ jobs: arch: - x64 steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - uses: julia-actions/setup-julia@v1 with: version: ${{ matrix.version }} arch: ${{ matrix.arch }} - - uses: actions/cache@v1 + - uses: actions/cache@v3 env: cache-name: cache-artifacts with: @@ -45,30 +45,23 @@ jobs: - uses: julia-actions/julia-buildpkg@v1 - uses: julia-actions/julia-runtest@v1 - uses: julia-actions/julia-processcoverage@v1 - - uses: codecov/codecov-action@v2 + - uses: codecov/codecov-action@v3 with: files: lcov.info docs: name: Documentation runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - uses: julia-actions/setup-julia@v1 with: version: '1' - run: | julia --project=docs -e ' using Pkg - pkg"add https://github.com/jagot/Jagot.jl"' - - run: | - julia --project=docs -e ' - using Pkg - Pkg.develop(PackageSpec(path=pwd())) Pkg.instantiate() - pkg"build PyPlot"' - env: - PYTHON: "" - - run: julia --project=docs docs/make.jl + pkg"add https://github.com/jagot/Jagot.jl"' + - uses: julia-actions/julia-docdeploy@v1 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} DOCUMENTER_KEY: ${{ secrets.DOCUMENTER_KEY }} @@ -76,7 +69,7 @@ jobs: name: Doctests runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - uses: julia-actions/setup-julia@v1 with: version: '1' diff --git a/.gitignore b/.gitignore index 0545f2b..72481cc 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,5 @@ *.jl.mem *~ /docs/src/figures/ +Manifest.toml +.CondaPkg \ No newline at end of file diff --git a/Project.toml b/Project.toml index 94f1ceb..e1f864b 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "AtomicStructure" uuid = "e24b7630-0518-11e9-1346-1188d3abce50" authors = ["Stefanos Carlström "] -version = "0.1.7" +version = "0.1.8" [deps] AngularMomentumAlgebra = "0bb1b1ac-0216-11e9-361b-bb110c659ce1" @@ -40,22 +40,22 @@ WignerSymbols = "9f57e263-0b3d-5e2e-b1be-24f2bb48858b" [compat] AngularMomentumAlgebra = "0.1, 0.2, 0.3" ArnoldiMethod = "0.2" -ArrayLayouts = "0.7, 0.8" +ArrayLayouts = "0.7, 0.8, 1" AtomicLevels = "0.1.3" BandedMatrices = "0.16, 0.17" -BlockBandedMatrices = "0.11" +BlockBandedMatrices = "0.11, 0.12" CompactBases = "0.3.9" Compat = "3.27, 4" ContinuumArrays = "0.10, 0.11, 0.12" CoulombIntegrals = "0.1.1" Crayons = "4.0" EnergyExpressions = "0.1" -FillArrays = "0.12, 0.13" +FillArrays = "0.12, 0.13, 1" Formatting = "0.4" HalfIntegers = "1.3" IntervalSets = "0.5, 0.6, 0.7" IterativeSolvers = "0.9" -LazyArrays = "0.22" +LazyArrays = "0.22, 1" LineSearches = "7" Optim = "1.7" PrettyTables = "2" diff --git a/docs/CondaPkg.toml b/docs/CondaPkg.toml new file mode 100644 index 0000000..7d59288 --- /dev/null +++ b/docs/CondaPkg.toml @@ -0,0 +1,2 @@ +[deps] +matplotlib = ">=3" diff --git a/docs/Project.toml b/docs/Project.toml index 94e550c..bd30b44 100644 --- a/docs/Project.toml +++ b/docs/Project.toml @@ -2,17 +2,30 @@ AngularMomentumAlgebra = "0bb1b1ac-0216-11e9-361b-bb110c659ce1" AtomicLevels = "10933b4c-d60f-11e8-1fc6-bd9035a249a1" CompactBases = "2c0377a8-7469-4ebd-be0f-82e501f20078" +CondaPkg = "992eb4ea-22a4-4c89-a5bb-47a3300528ab" ContinuumArrays = "7ae1f121-cc2c-504b-ac30-9b923412ae5c" CoulombIntegrals = "42e5845a-f9f1-11e8-0afe-795ea56ed153" Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4" EnergyExpressions = "f4b57a2e-27c7-11e9-0cb0-edd185b706f6" IntervalSets = "8197267c-284f-5f27-9208-e0e47529a953" -Jagot = "84fb645a-ffa8-56cf-983b-ade63a92b20c" LazyArrays = "5078a376-72f3-5289-bfd5-ec5146d43c02" -PyCall = "438e738f-606a-5dbb-bf0a-cddfbfd45ab0" -PyPlot = "d330b81b-6aea-500a-939a-2ce795aea3ee" +PythonCall = "6099a3de-0909-46bc-b1f4-468b9a2dfc0d" +PythonPlot = "274fc56d-3b97-40fa-a1cd-1b4a50311bf9" QuasiArrays = "c4ea9172-b204-11e9-377d-29865faadc5c" SolverTraces = "619b3e1a-df4a-11e8-3b0b-a997e0925a8d" [compat] +AngularMomentumAlgebra = "0.1, 0.2, 0.3" +AtomicLevels = "0.1.3" +CompactBases = "0.3" +CondaPkg = "0.2" +ContinuumArrays = "0.10, 0.11, 0.12" +CoulombIntegrals = "0.1.1" Documenter = "0.27" +EnergyExpressions = "0.1" +IntervalSets = "0.7" +LazyArrays = "0.22, 1" +PythonCall = "0.9" +PythonPlot = "1" +QuasiArrays = "0.9" +SolverTraces = "0.1" diff --git a/docs/plots.jl b/docs/plots.jl index 6069c21..33059ef 100644 --- a/docs/plots.jl +++ b/docs/plots.jl @@ -1,11 +1,11 @@ -using PyPlot +using PythonPlot using Jagot.plotting plot_style("ggplot") -using PyCall +using PythonCall Cycler = pyimport("cycler") -plt.rc("axes", prop_cycle=(plt.rcParams["axes.prop_cycle"] + - Cycler.cycler("linestyle", ["-","--",":","-.",":","-","--"]))) +pyplot.rc("axes", prop_cycle=(pyplot.rcParams["axes.prop_cycle"] + + Cycler.cycler("linestyle", ["-","--",":","-.",":","-","--"]))) using Statistics using Random @@ -23,29 +23,24 @@ function mean_color(color::String) mean([c.r,c.g,c.b]) end +mean_color(color::Py) = mean_color(pyconvert(String, color)) + lerp(a,b,t) = (1-t)*a + t*b mean_position(x, ϕ) = ϕ'*Diagonal(x)*ϕ/(ϕ'ϕ) -function cfigure(fun::Function, figname; clear=true, tight=true, kwargs...) - figure(figname; kwargs...) - clear && clf() - fun() - tight && tight_layout() -end - -function csubplot(fun::Function, args...; nox=false, noy=false) - ax = subplot(args...) - fun() - if nox - no_tick_labels(:x) - xlabel("") - end - if noy - no_tick_labels(:y) - ylabel("") +function savedocfig(name,dir="figures") + fig = gcf() + filename = joinpath(@__DIR__, "src", dir, "$(name).svg") + savefig(filename, + transparent=true, + facecolor=fig.get_facecolor()) + PythonPlot.close("all") + if isfile(filename) + println("Saved $(name) to $(filename)") + else + @warn "Saving $(name) to $(filename) failed" end - ax end function plot_orbitals(atom::Atom; nrplot=1000, plot_basis=false, @@ -120,7 +115,7 @@ function hydrogen() gst = ground_state(nucleus) atom = Atom(R, [spin_configurations(gst)[1]], nucleus) plot_orbitals(atom) - savefig("docs/src/figures/hydrogen.svg") + savedocfig("hydrogen") end function helium() @@ -142,7 +137,7 @@ function helium() end legend(framealpha=0.75,ncol=2) end - savefig("docs/src/figures/helium.svg") + savedocfig("helium") end function beryllium(grid_type) @@ -153,7 +148,7 @@ function beryllium(grid_type) fock = Fock(atom) optimize!(fock,ω=0.999,ωmax=1-1e-3,scf_method=:arnoldi) plot_orbitals(atom) - savefig("docs/src/figures/beryllium-$(grid_type).svg") + savedocfig("beryllium-$(grid_type)") end macro echo(expr) @@ -162,7 +157,8 @@ macro echo(expr) end @info "Documentation plots" -mkpath("docs/src/figures") +fig_dir = joinpath(@__DIR__, "src", "figures") +mkpath(fig_dir) @echo hydrogen() @echo helium() @echo beryllium(:fedvr)