Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

geomopt filter_func argument does not support ase.constraints as advertised #311

Open
ajjackson opened this issue Sep 30, 2024 · 5 comments · May be fixed by #313
Open

geomopt filter_func argument does not support ase.constraints as advertised #311

ajjackson opened this issue Sep 30, 2024 · 5 comments · May be fixed by #313
Labels
bug Something isn't working documentation Improvements or additions to documentation priority Urgent attention required

Comments

@ajjackson
Copy link

The docstring for janus geomopt includes

    filter_func : Optional[str]
        Name of filter function from ase.filters or ase.constraints, to apply
        constraints to atoms. If using --vectors only or --fully-opt, defaults to
        `FrechetCellFilter` if available, otherwise `ExpCellFilter`.

but the code does not actually seem to look for functions in ase.constraints. I would like to use the FixSymmetry constraint with a full geometry optimisation. Is there a way to make that work?

@ajjackson
Copy link
Author

I wonder if it will be better to have separate arguments selecting the optimising filter and selecting other constraint(s) as these are really independent choices.

@ElliottKasoar
Copy link
Member

I think the docstring is wrong, sorry.

Through the Python interface you could pass the actual constraint function, or (untested) the Atoms already constrained.

This is somewhat of a remnant of moving from ASE 3.22.1, where everything was contained within the constraints module, but yes now that they're separate modules, individual arguments sounds like a reasonable addition.

@ElliottKasoar ElliottKasoar added bug Something isn't working documentation Improvements or additions to documentation priority Urgent attention required labels Sep 30, 2024
@ajjackson ajjackson linked a pull request Sep 30, 2024 that will close this issue
3 tasks
@ajjackson
Copy link
Author

Constraints and Filters don't really work the same way, though. I don't see how e.g. unit-cell optimisation with a FixedAtoms constraint could be set up correctly through the current Python API. In #313 you can see how the constraint should be attached.

@ElliottKasoar
Copy link
Member

ElliottKasoar commented Sep 30, 2024

Ok yes, sorry I didn't think through passing the function through carefully enough, I agree that shouldn't work.

Would you not expect the latter suggestion

struct.set_constraint(constraint)
GeomOpt(struct)

to work though?

I'm probably missing something, but I don't see why it should need to be constrained within the optimiser class?

@ajjackson
Copy link
Author

ajjackson commented Sep 30, 2024

Yeah that should work, and would simplify implementation a bit more! Would it have implications for logging etc.?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working documentation Improvements or additions to documentation priority Urgent attention required
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants