Beispiel #1
0
def run(rw, name="rw", plot=False, a=-3, b=3, **aniparams):
    params = nanopores.user_params(video=False, save=False, cyl=False)
    if params.video:
        ani = video(rw, cyl=params.cyl, **aniparams)
        if params.save:
            save(ani, name=name)
        else:
            plt.show()
    else:
        for t in rw.walk():
            pass
    if plot and ((not params.video) or (not params.save)):
        histogram(rw, a, b)
        #plt.figure()
        #hist_poisson(rw, "attempts")
        #plt.figure()
        #hist_poisson(rw, "bindings")
        plt.show()
Beispiel #2
0
#   MEMBRANE   |DDDDD|       |DDDDD|             .    H
#      |       |DDDDD|       |DDDDD|             .    .
#      |       |DDDDD|       |DDDDD|....h4       .    .
#______V_________|DDD|       |DDD|_____.________ .___ .......
#MMMMMMMMMMMMMMMM|DDD|       |DDD|MMMMM.MMMMMMMMM.MMMM.    hmem
#MMMMMMMMMMMMMMMM|DDD|_______|DDD|MMMMM.MMMMMMMMM.MMMM.......
#                .               .                    .
#                .......l4........                    .
#                                                     .
#                                                     .
#                                                     .
#......................................................

if __name__ == "__main__":
    from nanopores import user_params
    up = user_params(dim=2, h=1., Nmax=1e5, x0=[0.,0.,0.], bV=-0.08,
                     diffusivity="Dpugh2", diamPore=6.)
    setup = Setup(**up)
    #setup.geo.plot_boundaries()

    _, pnps = solve(setup, True)
    print get_forces(setup, pnps)

    plotter = Plotter(setup)
    v, cp, cm, u, p = pnps.solutions()
    plotter.plot_vector(u, "velocity")
    plotter.plot(cm, "cm")
    plotter.plot(cp, "cp")
    plotter.plot(p, "p")
    dolfin.interactive()
Beispiel #3
0
from scipy import ndimage
import nanopores.geometries.pughpore as pughpore
import nanopores
import numpy as np
import matplotlib.pyplot as plt

up = nanopores.user_params(pughpore.params, k=3)

R = up.R
H = up.H

def z_func(x, y):
    return (1 - (x ** 2 + y ** 3)) * np.exp(-(x ** 2 + y ** 2) / 2)

X, Y, Z = np.load('X.npy'), np.load('Y.npy'), np.load('ZJ4.npy')
Z=ndimage.rotate(Z,0)

im = plt.imshow(Z, cmap=plt.cm.viridis, extent=(-R/2., R/2., H/2., -H/2.))  
plt.colorbar(im)  

plt.tight_layout()
plt.show()
Beispiel #4
0
"solve eikonal equation to get distance to boundary"
"TODO: implement also in 2D"

from dolfin import *
from nanopores.tools import fields
import nanopores.geometries.pughpore as pughpore
import nanopores.models.pughpore as pughm
import nanopores as nano
import folders

up = nano.user_params(h=8.0)

def distance_boundary():
    h = up.h
    geo = pughpore.get_geo(h)
    y = distance_boundary_from_geo(geo)
    print "Max distance:", y.vector().max()

    if not fields.exists("pugh_distance", h=h):
        fields.save_functions("pugh_distance", dict(h=h), y=y)
        fields.update()
    return y

def distance_boundary_from_geo(geo):
    mesh = geo.mesh
    V = FunctionSpace(mesh, "CG", 1)
    v = TestFunction(V)
    u = TrialFunction(V)
    f = Constant(1.0)
    y = Function(V)
Beispiel #5
0
params = nanopores.user_params(
    # general params
    geoname="wei",
    dim=2,
    rMolecule=1.25,  # 6.
    h=5.,
    Nmax=1e5,
    Qmol=2.,  #15.,
    bV=-0.2,
    dp=26.,
    geop=dict(dp=26.),
    posDTarget=True,

    # random walk params
    N=100000,  # number of (simultaneous) random walks
    dt=.5,  # time step [ns]
    walldist=2.,  # in multiples of radius, should be >= 1
    margtop=60.,
    margbot=0.,
    #zstart = 46.5, # 46.5
    #xstart = 0., # 42.
    rstart=30,
    initial="sphere",

    # receptor params
    tbind=40e9,  # from Lata, = 1/kd = 1/(25e-3)s [ns]
    # tbind = 286e9, from Wei, = 1/kd = 1/(3.5e-3)s [ns]
    ka=1.5e5,
    zreceptor=.95,  # receptor location relative to pore length (1 = top)
)
##### what to do
Beispiel #6
0
    )
    domain.params = dict(
        _params,
        name="pughpore",
        dim=1,
        nm=1.,
        lscale=1e9,
    )
    geo = domain.create_geometry(lc=lc)
    return geo


if __name__ == "__main__":
    import dolfin
    from nanopores import plot_sliced, user_params
    up = user_params(params, h=4.)

    geo2D = get_geo_cyl(lc=1., **up)
    dolfin.plot(geo2D.subdomains, title="subdomains")
    dolfin.plot(geo2D.boundaries, title="boundaries")
    print geo2D

    domain = get_domain(**up)
    membrane = domain.getsubdomain("membrane")
    dna = domain.getsubdomain("dna")
    molecule = domain.getsubdomain("molecule")

    solid = membrane | dna | molecule
    solid.addsubdomains(dna=dna, membrane=membrane)
    solid.addball(molecule, "molecule", "moleculeb")
    solid.addboundaries(
Beispiel #7
0
def cache_pugh_diffusivity_alt(**params):
    "the function above applied to the pugh pore"
    if not fields.exists("Dpugh_alt", **params):
        setup_params = dict(params)
        r = setup_params.pop("r")
        ddata_pore = fields.get_fields("pugh_diff_pore", rMolecule=r)
        ddata_bulk = fields.get_fields("pugh_diff_bulk", rMolecule=r)
        if not "cheapest" in setup_params:
            setup_params["cheapest"] = True
        setup = pugh.Setup(x0=None, **setup_params)
        functions = diffusivity_field_alt(setup, r, ddata_pore, ddata_bulk)
        fields.save_functions("Dpugh_alt", params, **functions)
        fields.update()


def get_pugh_diffusivity_alt(**params):
    cache_pugh_diffusivity_alt(**params)
    functions, mesh = fields.get_functions("Dpugh_alt", **params)
    return functions, mesh


if __name__ == "__main__":
    params = nanopores.user_params(dim=2, r=0.11, h=1., Nmax=1e5)
    functions = get_pugh_diffusivity(**params)
    D = functions["D"]
    D = dolfin.as_matrix(np.diag([D[i] for i in range(params.dim)]))
    dolfin.plot(functions["D"][0], title="Dx")
    dolfin.plot(functions["D"][1], title="Dz")
    dolfin.plot(functions["dist"], title="dist")
    dolfin.interactive()
Beispiel #8
0
i.e current and release time series for specific molecule."""
from nanopores.tools.fields import cache
import nanopores
import dolfin
import matplotlib.pyplot as plt
from nanopores.physics.convdiff import ConvectionDiffusion
import forcefields
from eikonal import boundary_force

p = nanopores.user_params(
    overwrite=False,
    bforce=True,
    levels=12,
    t=1e-8,
    steps=20,
    Qmol=-1,
    rMolecule=0.5,
    implicit=False,
    R=100.,
    h=4.,
    Nmax=1e5,
    dnaqsdamp=1.,
)

# force field parameters
f_params = dict(
    Qmol=p.Qmol,
    rMolecule=p.rMolecule,
    implicit=p.implicit,
    Ry=p.R,
    Rx=p.R,
    Nmax=p.Nmax,
Beispiel #9
0
default = dict(
    dim = 2,
    geoname = "alphahem",
    porename = "alphahem",
    Htop = 7.,
    Hbot = 15.,
    R = 10.,
    cs = [-3, -6],
    zmem = -7.625,
    proteincs = [-2.3, -4.6, -7.2],
)

def get_pore(**params):
    params = dict(default, **params)
    pore = Pore(poly, **params)
    pore.build_polygons()
    pore.build_boundaries()
    return pore

def get_geo(h=1., recreate=False, **params):
    params = dict(default, **params)
    geo = get_geo_generic(poly, h=h, recreate=recreate, **params)
    return geo

if __name__ == "__main__":
    from nanopores import user_params
    params = user_params(default, x0=None, h=1.)
    geo = get_geo(reconstruct=True, **params)
    geo.plot_subdomains()
    geo.plot_boundaries(interactive=True)
Beispiel #10
0
    i0 = V.index(0.)
    F[i0] = velo2force_2D(0., setup)
    F0 = F[i0]
    print "F(0)", F0

    for i, v in enumerate(V):
        if not i == i0:
            print "\n--- Velocity %d ---" %(i+1,)
            F[i] = velo2force_2D(v, setup)
            print "Velocity", v
            print "Force (exact)", F[i]
            print "Force (linear)", F0 - gamma*v

    return F, gamma, F0

params = user_params(dim=3, Nmax=1.5e5, h=1., dnaqsdamp=0.25,
                     x0=[0.2,0.,4.01], Qmol=-1., bulkcon=300.)
setup = Howorka.Setup(**params)
setup.prerefine()
velo2force_3D([0., 0.1, 0.2], setup)

do_v2f = False
redo_v2f = False
if do_v2f:
    if redo_v2f:
        params = user_params(dim=2, Nmax=2e4, h=.5, dnaqsdamp=0.25,
                             x0=[0.,0.,4.5], Qmol=-1., bulkcon=300.)
        V = list(np.linspace(-1., 1., 3))
        F, gamma, F0 = nonzero_velocities_2D(V, **params)
        fields.save_entries("howorka_velo2force_3", params, V=V, F=F, gamma=gamma, F0=F0)
        fields.update()
Beispiel #11
0
        r = setup_params.pop("r")
        ddata_pore = fields.get_fields("pugh_diff_pore", rMolecule=r)
        ddata_bulk = fields.get_fields("pugh_diff_bulk", rMolecule=r)
        if not "cheapest" in setup_params:
            setup_params["cheapest"] = True
        setup = pugh.Setup(x0=None, **setup_params)
        functions = diffusivity_field_alt(setup, r, ddata_pore, ddata_bulk)
        fields.save_functions("Dpugh_alt", params, **functions)
        fields.update()


def get_pugh_diffusivity_alt(**params):
    cache_pugh_diffusivity_alt(**params)
    functions, mesh = fields.get_functions("Dpugh_alt", **params)
    return functions, mesh


if __name__ == "__main__":
    params = nanopores.user_params(geoname="pughcyl",
                                   dim=2,
                                   r=0.11,
                                   h=1.,
                                   Nmax=1e4)
    functions, mesh = get_diffusivity(**params)
    D = functions["D"]
    D = dolfin.as_matrix(np.diag([D[i] for i in range(params.dim)]))
    dolfin.plot(functions["D"][0], title="Dx")
    dolfin.plot(functions["D"][1], title="Dz")
    dolfin.plot(functions["dist"], title="dist")
    dolfin.interactive()
Beispiel #12
0
# (c) 2016 Gregor Mitscha-Baude
import diffusion
import nanopores.tools.solvers as solvers
import nanopores.models.pughpore as pugh
import numpy as np
from folders import fields
import nanopores as nano
import dolfin


def tolist(array):
    return [list(a) for a in array]


up = nano.user_params(h=1., Nmax=2e5, H=10., R=3.1)
params = dict(
    H=up.H,
    R=up.R,
    center_z_at_x0=True,  #False, #True,
    dim=3,
    h=up.h,
    Nmax=up.Nmax,
    rMolecule=2.0779,
    bulkbc=True,
)


@solvers.cache_forcefield("pugh_diff3D", {})
def D_tensor(X, **params):
    x0 = X[0]
    print
Beispiel #13
0
import dolfin
import matplotlib.pyplot as plt
from nanopores.geometries.pughpore import (params, get_geo_cyl, get_domain,
                                           get_geo)
from nanopores import plot_sliced, user_params
from nanopores.tools.balls import Box, Ball, EmptySet, set_tol, union

up = user_params(params, h=1.)

r = up.rMolecule
lc = up.lcMolecule

positions = [
    [3., 0., 26.],
    [-0.9, .9, 2.],
    [0.1, .8, -24.],
]
molecules = [Ball(x0, r=r, lc=lc) for x0 in positions]

#geo2D = get_geo_cyl(lc=1., **up)
#dolfin.plot(geo2D.subdomains, title="subdomains", backend="matplotlib")
#dolfin.plot(geo2D.boundaries, title="boundaries", backend="matplotlib")
#dolfin.plot(geo2D.mesh, backend="matplotlib")
#print geo2D
#dolfin.interactive()

domain = get_domain(**up)
membrane = domain.getsubdomain("membrane")
dna = domain.getsubdomain("dna")
molecule = domain.getsubdomain("molecule")
Beispiel #14
0
    name = params["geoname"] if params is not None else "cylpore"
    try:
        geo = reconstructgeo(name=name, params=dict(params))
    except EnvironmentError as e:
        print e.message
        geo = None
    return geo


if __name__ == "__main__":
    from nanopores import user_params, showplots
    params = user_params(
        h=1.,
        porename="dna",
        H=20.,
        R=10.,
        x0=[0., 0., 0.],
        dim=2,
        subs=None,
    )

    dnapolygon = [[1, -5], [1, 5], [3, 5], [3, -5]]

    # --- TEST
    p = MultiPore(dict(dna=dnapolygon), **params)
    p.build_polygons()
    p.build_boundaries()
    #print p.polygons.keys()
    #print p.boundaries.keys()

    p.protein.plot(".k", zorder=100)
Beispiel #15
0
# (c) 2017 Gregor Mitscha-Baude
import numpy as np
from matplotlib import pyplot as plt
from nanopores import fields, user_params

up = user_params(diamPore=7.)

data = fields.get_fields("diffz_pugh", **up)
z = map(lambda x: x[2], data["x"])
data, z = fields._sorted(data, z)
plt.plot(z, data["D"], "o-")
plt.ylim(0, 1)
Beispiel #16
0
@solvers.cache_forcefield("pugh_diffusivity", default)
def calculate_diffusivity(X, **params):
    _params = dict(default, **params)
    values = []
    for x0 in X:
        setup = pugh.Setup(x0=x0, **_params)
        setup.physp["bulkbc"] = _params["bulkbc"]
        D = diffusivity(setup)
        values.append(D)
    return dict(D=values)


@solvers.cache_forcefield("pugh_diffusivity2D", default)
def calculate_diffusivity2D(X, **params):
    _params = dict(default, frac=.5, **params)
    _params["dim"] = 2
    values = []
    for x0 in X:
        setup = pugh.Setup(x0=x0, **_params)
        setup.physp["bulkbc"] = _params["bulkbc"]
        D = diffusivity(setup)
        values.append(D)
    return dict(D=values)


if __name__ == "__main__":
    up = nano.user_params(h=.1, H=8., R=4., Nmax=4e4)
    print calculate_diffusivity2D([[0., 0., 0.]], cache=False, **up)
    #print calculate_diffusivity([[0.,0.,0.], [0.,0.,30.]], nproc=2)
Beispiel #17
0
"harmonic interpolation -- proof of concept."
import numpy as np
import dolfin
import nanopores.geometries.pughpore as pughpore
from nanopores.models.pughpore import Plotter
from nanopores import user_params, Log
#import nanopores.py4gmsh as gmsh
from nanopores.tools.interpolation import harmonic_interpolation
import nanopores.tools.box as box

h = 2.
box.set_tol(None)
domain = pughpore.get_domain(h, x0=None)

# create random points
N = user_params(N=1000).N
R, H = domain.params["R"], domain.params["H"]
px = 2*R*np.random.random(N) - R
py = 2*R*np.random.random(N) - R
pz = H*np.random.random(N) - H/2.
points = zip(px, py, pz)

# prepare mesh containing points
domain.write_gmsh_code(h)
domain.insert_points(points, h, forbidden=["dna", "membrane"])
geo = domain.code_to_mesh()
mesh = geo.mesh

with Log("harmonic interpolation..."):
    # interpolate function from point values
    values = np.sin(np.array(points)[:,2]/5.)
from nanopores.tools.solvers import cache_forcefield
fields.set_dir_dropbox()

params = nanopores.user_params(
    # general params
    geoname="wei",
    dim=2,
    rMolecule=1.25,  # 6.
    h=5.,
    Nmax=1e5,
    Qmol=2.,  #15.,
    bV=-0.2,
    dp=23.,

    # random walk params
    N=1000,  # number of (simultaneous) random walks
    dt=1.,  # time step [ns]
    walldist=2.,  # in multiples of radius, should be >= 1
    margtop=50.,
    margbot=0.,
    zstart=46.5,  # 46.5
    xstart=0.,  # 42.
    rstart=None,

    # receptor params
    rec_t=3.7e9,
    rec_p=0.01763,
    rec_eps=0.1,
)

receptor = randomwalk.Ball([8.5 - 3. + 2., 0., 40.5], 0.5)  # ztop 46.5
receptor_params = dict(
Beispiel #19
0
# (c) 2017 Gregor Mitscha-Baude
import dolfin
import nanopores as nano
from nanopores.tools import fields
from nanopores.models import nanopore
from nanopores.tools.poreplots import streamlines
from nanopores.geometries.allpores import WeiPore
from nanopores.tools.polygons import MultiPolygon, Polygon
from nanopores.models.diffusion_interpolation import diffusivity_field
params = nano.user_params(
    geoname="wei",
    h=5.,
    Nmax=4e4,
    dim=2,
    x0=None,
    rMolecule=6.,
    Qmol=-1.,
    bV=-0.5,
)
fields.set_dir_dropbox()

name = "wei_force_ps"
if not fields.exists(name, **params):
    setup = nanopore.Setup(**params)
    _, pnps = nanopore.solve(setup, True)
    v, cp, cm, u, p = pnps.solutions()

    F, Fel, Fdrag = setup.phys.ForceField(v, u, "fluid")
    fields.save_functions(name, params, F=F, Fel=Fel, Fdrag=Fdrag)
    fields.update()
# (c) 2017 Gregor Mitscha-Baude
import dolfin
import os, sys
import numpy as np
from nanopores.models.pughpore import *
from nanopores import user_params

setup = Setup(**user_params(dim=3,
                            h=2.,
                            Nmax=5e5,
                            x0=[0., 0., 0.],
                            diffusivity="Dpugh2",
                            cheapest=True,
                            diamPore=6.))
setup.prerefine()
set_D(setup)
dim = setup.phys.dim
setup.plot(setup.phys.Dp[dim - 1, dim - 1], interactive=True)
Beispiel #21
0
import numpy
import nanopores
import matplotlib.pyplot as plt
from selectivity import selectivity, default

Qs = [-1., -3.]
label = r"$Q = %.0f$"

default = nanopores.user_params(**default)


def avg(J):
    n = len(J)
    J0 = list(numpy.array(J)[n * 0.2:n * 0.5])
    return sum(J0) / len(J0)


Javg = []

for Q in Qs:
    params = dict(default)
    params["Qmol"] = Q
    results = selectivity(**params)
    t = results["time"]
    J = results["current"]
    rel = results["release"]
    params0 = results["params"]

    plt.figure(0)
    plt.semilogx(t, rel, "x-", label=label % Q)
    plt.xlabel("time [s]")
Beispiel #22
0
from nanopores.models import nanopore
from nanopores.tools.poreplots import streamlines
from nanopores.tools import fields

dolfin.parameters["allow_extrapolation"] = True  #False #TODO:

params = nanopores.user_params(
    # general params
    geoname="wei",
    dim=2,
    rMolecule=6.,
    h=5.,
    Nmax=4e4,
    Qmol=-1.,
    bV=-0.2,
    posDTarget=True,
    x0=None,

    # random walk params
    N=100,  # number of (simultaneous) random walks
    dt=10.,  # time step [ns]
    walldist=1.,  # in multiples of radius, should be >= 1
    margtop=40.,
    margbot=20.,
    initial="disc",  # oder "sphere"
)

# domains are places where molecule can bind
# and/or be reflected after collision
domain_params = dict(
    cyl=False,  # determines whether rz or xyz coordinates are passed to .inside
    walldist=1.,  # multiple of radius that determines what counts as collision
Beispiel #23
0
# (c) 2016 Gregor Mitscha-Baude
import dolfin
import nanopores as nano
import nanopores.tools.box as box
import nanopores.geometries.pughpore as pughpore
from nanopores.geometries.curved import Sphere
#from nanopores.models.mysolve import pbpnps
import nanopores.physics.simplepnps as simplepnps
import solvers

up = nano.user_params(
    #up = nano.Params( # for iPython
    h=2.,
    Qmol=-1.,
    Nmax=1e5,
    R=30.,
)

geop = nano.Params(R=up.R, H=80., x0=[0., 0., 15.])
physp = nano.Params(
    Qmol=up.Qmol,
    bulkcon=300.,
    dnaqsdamp=.5,
    bV=-0.1,
)
solverp = nano.Params(
    h=up.h,
    frac=0.2,
    Nmax=up.Nmax,
    imax=30,
    tol=1e-2,
Beispiel #24
0
params = nanopores.user_params(
    # general params
    # geo
    geoname="pughcyl",
    dim=2,
    diamPore=6.,
    rMolecule=2.0779,
    R=40.,
    Htop=60.,
    Hbot=35.,
    geop=dict(R=40., Htop=60., Hbot=35.),
    x0=None,
    # physics
    Qmol=5.,
    bulkcon=1000.,
    dnaqsdamp=0.7353,
    bV=-0.1,
    posDTarget=True,
    # solver
    h=2.,
    frac=0.5,
    Nmax=5e4,
    imax=30,
    tol=1e-3,
    cheapest=False,
    stokesiter=False,  #True
    hybrid=True,
    reconstruct=False,

    # random walk params
    N=100,  # number of (simultaneous) random walks
    dt=.2,  # time step [ns]
    walldist=1.,  # in multiples of radius, should be >= 1
    margtop=15.,  # 35 is about the maximum
    margbot=0.,
    rstart=5.,
    initial="sphere",

    # receptor params
    bind_everywhere=False,
    lbind=8.,  # length of binding zone for long binding [nm]
    ra=.2,  # binding zone radius [nm] (1nm means whole channel)
    collect_stats_mode=True,
)
Beispiel #25
0
params = nanopores.user_params(
    # general params
    # geo
    geoname="pughcyl",
    dim=2,
    diamPore=6.,
    rMolecule=2.0779,
    R=40.,
    Htop=60.,
    Hbot=35.,
    geop=dict(R=40., Htop=60., Hbot=35.),
    x0=None,
    # physics
    Qmol=5.,
    bulkcon=1000.,
    dnaqsdamp=0.7353,
    bV=-0.1,
    posDTarget=True,
    # solver
    h=2.,
    frac=0.5,
    Nmax=5e4,
    imax=30,
    tol=1e-3,
    cheapest=False,
    stokesiter=False,  #True
    hybrid=True,
    reconstruct=False,

    # random walk params
    N=100,  # number of (simultaneous) random walks
    dt=.3,  # time step [ns]
    walldist=1.2,  # in multiples of radius, should be >= 1
    margtop=35.,
    margbot=0.,
    rstart=5.,
    initial="sphere",

    # receptor params
    lbind=4.,  # length of binding zone for long binding [nm]
)
#from nanopores.geometries import pughpore
import numpy as np
from nanopores.models import pughpore as pugh
from nanopores.tools.interpolation import harmonic_interpolation
from eikonal import distance_boundary_from_geo
from scipy.interpolate import interp1d
from folders import fields as f
import dolfin
import nanopores

# read user parameters
params = nanopores.user_params(
    #    dim = 3,
    #    h = 2.,
    #    Nmax = 2e6,
    dim=2,
    h=1.,
    Nmax=1e5,
    r=2.0779,
)
print "params", params

if not f.exists("Dpugh", **params):
    # build 1D interpolations from data
    data = f.get_fields("pugh_diff2D", rMolecule=params.r)
    z = [x[2] for x in data["x"]]
    data, z = f._sorted(data, z)
    Dz = data["D"]

    data = f.get_fields("pugh_diff3D", rMolecule=params.r, bulkbc=True)
    x = [x[0] for x in data["x"]]
Beispiel #27
0
# (c) 2017 Gregor Mitscha-Baude
import numpy as np
from nanopores.tools.polygons import Ball, Polygon, MultiPolygon, MultiPolygonPore
from nanopores.geometries.cylpore import MultiPore
from nanopores import user_params
params = user_params(
    R = 100.,
    R0 = 60.,
    H0 = 70.,
    H = 150.,
    x0 = [0, 0, 46],
    rMolecule = 2.1,
    dim = 3,
    no_membrane = True,
    r0 = 13, # pore radius
    angle = 40, # aperture angle in degrees
    lcCenter = 0.3,
    lcMolecule = 0.1,
    h = 10.,
    subs = "solid",
    reconstruct = False,
    poreregion = True,
)

# SiN membrane thickness (in vertical direction)
lsin = 50.
# Au membrane thickness (in vertical direction)
lau = 40.
# Au thickness in radial direction
rlau = 10.
# SAM layer thickness (in vertical direction)
Beispiel #28
0
# (c) 2017 Gregor Mitscha-Baude
import numpy as np
import dolfin, os
import nanopores
from nanopores.models.pughpore import Plotter
from nanopores.models.diffusion_interpolation import get_pugh_diffusivity_alt
from nanopores.tools import fields
fields.set_dir(os.path.expanduser("~") + "/Dropbox/nanopores/fields")

params = nanopores.user_params(dim=3, r=2.0779, h=1., Nmax=.5e6)
functions = get_pugh_diffusivity_alt(**params)
D = functions["D"]

print D([0.,0.,0.])

#D = dolfin.as_matrix(np.diag([D[i] for i in range(params.dim)]))
plotter = Plotter()
plotter.plot(functions["D"][0], title="Dx")
plotter.plot(functions["D"][1], title="Dz")
plotter.plot(functions["dist"], title="dist")
dolfin.interactive()
Beispiel #29
0
    3: dict(name="Dpugh", Nmax=2e6, dim=3, r=0.11, h=2.0)
}

physp = dict(
    bV=-0.08,
    Qmol=5.,
    bulkcon=1000.,
    dnaqsdamp=0.5882,
)
default = {
    2:
    dict(physp, dim=2, h=.75, Nmax=1e5, diffusivity_data=ddata[2]),
    3:
    dict(physp,
         dim=3,
         h=1.25,
         Nmax=7e5,
         diffusivity_data=ddata[3],
         stokesiter=True)
}

dim = 3
params = user_params(default[dim])

ran = np.linspace(-30, 30, 10)
X = [[0., 0., t] for t in ran]

result = pugh.F_explicit(X, name="pugh_test", **params)

print result
print result["J"]
Beispiel #30
0
# (c) 2017 Gregor Mitscha-Baude
import nanopores
from nanopores.models.randomwalk import (get_pore, RandomWalk, Ball, run)

params = nanopores.user_params(
    # general params
    geoname = "alphahem",
    dim = 2,
    rMolecule = .25,
    h = 1.,
    Nmax = 4e4,
    Qmol = 1.,
    bV = -0.4,
    # random walk params
    N = 100, # number of (simultaneous) random walks
    dt = 1e-2, # time step [ns]
    walldist = 2., # in multiples of radius, should be >= 1
    margtop = 2.,
    margbot = .5,
    rstart = 0.1,
    zstart = -5.,
)

pore = get_pore(**params)
rw = RandomWalk(pore, **params)
#receptor = Ball([1., 0., -30.], 8.)
#rw.add_domain(receptor, exclusion=True, walldist=1.,
#              binding=True, eps=1., t=1e6, p=0.1)
rw.add_wall_binding(t=1e4, p=0.1, eps=0.1)
run(rw, "rw_ahem", a=-9, b=3, save_count=1000)