<commit_before>import numpy, math
from params_geo import *
import nanopores.py4gmsh.basic
import nanopores.py4gmsh.extra
from nanopores.py4gmsh import *
from warnings import warn

def get_geo(x0 = None, crosssections = True, **params):
    """
    writes a 3d geo file for an extruded axissymmetric geometry
    for Howorka 'Self-Assembled aHem that spans lipid bilayers'
    _________
    |        |
    |  _     |
    | | |____|
    | | |____|
    | |_|    |
    |        |
    |________|   *rotated around y-axis *

    """
    reload(nanopores.py4gmsh.basic)
    reload(nanopores.py4gmsh.extra)
    globals().update(params)



    X_aHem = numpy.array([[2.16, 0.0, 0.0],
                          [2.77, 0.0, -0.19],
                          [3.24, 0.0, -0.1 ],
                          [3.59, 0.0, -0.1 ],
                          [3.83, 0.0, -0.35],
                          [3.84, 0.0, -0.8 ],
                          [3.67, 0.0, -1.34],
                          [3.73, 0.0, -1.96],
                          [3.93, 0.0, -2.31],
                          [4.23, 0.0, -2.67],
                          [4.44, 0.0, -2.81],
                          [4.33, 0.0, -3.25],
                          [4.01, 0.0, -3.5 ],
                          [3.99, 0.0, -3.67],
                          [4.11, 0.0, -3.94],
                          [4.39, 0.0, -4.12],
                          [4.44, 0.0, -4.52],
                          [4.73, 0.0, -4.86],
                          [4.96, 0.0, -5.41],
                          [4.89, 0.0, -5.87],
                          [4.63, 0.0, -6.44],
                          [4.43, 0.0, -6.96],
                          [4.07, 0.0, -7.32],
                          [3.71, 0.0, -7.51],
                          [3.46, 0.0, -7.36],
                          [3.41, 0.0, -7.1 ],
                          [3.31, 0.0, -6.9 ],
                          [3.04, 0.0, -6.87],
                          [2.73, 0.0, -6.73],
                          [2.41, 0.0, -6.6 ],
                          [2.17, 0.0, -6.41],
                          [1.97, 0.0, -6.23],
                          [1.84, 0.0, -6.03],
                          [1.76, 0.0, -5.87],
                          [1.54, 0.0, -5.87],
                          [1.4 , 0.0, -5.96],
                          [1.31, 0.0, -6.16],
                          [1.39, 0.0, -6.57],
                          [1.6 , 0.0, -6.81],
                          [1.71, 0.0, -7.09],
                          [1.76, 0.0, -7.32],
                          [1.67, 0.0, -7.65],
                          [1.44, 0.0, -7.81],
                          [1.49, 0.0, -8.06],
                          [1.56, 0.0, -8.36],
                          [1.44, 0.0, -8.61],
                          [1.43, 0.0, -8.79],
                          [1.44, 0.0, -9.1 ],
                          [1.6 , 0.0, -9.48],
                          [1.74, 0.0, -9.84],
                          [1.63, 0.0, -10.0],
                          [1.47, 0.0, -10.19],
                          [1.26, 0.0, -10.21],
                          [1.07, 0.0, -10.05],
                          [1.03, 0.0, -9.76],
                          [1.09, 0.0, -9.44],
                          [1.07, 0.0, -9.02],
                          [0.86, 0.0, -8.79],
                          [0.64, 0.0, -8.68],
                          [0.63, 0.0, -8.36],
                          [0.8 , 0.0, -8.22],
                          [0.81, 0.0, -7.93],
                          [0.89, 0.0, -7.71],
                          [1.04, 0.0, -7.51],
                          [1.1 , 0.0, -7.25],
                          [0.91, 0.0, -7.02],
                          [0.91, 0.0, -6.76],
                          [0.91, 0.0, -6.48],
                          [0.69, 0.0, -6.25],
                          [0.69, 0.0, -6.  ],
                          [0.66, 0.0, -5.68],
                          [0.59, 0.0, -5.36],
                          [0.53, 0.0, -5.12],
                          [0.54, 0.0, -4.92],
                          [0.79, 0.0, -4.84],
                          [1.03, 0.0, -4.89],
                          [1.21, 0.0, -4.7 ],
                          [1.36, 0.0, -4.42],
                          [1.49, 0.0, -4.16],
                          [1.66, 0.0, -3.92],
                          [1.66, 0.0, -3.7 ],
                          [1.8 , 0.0, -3.41],
                          [2.  , 0.0, -3.22],
                          [1.91, 0.0, -2.93],
                          [1.8 , 0.0, -2.71],
                          [1.56, 0.0, -2.55],
                          [1.46, 0.0, -2.38],
                          [1.3 , 0.0, -2.19],
                          [1.21, 0.0, -1.93],
                          [1.09, 0.0, -1.64],
                          [0.9 , 0.0, -1.45],
                          [0.8 , 0.0, -1.28],
                          [0.84, 0.0, -1.  ],
                          [1.  , 0.0, -0.8 ],
                          [1.26, 0.0, -0.64],
                          [1.7 , 0.0, -0.31]])

    #Anchor Points on aHem for membran (index)
    ap1 = 18
    ap2 = 49
    apdiff=ap2-ap1

    #Anchor Points in aHem for CrossS (index)
    ac1 = 52
    ac2 = 68
    ac3 = 82
    ac4 = 0

    X_Fluid_ext = numpy.array([[0.0, 0.0, l3],
                               [R, 0.0, l3],
                               [R, 0.0, X_aHem[ap1][2]],
                               [R, 0.0, X_aHem[ap2][2]],
                               [R, 0.0, -l0-l1-l4],
                               [0.0, 0.0, -l0-l1-l4]])
    X_Fluid_ctr = numpy.array([[0.0, 0.0, X_aHem[ac1][2]],
                               [0.0, 0.0, X_aHem[ac2][2]],
                               [0.0, 0.0, X_aHem[ac3][2]],
                               [0.0, 0.0, X_aHem[ac4][2]]])


    p_Fluid = [Point(x, lcOuter) for x in X_Fluid_ext]
    p_Fluid.extend([Point(y, lcCenter) for y in X_Fluid_ctr])
    p_aHem = [Point(x, lcCenter) for x in X_aHem]

    #Create Line Loops from the points sitting on the line
    Comment(' Connect all Fluid points ')
    e_Fluid = [Line(p_Fluid[k], p_Fluid[k+1]) for k in range(len(p_Fluid)-1)]
    e_Fluid.append(Line(p_Fluid[-1], p_Fluid[0]))

    Comment(' Connect all aHem points ')
    e_aHem = [Line(p_aHem[k], p_aHem[k+1]) for k in range(len(p_aHem)-1)]
    e_aHem.append(Line(p_aHem[-1], p_aHem[0]))

    e_Membrane = [Line(p_aHem[ap1],p_Fluid[2]), Line(p_Fluid[3], p_aHem[ap2])]

    edges_to_rot = [e_Fluid[0:5], e_aHem, e_Membrane]

    geo_cs_str = "no crosssectional surface"
    if crosssections:
        Comment(' integrate crosssectional lines in fluid and check if molecule intersects lines')
        e_CrossS = [Line(p_aHem[52], p_Fluid[6]), Line(p_aHem[68], p_Fluid[7]), Line(p_aHem[82], p_Fluid[8]), Line(p_aHem[0], p_Fluid[9])]
        cs_pop_i = None
        # check if molecule is near pore
        if x0 is not None and (x0[0]**2 + x0[1]**2 <= r0**2):
            # check z coordinate of molecule
            if abs(x0[2]) < rMolecule:
                geo_cs_str = "top crosssection"
                cs_pop_i = -1
            elif abs(x0[2] + 3.22) < rMolecule:
                geo_cs_str = "center top crosssection"
                cs_pop_i = 2
            elif abs(x0[2] + 3.25) < rMolecule:
                geo_cs_str = "center bottom crosssection"
                cs_pop_i = 1
            elif abs(x0[2] + 10.21) < rMolecule:
                geo_cs_str = "bottom crosssection"
                cs_pop_i = 0
        if cs_pop_i is not None:
            e_CrossS.pop(cs_pop_i)
        edges_to_rot.append(e_CrossS)

    rot_axis = [0.0, 0.0, 1.0]
    point_on_rot_axis = [0.0, 0.0, 0.0]
    # Extrude all edge 4 times Pi/2
    surfs = []
    angle = 'Pi/2'
    n_e = len(edges_to_rot)<commit_msg>parameterized source arrays py4geo 2nd<commit_after>import numpy, math
from params_geo import *
import nanopores.py4gmsh.basic
import nanopores.py4gmsh.extra
from nanopores.py4gmsh import *
from warnings import warn

def get_geo(x0 = None, crosssections = True, **params):
    """
    writes a 3d geo file for an extruded axissymmetric geometry
    for Howorka 'Self-Assembled aHem that spans lipid bilayers'
    _________
    |        |
    |  _     |
    | | |____|
    | | |____|
    | |_|    |
    |        |
    |________|   *rotated around y-axis *

    """
    reload(nanopores.py4gmsh.basic)
    reload(nanopores.py4gmsh.extra)
    globals().update(params)



    X_aHem = numpy.array([[2.16, 0.0, 0.0],
                          [2.77, 0.0, -0.19],
                          [3.24, 0.0, -0.1 ],
                          [3.59, 0.0, -0.1 ],
                          [3.83, 0.0, -0.35],
                          [3.84, 0.0, -0.8 ],
                          [3.67, 0.0, -1.34],
                          [3.73, 0.0, -1.96],
                          [3.93, 0.0, -2.31],
                          [4.23, 0.0, -2.67],
                          [4.44, 0.0, -2.81],
                          [4.33, 0.0, -3.25],
                          [4.01, 0.0, -3.5 ],
                          [3.99, 0.0, -3.67],
                          [4.11, 0.0, -3.94],
                          [4.39, 0.0, -4.12],
                          [4.44, 0.0, -4.52],
                          [4.73, 0.0, -4.86],
                          [4.96, 0.0, -5.41],
                          [4.89, 0.0, -5.87],
                          [4.63, 0.0, -6.44],
                          [4.43, 0.0, -6.96],
                          [4.07, 0.0, -7.32],
                          [3.71, 0.0, -7.51],
                          [3.46, 0.0, -7.36],
                          [3.41, 0.0, -7.1 ],
                          [3.31, 0.0, -6.9 ],
                          [3.04, 0.0, -6.87],
                          [2.73, 0.0, -6.73],
                          [2.41, 0.0, -6.6 ],
                          [2.17, 0.0, -6.41],
                          [1.97, 0.0, -6.23],
                          [1.84, 0.0, -6.03],
                          [1.76, 0.0, -5.87],
                          [1.54, 0.0, -5.87],
                          [1.4 , 0.0, -5.96],
                          [1.31, 0.0, -6.16],
                          [1.39, 0.0, -6.57],
                          [1.6 , 0.0, -6.81],
                          [1.71, 0.0, -7.09],
                          [1.76, 0.0, -7.32],
                          [1.67, 0.0, -7.65],
                          [1.44, 0.0, -7.81],
                          [1.49, 0.0, -8.06],
                          [1.56, 0.0, -8.36],
                          [1.44, 0.0, -8.61],
                          [1.43, 0.0, -8.79],
                          [1.44, 0.0, -9.1 ],
                          [1.6 , 0.0, -9.48],
                          [1.74, 0.0, -9.84],
                          [1.63, 0.0, -10.0],
                          [1.47, 0.0, -10.19],
                          [1.26, 0.0, -10.21],
                          [1.07, 0.0, -10.05],
                          [1.03, 0.0, -9.76],
                          [1.09, 0.0, -9.44],
                          [1.07, 0.0, -9.02],
                          [0.86, 0.0, -8.79],
                          [0.64, 0.0, -8.68],
                          [0.63, 0.0, -8.36],
                          [0.8 , 0.0, -8.22],
                          [0.81, 0.0, -7.93],
                          [0.89, 0.0, -7.71],
                          [1.04, 0.0, -7.51],
                          [1.1 , 0.0, -7.25],
                          [0.91, 0.0, -7.02],
                          [0.91, 0.0, -6.76],
                          [0.91, 0.0, -6.48],
                          [0.69, 0.0, -6.25],
                          [0.69, 0.0, -6.  ],
                          [0.66, 0.0, -5.68],
                          [0.59, 0.0, -5.36],
                          [0.53, 0.0, -5.12],
                          [0.54, 0.0, -4.92],
                          [0.79, 0.0, -4.84],
                          [1.03, 0.0, -4.89],
                          [1.21, 0.0, -4.7 ],
                          [1.36, 0.0, -4.42],
                          [1.49, 0.0, -4.16],
                          [1.66, 0.0, -3.92],
                          [1.66, 0.0, -3.7 ],
                          [1.8 , 0.0, -3.41],
                          [2.  , 0.0, -3.22],
                          [1.91, 0.0, -2.93],
                          [1.8 , 0.0, -2.71],
                          [1.56, 0.0, -2.55],
                          [1.46, 0.0, -2.38],
                          [1.3 , 0.0, -2.19],
                          [1.21, 0.0, -1.93],
                          [1.09, 0.0, -1.64],
                          [0.9 , 0.0, -1.45],
                          [0.8 , 0.0, -1.28],
                          [0.84, 0.0, -1.  ],
                          [1.  , 0.0, -0.8 ],
                          [1.26, 0.0, -0.64],
                          [1.7 , 0.0, -0.31]])

    #Anchor Points on aHem for membran (index)
    ap1 = 18
    ap2 = 49
    apdiff=ap2-ap1

    #Anchor Points in aHem for CrossS (index)
    ac1 = 52
    ac2 = 68
    ac3 = 82
    ac4 = 0

    X_Fluid_ext = numpy.array([[0.0, 0.0, l3],
                               [R, 0.0, l3],
                               [R, 0.0, X_aHem[ap1][2]],
                               [R, 0.0, X_aHem[ap2][2]],
                               [R, 0.0, -l0-l1-l4],
                               [0.0, 0.0, -l0-l1-l4]])
    X_Fluid_ctr = numpy.array([[0.0, 0.0, X_aHem[ac1][2]],
                               [0.0, 0.0, X_aHem[ac2][2]],
                               [0.0, 0.0, X_aHem[ac3][2]],
                               [0.0, 0.0, X_aHem[ac4][2]]])


    p_Fluid = [Point(x, lcOuter) for x in X_Fluid_ext]
    p_Fluid.extend([Point(y, lcCenter) for y in X_Fluid_ctr])
    p_aHem = [Point(x, lcCenter) for x in X_aHem]

    #Create Line Loops from the points sitting on the line
    Comment(' Connect all Fluid points ')
    e_Fluid = [Line(p_Fluid[k], p_Fluid[k+1]) for k in range(len(p_Fluid)-1)]
    e_Fluid.append(Line(p_Fluid[-1], p_Fluid[0]))

    Comment(' Connect all aHem points ')
    e_aHem = [Line(p_aHem[k], p_aHem[k+1]) for k in range(len(p_aHem)-1)]
    e_aHem.append(Line(p_aHem[-1], p_aHem[0]))

    e_Membrane = [Line(p_aHem[ap1],p_Fluid[2]), Line(p_Fluid[3], p_aHem[ap2])]

    edges_to_rot = [e_Fluid[0:5], e_aHem, e_Membrane]

    geo_cs_str = "no crosssectional surface"
    if crosssections:
        Comment(' integrate crosssectional lines in fluid and check if molecule intersects lines')
        e_CrossS = [Line(p_aHem[ac1], p_Fluid[6]), Line(p_aHem[ac2], p_Fluid[7]), Line(p_aHem[ac3], p_Fluid[8]), Line(p_aHem[ac4], p_Fluid[9])]
        cs_pop_i = None
        # check if molecule is near pore
        if x0 is not None and (x0[0]**2 + x0[1]**2 <= r0**2):
            # check z coordinate of molecule
            if abs(x0[2]) < rMolecule:
                geo_cs_str = "top crosssection"
                cs_pop_i = -1
            elif abs(x0[2] + 3.22) < rMolecule:
                geo_cs_str = "center top crosssection"
                cs_pop_i = 2
            elif abs(x0[2] + 3.25) < rMolecule:
                geo_cs_str = "center bottom crosssection"
                cs_pop_i = 1
            elif abs(x0[2] + 10.21) < rMolecule:
                geo_cs_str = "bottom crosssection"
                cs_pop_i = 0
        if cs_pop_i is not None:
            e_CrossS.pop(cs_pop_i)
        edges_to_rot.append(e_CrossS)

    rot_axis = [0.0, 0.0, 1.0]
    point_on_rot_axis = [0.0, 0.0, 0.0]
    # Extrude all edge 4 times Pi/2
    surfs = []
    angle = 'Pi/2'
    n_e = len(edges_to_rot)
{'fraction_non_alphanumeric': 0.1677162318468063, 'fraction_numerical': 0.11418840765968384, 'mean_word_length': 0.8014816529690937, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 4, 'word_list_counts': {'cursed_substrings.json': 8, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4539524', 'n_tokens_mistral': 6625, 'n_tokens_neox': 5923, 'n_words': 1149}