Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
f5f32ed
Initial sketch
kellertuer May 26, 2025
666013c
Small improvements on the stopping criterion.
kellertuer May 26, 2025
ce229da
fix a typo.
kellertuer May 26, 2025
0e6842c
Sketch remaining roadmap.
kellertuer May 26, 2025
942db47
Clarify a few comments already.
kellertuer May 27, 2025
9e1b257
Resolve a few things in the extension
kellertuer Jun 2, 2025
a51957b
Extend the enegry_hamiltonian doc string.
kellertuer Jun 2, 2025
3667599
Improving costgrad a bit.
kellertuer Jun 2, 2025
46011d3
Further work before first PR.
kellertuer Jun 3, 2025
24c88e9
clear a few comments.
kellertuer Jun 3, 2025
962a7e8
add a bit of docs.
kellertuer Jun 3, 2025
b74efad
fix a typo.
kellertuer Jun 3, 2025
e5fec8a
debug info.
kellertuer Jun 3, 2025
249f1d0
remove an nonexistent field.
kellertuer Jun 3, 2025
05a2c4f
Merge branch 'master' into kellertuer/direct-min-manopt
kellertuer Jun 4, 2025
0604bc9
Also include RAT for speed reasons. First extension version that comp…
kellertuer Jun 4, 2025
bfb3643
First version that runs.
kellertuer Jun 4, 2025
eb74a21
Fix precon.
kellertuer Jun 4, 2025
54d360a
fix a few more default, still not properly working.
kellertuer Jun 4, 2025
2ecc48b
Fix a few more things.
kellertuer Jun 6, 2025
34f0fc0
Merge branch 'master' into kellertuer/direct-min-manopt
kellertuer Jun 6, 2025
2bec04b
Merge branch 'master' into kellertuer/direct-min-manopt
kellertuer Jun 17, 2025
84a9b84
improve naming and docs.
kellertuer Jun 17, 2025
aa52b9b
Fix one place in the docs.
kellertuer Jun 20, 2025
444a2c3
rename a variable.
kellertuer Jun 21, 2025
849184f
Split `direct_minimization` into two variants.
kellertuer Jul 2, 2025
9e7b667
Unify statements of return
kellertuer Jul 2, 2025
f5787b8
avoid the hack with the global setting by exporting the constructor.
kellertuer Jul 2, 2025
600742a
code formatting to avoid return.
kellertuer Jul 2, 2025
fde86c4
Avoid necessity to ] dev DFTK in the docs, add DocumenterInterLinks a…
kellertuer Jul 2, 2025
1cc65a1
Rename the costgrad functor to InsulatorEnergy.
kellertuer Jul 2, 2025
05553db
Fix a typo so that all but one wannier example (probably an unrelated…
kellertuer Jul 2, 2025
81cba58
Fix a few small bugs.
kellertuer Jul 2, 2025
532b297
Fix tests.
kellertuer Jul 2, 2025
60c468d
Define records and debugs, introduce separate cost/grad
kellertuer Jul 4, 2025
5a7dbd8
Remove a few finished TODOs.
kellertuer Jul 4, 2025
2ec2788
Add a few more things to the named tuple return thingy.
kellertuer Jul 7, 2025
cb20c31
Finish the other 3 easy things we can provide and document that prope…
kellertuer Jul 7, 2025
bc12327
Merge branch 'master' into kellertuer/direct-min-manopt
kellertuer Jul 7, 2025
67dc92f
Merge branch 'master' into kellertuer/direct-min-manopt
kellertuer Jul 7, 2025
de08702
fix project.toml.
kellertuer Jul 8, 2025
6634ce0
Fix an example to also run standalone again.
kellertuer Jul 8, 2025
1eca7c0
Merge branch 'master' into kellertuer/direct-min-manopt
mfherbst Sep 13, 2025
1383c8b
fix a typo and add a note.
kellertuer Sep 15, 2025
5baf0d8
Merge branch 'kellertuer/direct-min-manopt' of github.com:kellertuer/…
kellertuer Sep 15, 2025
045a4fd
to 92 characters.
kellertuer Sep 15, 2025
6cb7fb5
add converged result. Bump Manopt dependency to yesterdays 0.5.23, wh…
kellertuer Sep 15, 2025
e4f044a
Prepare to document the extension.
kellertuer Sep 17, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 11 additions & 5 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,10 @@ Interpolations = "a98d9a8b-a2ab-59e6-89dd-64a1c18fca59"
IterTools = "c8e1da08-722c-5040-9ed9-7db0dc04731e"
KrylovKit = "0b1a1467-8014-51b9-945f-bf0ae24f4b77"
Libxc = "66e17ffc-8502-11e9-23b5-c9248d0eb96d"
LineSearches = "d3d80556-e9d4-5f37-9878-2ab0fcc64255"
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
LinearMaps = "7a12625a-238d-50fd-b39a-03d52299707e"
MPI = "da04e1cc-30fd-572f-bb4f-1f8673147195"
Markdown = "d6f4376e-aef5-505a-96c1-9c027394607a"
Optim = "429524aa-4258-5aef-a3af-852621145aeb"
PeriodicTable = "7b2266bf-644c-5ea3-82d8-af4bbd25a884"
PkgVersion = "eebad327-c553-4316-9ea0-9fa01ccd7688"
Polynomials = "f27b6e38-b328-58d1-80ce-0feddd5e7a45"
Expand Down Expand Up @@ -53,7 +51,10 @@ GeometryOptimization = "673bf261-a53d-43b9-876f-d3c1fc8329c2"
IntervalArithmetic = "d1acc4aa-44c8-5952-acd4-ba5d80a2a253"
JLD2 = "033835bb-8acc-5ee8-8aae-3f567f8a3819"
JSON3 = "0f8b85d8-7281-11e9-16c2-39a750bddbf1"
Manifolds = "1cead3c2-87b3-11e9-0ccd-23c62b72b94e"
Manopt = "0fc0a36d-df90-57f3-8f93-d78a9fc72bb5"
Plots = "91a5bcdd-55d7-5caf-9e0b-520d859cae80"
RecursiveArrayTools = "731186ca-8d62-57ce-b412-fbd966d074cd"
Wannier = "2b19380a-1f7e-4d7d-b1b8-8aa60b3321c9"
WriteVTK = "64499a7a-5c06-52f2-abe2-ccb03c286192"
wannier90_jll = "c5400fa0-8d08-52c2-913f-1e3f656c1ce9"
Expand All @@ -66,6 +67,7 @@ DFTKGeometryOptimizationExt = "GeometryOptimization"
DFTKIntervalArithmeticExt = "IntervalArithmetic"
DFTKJLD2Ext = "JLD2"
DFTKJSON3Ext = "JSON3"
DFTKManifoldsManoptRATExt = ["Manifolds", "Manopt", "RecursiveArrayTools"]
DFTKPlotsExt = "Plots"
DFTKWannier90Ext = "wannier90_jll"
DFTKWannierExt = "Wannier"
Expand Down Expand Up @@ -104,13 +106,13 @@ JLD2 = "0.4, 0.5, 0.6"
JSON3 = "1"
KrylovKit = "0.8.3, 0.9, 0.10"
Libxc = "0.3.17"
LineSearches = "7"
LinearAlgebra = "1"
LinearMaps = "3"
Logging = "1"
MPI = "0.20.22"
Manifolds = "0.10.17"
Manopt = "0.5.23"
Markdown = "1"
Optim = "1"
PeriodicTable = "1"
PkgVersion = "0.3"
Plots = "1"
Expand All @@ -123,6 +125,7 @@ PseudoPotentialIO = "0.1"
PythonCall = "0.9"
QuadGK = "2"
Random = "1"
RecursiveArrayTools = "3.33.0"
Roots = "2"
SparseArrays = "1"
SpecialFunctions = "2"
Expand Down Expand Up @@ -158,15 +161,18 @@ JLD2 = "033835bb-8acc-5ee8-8aae-3f567f8a3819"
JSON3 = "0f8b85d8-7281-11e9-16c2-39a750bddbf1"
KrylovKit = "0b1a1467-8014-51b9-945f-bf0ae24f4b77"
Logging = "56ddb016-857b-54e1-b83d-db4d58db5568"
Manifolds = "1cead3c2-87b3-11e9-0ccd-23c62b72b94e"
Manopt = "0fc0a36d-df90-57f3-8f93-d78a9fc72bb5"
Plots = "91a5bcdd-55d7-5caf-9e0b-520d859cae80"
PythonCall = "6099a3de-0909-46bc-b1f4-468b9a2dfc0d"
QuadGK = "1fd47b50-473d-5c70-9696-f719f8f3bcdc"
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
RecursiveArrayTools = "731186ca-8d62-57ce-b412-fbd966d074cd"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
TestItemRunner = "f8b46487-2199-4994-9208-9a1283c18c0a"
Wannier = "2b19380a-1f7e-4d7d-b1b8-8aa60b3321c9"
WriteVTK = "64499a7a-5c06-52f2-abe2-ccb03c286192"
wannier90_jll = "c5400fa0-8d08-52c2-913f-1e3f656c1ce9"

[targets]
test = ["Test", "TestItemRunner", "AMDGPU", "ASEconvert", "AtomsBuilder", "Aqua", "AtomsIO", "AtomsIOPython", "CUDA", "CUDA_Runtime_jll", "ComponentArrays", "DoubleFloats", "FiniteDiff", "FiniteDifferences", "GenericLinearAlgebra", "GeometryOptimization", "IntervalArithmetic", "JLD2", "JSON3", "Logging", "Plots", "PythonCall", "QuadGK", "Random", "KrylovKit", "Wannier", "WriteVTK", "wannier90_jll"]
test = ["Test", "TestItemRunner", "AMDGPU", "ASEconvert", "AtomsBuilder", "Aqua", "AtomsIO", "AtomsIOPython", "CUDA", "CUDA_Runtime_jll", "ComponentArrays", "DoubleFloats", "FiniteDiff", "FiniteDifferences", "GenericLinearAlgebra", "GeometryOptimization", "IntervalArithmetic", "JLD2", "JSON3", "Logging", "Manifolds", "Manopt", "Plots", "PythonCall", "QuadGK", "Random", "RecursiveArrayTools", "KrylovKit", "Wannier", "WriteVTK", "wannier90_jll"]
11 changes: 11 additions & 0 deletions docs/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ Brillouin = "23470ee3-d0df-4052-8b1a-8cbd6363e7f0"
CUDA = "052768ef-5323-5732-b1bb-66c8b64840ba"
DFTK = "acf6eb54-70d9-11e9-0013-234b7a5f5337"
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
DocumenterCitations = "daee34ce-89f3-4625-b898-19384cb65244"
DocumenterInterLinks = "d12716ef-a0f6-4df4-a9f1-a5a34e75c656"
ForwardDiff = "f6369f11-7733-5829-9624-2563aa707210"
GeometryOptimization = "673bf261-a53d-43b9-876f-d3c1fc8329c2"
IterativeSolvers = "42fd0dbc-a981-5370-80f2-aaf504508153"
Expand All @@ -21,12 +23,15 @@ LazyArtifacts = "4af54fe1-eca0-43a8-85a7-787d91b784e3"
LibGit2 = "76f85450-5226-5b5a-8eaa-529ad045b433"
LinearMaps = "7a12625a-238d-50fd-b39a-03d52299707e"
Literate = "98b081ad-f1c9-55d3-8b20-4c87d4299306"
Manifolds = "1cead3c2-87b3-11e9-0ccd-23c62b72b94e"
Manopt = "0fc0a36d-df90-57f3-8f93-d78a9fc72bb5"
Optim = "429524aa-4258-5aef-a3af-852621145aeb"
Pkg = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f"
Plots = "91a5bcdd-55d7-5caf-9e0b-520d859cae80"
Printf = "de0858da-6303-5e67-8744-51eddeeeb8d7"
PseudoPotentialData = "5751a51d-ac76-4487-a056-413ecf6fbe19"
PythonCall = "6099a3de-0909-46bc-b1f4-468b9a2dfc0d"
RecursiveArrayTools = "731186ca-8d62-57ce-b412-fbd966d074cd"
StaticArrays = "90137ffa-7385-5640-81b9-e52037218182"
TimerOutputs = "a759f4b9-e2f1-59dc-863e-4aeb61b1ea8f"
Unitful = "1986cc42-f94f-5a68-af5c-568840ba703d"
Expand All @@ -35,9 +40,15 @@ Wannier = "2b19380a-1f7e-4d7d-b1b8-8aa60b3321c9"
WriteVTK = "64499a7a-5c06-52f2-abe2-ccb03c286192"
wannier90_jll = "c5400fa0-8d08-52c2-913f-1e3f656c1ce9"

[sources]
DFTK = {path = ".."}

[compat]
AtomsBuilder = "0.2"
AtomsCalculators = "0.2.3"
Documenter = "~1.8"
GeometryOptimization = "0.1"
PseudoPotentialData = "0.2.0"

[extras]
CUDA_Runtime_jll = "76a88914-d11a-5bdc-97e0-2f5a05c973a2"
21 changes: 17 additions & 4 deletions docs/make.jl
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ PAGES = [
"developer/symmetries.md",
"developer/gpu_computations.md",
],
"Extensions" => "extensions/index.md",
"api.md",
"publications.md",
]
Expand Down Expand Up @@ -121,7 +122,6 @@ DFTKREPO = DFTKGH * ".git"
# Setup julia dependencies for docs generation if not yet done
Pkg.activate(@__DIR__)
if !isfile(joinpath(@__DIR__, "Manifest.toml"))
Pkg.develop(Pkg.PackageSpec(; path=ROOTPATH))
Pkg.instantiate()
end

Expand All @@ -133,8 +133,10 @@ ENV["PLOTS_TEST"] = "true"
# Import packages for docs generation
using DFTK
using Documenter
using DocumenterCitations, DocumenterInterLinks
using Literate

# For documentation in extensions:
using Manifolds, Manopt, RecursiveArrayTools
#
# Generate the docs
#
Expand Down Expand Up @@ -187,7 +189,7 @@ for file in literate_files
badges = [
"[![](https://mybinder.org/badge_logo.svg)]" *
"(@__BINDER_ROOT_URL__/$subfolder/@__NAME__.ipynb)",
"[![](https://img.shields.io/badge/show-nbviewer-579ACA.svg)]" *
"[![](https://img.shields.io/badge/show-nbviewer-579ACA.svg)]" *
"(@__NBVIEWER_ROOT_URL__/$subfolder/@__NAME__.ipynb)",
]
else
Expand Down Expand Up @@ -216,8 +218,18 @@ mathengine = Documenter.MathJax3(Dict(
),
))

#Setup Citations and InterLinks
links = InterLinks(
"Manopt" => ("https://manoptjl.org/stable/"),
"ManifoldsBase" => ("https://juliamanifolds.github.io/ManifoldsBase.jl/stable/"),
"Manifolds" => ("https://juliamanifolds.github.io/Manifolds.jl/stable/"),
)
bib = CitationBibliography(joinpath(@__DIR__, "src", "references.bib"); style=:alpha)
makedocs(;
modules=[DFTK],
modules=[
DFTK,
Base.get_extension(DFTK, :DFTKManifoldsManoptRATExt),
],
format=Documenter.HTML(;
# Use clean URLs, unless built as a "local" build
prettyurls=CONTINUOUS_INTEGRATION,
Expand All @@ -231,6 +243,7 @@ makedocs(;
authors = "Michael F. Herbst, Antoine Levitt and contributors.",
pages=transform_to_md(PAGES),
checkdocs=:exports,
plugins=[bib, links],
warnonly=DEBUG,
remote_args...,
)
Expand Down
6 changes: 6 additions & 0 deletions docs/src/extensions/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Extensions

## Manopt.jl

```@docs
```
Empty file added docs/src/references.bib
Empty file.
1 change: 1 addition & 0 deletions examples/anyons.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using DFTK
using StaticArrays
using Plots
using Manifolds, Manopt, RecursiveArrayTools

## Unit cell. Having one of the lattice vectors as zero means a 2D system
a = 14
Expand Down
1 change: 1 addition & 0 deletions examples/compare_solvers.jl
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ using AtomsBuilder
using DFTK
using LinearAlgebra
using PseudoPotentialData
using Manopt, Manifolds, RecursiveArrayTools
Copy link
Member

Choose a reason for hiding this comment

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

It's a little weird that one needs to using all there three packages explicitly. Can we somehow avoid that ?

Copy link
Author

Choose a reason for hiding this comment

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

Not really.

  • Manopt is needed to load the solver(s) we use
  • Manifolds is needed for Grassmann and the Product manifold
  • The product manifold is basically a dummy until RecursiveArrayTools are loaded end the extension (in Manifolds) provides the efficient product manifold functions (baes on ArrayPartition)

so all 3 are needed.

Copy link
Member

Choose a reason for hiding this comment

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

I see, but that's quite inconvenient for a potential user. Could we avoid that by making a metapackage that depends on all three of them (like DFTKManopt.jl) ?

Copy link
Author

Choose a reason for hiding this comment

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

Uff. I would have no clue how to do that?
I also do not agree that that is inconvenient, it is what the extensions now bring – more modular packages without direct dependencies:

One can use Manopt with an own manifold (nand then not load Manifolds)
One can use Manifolds with an own implementation for the product structure (and then not load RecursiveArrayTools)

What would that package look like? Something with the Reexport all package? I am not sure what to do here.


pseudopotentials = PseudoFamily("dojo.nc.sr.pbesol.v0_4_1.standard.upf")
model = model_DFT(bulk(:Si); functionals=PBEsol(), pseudopotentials)
Expand Down
3 changes: 2 additions & 1 deletion examples/gross_pitaevskii.jl
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ lattice = a .* [[1 0 0.]; [0 0 0]; [0 0 0]];
# which is special cased in DFTK to support 1D models.
#
# For the potential term `V` we pick a harmonic
# potential. We use the function `ExternalFromReal` which uses
# potential. We use the function `ExternalFromReal` which uses
# Cartesian coordinates ( see [Lattices and lattice vectors](@ref conventions-lattice)).
pot(x) = (x - a/2)^2;

Expand All @@ -39,6 +39,7 @@ C = 1.0
# … and with this build the model
using DFTK
using LinearAlgebra
using Manopt, Manifolds, RecursiveArrayTools

n_electrons = 1 # Increase this for fun
terms = [Kinetic(),
Expand Down
1 change: 1 addition & 0 deletions examples/gross_pitaevskii_2D.jl
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
using DFTK
using StaticArrays
using Plots
using Manifolds, Manopt, RecursiveArrayTools

## Unit cell. Having one of the lattice vectors as zero means a 2D system
a = 15
Expand Down
Loading
Loading