Пример #1
0
def draw_displacement_iv_wrapper(gf, r0, dt, event_type, a, sigma):
    def drawTheta_wrapper(gf, r, r0, dt):
        """Draw theta for the inter-particle vector.

        """
        rnd = myrandom.uniform()

        if __debug__:
            log.debug('        *drawTheta. ' + gf.__class__.__name__)
        try:
            theta = gf.drawTheta(rnd, r, r0, dt)
        except Exception, e:
            raise Exception('gf.drawTheta() failed, '
                            '%s, rnd = %g, r = %g, r0 = %g, dt = %g' %
                            (str(e), rnd, r, r0, dt))#, gf.dump()))

        # Heads up. For cylinders theta should be between [-pi, pi]. For 
        # spheres it doesn't matter.
        return myrandom.choice(-1, 1) * theta
Пример #2
0
def draw_displacement_iv_wrapper(gf, r0, dt, event_type, a, sigma):
    def drawTheta_wrapper(gf, r, r0, dt):
        """Draw theta for the inter-particle vector.

        """
        rnd = myrandom.uniform()

        if __debug__:
            log.debug("        *drawTheta. " + gf.__class__.__name__)
        try:
            theta = gf.drawTheta(rnd, r, r0, dt)
        except Exception, e:
            raise Exception(
                "gf.drawTheta() failed, " "%s, rnd = %g, r = %g, r0 = %g, dt = %g" % (str(e), rnd, r, r0, dt)
            )  # , gf.dump()))

        # Heads up. For cylinders theta should be between [-pi, pi]. For
        # spheres it doesn't matter.
        return myrandom.choice(-1, 1) * theta
Пример #3
0
            if __debug__:
                log.debug('        *drawR: redraw')
            rnd = myrandom.uniform()
            r = gf.drawR(rnd, dt)
    except Exception, e:
        raise Exception('gf.drawR() failed, '
                        '%s, rnd = %.16g, dt = %.16g, %s' %
                        (str(e), rnd, dt, gf.dump()))

    return r


def draw_theta_wrapper(gf, r, dt):
    """Draw theta for the inter-particle vector.

    """
    rnd = myrandom.uniform()

    if __debug__:
        log.debug('        *drawTheta. ' + gf.__class__.__name__)
    try:
        theta = gf.drawTheta(rnd, r, dt)
    except Exception, e:
        raise Exception('gf.drawTheta() failed, '
                        '%s, rnd = %.16g, r = %.16g, dt = %.16g' %
                        (str(e), rnd, r, dt))  #, gf.dump()))

    # Heads up. For cylinders theta should be between [-pi, pi]. For
    # spheres it doesn't matter.
    return myrandom.choice(-1, 1) * theta
Пример #4
0
 def random_unbinding_site(self, pos, radius):
     return pos + myrandom.choice(-1, 1) * \
                  self.minimal_distance_from_surface(radius)  * self.shape.unit_z
Пример #5
0
 def random_vector(self, r):
     return myrandom.choice(-1, 1) * r * self.shape.unit_z
Пример #6
0
 def random_unbinding_site(self, pos, radius):
     return pos + myrandom.choice(-1, 1) * self.minimal_distance_from_surface(radius) * self.shape.unit_z
Пример #7
0
 def random_vector(self, r):
     return myrandom.choice(-1, 1) * r * self.shape.unit_z
Пример #8
0
            if __debug__:
                log.debug('        *drawR: redraw')
            rnd = myrandom.uniform()
            r = gf.drawR(rnd, dt)
    except Exception, e:
        raise Exception('gf.drawR() failed, '
                        '%s, rnd = %.16g, dt = %.16g, %s' %
                        (str(e), rnd, dt, gf.dump()))

    return r

def draw_theta_wrapper(gf, r, dt):
    """Draw theta for the inter-particle vector.

    """
    rnd = myrandom.uniform()

    if __debug__:
        log.debug('        *drawTheta. ' + gf.__class__.__name__)
    try:
        theta = gf.drawTheta(rnd, r, dt)
    except Exception, e:
        raise Exception('gf.drawTheta() failed, '
                        '%s, rnd = %.16g, r = %.16g, dt = %.16g' %
                        (str(e), rnd, r, dt))#, gf.dump()))

    # Heads up. For cylinders theta should be between [-pi, pi]. For 
    # spheres it doesn't matter.
    return myrandom.choice(-1, 1) * theta