示例#1
0
def test_range(u):
    ags = sels(u)
    rmin, rmax = 1.0, 13.0
    rdf = InterRDF_s(u, ags, range=(rmin, rmax)).run()

    assert rdf.edges[0] == rmin
    assert rdf.edges[-1] == rmax
示例#2
0
def test_density(u, sels, density, value):
    kwargs = {'density': density} if density is not None else {}
    rdf = InterRDF_s(u, sels, **kwargs).run()
    assert_almost_equal(max(rdf.rdf[0][0][0]), value)
    if not density:
        s1 = u.select_atoms('name ZND and resid 289')
        s2 = u.select_atoms(
            'name OD1 and resid 51 and sphzone 5.0 (resid 289)')
        rdf_ref = InterRDF(s1, s2).run()
        assert_almost_equal(rdf_ref.rdf, rdf.rdf[0][0][0])
示例#3
0
def test_nbins(u, sels):
    rdf = InterRDF_s(u, sels, nbins=412).run()

    assert len(rdf.bins) == 412
示例#4
0
def rdf(u, sels):
    return InterRDF_s(u, sels).run()
示例#5
0
def test_density(u, sels, density, value):
    rdf = InterRDF_s(u, sels, density=density).run()
    assert_almost_equal(max(rdf.rdf[0][0][0]), value)
示例#6
0
import MDAnalysis as mda
from MDAnalysis.analysis.rdf import InterRDF_s
import numpy as np

u = mda.Universe('step6.6.part0001.gro', 'step7_1000ns_dt_500_center.xtc')

Zn1 = u.select_atoms('name ZND and resid 24905')
Zn2 = u.select_atoms('name ZND and resid 24900')
Zn3 = u.select_atoms('name ZND')

Bsites1 = u.select_atoms(
    '((name O* and resname ASP) or (name N* and resname HSD)) and around 4.0 (name ZND and resid 24905)'
)
Bsites2 = u.select_atoms(
    '((name O* and resname ASP) or (name N* and resname HSD)) and around 4.0 (name ZND and resid 24900)'
)

ags = [[Zn1, Bsites1], [Zn2, Bsites2]]

rdf = InterRDF_s(u, ags, nbins=200, range=(1.0, 4.0), density=False)
rdf.run()
rdf.get_cdf()

np.savetxt('bins.dat', rdf.bins)
np.save('rdf', rdf.rdf)
np.save('indices', rdf.indices)
np.save('cdf', rdf.cdf)
示例#7
0
def test_nbins(u):
    ags = sels(u)
    rdf = InterRDF_s(u, ags, nbins=412).run()

    assert len(rdf.bins) == 412