-
Notifications
You must be signed in to change notification settings - Fork 15
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
Enable user-specified spin flips to canonical MC #52
Comments
Just to clarify, my solution involves providing the CanonicalEnsemble object with a new set of sublattices, defined by the sites occupied by certain species for a given initial occupation, when the object is first instantiated. Maybe we could add this as an option during CanonicalEnsemble instantiation to specify a new or additional set of sublattices. The reason I mention the possibility of adding possible sublattices rather than replacing the current set of sublattices is because there is an option to choose which sublattices you want to perform the MC on in the run function, so you could potentially run an annealing over the all-cation sublattice then a normal MC run within the Li-Va sublattice with a single CanonicalEnsemble instance. Of course, the load to just create separate CanonicalEnsemble instances for the all-cation sublattice and the Li-Va sublattice isn't high, so I'm not sure if there is a benefit either way. |
Thanks @juliayang and @tchen0965 this seems to be a pretty important option for us if using a canonical ensemble. I think as @juliayang mentions this are two (3?) issues.
|
@lbluque Yes, that's what I used. As a note, in a previous pull request, I added the option to set the sublattices in the CanonicalEnsemble instantiation too. I agree that some care has to be taken that species aren't swapped onto sites on which they are not in the domain (site space). I think this takes some knowledge from the user that I'm not sure we should assume they have, which is partially why I'm not quite sure how to handle it. For example, I was thinking of adding the option to add sublattices by species (e.g. user can provide ['Li+', 'Vacancy'] as another sublattice), but I don't think you should provide an option which can break the MC (e.g. if you provide ['Li+', 'Va', 'Mn2+', 'Mn3+'] as possible sublattice but Mn3+ can only be in oct site), so I don't think that's a reasonable solution. |
Oooh. I like your idea! Something along the lines of set intersections of site spaces? |
I think so? The set interactions would be only those sites which contain the given species (for example, Li and Vacancy). As long as both Li and Vacancy are all allowed on the same set of sites, even if their list of possible sites has different site spaces, they shouldn't end up in a site that they shouldn't be on. It may require a bit of editing on the flip function too though, if the bit of a species changes from one site space to another. If this is an ok solution, I can work on a version for the pull request, and we can decide when the request is submitted if we want to make changes in how it's implemented. |
I think this can be a very good solution, although fully generalizing in a robust manner will require a bit of thinking, but I actually think its a very fun problem. It should only involve adapting the smol/smol/moca/ensembles/canonical.py Lines 208 to 231 in f55cb96
Two not so trivial things are to define a general, robust and fast way to find all the sites that are needed to augment the I actually have some ideas on how to do the first part, so if you want I may just create a quick feature branch for this so we can work on it and then merge it into master and/or experimental once we are happy. |
Hi @tchen0965, have a look at the overlap_canonical branch I just created. I added the following things as a sketch to implement the possible swapping of species among sublattices. I haven't even checked it, so this still needs quite a bit of work. But feel free to checkout this branch and add/edit to it. This is an attempt to get the info necessary of overlaps. Its a start, but still not sure what the best way to store it is. smol/smol/moca/ensembles/canonical.py Lines 68 to 79 in d7382c7
Here is where we augment the list of sites to choose a flip from. This is ok, the problem is there is a lot of calls and stuff going on so not sure how it affects the MC. I think the best is to get as much possible information in the step above (only done in construction) so that this part can be as efficient as possible. smol/smol/moca/ensembles/canonical.py Lines 247 to 260 in d7382c7
|
I'm closing this since it seems to have largely been addressed in #271 |
Is your feature request related to a problem? Please describe.
There are some examples which require modification to the way spin flips are currently implemented:
It has been suggested by Gerd to include a feature where a user can specify allowed perturbations since it seems that other perturbations, besides for the two examples above, may want to be enforced.
Describe the solution you'd like
Ideally, user specifies a table of allowed perturbations and a probability by which the perturbation can occur. In example 1, a user could specify:
{'Li+': {'sublattice_1': 0.5}, {'sublattice_2': 0.5}}
indicating that a Li+ can equally flip into sublattice 1 or sublattice 2. The code will then enforce that such possible flips are picked with equal probability.Note that detailed balance should be obeyed at all times, which could be either up the user, or the code, to enforce.
Describe alternatives you've considered
@tchen0965 has code which can address the first issue of Li+ spin flips between different sublattices. She may want to submit a PR soon.
The text was updated successfully, but these errors were encountered: