示例#1
0
def plot_pos_rad_ang(atoms, types, basis, dup=0):

    Ntypes = len(set(types))
    N = len(atoms)
    cs = ["yellow", "green", "blue", "red", "purple", "orange", "black"]

    #Periodic Atoms (duplicated, needed for distributions)
    datoms, dtypes = duplicate26(atoms, types, basis)

    #Neighbors needed for angular distribution
    dneighbs = neighbors(datoms, 5.0, style="full")

    #Radial Distribution
    [rbins, rdist] = rdf(datoms, inloop=N, cutoff=12.0)

    #Correlation of Angles
    [abins, adist] = adf(datoms, dneighbs, inloop=N)

    #Type sorted atoms lists
    tatoms = [list() for i in range(Ntypes)]
    if (dup == 1):
        for i, j in enumerate(dtypes):
            tatoms[j].append(datoms[i])
    else:
        for i, j in enumerate(types):
            tatoms[j].append(atoms[i])

    v1, v2, v3 = zip(*basis)

    #findsymmetry([v1,v2,v3],types,zip(xs,ys,zs))

    fig = pl.figure(figsize=(12, 6))
    aa = fig.add_subplot(311, projection='3d')
    aa.set_position([0, 0, 0.5, 1.0])
    for i in range(Ntypes):
        ax, ay, az = zip(*tatoms[i])
        aa.scatter(ax, ay, az, c=cs.pop(0), marker="o")

    aa.plot([0, v1[0]], [0, v1[1]], [0, v1[2]])
    aa.plot([0, v2[0]], [0, v2[1]], [0, v2[2]])
    aa.plot([0, v3[0]], [0, v3[1]], [0, v3[2]])

    bb = fig.add_subplot(312)
    bb.set_position([0.56, 0.55, 0.4, 0.4])
    bb.plot(rbins, rdist)
    pl.xlabel("Radius (A)")
    pl.ylabel("Count")

    cc = fig.add_subplot(313)
    cc.set_position([0.56, 0.08, 0.4, 0.36])
    cc.plot(abins, adist)
    pl.xlabel("Angle (deg)")
    pl.ylabel("Count")

    pl.show()
示例#2
0
def plot_pos_rad_ang(atoms,types,basis,dup=0):

	Ntypes=len(set(types))
	N=len(atoms)
	cs=["yellow","green","blue","red","purple","orange","black"]

        #Periodic Atoms (duplicated, needed for distributions)
        datoms,dtypes=duplicate26(atoms,types,basis)

        #Neighbors needed for angular distribution
        dneighbs=neighbors(datoms,5.0,style="full")

        #Radial Distribution
        [rbins,rdist]=rdf(datoms,inloop=N,cutoff=12.0)

        #Correlation of Angles
        [abins,adist]=adf(datoms,dneighbs,inloop=N)

        #Type sorted atoms lists
        tatoms=[list() for i in range(Ntypes)]
        if(dup==1):
            for i,j in enumerate(dtypes):
                tatoms[j].append(datoms[i])
        else:
            for i,j in enumerate(types):
                tatoms[j].append(atoms[i])

	v1,v2,v3=zip(*basis)

        #findsymmetry([v1,v2,v3],types,zip(xs,ys,zs))

        fig=pl.figure(figsize=(12,6))
        aa = fig.add_subplot(311,projection='3d')
        aa.set_position([0,0,0.5,1.0])
        for i in range(Ntypes):
            ax,ay,az=zip(*tatoms[i])
            aa.scatter(ax,ay,az,c=cs.pop(0),marker="o")

        aa.plot([0,v1[0]],[0,v1[1]],[0,v1[2]])
        aa.plot([0,v2[0]],[0,v2[1]],[0,v2[2]])
        aa.plot([0,v3[0]],[0,v3[1]],[0,v3[2]])
        
        bb = fig.add_subplot(312)
        bb.set_position([0.56,0.55,0.4,0.4])
        bb.plot(rbins,rdist)
        pl.xlabel("Radius (A)")
        pl.ylabel("Count")

        cc = fig.add_subplot(313)
        cc.set_position([0.56,0.08,0.4,0.36])
        cc.plot(abins,adist)
        pl.xlabel("Angle (deg)")
        pl.ylabel("Count")

        pl.show()
示例#3
0
def make_rdf(system, rdfOutputFile, ion=False, bulk=False, force=False):
    if not path.exists(system):
        print("no system exists:", system)
        return []

    if path.exists(system + "/" + rdfOutputFile + ".dat"):
        print("coord exists:", system, rdfOutputFile)
        if force:
            print("overwriting")
        else:
            return []

    topology = system + "/md_nvt_prod_start_drudes.pdb"
    trajectory = system + "/md_nvt_prod.dcd"
    output_log = system + "/output.log"

    diff_sys = DiffusionSystem(system)

    ion_atom = {"BF4": "B", "TMA": "N", "TMEA": "N"}[diff_sys.diffusingIon]

    if ion:
        solvent_resname = {
            "BF4": ("TME or resname TMA", "N"),
            "TMA": ("BF4", "B"),
            "TMEA": ("BF4", "B")
        }[diff_sys.diffusingIon]

        if diff_sys.ion_pair == "bmim":
            solvent_resname = ("BMI", "N1")
    else:
        solvent_resname = {
            "dce": ("dch", "CT CT1"),
            "acn": ("acn", "CT"),
            "h2o": ("HOH", "O"),
        }[diff_sys.solvent]

    ion_atomselection = "((resname %s) and name %s)" % (
        diff_sys.diffusingIon[:3], ion_atom)
    solvent_atomselection = "((resname %s) and name %s)" % (
        solvent_resname[0][:3], solvent_resname[1])

    smooth_coords = rdf(topology,
                        trajectory,
                        output_log,
                        ion_atomselection,
                        solvent_atomselection,
                        bulk=bulk)

    with open(system + "/" + rdfOutputFile + ".dat", "w") as f:
        for i in smooth_coords:
            f.write(str(i) + "\n")

    return smooth_coords
示例#4
0
 def do_rdf_RDF(self):
     from rdf import rdf
     validatorBase.defaultNamespaces.append(purl1_namespace)
     return rdf()
示例#5
0
 def do_rdf_RDF(self):
   from rdf import rdf
   self.dispatcher.defaultNamespaces.append(purl1_namespace)
   return rdf()
示例#6
0
 def do_rdf_RDF(self):
   from rdf import rdf
   self.dispatcher.defaultNamespaces.append(purl1_namespace)
   return rdf()
示例#7
0
 def do_rdf_RDF(self):
   from rdf import rdf
   validatorBase.defaultNamespaces.append(purl1_namespace)
   return rdf()
示例#8
0
    print "="*80
    print "Generation %d, EA#%d"%(gencnt,eanum)
    a=fitness.pop(0).strip()
    print "Fitness= %s eV   PerAtom Energy= %s eV\nkpoints= %sVolume= %sEnthalpy= %s"%(a,round(float(a)/N,3),kpoints.pop(0),volumes.pop(0),enthalpy.pop(0).strip())

    if gencnt >= start:
        #plot_pos_rad_ang(atoms,types,pdup=pdup)

        #Periodic Atoms (duplicated)
        datoms,dtypes,dbasis=duplicate26(atoms,types,basis)

        #Neighbors needed for angular distribution
        dneighbs=neighbors(datoms,5.0,style="full")

        #Radial Distribution
        [rbins,rdist]=rdf(datoms,inloop=N,cutoff=12.0)

        #Correlation of Angles
        [abins,adist]=adf(datoms,dneighbs,inloop=N)

        #Type sorted atoms lists
        tatoms=[list() for i in range(Ntypes)]
        if(pdup==1):
            for i,j in enumerate(dtypes):
                tatoms[j].append(datoms[i])
        else:
            for i,j in enumerate(types):
                tatoms[j].append(atoms[i])

        fig=pl.figure(figsize=(12,6))
        aa = fig.add_subplot(311,projection='3d')
示例#9
0
    a = fitness.pop(0).strip()
    print "Fitness= %s eV   PerAtom Energy= %s eV\nkpoints= %sVolume= %sEnthalpy= %s" % (
        a, round(float(a) / N,
                 3), kpoints.pop(0), volumes.pop(0), enthalpy.pop(0).strip())

    if gencnt >= start:
        #plot_pos_rad_ang(atoms,types,pdup=pdup)

        #Periodic Atoms (duplicated)
        datoms, dtypes, dbasis = duplicate26(atoms, types, basis)

        #Neighbors needed for angular distribution
        dneighbs = neighbors(datoms, 5.0, style="full")

        #Radial Distribution
        [rbins, rdist] = rdf(datoms, inloop=N, cutoff=12.0)

        #Correlation of Angles
        [abins, adist] = adf(datoms, dneighbs, inloop=N)

        #Type sorted atoms lists
        tatoms = [list() for i in range(Ntypes)]
        if (pdup == 1):
            for i, j in enumerate(dtypes):
                tatoms[j].append(datoms[i])
        else:
            for i, j in enumerate(types):
                tatoms[j].append(atoms[i])

        fig = pl.figure(figsize=(12, 6))
        aa = fig.add_subplot(311, projection='3d')