-
Notifications
You must be signed in to change notification settings - Fork 23
Description
Here is an email from Chi Xu, who works with @gcourcou
This is Chi, I am working with George Courcoubetis on tissue research. Currently we want to visualize T1 transitions in a growing tissue. Specifically, we want to get the number of T1 transitions and the place(which cells) where they happen in the tissue when we use find energy min function with T1 transitions is on. However I found it's not easy to do so. I keep track of the number of sides for each cell, if it's changing I assume T1 transitions happen. But it could be different(like cell divisions, or T1 transitions happen twice on a cell which keeps the number of sides the same for that cell). So I am sending this email to ask whether there is an explicit way to show the number of T1 transitions and the place where they happen during finding energy min process.
For now there is no explicit way to do that.
A solution would be to be able to pass a on_topo_change callback to the QSSolver class to be called here. I should have time to open a PR for that next week. It can be done by subclasseing QSSolver:
class QSSolverT(QSSolver):
def __init__(self, on_topo_change, *args, **kwargs):
super().__init__(*args, **kwargs)
self.on_topo_change = on_topo_change
def _minimize(self, eptm, geom, model, **kwargs):
for i in count():
if i == MAX_ITER:
return self.res
pos0 = eptm.vert_df.loc[
eptm.vert_df.is_active.astype(bool), eptm.coords
].values.flatten()
try:
self.res = optimize.minimize(
self._opt_energy,
pos0,
args=(eptm, geom, model),
jac=self._opt_grad,
**kwargs
)
return self.res
except TopologyChangeError:
log.info("TopologyChange")
self.on_topo_change(eptm)
self.num_restarts = i + 1A longer term solution, also more generic & interesting is to have a better History object that could keep track of the objects throughout rearrangements (e.g as a 4D graph). This could go with a redefinition of the I/O.