def animate(i):
    start = time.time()
    global x,y,vx,vy,X,Y,l2,tmax,dt,N,fx,fy,V,R2,xnew,ynew,vlist,t,q,a,C,sig,size,theta,tau,w,qx,qy,C2
    #fx,fy,V,R2 = dymol.forcas(x,y,X,Y,l2)    
    p = np.c_[x,y]
    #fx,fy,V,R2 = forcas.lennardjones(size,p,X,Y,l2)  
    for i in range(0,2):
        fx,fy,V,R2,tau = forcas.janusparticle(size,p,q,X,Y,l2,sig,a,C,C2)
        x,y,vx,vy = dymol.integrate(x,y,vx,vy,fx,fy,dt)
        qx,qy, w = dymol.integrate_rot(qx,qy,w,tau,sig,dt)
        #qx = np.cos(theta)
        #qy = np.sin(theta)
        q = np.c_[qx,qy]
        #F.append(fx[5]*fx[5]+fy[5]*fy[5])
        #D.append(R2[5])
        t = t+dt
        x,y = dymol.period(x,y,X,Y)
    #t = t+dt
    #print np.sum((vx**2 + vy**2)*0.5),w[5],qx[5],fx[5] #+sum(V)
    print fx
    
    #line.set_data(x, y)
    lines.set_UVC(qx,qy)
    lines.set_offsets(np.array([x, y]).T)
    time_text.set_text(time_template%(i*dt))
    #print 'time do loop: ', time.time()-start
    return line,time_text,
Пример #2
0
def animate(i):
    start = time.time()
    global x, y, vx, vy, X, Y, l2, tmax, dt, N, fx, fy, V, R2, xnew, ynew, vlist, t, q, a, C, sig, size, theta, tau, w, qx, qy, C2
    #fx,fy,V,R2 = dymol.forcas(x,y,X,Y,l2)
    p = np.c_[x, y]
    #fx,fy,V,R2 = forcas.lennardjones(size,p,X,Y,l2)
    for i in range(0, 2):
        fx, fy, V, R2, tau = forcas.janusparticle(size, p, q, X, Y, l2, sig, a,
                                                  C, C2)
        x, y, vx, vy = dymol.integrate(x, y, vx, vy, fx, fy, dt)
        qx, qy, w = dymol.integrate_rot(qx, qy, w, tau, sig, dt)
        #qx = np.cos(theta)
        #qy = np.sin(theta)
        q = np.c_[qx, qy]
        #F.append(fx[5]*fx[5]+fy[5]*fy[5])
        #D.append(R2[5])
        t = t + dt
        x, y = dymol.period(x, y, X, Y)
    #t = t+dt
    #print np.sum((vx**2 + vy**2)*0.5),w[5],qx[5],fx[5] #+sum(V)
    print fx

    #line.set_data(x, y)
    lines.set_UVC(qx, qy)
    lines.set_offsets(np.array([x, y]).T)
    time_text.set_text(time_template % (i * dt))
    #print 'time do loop: ', time.time()-start
    return line, time_text,
def animate(i):
    start = time.time()
    global x,y,vx,vy,X,Y,l2,tmax,dt,N,fx,fy,V,R2,xnew,ynew,vlist,t
    fx,fy,V,R2,vlist = dymol.forcas_verlet(xnew,ynew,x,y,X,Y,l2,R2,rv,rc,vlist)
    x = np.array(xnew)
    y = np.array(ynew)
       
    xnew,ynew,vx,vy = dymol.integrate(x,y,vx,vy,fx,fy,dt)
        
    t = t+dt
    print np.sum((vx**2 + vy**2)*0.5) #+sum(V)
    
    
    line.set_data(x, y)
    
    time_text.set_text(time_template%(i*dt))
    #print 'time do loop: ', time.time()-start
    return line, time_text
Пример #4
0
def animate(i):
    start = time.time()
    global x, y, vx, vy, X, Y, l2, tmax, dt, N, fx, fy, V, R2, xnew, ynew, vlist, t
    fx, fy, V, R2, vlist = dymol.forcas_verlet(xnew, ynew, x, y, X, Y, l2, R2,
                                               rv, rc, vlist)
    x = np.array(xnew)
    y = np.array(ynew)

    xnew, ynew, vx, vy = dymol.integrate(x, y, vx, vy, fx, fy, dt)

    t = t + dt
    print np.sum((vx**2 + vy**2) * 0.5)  #+sum(V)

    line.set_data(x, y)

    time_text.set_text(time_template % (i * dt))
    #print 'time do loop: ', time.time()-start
    return line, time_text
Пример #5
0
def animate(i):
    start = time.time()
    global x, y, vx, vy, X, Y, l2, tmax, dt, N, fx, fy, V, R2, xnew, ynew, vlist, t
    #fx,fy,V,R2 = dymol.forcas(x,y,X,Y,l2)
    size = len(x)
    p = np.c_[x, y]
    fx, fy, V, R2 = forcas.lennardjones(size, p, X, Y, l2)

    x, y, vx, vy = dymol.integrate(x, y, vx, vy, fx, fy, dt)

    t = t + dt
    print np.sum((vx**2 + vy**2) * 0.5)  #+sum(V)

    line.set_data(x, y)

    time_text.set_text(time_template % (i * dt))
    #print 'time do loop: ', time.time()-start
    return line, time_text
    return line, time_text
    

#============================ def animation =======================

t = 0.0 # initial time
#dt = 0.01 # intervals of integration
frame = int(tmax/dt)
#verlet radius
rc,rv = 0.,1.2
#initialize positions
x,y,vx,vy,X,Y,l2,tmax,dt,N = dymol.initial()
#while(t<tmax):
#initialize forces and distances and verlet lists
fx,fy,V,R2 = dymol.forcas(x,y,X,Y,l2)
xnew,ynew,vx,vy = dymol.integrate(x,y,vx,vy,fx,fy,dt)
vlist = dymol.verletlist(R2,rv,rc)

t = 0.


def animate(i):
    start = time.time()
    global x,y,vx,vy,X,Y,l2,tmax,dt,N,fx,fy,V,R2,xnew,ynew,vlist,t
    fx,fy,V,R2,vlist = dymol.forcas_verlet(xnew,ynew,x,y,X,Y,l2,R2,rv,rc,vlist)
    x = np.array(xnew)
    y = np.array(ynew)
       
    xnew,ynew,vx,vy = dymol.integrate(x,y,vx,vy,fx,fy,dt)
        
    t = t+dt
import matplotlib.pyplot as plt
from matplotlib import animation
import sys
import time
import dymol

#condicoes iniciais
x,y,vx,vy,X,Y,l2,tmax,dt,N = dymol.initial()
dr = 0.2
rmax = np.sqrt(X**2 + Y**2)
t = 0.

#para o sistema entrar no equilibrio
while(t<tmax):
    fx,fy,V,R2 = dymol.forcas(x,y,X,Y,l2)
    x,y = dymol.integrate(x,y,vx,vy,fx,fy,dt)
    t += dt
deltam = 0.

gga = []
for j in range(100):
    
    x,y,fx,fy,V,R2 = dymol.range_of_steps(x,y,vx,vy,X,Y,l2,dt,10)
    gga.append(np.array([x,y]))


    


deltam = deltam/100.
tempo = np.arange(4,9,0.05)
Пример #8
0
import time
import dymol
import forcas
#condicoes iniciais
x,y,vx,vy,X,Y,l2,tmax,dt,N = dymol.initial()
size = len(x)
p = np.c_[x,y]
dr = 0.2
rmax = np.sqrt(X**2 + Y**2)
t = 0.

#para o sistema entrar no equilibrio
while(t<tmax):
    fx,fy,V,R2 = forcas.lennardjones(size,p,X,Y,l2)

    x,y,vx,vy = dymol.integrate(x,y,vx,vy,fx,fy,dt)
    p = np.c_[x,y]
    t += dt
deltam = 0.
deltamz = 0.

for j in range(50):
    #for k in range(20):
    fx,fy,V,R2 = forcas.lennardjones(size,p,X,Y,l2)
    x,y,vx,vy = dymol.integrate(x,y,vx,vy,fx,fy,dt)
    p = np.c_[x,y]
        
    xi = np.array(x)
    yi = np.array(y)
    pi = np.array(p)
    vxi = np.array(vx)
Пример #9
0
import matplotlib.pyplot as plt
from matplotlib import animation
import sys
import time
import dymol

#condicoes iniciais
x, y, vx, vy, X, Y, l2, tmax, dt, N = dymol.initial()
dr = 0.2
rmax = np.sqrt(X**2 + Y**2)
t = 0.

#para o sistema entrar no equilibrio
while (t < tmax):
    fx, fy, V, R2 = dymol.forcas(x, y, X, Y, l2)
    x, y = dymol.integrate(x, y, vx, vy, fx, fy, dt)
    t += dt
deltam = 0.

gga = []
for j in range(100):

    x, y, fx, fy, V, R2 = dymol.range_of_steps(x, y, vx, vy, X, Y, l2, dt, 10)
    gga.append(np.array([x, y]))

deltam = deltam / 100.
tempo = np.arange(4, 9, 0.05)
print len(deltam), len(tempo)
plt.plot(tempo, deltam, 'g-', ms=1)
plt.xlabel("tempo")
plt.ylabel("r^2")
Пример #10
0
    return line, time_text


#============================ def animation =======================

t = 0.0  # initial time
#dt = 0.01 # intervals of integration
frame = int(tmax / dt)
#verlet radius
rc, rv = 0., 1.2
#initialize positions
x, y, vx, vy, X, Y, l2, tmax, dt, N = dymol.initial()
#while(t<tmax):
#initialize forces and distances and verlet lists
fx, fy, V, R2 = dymol.forcas(x, y, X, Y, l2)
xnew, ynew, vx, vy = dymol.integrate(x, y, vx, vy, fx, fy, dt)
vlist = dymol.verletlist(R2, rv, rc)

t = 0.


def animate(i):
    start = time.time()
    global x, y, vx, vy, X, Y, l2, tmax, dt, N, fx, fy, V, R2, xnew, ynew, vlist, t
    fx, fy, V, R2, vlist = dymol.forcas_verlet(xnew, ynew, x, y, X, Y, l2, R2,
                                               rv, rc, vlist)
    x = np.array(xnew)
    y = np.array(ynew)

    xnew, ynew, vx, vy = dymol.integrate(x, y, vx, vy, fx, fy, dt)
Пример #11
0
import time
import dymol
import forcas
#condicoes iniciais
x, y, vx, vy, X, Y, l2, tmax, dt, N = dymol.initial()
size = len(x)
p = np.c_[x, y]
dr = 0.2
rmax = np.sqrt(X**2 + Y**2)
t = 0.

#para o sistema entrar no equilibrio
while (t < tmax):
    fx, fy, V, R2 = forcas.lennardjones(size, p, X, Y, l2)

    x, y, vx, vy = dymol.integrate(x, y, vx, vy, fx, fy, dt)
    p = np.c_[x, y]
    t += dt
deltam = 0.
deltamz = 0.

for j in range(50):
    #for k in range(20):
    fx, fy, V, R2 = forcas.lennardjones(size, p, X, Y, l2)
    x, y, vx, vy = dymol.integrate(x, y, vx, vy, fx, fy, dt)
    p = np.c_[x, y]

    xi = np.array(x)
    yi = np.array(y)
    pi = np.array(p)
    vxi = np.array(vx)