コード例 #1
0
    #    print -de, name

    # make a plot
    _, axarr = plt.subplots(1, 3)
    p = np.corrcoef(e0, e1)[0, 1]
    print "Energy: p =", p
    axarr[0].scatter(e0, e1)
    axarr[0].text(0, 0, 'p=%.4f' % p)
    p = np.corrcoef(fce0, fce1)[0, 1]
    print "Force: p =", p
    axarr[1].scatter(fce0, fce1)
    axarr[1].text(0, 0, 'p=%.4f' % p)
    p = np.corrcoef(trq0, trq1)[0, 1]
    print "Torque: p =", p
    axarr[2].scatter(trq0, trq1)
    axarr[2].text(0, 0, 'p=%.4f' % p)
    plt.savefig('corr.png')


if __name__ == '__main__':
    order = 3
    calculator = EFT_calculator(order)
    t0 = time()
    cc = Classical_calculator()
    #calculator.setup('grid_data.txt')
    calculator.setup()
    calculator.fill_grid(cc)
    t1 = time()
    print 'took %.1f s to fill the grid' % (t1 - t0)
    test_random_set()
コード例 #2
0
        pdb = open("%s/eft.%s.pdb" % (folder, idx), "w")
        pdb.write(coors)
        pdb.close()
        file_count += 1


if __name__ == '__main__':
    if len(sys.argv) < 2:
        print("\n       Usage:#0 figname.png [datfilename.dat err_cutoff]\n")
        sys.exit()
    figname = sys.argv[1]  # a output fig name
    databaseName = sys.argv[2]

    t0 = time()
    cc = Classical_calculator()
    if os.path.exists(databaseName):
        print("loaded a old database")
        calculator = EFT_calculator(databaseName)
    else:
        print("created a new mesh")
        calculator = EFT_calculator()
    if len(sys.argv) == 4:
        error_cutoff = float(sys.argv[3])
        print("set cutoff as %f" % (error_cutoff))
        calculator.fill_grid(cc, databaseName, error_cutoff)
    t1 = time()
    print('took %.1f s to fill the grid' % (t1 - t0))
    test_random_set()
    #randomSample()
    grids_conf()