Subida inicial del proyecto
This commit is contained in:
1 parent
129375d321
commit
565c77213c
7 files changed
+81
-77
No files matched your search
@@ -1,40 +1,29 @@
|
|||||||
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
import matplotlib.pyplot as plt
|
import matplotlib.pyplot as plt
|
||||||
from scipy.optimize import curve_fit
|
from scipy.optimize import curve_fit
|
||||||
|
|
||||||
kb = 1.380649e-23 # Constante de Boltzmann
|
kb = 1.380649e-23 # Constante de Boltzmann
|
||||||
T = 300 # Temperatura en Kelvin
|
|
||||||
kbT = kb * T # Factor kb * T
|
|
||||||
|
|
||||||
def helfrich_model(x, bend, stretch):
|
|
||||||
|
|
||||||
|
def helfrich_model(x, bend, stretch, kbT):
|
||||||
bend = abs(bend)
|
bend = abs(bend)
|
||||||
stretch = abs(stretch)
|
stretch = abs(stretch)
|
||||||
|
|
||||||
term = stretch / bend + x**2
|
term = stretch / bend + x**2
|
||||||
|
|
||||||
result = kbT * (0.5 / stretch) * ((1 / x) - term ** -0.5)
|
result = kbT * (0.5 / stretch) * ((1 / x) - term ** -0.5)
|
||||||
return result
|
return result
|
||||||
|
|
||||||
def aproxHelfrich(x, y):
|
|
||||||
|
def aproxHelfrich(x, y, T):
|
||||||
x = np.array(x)
|
x = np.array(x)
|
||||||
y = np.array(y)
|
y = np.array(y)
|
||||||
|
kbT = kb * T
|
||||||
|
|
||||||
|
def model_fixedT(x, bend, stretch):
|
||||||
|
return helfrich_model(x, bend, stretch, kbT)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
popt, _ = curve_fit(model_fixedT, x, y, p0=[1.4e-19, 1e-7])
|
||||||
popt, _ = curve_fit(helfrich_model, x, y, p0=[1.4e-19, 1e-7]) # valores referencia
|
|
||||||
bend, stretch = popt
|
bend, stretch = popt
|
||||||
|
return abs(bend), abs(stretch)
|
||||||
# Aseguramos que bend y stretch sean siempre positivos
|
|
||||||
bend = abs(bend)
|
|
||||||
stretch = abs(stretch)
|
|
||||||
|
|
||||||
# # Establecemos un límite inferior para el valor de 'bend'
|
|
||||||
# bend = max(bend, 1e-20)
|
|
||||||
return bend, stretch
|
|
||||||
except RuntimeError:
|
except RuntimeError:
|
||||||
print("Error: La optimización no convergió")
|
print("Error: La optimización no convergió")
|
||||||
return None, None
|
return None, None
|
||||||
|
|
||||||
|
|
||||||
+19
-26
@@ -10,42 +10,35 @@ import matplotlib.pyplot as plt
|
|||||||
import Codigo2D_Base as c7
|
import Codigo2D_Base as c7
|
||||||
import Codigo2D_AjusteHelfrich as c8
|
import Codigo2D_AjusteHelfrich as c8
|
||||||
|
|
||||||
|
# %% CONSTANTES
|
||||||
|
kb = 1.380649e-23 # J/K
|
||||||
|
|
||||||
# %% FUNCION TEORICA
|
# %% FUNCION TEORICA
|
||||||
|
def fx(x, stretch, bend, T):
|
||||||
kb = 1.380649*10**-23
|
kbT = kb * T
|
||||||
T = 300
|
y = kbT * (0.5 / stretch) * ((1 / x) - (stretch / bend + x**2) ** -0.5)
|
||||||
kbT = kb*T
|
|
||||||
|
|
||||||
valor = 10*kbT # este es el valor que deberia tener el bending
|
|
||||||
|
|
||||||
def fx(x,stretch,bend):
|
|
||||||
y = kbT*(0.5/stretch)*((1/x) - (stretch/bend + x**2)**(-0.5))
|
|
||||||
return y
|
return y
|
||||||
|
|
||||||
# %% CODIGO
|
# %% CODIGO
|
||||||
|
def calculatecoefs(MSph, nmin, nmax, T):
|
||||||
|
"""
|
||||||
|
Se utiliza el método de trapecios
|
||||||
|
"""
|
||||||
|
|
||||||
def calculatecoefs(MSph, nmin, nmax):
|
qx, u = c7.f2(MSph, 21, positive="Yes") # TODOS LOS COEFICIENTES (U) del 1 al 20
|
||||||
|
|
||||||
'''
|
|
||||||
Se utiliza el metodo de trapecios
|
|
||||||
'''
|
|
||||||
|
|
||||||
qx,u = c7.f2(MSph,21,positive = "Yes") # TODOS LOS COEFICIENTES (U) del 1 al 20
|
|
||||||
|
|
||||||
'''
|
|
||||||
El bending solo se calcula para ciertos modos
|
|
||||||
'''
|
|
||||||
|
|
||||||
|
# El bending solo se calcula para ciertos modos
|
||||||
qxnew = qx[nmin:nmax]
|
qxnew = qx[nmin:nmax]
|
||||||
unew = u[nmin:nmax]
|
unew = u[nmin:nmax]
|
||||||
|
|
||||||
bend,stretch = c8.aproxHelfrich(qxnew,unew)
|
bend, stretch = c8.aproxHelfrich(qxnew, unew, T)
|
||||||
qxcont = np.linspace(qxnew[0],qxnew[-1],100) # limites coinciden con qx, pero Y no tiene porque es un ajuste no hay restriccion
|
qxcont = np.linspace(qxnew[0], qxnew[-1], 100)
|
||||||
Ycont = fx(qxcont,stretch,bend) # Al representar sera en el eje x: qxnew y en el y: Y
|
Ycont = fx(qxcont, stretch, bend, T)
|
||||||
|
|
||||||
|
kbT = kb * T
|
||||||
print("----------------")
|
print("----------------")
|
||||||
print(f"Para modos entre {nmin+1} y {nmax+1} se obtiene:")
|
print(f"Para modos entre {nmin+1} y {nmax+1} se obtiene:")
|
||||||
print("Bending (en uds kbT): ",bend/kbT)
|
print("Bending (en uds kbT): ", bend / kbT)
|
||||||
print("Stretching [N/m]: ",stretch)
|
print("Stretching [N/m]: ", stretch)
|
||||||
|
|
||||||
return qx,u,qxcont,Ycont,bend,stretch
|
return qx, u, qxcont, Ycont, bend, stretch
|
||||||
+8
-8
@@ -9,6 +9,7 @@ import Codigo2D_FiltroZ as c1
|
|||||||
import Codigo2D_Interpolacion as c2
|
import Codigo2D_Interpolacion as c2
|
||||||
import Codigo2D_Coefs as c3 # Este incluye a ajuste de Helfrich y a Base
|
import Codigo2D_Coefs as c3 # Este incluye a ajuste de Helfrich y a Base
|
||||||
|
|
||||||
|
T = 300 # temperatura
|
||||||
time = 50 # tiempo para graficar
|
time = 50 # tiempo para graficar
|
||||||
|
|
||||||
# %% PROGRAMA ARIN
|
# %% PROGRAMA ARIN
|
||||||
@@ -37,17 +38,16 @@ MCart[:,:,2] = 0
|
|||||||
# %% CALCULO DE BENDING Y STRETCH
|
# %% CALCULO DE BENDING Y STRETCH
|
||||||
nmax = 19
|
nmax = 19
|
||||||
nmin = 4 # NOTA nmin = 0, es el modo 1
|
nmin = 4 # NOTA nmin = 0, es el modo 1
|
||||||
qx,u,qxnew,unew,bend,stretch = c3.calculatecoefs(MSph,nmin,nmax)
|
qx,u,qxnew,unew,bend,stretch = c3.calculatecoefs(MSph,nmin,nmax,T)
|
||||||
|
|
||||||
# %% GRAFICA
|
# %% GRAFICA
|
||||||
|
|
||||||
# plt.figure()
|
|
||||||
# plt.loglog(qx,u,marker = "o", color = "blue",linestyle = "none")
|
|
||||||
# plt.loglog(qxnew,unew,color="red", linestyle="-.")
|
|
||||||
|
|
||||||
plt.figure()
|
plt.figure()
|
||||||
plt.plot(qx[nmin:nmax],u[nmin:nmax],marker = "o",color = "blue")
|
plt.plot(qx[nmin:nmax],u[nmin:nmax],marker = "o",color = "blue")
|
||||||
plt.plot(qxnew,unew,color="red", linestyle="-.")
|
plt.plot(qxnew,unew,color="red", linestyle="-.")
|
||||||
|
plt.title("Coeficientes en función de qx", fontweight="bold")
|
||||||
|
plt.xlabel("qx", fontweight="bold")
|
||||||
|
plt.ylabel(r"$\langle \mathbf{|u|^2} \rangle$", fontsize=14)
|
||||||
|
|
||||||
# GRAFICA FILTRO (Simplemente para ver forma)
|
# GRAFICA FILTRO (Simplemente para ver forma)
|
||||||
|
|
||||||
@@ -62,9 +62,9 @@ z1_label = f"$\Delta z_1$ = {np.format_float_scientific(Z1, precision=2)}"
|
|||||||
|
|
||||||
plt.plot(FiltroEsfmask[:,2], FiltroEsfmask[:,0], marker="h", linestyle="none", color="red", label=z1_label)
|
plt.plot(FiltroEsfmask[:,2], FiltroEsfmask[:,0], marker="h", linestyle="none", color="red", label=z1_label)
|
||||||
|
|
||||||
plt.title("Datos simulaciones filtro", fontweight="bold")
|
plt.title("Radio en función de phi", fontweight="bold")
|
||||||
plt.xlabel("qx", fontweight="bold")
|
plt.xlabel("PHI", fontweight="bold")
|
||||||
plt.ylabel(r"$\langle \mathbf{|u|^2} \rangle$", fontsize=14)
|
plt.ylabel("R [m]", fontweight = "bold")
|
||||||
|
|
||||||
plt.legend()
|
plt.legend()
|
||||||
plt.show()
|
plt.show()
|
||||||
+10
-22
@@ -3,37 +3,25 @@ import numpy as np
|
|||||||
import matplotlib.pyplot as plt
|
import matplotlib.pyplot as plt
|
||||||
from scipy.optimize import curve_fit
|
from scipy.optimize import curve_fit
|
||||||
|
|
||||||
# %% AJUSTE
|
kb = 1.380649e-23 # J/K
|
||||||
|
|
||||||
kb = 1.380649e-23 # Constante de Boltzmann
|
def helfrich_model(x, kappa, b, kbT):
|
||||||
T = 300 # Temperatura en Kelvin
|
|
||||||
kbT = kb * T # Factor kb * T
|
|
||||||
|
|
||||||
def helfrich_model(x, kappa, b):
|
|
||||||
|
|
||||||
# b = abs(b)
|
|
||||||
kappa = abs(kappa)
|
kappa = abs(kappa)
|
||||||
b = abs(b)
|
b = abs(b)
|
||||||
|
return kbT / (8 * b + kappa * x)
|
||||||
|
|
||||||
result = kbT / (8*b + kappa*x)
|
def aproxHelfrich(x, y, T):
|
||||||
return result
|
|
||||||
|
|
||||||
def aproxHelfrich(x, y):
|
|
||||||
x = np.array(x)
|
x = np.array(x)
|
||||||
y = np.array(y)
|
y = np.array(y)
|
||||||
|
kbT = kb * T
|
||||||
|
|
||||||
|
def model_fixedT(x, kappa, b):
|
||||||
|
return helfrich_model(x, kappa, b, kbT)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
popt, _ = curve_fit(model_fixedT, x, y, p0=[1.4e-19, 1e-7])
|
||||||
popt, _ = curve_fit(helfrich_model, x, y, p0=[1.4e-19, 1e-7]) # valores referencia
|
|
||||||
kappa, b = popt
|
kappa, b = popt
|
||||||
|
return abs(kappa), abs(b)
|
||||||
# Aseguramos que bend y stretch sean siempre positivos
|
|
||||||
b = abs(b)
|
|
||||||
kappa = abs(kappa)
|
|
||||||
|
|
||||||
# # Establecemos un límite inferior para el valor de 'bend'
|
|
||||||
# bend = max(bend, 1e-20)
|
|
||||||
return kappa, b
|
|
||||||
except RuntimeError:
|
except RuntimeError:
|
||||||
print("Error: La optimización no convergió")
|
print("Error: La optimización no convergió")
|
||||||
return None, None
|
return None, None
|
||||||
|
|||||||
+1
-1
@@ -33,7 +33,7 @@ maximo = 6 # corresponde a l = 5, pero luego sumamos 1 y es l = 6
|
|||||||
coefs = a2l[minimo:maximo+1] # coeficientes entre l = 2, l = 6
|
coefs = a2l[minimo:maximo+1] # coeficientes entre l = 2, l = 6
|
||||||
valorx = terminol[minimo:maximo+1]/(r0*r0) # x de la funcion
|
valorx = terminol[minimo:maximo+1]/(r0*r0) # x de la funcion
|
||||||
|
|
||||||
kappa,b = c3.aproxHelfrich(valorx,coefs)
|
kappa,b = c3.aproxHelfrich(valorx,coefs,T)
|
||||||
|
|
||||||
bending = kappa/kbT
|
bending = kappa/kbT
|
||||||
stretching = b
|
stretching = b
|
||||||
|
|||||||
@@ -0,0 +1,9 @@
|
|||||||
|
El archivo de las simulaciones usado es "matrizcartesianas.npy" (modificar variando T y xi)
|
||||||
|
|
||||||
|
- Los archivos de "..._Ejemplo.py" son los que hay que ejecutar (cambiando el archivo de simulaciones)
|
||||||
|
|
||||||
|
- Cuando se varía T de las simulaciones, se tiene que modificar "..._Ejemplo.py" (linea 15 en 3D, linea 12 en 2D)
|
||||||
|
|
||||||
|
- En el caso 3D el análisis se hace hasta Lmax = 20, y el análisis posterior se hace entre l = 2 y l = 6 (se puede variar en las líneas 26,30,31)
|
||||||
|
|
||||||
|
- En el caso 2D, se realiza el análisis hasta un 1% del radio promedio (en z, linea 29 modificable), y se analiza entre n = 5, y n = 20 (modificable en linea 39,40)
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
En estos códigos se realiza el análisis en 2D y 3D de la membrana.
|
||||||
|
|
||||||
|
# %% CASO 2D
|
||||||
|
|
||||||
|
2D: https://link.springer.com/article/10.1140/epje/i2004-10001-9 (Ajuste a Ec.11)
|
||||||
|
|
||||||
|
En el caso 2D se eligen valores cercanos al origen y se proyectan sobre el plano Z = 0
|
||||||
|
|
||||||
|
Se interpolan los datos de forma equiespaciada
|
||||||
|
|
||||||
|
Mediante integración por trapecios se obtienes los coeficientes
|
||||||
|
|
||||||
|
Se obtienen los valores medios y se ajustan a la ecuación
|
||||||
|
|
||||||
|
# %% CASO 3D
|
||||||
|
|
||||||
|
3D: https://journals.aps.org/prl/abstract/10.1103/PhysRevLett.106.188101 (Ajuste a Ec.7)
|
||||||
|
|
||||||
|
- Proyección sobre grid icosaédrico
|
||||||
|
|
||||||
|
- Expansion mediante armónicos esféricos (de variación con respecto a superficie promedio)
|
||||||
|
|
||||||
|
- Calculo de valores medios
|
||||||
|
|
||||||
|
- Se obtienen los valores medios y se ajustan a la ecuación
|
||||||
Reference in new issue
Block a user