Example #1
0
import matplotlib.path as mplPath
from random import gauss
from math import sqrt, pi, acos, cos, sin, exp
import math
import numpy as np
from numpy import linalg as LA
from nanopores import *
from dolfin import *
import sys
from calculateforce import loadforces
F, Fel, Fdrag = loadforces()
hbond=np.load('hbond.npy')
bbPath=mplPath.Path(hbond) #bigger aHem pore for H-Bond


def radius(x,y):
    return sqrt(x**2+y**2)
def argument(x,y,z):
    return np.array([float(x),float(y),float(z)])
def FF(array):
    if radius(array[0],array[1])>5. or array[2]>5.:
        return [0.,0.,0.]
    return F(array)


geo = geo_from_xml("aHem")
indicator_poretop_geo = geo.indicator("poretop",callable=True)
def indicator_poretop(vec):
    x, y, z = vec[0], vec[1], vec[2]
    if radius(x,y)>5.:
    	return 0
Example #2
0
from matplotlib import rc
rc('font',**{'family':'serif','serif':['Palatino']})
rc('text', usetex=True)
#import colormaps
from matplotlib import cm
from math import sqrt
import matplotlib.pyplot as plt
import matplotlib.path as mplPath
import numpy as np
from calculateforce import loadforces
Fel_, Fdrag_ = loadforces()
X_How_2d = np.array([[1.,4.5],[2.5,4.5],[2.5,1.1],[10.,1.1],[10.,-1.1],[2.5,-1.1],[2.5,-4.5],[1.,-4.5]])
def Fel(x,y,z):
    if x==0. and y==0.:
        return [0.,0.,Fel_(np.array([0,z]))[1]]
    else:
        rad=sqrt(x**2+y**2)
        x0=x/rad
        y0=y/rad
        return [x0*Fel_(rad,z)[0],y0*Fel_(rad,z)[0],Fel_(rad,z)[1]]
def Fdrag(x,y,z):
    if x==0. and y==0.:
        return [0.,0.,Fdrag_(np.array([0,z]))[1]]
    else:
        rad=sqrt(x**2+y**2)
        x0=x/rad
        y0=y/rad
        return [x0*Fdrag_(rad,z)[0],y0*Fdrag_(rad,z)[0],Fdrag_(rad,z)[1]]

#plt.ion()
#fig1=plt.figure(figsize=(18,12))