How to use the molgrid.float3 function in molgrid

To help you get started, we’ve selected a few molgrid examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github gnina / libmolgrid / test / test_transform.py View on Github external
def test_numpy_apply_transform():
    '''non-random transform'''
    from molgrid import Transform, Quaternion, float3, MGrid2f, Grid2f
    from math import sqrt
    import numpy as np
    
    q = Quaternion(sqrt(0.5),0,0,sqrt(0.5)) # //z 90
    nr = Transform(q, float3(0,1,1), float3(2,0,-3))

    #random
    r = Transform(float3(0,1,1), 10.0, True)

    coord_data = [ [0,0,0],
                   [1,0,0],
                   [0,1,0],
                   [0,0,1],
                   [-1,.5,3],
                   [1,1,1],
                   [0,1,1],
                   [.333,.75,-9] ]
  
    coords = np.array(coord_data,np.float32)
    coords2 = np.zeros((8,3),np.float32)
github gnina / libmolgrid / test / test_transform.py View on Github external
def test_random_transform():
  from molgrid import Transform
  molgrid.set_random_seed(0)
  c1 = molgrid.float3(0,0,0);
  c2 = molgrid.float3(0,0,1);

  t1 = Transform(c1, 4.0, True)
  t2 = Transform(c2, 4.0, True)

  nrt1 = Transform (c1)
  nrt2 = Transform (c2)

  t = Transform()

  molgrid.set_random_seed(0) # reset, should get same sample
  t3 = Transform(c1, 4.0, True);

  neqQ(t1.get_quaternion(),t2.get_quaternion());
  neqQ(t1.get_quaternion(),nrt1.get_quaternion());
  eqQ(t1.get_quaternion(),t3.get_quaternion());
github gnina / libmolgrid / test / test_transform.py View on Github external
def test_random_transform():
  from molgrid import Transform
  molgrid.set_random_seed(0)
  c1 = molgrid.float3(0,0,0);
  c2 = molgrid.float3(0,0,1);

  t1 = Transform(c1, 4.0, True)
  t2 = Transform(c2, 4.0, True)

  nrt1 = Transform (c1)
  nrt2 = Transform (c2)

  t = Transform()

  molgrid.set_random_seed(0) # reset, should get same sample
  t3 = Transform(c1, 4.0, True);

  neqQ(t1.get_quaternion(),t2.get_quaternion());
  neqQ(t1.get_quaternion(),nrt1.get_quaternion());
  eqQ(t1.get_quaternion(),t3.get_quaternion());
  eqQ(nrt1.get_quaternion(),nrt2.get_quaternion());
github gnina / libmolgrid / test / test_transform.py View on Github external
def test_numpy_apply_transform():
    '''non-random transform'''
    from molgrid import Transform, Quaternion, float3, MGrid2f, Grid2f
    from math import sqrt
    import numpy as np
    
    q = Quaternion(sqrt(0.5),0,0,sqrt(0.5)) # //z 90
    nr = Transform(q, float3(0,1,1), float3(2,0,-3))

    #random
    r = Transform(float3(0,1,1), 10.0, True)

    coord_data = [ [0,0,0],
                   [1,0,0],
                   [0,1,0],
                   [0,0,1],
                   [-1,.5,3],
                   [1,1,1],
                   [0,1,1],
                   [.333,.75,-9] ]
  
    coords = np.array(coord_data,np.float32)
    coords2 = np.zeros((8,3),np.float32)

    #does nr perform as expected?
    nr.forward(coords,coords2)
github gnina / libmolgrid / test / test_transform.py View on Github external
def test_apply_transform():
    '''non-random transform'''
    from molgrid import Transform, Quaternion, float3, MGrid2f, Grid2f
    from math import sqrt
    
    q = Quaternion(sqrt(0.5),0,0,sqrt(0.5)) # //z 90
    nr = Transform(q, float3(0,1,1), float3(2,0,-3))

    #random
    r = Transform(float3(0,1,1), 10.0, True)

    coord_data = [ [0,0,0],
                   [1,0,0],
                   [0,1,0],
                   [0,0,1],
                   [-1,.5,3],
                   [1,1,1],
                   [0,1,1],
                   [.333,.75,-9] ]
  
    coords = MGrid2f(8,3)
    coords2 = MGrid2f(8,3)

    for i in range(8):
        for j in range(3):
            coords[i][j] = coord_data[i][j]
github gnina / libmolgrid / test / test_transform.py View on Github external
def test_apply_transform():
    '''non-random transform'''
    from molgrid import Transform, Quaternion, float3, MGrid2f, Grid2f
    from math import sqrt
    
    q = Quaternion(sqrt(0.5),0,0,sqrt(0.5)) # //z 90
    nr = Transform(q, float3(0,1,1), float3(2,0,-3))

    #random
    r = Transform(float3(0,1,1), 10.0, True)

    coord_data = [ [0,0,0],
                   [1,0,0],
                   [0,1,0],
                   [0,0,1],
                   [-1,.5,3],
                   [1,1,1],
                   [0,1,1],
                   [.333,.75,-9] ]
  
    coords = MGrid2f(8,3)
    coords2 = MGrid2f(8,3)