JuLIP.jl
JuLIP.jl copied to clipboard
Consider redesign of constraints
to make it easy to implement much more general constraints, Including bound constraints, box constraints, all sorts of useful stuff.
FixedCell
and VariableCell
would either become DofManagers
or alternatively VariableCell
could be the default while FixedCell
just becomes another constraint to add to the system.
Constraints which maintain cubic symmetry of the cell (or other symmetries) during minimisation would be helpful. I occasionally get 1e-5 variation in side lengths for the unit cell, which can lead to significant asymmetry when constructing large systems.
We have this in Python already :-)
https://gitlab.com/ase/ase/merge_requests/950
interesting - how would one implement this?
Are these just linear constraints on the cell matrix?
Essentially we use spglib
to find the symmetry group and project out contributions to force and stress that depart from symmetry.
force as well?
Yes - atomic positions may be symmetry-constrained for multilattices
Maybe this is a good example of a special-case that should be coded once, and this provides an opportunity to improve JuLIP <---> ASE
convenience bindings
It's currently implemented by wrapping the Calculator, but I've agreed to try to turn it into an ASE constraint. Could we add an ASEConstraint
wrapper to JuLIP that calls adjust_forces()
and adjust_positions()
?
But we would allow this only for linear constraints. Even then I'm a bit nervous... One also needs to incorporate the constraint into the preconditioners...
That's fair. In the ASE implementation we just project back on to the constraint manifold after each step and it seems to work (most of the time), even with the preconditioned optimizers.
Perhaps an advantage of keeping it as a Calculator wrapper is that a non-linear transformation of the forces and stresses is then ok?
Code is not huge it you want to reimplement in Julia, I'm just worried about the overhead if we have to code/test/maintain everything twice
https://gitlab.com/ase/ase/merge_requests/950/diffs?view=inline
Well, my suggestion would be as a first step to not automate it as you did, but to put the burden onto the user :). I.e. just offer the option of a linear constraint on the cell.
As a second step we could maybe find out how to "read" the constraint from ASE but then implement it within the JuLIP framework.
Sounds like a good plan
Tom - can we have a chat at some point about how to implement - and more important test - this?
Certainly!
Some thoughts on a new DoF Manager Design:
- have a generic Dog Manager
- the atoms mask can be a specific constraint that we can apply set_constraint!(Clamp(free = , clamp = , mask = , clampx = , clampy = , ... )) set_contraint!(InPlane), set_constraint!(AntiPlane)
- set_variablecell!(true/false) or set_fixedcell!(true / false) or set_constraint!(FixedCell), set_constraint!(VariableCell)
- clear_constraints!(at)
new dof manager is done. Will look at linear constraints when there is time / a need!