-
Hi I have created a cluster expansion and ensemble with four sublattices. Two of the sublattices are active. I would like to fix the concentration on one of the sublattices and fix the chemical potential on the other in a SGCMC simulation. I see in the example notebook how to create a CompositionSpace object that contains such constraints, but it's unclear how to pass that object to the sampler. Trying to parse the code but it's slow-going -- any help is appreciated! |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 24 replies
-
Hello @dmebane 👋 If I understand correctly, I think that your situation can be resolved without relying on the This will then result in MC where only sites of the single active sublattices (for which you are setting the chemical potential) will be updated. so the sites of those sublattices will never be changed, however the configuration of the originally active sublattice that you set to be inactive will still be used in computing the CE energy. This would be something like this: assert len(ensemble.active_sublattices) == 2
assert len(ensemble.inactive_sublattices) == 2
# say the sublattice you want to set to inactive is index 0
ensemble.active_sublattices[0].restrict_sites(ensemble.active_sublattices[0].sites)
# This should render that sublattice as inactive now
assert len(ensemble.active_sublattices) == 1
assert assert len(ensemble.inactive_sublattices) == 3 Does this sound like it addresses your use case? |
Beta Was this translation helpful? Give feedback.
-
Hi -- update: I am using a workaround which is to sweep chemical potentials of the composition I want to fix, then fitting a function to the results and fixing that function at the composition I want. This seems to work at the cost of a lot of extra computation. |
Beta Was this translation helpful? Give feedback.
Hi @dmebane
Just looked into this, sorry for the delay. We have a CompositeUsher already implemented, which in principle can solve your problem. However, it is currently not very user-friendly, as you have to manually create a list of MCUshers to pass into the Sampler constructor. Also, I don't think it yet works for the "table-flip" step type.
Here is example code to make a Sampler with a CompositeUsher, assuming you have an ensemble made already: