コード例 #1
0
ファイル: test_basic.py プロジェクト: yfyh2013/yaff
def test_plot_temp_dist():
    with run_nve_water32(__name__, 'test_plot_temp_dist') as (dn_tmp, nve, f):
        fn_png = '%s/temp_dist1.png' % dn_tmp
        plot_temp_dist(f, fn_png)
        assert os.path.isfile(fn_png)
        fn_png = '%s/temp_dist2.png' % dn_tmp
        plot_temp_dist(f, fn_png, select=[0, 1, 2, 6, 7, 8])
        assert os.path.isfile(fn_png)
コード例 #2
0
ファイル: test_basic.py プロジェクト: molmod/yaff
def test_plot_temp_dist():
    with run_nve_water32(__name__, 'test_plot_temp_dist') as (dn_tmp, nve, f):
        fn_png = '%s/temp_dist1.png' % dn_tmp
        plot_temp_dist(f, fn_png)
        assert os.path.isfile(fn_png)
        fn_png = '%s/temp_dist2.png' % dn_tmp
        plot_temp_dist(f, fn_png, select=[0, 1, 2, 6, 7, 8])
        assert os.path.isfile(fn_png)
コード例 #3
0
def test_rdf1_offline():
    with run_nve_water32(__name__, 'test_rdf1_offline') as (dn_tmp, nve, f):
        select = nve.ff.system.get_indexes('O')
        rdf = RDF(4.5*angstrom, 0.1*angstrom, f, select0=select)
        assert 'trajectory/pos_rdf' in f
        assert 'trajectory/pos_rdf/d' in f
        assert 'trajectory/pos_rdf/rdf' in f
        fn_png = '%s/rdf.png' % dn_tmp
        rdf.plot(fn_png)
        assert os.path.isfile(fn_png)
コード例 #4
0
ファイル: test_diffusion.py プロジェクト: yfyh2013/yaff
def test_diff_offline():
    with run_nve_water32(__name__, 'test_diff_offline') as (dn_tmp, nve, f):
        select = nve.ff.system.get_indexes('O')
        diff = Diffusion(f, select=select)
        assert 'trajectory/pos_diff' in f
        assert 'trajectory/pos_diff/msds' in f
        assert 'trajectory/pos_diff/time' in f
        assert 'trajectory/pos_diff/msdcounters' in f
        assert 'trajectory/pos_diff/msdsums' in f
        assert 'trajectory/pos_diff/pars' in f
        fn_png = '%s/msds.png' % dn_tmp
        diff.plot(fn_png)
        assert os.path.isfile(fn_png)
コード例 #5
0
ファイル: test_diffusion.py プロジェクト: molmod/yaff
def test_diff_offline():
    with run_nve_water32(__name__, 'test_diff_offline') as (dn_tmp, nve, f):
        select = nve.ff.system.get_indexes('O')
        diff = Diffusion(f, select=select)
        assert 'trajectory/pos_diff' in f
        assert 'trajectory/pos_diff/msds' in f
        assert 'trajectory/pos_diff/time' in f
        assert 'trajectory/pos_diff/msdcounters' in f
        assert 'trajectory/pos_diff/msdsums' in f
        assert 'trajectory/pos_diff/pars' in f
        fn_png = '%s/msds.png' % dn_tmp
        diff.plot(fn_png)
        assert os.path.isfile(fn_png)
コード例 #6
0
def test_spectrum_offline():
    with run_nve_water32(__name__, 'test_spectrum_offline') as (dn_tmp, nve, f):
        for bsize in 2, 4, 5:
            spectrum = Spectrum(f, bsize=bsize)
            assert 'trajectory/vel_spectrum' in f
            assert 'trajectory/vel_spectrum/amps' in f
            assert 'trajectory/vel_spectrum/freqs' in f
            assert 'trajectory/vel_spectrum/ac' in f
            assert 'trajectory/vel_spectrum/time' in f
            fn_png = '%s/spectrum%i.png' % (dn_tmp, bsize)
            spectrum.plot(fn_png)
            assert os.path.isfile(fn_png)
            fn_png = '%s/ac%i.png' % (dn_tmp, bsize)
            spectrum.plot_ac(fn_png)
            assert os.path.isfile(fn_png)
            assert f['trajectory/vel_spectrum'].attrs['nfft'] == 3*3*32*(6//bsize)
            del f['trajectory/vel_spectrum']
コード例 #7
0
def test_rdf2_offline_pairs_sr_nimage():
    with run_nve_water32(__name__, 'test_rdf2_offline_pairs_sr_nimage') as (dn_tmp, nve, f):
        select0 = nve.ff.system.get_indexes('O')
        select1 = nve.ff.system.get_indexes('H')
        pairs_sr = []
        for i in range(32):
            pairs_sr.append((3*i+1,3*i))
            pairs_sr.append((3*i+2,3*i))
        pairs_sr = np.array(pairs_sr)
        rdf = RDF(9.0*angstrom, 0.1*angstrom, f, select0=select0, select1=select1, pairs_sr=pairs_sr, nimage=1)
        assert 'trajectory/pos_rdf' in f
        assert 'trajectory/pos_rdf/d' in f
        assert 'trajectory/pos_rdf/rdf' in f
        assert 'trajectory/pos_rdf/rdf_sr' in f
        assert (f['trajectory/pos_rdf/rdf'][:] != f['trajectory/pos_rdf/rdf_sr']).any()
        fn_png = '%s/rdf.png' % dn_tmp
        rdf.plot(fn_png)
        assert os.path.isfile(fn_png)
コード例 #8
0
ファイル: test_rdf.py プロジェクト: molmod/yaff
def test_rdf2_offline_pairs_sr_nimage():
    with run_nve_water32(__name__, 'test_rdf2_offline_pairs_sr_nimage') as (dn_tmp, nve, f):
        select0 = nve.ff.system.get_indexes('O')
        select1 = nve.ff.system.get_indexes('H')
        pairs_sr = []
        for i in range(32):
            pairs_sr.append((3*i+1,3*i))
            pairs_sr.append((3*i+2,3*i))
        pairs_sr = np.array(pairs_sr)
        rdf = RDF(9.0*angstrom, 0.1*angstrom, f, select0=select0, select1=select1, pairs_sr=pairs_sr, nimage=1)
        assert 'trajectory/pos_rdf' in f
        assert 'trajectory/pos_rdf/d' in f
        assert 'trajectory/pos_rdf/rdf' in f
        assert 'trajectory/pos_rdf/rdf_sr' in f
        assert (f['trajectory/pos_rdf/rdf'][:] != f['trajectory/pos_rdf/rdf_sr']).any()
        fn_png = '%s/rdf.png' % dn_tmp
        rdf.plot(fn_png)
        assert os.path.isfile(fn_png)
コード例 #9
0
ファイル: test_basic.py プロジェクト: molmod/yaff
def test_plot_epot_contribs_nve():
    with run_nve_water32(__name__, 'test_plot_epot_contribs_nve') as (dn_tmp, nve, f):
        fn_png = '%s/epot_contribs.png' % dn_tmp
        plot_epot_contribs(f, fn_png)
        assert os.path.isfile(fn_png)
コード例 #10
0
ファイル: test_basic.py プロジェクト: molmod/yaff
def test_plot_density():
    with run_nve_water32(__name__, 'test_plot_density') as (dn_tmp, nve, f):
        fn_png = '%s/density1.png' % dn_tmp
        plot_density(f, fn_png)
        assert os.path.isfile(fn_png)
コード例 #11
0
ファイル: test_basic.py プロジェクト: molmod/yaff
def test_plot_temperature():
    with run_nve_water32(__name__, 'test_plot_temperature') as (dn_tmp, nve, f):
        fn_png = '%s/temperature1.png' % dn_tmp
        plot_temperature(f, fn_png)
        assert os.path.isfile(fn_png)
コード例 #12
0
ファイル: test_basic.py プロジェクト: yfyh2013/yaff
def test_plot_epot_contribs_nve():
    with run_nve_water32(__name__,
                         'test_plot_epot_contribs_nve') as (dn_tmp, nve, f):
        fn_png = '%s/epot_contribs.png' % dn_tmp
        plot_epot_contribs(f, fn_png)
        assert os.path.isfile(fn_png)
コード例 #13
0
ファイル: test_basic.py プロジェクト: yfyh2013/yaff
def test_plot_density():
    with run_nve_water32(__name__, 'test_plot_density') as (dn_tmp, nve, f):
        fn_png = '%s/density1.png' % dn_tmp
        plot_density(f, fn_png)
        assert os.path.isfile(fn_png)
コード例 #14
0
ファイル: test_basic.py プロジェクト: yfyh2013/yaff
def test_plot_temperature():
    with run_nve_water32(__name__,
                         'test_plot_temperature') as (dn_tmp, nve, f):
        fn_png = '%s/temperature1.png' % dn_tmp
        plot_temperature(f, fn_png)
        assert os.path.isfile(fn_png)