-
Notifications
You must be signed in to change notification settings - Fork 18
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
Simplify the System API? #138
Comments
I don't know if this comment belongs here or in #126. How I would see a new system is:
There is still some weirdness with the |
They can not really be public: we need to ensure consistency between molecules and the molecules ids list.
We mainly use the kind during a simulation, and the name to set the particle kind when adding a new particle. This can happen in two cases: adding new particles between simulation runs, or adding molecules during the run (GCMC is the main culprit here, and maybe Gibbs ensemble simulations too). So we need the name => kind association to add new particles during a simulation. Other than that, I agree with you that having all the access functions will be bad, and the separation seems reasonable. |
At least the read-only part could be ? Do we really need to add particles by name when doing that in the middle of a simulation ? |
Adding new particles (and removing existing particles) is the whole idea of GCMC (the goal is to equilibrate the system at a given chemical potential by changing the particles number). The issue here is that the particle to add are part of the simulation, not the system, so we can not set the particle kind beforehand.
I don't get you here =). How can we ensure that something is read-only if we are making the field public? |
What should insertion be capable of, i.e. can there be fractional molecules? The selection of what can be inserted into the system is known before the simulation starts, right? The easiest case would be to have a "blueprint" of every molecule that can be inserted - stored somewhere and then pick it (clone it) and try to insert it. That would only need a |
Yes, but different system can associate different particles kind to a given name. Storing blueprint is what I had in mind, but we store them inside the We could setup the particle kind in |
And yeah, this sucks when trying to decouple system and interaction =/ I really have no better idea on how to do this. |
Wild idea: can we provide the list of insertion targets as arguments to the MCMove? Although, we then have to work out how to check if a molecule is present in the system ... |
Can you expand on that? I don't get it |
Mhm, my idea would have been to build the particles before the simulation starts. For that, we need system information, i.e. we need to be able to build a particle with a Does that make sense? |
Yes, ok =). This would be possible to do, but we still need to associate the simulation and the system for the setup. This is roughly what I was proposing: use the |
Well, there is no way to get around this, right?
Yep. I guess the only difference is that the pre-built particles would not have to reside in |
Yeah that was not clear in my head. I guess what I was thinking is that we could expose the immutable slices of the SOA directly instead of having to create every getters. The good thing if we setup the Kinds in the simulation setup is that we will know exactly how many Kinds there is, and consequently would not need a |
Yes, exposing slices (mutable and immutables) would be nice! We just need to prevent insertions and removal in the vector. Why would we want to have a Vec for the kind already? If it is just for memory locality, we could use something like ordermap =) |
It's just that it is simpler than the current I do not know all the places that use |
Yes, I messed up with the interaction lookup, where we are also using BTreeMap 😄 |
Yes this |
For pairs and bonds, yes. We'll still need a map (or a sparse tensor) for angles and dihedrals. |
Opening a meta-issue to discuss possible simplification for the System API. The
System
is a bit of a God Object, with an ever growing API.What we we do to simplify it? And what can we do to encapsulate the internals better, while retaining control on performances?
The text was updated successfully, but these errors were encountered: