Skip to content

Commit

Permalink
Set multiple lenses successively using Kaleido.jl
Browse files Browse the repository at this point in the history
  • Loading branch information
singularitti committed Aug 13, 2019
1 parent 28a2232 commit 6869bb4
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/StructureOptimization/StructureOptimization.jl
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ module StructureOptimization

using LinearAlgebra

using Kaleido: @batchlens

using IntervalArithmetic
using IntervalRootFinding
using EquationsOfState
Expand All @@ -34,9 +36,11 @@ function update_alat(pw::PWscfInput, eos::EquationOfState, pressure::Real)
volume = find_volume(PressureTarget, eos, pressure, 0..1000, Newton).interval.lo
alat = cbrt(volume / det(pw.cell_parameters.data))

alat_lens = @lens _.system.celldm[1]
press_lens = @lens _.cell.press
set(set(pw, alat_lens, alat), press_lens, pressure)
lenses = @batchlens begin
_.system.celldm[1]
_.cell.press
end
set(pw, lenses, (alat, pressure))
end

function generate_input(
Expand Down

0 comments on commit 6869bb4

Please sign in to comment.