Skip to content

Commit

Permalink
Merge pull request #18 from JuliaMolSim/ab05
Browse files Browse the repository at this point in the history
  • Loading branch information
mfherbst authored Dec 11, 2024
2 parents aa4f914 + c711593 commit e3f0dfd
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 34 deletions.
9 changes: 5 additions & 4 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "GeometryOptimization"
uuid = "673bf261-a53d-43b9-876f-d3c1fc8329c2"
authors = ["JuliaMolSim community"]
version = "0.1.0"
version = "0.1.1"

[deps]
AtomsBase = "a963bdd2-2df7-4f54-a1ee-49d51e6be12a"
Expand All @@ -19,9 +19,10 @@ Unitful = "1986cc42-f94f-5a68-af5c-568840ba703d"
UnitfulAtomic = "a7773ee8-282e-5fa2-be4e-bd808c38a91a"

[compat]
AtomsBase = "0.3"
AtomsBuilder = "0.1"
AtomsCalculators = "0.2"
ASEconvert = "0.1.8"
AtomsBase = "0.5"
AtomsBuilder = "0.2.2"
AtomsCalculators = "0.2.3"
DocStringExtensions = "0.9"
LineSearches = "7"
Optimization = "3"
Expand Down
8 changes: 3 additions & 5 deletions docs/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,13 @@ AtomsCalculators = "a3e0e189-c65a-42c1-833c-339540406eb1"
AtomsIO = "1692102d-eeb4-4df9-807b-c9517f998d44"
DFTK = "acf6eb54-70d9-11e9-0013-234b7a5f5337"
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
EmpiricalPotentials = "38527215-9240-4c91-a638-d4250620c9e2"
GeometryOptimization = "673bf261-a53d-43b9-876f-d3c1fc8329c2"
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
OptimizationNLopt = "4e6fcdb7-1186-4e1f-a706-475e75c168bb"
Unitful = "1986cc42-f94f-5a68-af5c-568840ba703d"
UnitfulAtomic = "a7773ee8-282e-5fa2-be4e-bd808c38a91a"

[compat]
ASEconvert = "0.1"
DFTK = "0.6"
Documenter = "~1.5"
EmpiricalPotentials = "0.1"
ASEconvert = "0.1.8"
DFTK = "0.7"
Documenter = "~1.8"
19 changes: 7 additions & 12 deletions docs/src/examples/aluminium_dftk.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,27 +15,22 @@ system = rattle!(bulk(:Al; cubic=true), 0.2u"Å")
Next we create a calculator employing the
[density-functional toolkit](https://dftk.org/)
to compute energies and forces at using the LDA density functional.
As pseudopotentials we use the [PseudoDojo](http://pseudo-dojo.org) as available
in the [PseudoPotentialData](https://github.com/JuliaMolSim/PseudoPotentialData.jl/)
package.
```@example dftk-aluminium
using DFTK
using PseudoPotentialData
model_kwargs = (; functionals=[:lda_x, :lda_c_pw], temperature=1e-3)
pseudopotentials = PseudoFamily("dojo.nc.sr.lda.v0_4_1.oncvpsp3.standard.upf")
model_kwargs = (; functionals=LDA(), temperature=1e-3, pseudopotentials)
basis_kwargs = (; kgrid=(3, 3, 3), Ecut=10.0)
scf_kwargs = (; mixing=KerkerMixing())
calc = DFTKCalculator(; model_kwargs, basis_kwargs, scf_kwargs)
nothing
```

We attach pseudopotentials to the aluminium system,
i.e. we tell DFTK, that each aluminium atom should be modelled using
a pseudopotential rather than the full Coulomb potential.

```@example dftk-aluminium
system = attach_psp(system; Al="hgh/lda/al-q3")
nothing
```

!!! info "Crude computational parameters"
Note, that these numerical parameters are chosen rather crudely in order
Note, that the numerical parameters above are chosen rather crudely in order
to give a fast runtime on CI systems. For production calculations one would
require larger computational parameters.

Expand Down
9 changes: 4 additions & 5 deletions docs/src/examples/other_solvers.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ to compute energies and forces at using the LDA density functional.

```@example other-solvers
using DFTK
using PseudoPotentialData
model_kwargs = (; functionals=[:lda_x, :lda_c_pw])
pseudopotentials = PseudoFamily("dojo.nc.sr.lda.v0_4_1.oncvpsp3.standard.upf")
model_kwargs = (; functionals=LDA(), pseudopotentials)
basis_kwargs = (; kgrid=(1, 1, 1), Ecut=20.0)
scf_kwargs = (; tol=1e-6)
calc = DFTKCalculator(; model_kwargs, basis_kwargs, scf_kwargs)
nothing
calc = DFTKCalculator(; model_kwargs, basis_kwargs)
```

and we build the hydrogen molecular system,
Expand All @@ -31,7 +31,6 @@ bounding_box = [[10.0, 0.0, 0.0], [0.0, 10.0, 0.0], [0.0, 0.0, 10.0]]u"Å"
system = periodic_system([:H => [0, 0, 1.]u"bohr",
:H => [0, 0, 3.]u"bohr"],
bounding_box)
system = attach_psp(system; H="hgh/lda/h-q1")
nothing
```

Expand Down
16 changes: 9 additions & 7 deletions docs/src/examples/tial_lj.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,36 +3,38 @@
TODO Write some text motivating this example

Setup system:
```@example tial
using AtomsBase
```julia
## TODO: Should run as @example once EmpiricalPotentials is compatible with AB 0.5
using AtomsIO
using EmpiricalPotentials
using GeometryOptimization
GO = GeometryOptimization

system = load_system(joinpath(pkgdir(EmpiricalPotentials), "data/TiAl-1024.xyz"))
nothing
```

Setup calculator:
```@example tial
```julia
## TODO: Should run as @example once EmpiricalPotentials is compatible with AB 0.5
using Unitful
using UnitfulAtomic

calc = LennardJones(-1.0u"meV", 3.1u"Å", 13, 13, 6.0u"Å")
nothing
```

Minimise energy:
```julia
## TODO: Should run as @example once EmpiricalPotentials is compatible
## TODO: Should run as @example once EmpiricalPotentials is compatible with AB 0.5
using GeometryOptimization
GO = GeometryOptimization

results = minimize_energy!(system, calc, GO.OptimCG(); maxiters=10, verbosity=1)
results.energy
```

Final structure:
```julia
## TODO: Should run as @example once EmpiricalPotentials is compatible
## TODO: Should run as @example once EmpiricalPotentials is compatible with AB 0.5

results.system
```
2 changes: 1 addition & 1 deletion src/clamping_updating_positions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ updated to the ones provided (in the order in which they appear in the system).
"""
function update_not_clamped_positions(system, positions::AbstractVector{<:Unitful.Length})
mask = [!get(atom, :clamped, false) for atom in system]
new_positions = deepcopy(position(system))
new_positions = deepcopy(position(system, :))
new_positions[mask] = reinterpret(reshape, SVector{3, eltype(positions)},
reshape(positions, 3, :))
update_positions(system, new_positions)
Expand Down

2 comments on commit e3f0dfd

@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/121177

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

Please sign in to comment.