# ComputeMorph

class ComputeMorph : public feasst::TrialCompute

Attempt to morph particle(s) a, b, …, h into particle(s) $$z_a, z_b, ..., z_h$$.

To avoid trivial morphs, the particle type of $$i$$ cannot be equal to the type of $$z_i$$.

The derivation of the acceptance criteria follows a similar procedure as descibed in TrialComputeAdd and ComputeAddMultiple.

 Forward event [reverse event] Probability, $$\pi_{on}$$ [reverse probability, $$\pi_{no}$$] Change particle of type a to z_a [Change particle of type z_a to a] $$1/N_a$$ $$[1/(N_{z_a}+\sum_{x=a}^h \delta_{z_az_x} - \delta_{z_ax})]$$ Change particle of type b to z_b [Change particle of type z_b to b] $$1/(N_b+1+\sum_{x=a}^{b} \delta_{z_x b} - \delta_{xb})$$ $$[1/(N_{z_b}+\sum_{x=b}^h \delta_{z_bz_x} - \delta_{z_bx})]$$ … … Change particle of type h to z_h [Change particle of type z_h to h] $$1/(N_h+1+\sum_{x=a}^{h} \delta_{z_x h} - \delta_{xh})$$ $$[1/(N_{z_h} + 1)]$$ Accept [Accept] $$min(1, \chi)$$ $$[min(1, 1/\chi)]$$

Application of local detailed balance yields the acceptance probability,

$$\chi = e^{-\beta\Delta U} \prod_{i=a}^h e^{\beta(\mu_{z_i}-\mu_i)} \frac{ N_i + 1 + \sum_{j=a}^i \delta_{z_j i} - \delta_{ji} }{ N_{z_i} + \sum_{j=i}^h \delta_{z_i z_j} - \delta_{z_ij} }$$

Note that the number of particles is from the perspective of the old state.

A rederivation using the new state number of particles instead is as follows:

 Forward event [reverse event] Probability, $$\pi_{on}$$ [reverse probability, $$\pi_{no}$$] Change particle of type a to z_a [Change particle of type z_a to a] $$1/(N_a+\sum_{x=a}^h \delta_{xa} - \delta_{z_xa})$$ $$[1/N_{z_a}]$$ Change particle of type b to z_b [Change particle of type z_b to b] $$1/(N_b+\sum_{x=b}^h \delta_{xb} - \delta_{z_xb})$$ $$[1/(N_{z_b}+1+\sum_{x=a}^b \delta_{xz_b}-\delta_{z_xz_b})]$$ … … Change particle of type h to z_h [Change particle of type z_h to h] $$1/(N_h + 1)$$ $$[1/(N_{z_h}+1+\sum_{x=a}^h \delta_{xz_h}-\delta_{z_xz_h})]$$ Accept [Accept] $$min(1, \chi)$$ $$[min(1, 1/\chi)]$$

$$\chi = e^{-\beta\Delta U} \prod_{i=a}^h e^{\beta(\mu_{z_i}-\mu_i)} \frac{ N_i + \sum_{j=i}^h\delta_{ji}-\delta_{z_j i} }{ N_{z_i}+1+\sum_{j=a}^i\delta_{jz_i}-\delta_{z_jz_i} }$$