mass = 1 radius = 0.1 dynamics = m.Overdamped style = {'color': 'dodgerblue'} class Big(m.Particle): mass = 1 radius = 8 frozen = True style = {'color': 'orange'} # simple harmonic potential to pull particles pot = m.Potential.harmonic(k=1, r0=0.1, max=3) # make big cell in the middle Big(m.Universe.center) #Big.style.visible = False # create a uniform mesh of particles and bonds on the surface of a sphere parts, bonds = m.bind_sphere(pot, type=Blue, n=5, phi=(0.6 * np.pi, 0.8 * np.pi), radius=Big.radius + Blue.radius) # run the model m.show()
r = m.forces.random(0, 5) m.bind(r, Cell) #m.bind(r, Actin) # make a yolk at the center of the simulation domain yolk = Yolk(m.Universe.center) # create the initial cell positions cell_positions = m.random_points(m.SolidSphere, 6000, dr=dr, phi=(0, epiboly_percent * np.pi)) \ * ((1 + dr/2) * Yolk.radius) + yolk.position # create an actin mesh that covers a section of a sphere. parts, bonds = m.bind_sphere(p_actin, type=Actin, n=4, \ phi=(0.9 * epiboly_percent * np.pi, \ (epiboly_percent + actin_percent * (1 - epiboly_percent)) * np.pi), \ radius = Yolk.radius + Actin.radius) # create the initial cell cells [Cell(p) for p in cell_positions] #m.bind_pairwise(h, c.neighbors(2* Cell.radius), cutoff=2*Cell.radius, pairs=[(Cell,Actin)]) # set visiblity on the different objects Yolk.style.visible = True Actin.style.visible = True #Cell.style.visible = False # display function to write out values, any code can go here.
#m.bind(pb, B, B) #m.bind(pab, A, B) r = m.forces.random(0, 5) m.bind(r, A) #m.bind(r, B) c = C(m.Universe.center) pos_a = m.random_points(m.SolidSphere, 3000, dr=0.25, phi=(0, 0.60 * np.pi)) \ * ((1 + 0.25/2) * C.radius) + m.Universe.center parts, bonds = m.bind_sphere(h, type=B, n=4, phi=(0.6 * np.pi, np.pi), radius=C.radius + B.radius) [A(p) for p in pos_a] # grab a vertical slice of the neighbors of the yolk: slice_parts = [p for p in c.neighbors() if p.spherical()[1] > 0] m.bind_pairwise(pab, slice_parts, cutoff=5 * A.radius, pairs=[(A, B)]) #A.style.visible = False C.style.visible = False B.style.visible = False #A.style.visible = False
#pb= m.Potential.glj(e=0.00001, r0=0.1, m=3, min=0.01, max=Blue.radius*3) pb = m.Potential.coulomb(q=0.01, min=0.01, max=3) # potential between the small and big particles pot = m.Potential.glj(e=1, m=2, max=5) Big(m.Universe.center) Big.style.visible = False m.bind(pot, Big, Blue) m.bind(pb, Blue, Blue) parts, bonds = m.bind_sphere(h, type=Blue, n=4, phi=(0.55 * np.pi, 1 * np.pi), radius = Big.radius + Blue.radius) #for b in bonds: # print("energy(", b.id, "): ", b.energy()) #print("parts: ", parts) #parts[0].destroy() #parts[3].destroy() #parts[7].destroy()