def fmm_m2l(c1, c2): c1_grand_parent = get_grand_parent(c1) c2_grand_parent = get_grand_parent(c2) if c1_grand_parent != None and c2_grand_parent != None and \ c1_grand_parent == c2_grand_parent: # reflect long-range interaction force mutually f = m2l(c1, c2) c1.l += f c2.l += -f # actual M2L force calculation look probably different elif (c1.is_root() and c2.is_root()) or \ c1.get_parent() == c2.get_parent(): for i, j in taco.product(c1.get_sub_cells(), c2.get_sub_cells()): fmm_m2l(i, j)
def interact(c1, c2, s): if c1.get_num_particles() <= s and \ c2.get_num_particles() <= s: common.direct([c1.particles[i] for i in c1.indices], [c2.particles[i] for i in c2.indices], c1.region == c2.region) else: if c1.get_num_particles() > s: c1_children = c1.get_sub_cells() else: c1_children = [c1] if c2.get_num_particles() > s: c2_children = c2.get_sub_cells() else: c2_children = [c2] for i, j in taco.product(c1_children, c2_children): interact(i, j, s) return