Exemple #1
0
def test_newrdf():
    from chemlab.molsim.rdf import distance_histogram
        
    system = datafile("tests/data/rdf/cry.gro").read('system')
    #system = datafile("/home/gabriele/projects/LiCl/molfrac-0.39-48668/opt.gro").read('system')
    size = system.box_vectors[0,0]/2
    
    timer.start()
    rdf_old = rdf(system.r_array[system.type_array == 'Cl'],
                 system.r_array[system.type_array == 'Li'],
                 binsize=0.2,
                 cutoff=size,
                 periodic=system.box_vectors, normalize=False)
    timer.stop()
    
    timer.start()
    rdf_new = distance_histogram(system.r_array[system.type_array == 'Cl'],
                                 system.r_array[system.type_array == 'Li'],
                                 binsize=0.2,
                                 cutoff=size,
                                 periodic=system.box_vectors)
    timer.stop()
    1/0
    plot(rdf_new, 'r')
    plot(rdf_old[1], 'b')
    show()
Exemple #2
0
def test_rdf():
    #system = datafile("tests/data/rdf/cry.gro").read('system')
    # Fix for this particular system water.gro
    #system.r_array += system.box_vectors[0,0]/2
    
    gro_rdf = np.loadtxt("tests/data/rdf/rdf.xvg", skiprows=13,unpack=True)
    #nbins = len(gro_rdf[0])
    size = system.box_vectors[0,0]/2
    
    rdf=rdf(system.r_array[system.type_array == 'Cl'],
            system.r_array[system.type_array == 'Li'],
            binsize=0.002,
            cutoff=size,
            periodic = system.box_vectors)

    plot(gro_rdf[0], gro_rdf[1], color='blue')
    plot(rdf[0], rdf[1], 'red')
    
    show()
Exemple #3
0
def test_rdf_oxy():
    system = datafile("examples/gromacs_tutorial/confout.gro").read('system')
    # Fix for this particular system water.gro
    #system.r_array += system.box_vectors[0,0]/2
    
    gro_rdf = np.loadtxt("examples/gromacs_tutorial/rdf.xvg",
                         skiprows=13,unpack=True)
    
    #nbins = len(gro_rdf[0])
    size = system.box_vectors[0,0]/2
    
    rd=rdf(system.r_array[system.type_array == 'O'],
            system.r_array[system.type_array == 'O'],
            binsize=0.002,
            cutoff=size,
            periodic = system.box_vectors)

    plot(gro_rdf[0], gro_rdf[1], color='blue')
    plot(rd[0], rd[1], 'red')
    
    show()
Exemple #4
0
def plot_rdf(type_a, type_b):
    s = current_system()
    rd = rdf(s.r_array[s.type_array == type_a],
             s.r_array[s.type_array == type_b], periodic=s.box_vectors)
    plot(rd[0], rd[1])
Exemple #5
0
def get_rdf(arguments):
    return rdf(arguments[0], arguments[1], periodic=arguments[2])
Exemple #6
0
def plot_rdf(type_a, type_b):
    s = current_system()
    rd = rdf(s.r_array[s.type_array == type_a],
             s.r_array[s.type_array == type_b],
             periodic=s.box_vectors)
    plot(rd[0], rd[1])