Ejemplo n.º 1
0
def rotation_test():
   print ">> running rotation test ",
   sys.stdout.flush()
   f = open("rotation.dat","w")
   p = 4
   print >>f,"# rotation test "
   n = 40
   alphas = []
   cs = []
   p = [math.sqrt(2.),math.sqrt(2.),0]
   p = [0,1,0]
   for i in range(n+1):
     a = 2.0*math.pi*i/n
     R = util.rotation(p,a)
     c = np.array(util.rotate_all(R,c1))
     alphas.append(a)
     cs.append(c)
   g0,R0 = r.distance(C1,C2)
   print >>f,"# RMSD ref =",g0
   print >>f,"# OGTO ref =",
   o0s = []
   for sig in sigmas: 
     d0,R0 = o.distance(c1,c2,sig)
     o0s.append(d0)
     print >>f,d0,
   print >>f
   print >>f,"# alpha d_rmsd, d_ogto @ sig=",
   for sig in sigmas: print >>f, sig,
   print >>f
   for i in range(len(alphas)):
     sys.stdout.write("*")
     sys.stdout.flush()
     a = alphas[i]
     # optimal rot
     d1,R1r = r.distance(C1,cs[i]) 
     print >>f,"{0:8.5f} ".format(a),
     print >>f,"{0:10.7f} ".format(d1),
     for j in range(len(sigmas)):
       sig = sigmas[j]
       d0 = o0s[j]
       d1,R1 = o.distance(c1,cs[i],sig) 
       print >>f,"{0:10.7f} ".format(d1),
#      if (d1 < 0.01):
#        print 
#        print R1r
#        print R1
     # no rot
     d1,R1 = r.dist(C1,cs[i]) 
     print >>f,"{0:10.7f} ".format(d1),
     for j in range(len(sigmas)):
       sig = sigmas[j]
       d0 = o0s[j]
       d1,R1 = o.dist(c1,cs[i],sig) 
       print >>f,"{0:10.7f} ".format(d1),
     print >>f
   print "done"
Ejemplo n.º 2
0
def rotation_test():
    print ">> running rotation test ",
    sys.stdout.flush()
    f = open("rotation.dat", "w")
    p = 4
    print >> f, "# rotation test "
    n = 40
    alphas = []
    cs = []
    for i in range(n + 1):
        a = 2.0 * math.pi * i / n
        R = util.rotation([1, 0, 0], a)
        c = np.array(util.rotate_all(R, c1))
        alphas.append(a)
        cs.append(c)
    g0, R0 = g.distance(C1, C2)
    print >> f, "# RMSD ref =", g0
    print >> f, "# OGTO ref =",
    o0s = []
    for sig in sigmas:
        d0, R0 = o.distance(c1, c2, sig)
        #d0,R0 = o.dist(c1,c2,sig)
        o0s.append(d0)
        print >> f, d0,
    print >> f
    print >> f, "# alpha (d1,d2)_rmsd, _ogto @ sig=",
    for sig in sigmas:
        print >> f, sig,
    print >> f
    for i in range(len(alphas)):
        sys.stdout.write("*")
        sys.stdout.flush()
        a = alphas[i]
        d1, R1 = g.distance(C1, cs[i])
        d2, R2 = g.distance(C2, cs[i])
        print "RMSD\n", R1, "\n", R2
        print >> f, "{0:8.5f} {1:10.7f} {2:10.7f}".format(a, d1 / g0, d2 / g0),
        for j in range(len(sigmas)):
            sig = sigmas[j]
            d0 = o0s[j]
            d1, R1 = o.distance(c1, cs[i], sig)
            d2, R2 = o.distance(c2, cs[i], sig)
            #d1,R1 = o.dist(c1,cs[i],sig)
            #d2,R2 = o.dist(c2,cs[i],sig)
            print "OGTO\n", R1, "\n", R2
            print >> f, "{0:10.7f} {1:10.7f}".format(d1 / d0, d2 / d0),
        print >> f
    print "done"
Ejemplo n.º 3
0
def rotation_test():
   print ">> running rotation test ",
   sys.stdout.flush()
   f = open("rotation.dat","w")
   p = 4
   print >>f,"# rotation test "
   n = 40
   alphas = []
   cs = []
   for i in range(n+1):
     a = 2.0*math.pi*i/n
     R = util.rotation([1,0,0],a)
     c = np.array(util.rotate_all(R,c1))
     alphas.append(a)
     cs.append(c)
   g0,R0 = g.distance(C1,C2)
   print >>f,"# RMSD ref =",g0
   print >>f,"# OGTO ref =",
   o0s = []
   for sig in sigmas: 
     d0,R0 = o.distance(c1,c2,sig)
     #d0,R0 = o.dist(c1,c2,sig)
     o0s.append(d0)
     print >>f,d0,
   print >>f
   print >>f,"# alpha (d1,d2)_rmsd, _ogto @ sig=",
   for sig in sigmas: print >>f, sig,
   print >>f
   for i in range(len(alphas)):
     sys.stdout.write("*")
     sys.stdout.flush()
     a = alphas[i]
     d1,R1 = g.distance(C1,cs[i]) 
     d2,R2 = g.distance(C2,cs[i]) 
     print "RMSD\n",R1,"\n",R2
     print >>f,"{0:8.5f} {1:10.7f} {2:10.7f}".format(a,d1/g0,d2/g0),
     for j in range(len(sigmas)):
       sig = sigmas[j]
       d0 = o0s[j]
       d1,R1 = o.distance(c1,cs[i],sig) 
       d2,R2 = o.distance(c2,cs[i],sig)
       #d1,R1 = o.dist(c1,cs[i],sig) 
       #d2,R2 = o.dist(c2,cs[i],sig)
       print "OGTO\n",R1,"\n",R2
       print >>f,"{0:10.7f} {1:10.7f}".format(d1/d0,d2/d0),
     print >>f
   print "done"
Ejemplo n.º 4
0
        print >> f, "  }"
        print >> f, "}"
        f.close()
        os.system("dot -Tpdf " + tag + ".gv -o " + tag + ".pdf")


#####################################################################
## MAIN
#####################################################################
if __name__ == "__main__":
    print "!!! TEST !!!"
    c1 = [[1.1, 1, 1], [1, -1, -1], [-1, 1, -1], [-1, -1, 1]]
    C1 = np.array(c1)
    c2 = [[1.1, 1, 1], [-1, 1, -1], [1, -1, -1], [-1, -1, 1]]
    #c2 = c1
    C2 = np.array(c2)
    g = graph()

    g.from_points(c1, c2)
    g.write("c12")
    print "# theta d"
    g.exponent = -2
    for i in range(19):
        theta = math.pi * i / 6
        R = util.rotation([1, 0, 0], theta)
        #print R
        Rc2 = util.rotate_all(R, c2)
        #print Rc2
        g.from_points(c1, Rc2)
        print "{0:10.6f} {1:10.6f}".format(theta, g.norm())
Ejemplo n.º 5
0
#####################################################################
## MAIN
#####################################################################
if  __name__ == "__main__":
  print "!!! TEST !!!" 
  c1 = [[1.1, 1, 1],
        [1, -1, -1],
        [-1, 1, -1],
        [-1, -1, 1]]
  C1 = np.array(c1)
  c2 = [[1.1, 1, 1],
        [-1, 1, -1],
        [1, -1, -1],
        [-1, -1, 1]]
  #c2 = c1
  C2 = np.array(c2)
  g = graph()
  
  g.from_points(c1,c2)
  g.write("c12")
  print "# theta d"
  g.exponent = -2
  for i in range(19):
    theta = math.pi*i/6
    R = util.rotation([1,0,0],theta)
    #print R
    Rc2 = util.rotate_all(R,c2)
    #print Rc2
    g.from_points(c1,Rc2)
    print "{0:10.6f} {1:10.6f}".format(theta,g.norm())