-
Notifications
You must be signed in to change notification settings - Fork 188
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
Merge the two MinimizeEnergy interfaces #3271
Comments
Agreed. Furthermore, the term 'minimize energy' should not appear, since that is not, what it does.
|
I think if we are considering a (major) interface change here, we should evaluate if the integrator should really be a property of the system. Mixing algorithmic aspects with the definition of the system is not co-aligned with the mental model suggested by statistical mechanics. I've always disliked how the current interface mixes the declaration of what the system is with what you do to it. To be more verbose: The That being said, I don't think that we should break every other user script again; lack of API stability is the complain I hear the second most often. I think we should think about introducing some API versioning system. E.g. there could be a default, but we could also provide something like |
@fweik I mostly agree. But what's the right approach? Re-designing the interface to be meaningful, with a clear separation between physical concepts and algorithms, requires a large effort. Splitting the effort in incremental changes is what seems to work best in the espresso team, because each small change tends to grow rapidly in scope. The present issue is just another sad example of the typical espresso maintenance workflow:
I don't see how we could maintain multiple APIs without introducing either more complexity or more code duplication, which would both increase the number of bugs. In the present issue, I'd be fine with having |
So, getting a clear idea of how things do and should inter-relate is something we are working on. I'd probably change the interface, only once we have a clear idea and focus the dis-entangling effort on the core for now. When we do change the interface at some point, however, it does help if there is exactly one place to touch. So, short term, I think, only integrator.set_steepest_descent should remain. |
What @RudolfWeeber says. I totally agree that this should be changed, but I think we should do one big change when we have figured out that we want do minimize the frequency of breaking interface changes, e.g. such changes that force many users to adapt their scripts. |
The GROMACS team seems to be facing the same issues of integrator maintenance, extensibility and nomenclature as we do: |
Fixes #3271 Description of changes: - represent core integrators as individual Python classes to reduce coupling in the script interface - use an `IntegratorHandle` Python class to store the currently active integrator - make the steepest descent algorithm a fully functional integrator and remove a side effect in `steepest_descent()` that reverted the `integ_switch` value after integration - move the integrator logic from `espressomd.minimize_energy.MinimizeEnergy` to `espressomd.integrate.SteepestDescent` - keep `espressomd.minimize_energy.MinimizeEnergy` as a wrapper for backward compatibility - API change: - *no API change* for integrators - API change for `espressomd.minimize_energy.MinimizeEnergy`: now a stateless free function that takes an espresso system as argument, renamed to `steepest_descent`
There are currently two Python interfaces for the steepest descent (SD) algorithm in the core:
MinimizeEnergy
: has type checks, default values, can be checkpointed, no interruption handlingIntegrator
: has no type checks, no default values, can be checkpointed, interruption handlingWhen using
Integrator
, the previous integrator state is overridden in both the core and interface, and needs to be restored after the minimization ends. When usingMinimizeEnergy
, the previous integrator state is overridden only in the core, which means runningsystem.integrator.run()
afterwards is ill-defined. The structure of classIntegrator
is also quite heterogeneous and not easily extensible. In particular, the numerousif self._method == X
introduce too much coupling between the different types of integrators.It would make more sense to refactor
integrate.pyx
with the design ofinteractions.pyx
: an abstract classIntegrator
from whichSD
/NPT
/VV
inherit, and a classCurrentIntegrator
(used asSystem.integrator = CurrentIntegrator()
) that contains an instance ofIntegrator
. Adding or removing an integrator algorithm would only be a matter of writing/removing a class.The text was updated successfully, but these errors were encountered: