コード例 #1
0
ファイル: pughpore.py プロジェクト: jhwnkim/nanopores
def polygon(rmem=20., **params):
    "polygon of pore + membrane for plotting"
    setup = SetupNoGeo(**params)
    params = nano.Params(pughpore.params) | setup.geop

    r = [0.5*params.l3, 0.5*params.l2, 0.5*params.l1, 0.5*params.l0,
         0.5*params.l4, rmem]
    ztop = params.hpore/2.
    zbot = -ztop
    z = [zbot, ztop - params.h2, ztop - params.h1, ztop, zbot + params.h4,
         zbot + params.hmem]
    # indices: [(0,0), (0,1), (1,1), (1,2), ..., (5,5), (5,0)]
    return [(r[i / 2 % 6], z[(i+1) / 2 % 6]) for i in range(12)]
コード例 #2
0
ファイル: randomwalk.py プロジェクト: jhwnkim/nanopores
def get_results(name, params, setup=setup_default, calc=True):
    # setup is function rw = setup(params) that sets up rw
    # check existing saved rws
    data = None
    if fields.exists(name, **params):
        data = load_results(name, **params)
        N = len(data.times)
    else:
        N = 0
    # determine number of missing rws and run
    N_missing = params["N"] - N
    if N_missing > 0 and calc:
        new_params = nanopores.Params(params, N=N_missing)
        rw = setup(new_params)
        run(rw, name)
        rw.save(name)
        data = load_results(name, **params)
    # return results
    elif data is None:
        data = load_results(name, **params)
    return data
コード例 #3
0
import nanopores.geometries.pughpore as pughpore
import matplotlib.pyplot as plt
from matplotlib.ticker import FormatStrFormatter
import numpy as np
import os
import sys
import nanopores.tools.fields as f
HOME = os.path.expanduser("~")
PAPERDIR = os.path.join(HOME, "papers", "paper-howorka")
FIGDIR = os.path.join(PAPERDIR, "figures", "")
DATADIR = os.path.join(HOME, "Dropbox", "nanopores", "fields")
f.set_dir_mega()

number = False

geop = nano.Params(pughpore.params)
hpore = geop.hpore
fieldsname = 'events3_onlyone_5'
params = dict(avgbind1=2e7,
              avgbind2=3e4,
              P_bind1=8.e-2,
              P_bind2=0 * 3e-1,
              z0=hpore / 2. + 0.)

#cmap=matplotlib.cm.get_cmap('viridis')
data = f.get_fields(fieldsname, **params)
figname = fieldsname + '_%.1e_%.1e_%.1e_%.1e' % (
    params["avgbind1"], params["avgbind2"], params["P_bind1"],
    params["P_bind2"]) + str(params["z0"])
t = data["t"]
tdata = np.array(t)
コード例 #4
0
from matplotlib import gridspec
import matplotlib.path as mplPath
import numpy as np
from get_F import Force, Current
from nanopores.models.pughpore import polygon
from nanopores.models.pughpoints import plot_polygon
import matplotlib.pyplot as plt
import nanopores as nano
import nanopores.geometries.pughpore as pughpore
#import os

up    = nano.Params(pughpore.params, k=3)

l0    = up.l0
l1    = up.l1
l2    = up.l2
l3    = up.l3
h1    = up.h1
h2    = up.h2
hpore = up.hpore

#import nanopores.tools.fields as f
#HOME = os.path.expanduser("~")
#PAPERDIR = os.path.join(HOME, "papers", "paper-howorka")
#FIGDIR = os.path.join(PAPERDIR, "figures", "")
#DATADIR = os.path.join(HOME,"Dropbox", "nanopores", "fields")
#f.set_dir(DATADIR)


#    30
#
コード例 #5
0
ファイル: test_pugh.py プロジェクト: jhwnkim/nanopores
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,
    cheapest=False,
)
コード例 #6
0
import nanopores.geometries.pughpore as pughpore
import matplotlib.pyplot as plt
from matplotlib.ticker import FormatStrFormatter
import numpy as np
import os
import sys
import nanopores.tools.fields as f
HOME = os.path.expanduser("~")
PAPERDIR = os.path.join(HOME, "Dropbox", "nanopores")
FIGDIR = os.path.join(PAPERDIR, "figures", "")
DATADIR = os.path.join(HOME, "Dropbox", "nanopores", "fields")
f.set_dir_mega()

number = False

geop = nanopores.Params(pughpore.params)
hpore = geop.hpore
fieldsname = 'eventsnew_both_1_'
params = dict(avgbind1=23e6,
              avgbind2=3e4,
              P_bind1=0.035,
              P_bind2=3e-1,
              z0=hpore / 2. + 0.)

drop, th = f.get("events_pugh_experiment", "drop", "t")
th = [1e0 * time for time in th]

#cmap=matplotlib.cm.get_cmap('viridis')
data = f.get_fields(fieldsname, **params)
figname = fieldsname + '_%.1e_%.1e_%.1e_%.1e' % (
    params["avgbind1"], params["avgbind2"], params["P_bind1"],
コード例 #7
0
ファイル: forcefield.py プロジェクト: jhwnkim/nanopores
    fields.update()

F, Fel, Fdrag = fields.get_functions(name, "F", "Fel", "Fdrag", **params)
D, dist = fields.get_functions(name_D, "D", "dist", **params)

if __name__ == "__main__":
    Fplot = nano.user_param(Fplot=False)
    Dplot = nano.user_param(Dplot=False)

    if Fplot:
        plt = nanopore.Plotter(dim=2)
        plt.plot_vector(F, title="F", interactive=True)
        #plt.plot_vector(Fel, title="Fel")
        #plt.plot_vector(Fdrag, title="Fdrag", interactive=True)
        pore = WeiPore()
        params = nano.Params(pore.default, **params)
        sam, au, sin, _ = pore.polygons(params)
        poly = MultiPolygon(Polygon(sam), Polygon(au), Polygon(sin)).nodes
        streamlines(polygon=poly,
                    rx=100.,
                    ry=100.,
                    Nx=100,
                    Ny=100,
                    maxvalue=None,
                    F=F)
        nano.showplots()

    if Dplot:
        plt = nanopore.Plotter(dim=2)
        #plt.plot(dist, "dist")
        plt.plot(D[1], "D", interactive=True)
コード例 #8
0
ファイル: selectivity.py プロジェクト: jhwnkim/nanopores
    #F, geo, phys = forcefields.F_geo_phys(p.overwrite, **fparams)
    F, geo, phys = forcefields.F_geo_phys(**fparams)

    # get additional boundary force
    if bforce:
        Fb, _ = boundary_force(mesh=geo.mesh, **fparams)
        F = F + Fb

    result = calculate_selectivity(F, geo, phys, **sparams)
    result["params"] = params
    return result


if __name__ == "__main__":
    import numpy
    results = nanopores.Params(selectivity(**default))
    t = results.time
    J = results.current
    rel = results.release
    params = results.params

    plt.figure(0)
    plt.semilogx(t, rel, "x-")
    plt.xlabel("time [s]")
    plt.ylabel("% release")
    plt.title("reservoir size: %.0f nm" % (params["Ry"], ))
    plt.ylim(ymin=0.)

    def avg(J):
        n = len(J)
        J0 = list(numpy.array(J)[n * 0.2:n * 0.5])
コード例 #9
0
default = nano.Params(
    geop=nano.Params(
        geoname="wei",
        dim=2,
        x0=None,
        rMolecule=0.5,
        receptor=None,
        lcMolecule=0.1,
        lcCenter=0.4,
    ),
    physp=nano.Params(
        Qmol=-1.,
        bulkcon=1000.,
        dnaqsdamp=.5,
        bV=-0.1,
        rDPore=.9,
        Membraneqs=-0.0,
        ahemqs=None,
        ahemuniformqs=False,
        posDTarget=True,
    ),
    solverp=nano.Params(
        h=1.,
        frac=0.2,
        Nmax=2e4,
        imax=30,
        tol=1e-2,
        cheapest=False,
        stokesiter=False,  #True
        diffusivity_data=None,
        reconstruct=False,
        fluid="fluid",
        hybrid=True,
    ))
コード例 #10
0
ファイル: randomwalk.py プロジェクト: jhwnkim/nanopores
def load_results(name, **params):
    data = fields.get_fields(name, **params)
    data = nanopores.Params({k: _load(data[k]) for k in data})
    print "Found %d simulated events." % len(data.times)
    return data
コード例 #11
0
ファイル: test_1Dpugh.py プロジェクト: jhwnkim/nanopores
# (c) 2016 Gregor Mitscha-Baude
" 1D PNP, modelling reservoirs and membrane far away from pore "

import nanopores as nano
import solvers

geop = nano.Params(
    R = 35.,
    H = 70.,
)
physp = nano.Params(
    bulkcon = 1000.,
    bV = -1.,
)

geo, pnp = solvers.solve1D(geop, physp)
solvers.visualize1D(geo, pnp)
nano.showplots()

コード例 #12
0
ファイル: rw.py プロジェクト: jhwnkim/nanopores
params = nanopores.Params(
    # simulation params
    geoname="alphahem",
    dim=2,
    rMolecule=.5,
    h=1.,
    Nmax=1e5,
    Qmol=-2.,
    bV=0.5,
    posDTarget=False,
    R=21,
    Hbot=21,
    Htop=21,
    geop=dict(R=21, Hbot=21, Htop=21),
    ahemqs=None,
    ahemuniformqs=False,

    # random walk params
    N=10000,  # number of (simultaneous) random walks
    dt=0.01,  # time step [ns]
    walldist=1.,  # in multiples of radius, should be >= 1
    rstart=1.,
    zstart=1.,
    initial="disc",  # oder "sphere"

    # binding params
    t_bind=1000.,
    p_bind=1.,
    eps_bind=0.1,

    # stopping criterion: max time (w/o binding) and radius
    Tmax=10000.,
    Rmax=20.,
    zstop=-1.28,
)
コード例 #13
0
ファイル: pughpore.py プロジェクト: jhwnkim/nanopores
default = nano.Params(
geop = nano.Params(
    dim = 3,
    R = pughpore.params["R"],
    H = pughpore.params["H"],
    l0 = pughpore.params["l0"],
    l1 = pughpore.params["l1"],
    l2 = pughpore.params["l2"],
    l3 = pughpore.params["l3"],
    l4 = pughpore.params["l4"],
    diamPore = 6., # will override l0,.. if set
    diamDNA = 2.5, # will override l0,.. if diamPore set
    x0 = pughpore.params["x0"],
    rMolecule = pughpore.params["rMolecule"],
    lcMolecule = pughpore.params["lcMolecule"],
    center_z_at_x0 = False,
),
physp = nano.Params(
    Qmol = 5., # charge of trypsin at pH 8.
    bulkcon = 1000.,
    dnaqsdamp = 0.7353,
    bV = -0.1,
    rDPore = .9,
    bulkbc = True,
    Membraneqs = -0.0,
),
solverp = nano.Params(
    h = 1.5,
    frac = 0.2,
    Nmax = 6e5,
    imax = 40,
    tol = 1e-2,
    cheapest = False,
    stokesiter = False, #True
    diffusivity_data = None,
    diffusivity = None,
))