Skip to content

Commit

Permalink
added sd as a solver option
Browse files Browse the repository at this point in the history
  • Loading branch information
Christoph Ortner committed Jan 10, 2019
1 parent a25d0b5 commit 1aaf03e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/Solve.jl
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ function minimise!(at::AbstractAtoms;
verbose = 1,
robust_energy_difference = false,
store_trace = false,
extended_trace = false,
extended_trace = false,
maxstep = Inf,
callback = nothing)

Expand Down Expand Up @@ -111,7 +111,7 @@ function minimise!(at::AbstractAtoms;
end

# choose the optimisation method Optim.jl
if method == :auto || method == :cg
if method == :auto || method == :cg
if isa(precond, Identity)
optimiser = ConjugateGradient(linesearch = BackTracking(order=2, maxstep=maxstep))
else
Expand All @@ -124,6 +124,10 @@ function minimise!(at::AbstractAtoms;
precondprep = (P, x) -> update!(P, at, x),
alphaguess = LineSearches.InitialHagerZhang(),
linesearch = BackTracking(order=2, maxstep=maxstep) )
elseif method == :sd
optimiser = Optim.GradientDescent( P = precond,
precondprep = (P, x) -> update!(P, at, x),
linesearch = BackTracking(order=2, maxstep=maxstep) )
else
error("JuLIP.Solve.minimise!: unknown `method` option")
end
Expand Down
8 changes: 8 additions & 0 deletions test/testsolve.jl
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,14 @@ set_constraint!(at, FixedCell(at))
P = FF(at, eam_W)
minimise!(at, precond = P, method = :lbfgs, robust_energy_difference = true, verbose=2)

## steepest descent
set_positions!(at, X0)
set_calculator!(at, eam_W)
set_constraint!(at, FixedCell(at))
P = FF(at, eam_W)
minimise!(at, precond = P, method = :sd, robust_energy_difference = true, verbose=2)


##
println("Optimise again with some different stabilisation options")
set_positions!(at, X0)
Expand Down

0 comments on commit 1aaf03e

Please sign in to comment.