Esempio n. 1
0
 def test_correlation_mol(self, datadir):
     frames, time_idx = chunk_reader(str(datadir["molecule.corr"]),
                                     "molecule",
                                     order="frame")
     corr_func = correlation(frames)
     # 10 origins used
     assert len(corr_func) == 40
Esempio n. 2
0
 def test_correlation_mol_origerror(self, datadir):
     frames, time_idx = chunk_reader(str(datadir["molecule.corr"]),
                                     "molecule",
                                     order="frame")
     with pytest.raises(Exception):
         corr_func = correlation(frames, orig_points=50)
     with pytest.raises(Exception):
         corr_func = correlation(frames, orig_points=100)
Esempio n. 3
0
 def test_spatial3D_zeropad(self, datadir):
     output = chunk_reader(str(datadir["spatial-3d.chunk"]), "spatial-3d", zerostep=True)
     assert len(output["axis"]) == 3
     assert np.allclose(output["axis"][0], np.linspace(3.61, 32.49, 5))
     assert np.allclose(output["axis"][1], np.linspace(4.79272, 62.9056, 11))
     assert np.allclose(output["axis"][2], np.linspace(3.61, 32.49, 5))
     # Selected rows assertions
     assert np.allclose(output["data"][2,0,1,0,:],\
            np.array([1.12900e+01,7.56219e-04, -8.71050e-04, -1.36277e-04]))
     assert np.allclose(output["data"][-1,-1,-2,-1,:],\
            np.array([2.40500e+01, -3.06655e-04, 3.79669e-04, 4.09706e-04]))
     assert output["data"].shape[0] == 11
Esempio n. 4
0
 def test_spatial1D(self, datadir):
     output = chunk_reader(str(datadir["spatial-1d.chunk"]), "spatial-1d")
     assert len(output["axis"]) == 1
     assert list(output["axis"][0]) == list(np.linspace(1.0, 59.0, 30))
Esempio n. 5
0
 def test_trajectory_row(self, datadir):
     output = chunk_reader(str(datadir["trajectory-xyz.chunk"]), "trajectory-xyz", order="row")
Esempio n. 6
0
 def test_molecule_chunk_row(self, datadir):
     output = chunk_reader(str(datadir["molecule.chunk"]), "molecule", order="row")
Esempio n. 7
0
 def test_ave_time_array_frame(self, datadir):
     output = chunk_reader(str(datadir["ave-time-array.chunk"]), "ave/time-array", order="frame")
Esempio n. 8
0
# g4, axis4 = md.rdf(output["data"], output["data"], 100, 2.5, no_procs=4)
# print "Time4:", a - time.time()
#
# if (g1==g2).all() and (g1==g3).all() and (g1==g4).all():
#     print "SON iguales!"

# corr = md.Correlation(output["data"], orig_points=1000)
# corr.run()
# print "time:",  corr.compute_time
# plt.plot(corr.corr_func)
# plt.show()

g_vmd = np.loadtxt("multiplot.dat")
system = md.atomic_rdf()
system = np.asfortranarray(np.transpose(system, (1, 0, 2)))
system2 = chunk_reader("traj.mpiio.out", "trajectory-xyz", order="frame")
# print system2["data"].shape, system.shape
# print system2["data"]
# print "----------------"
# print system
if np.allclose(system, system2["data"], rtol=1e-5):
    print "Son iguales."
g, axis = md.rdf(system2["data"],
                 system2["data"],
                 100,
                 8.0, (17.0291, 17.0291, 17.0291),
                 no_procs=4,
                 auto=True)
plt.plot(g_vmd[:, 0], g_vmd[:, 1], "--")
plt.plot(axis, g, "--")
plt.show()