Exemplo n.º 1
0
def bondOrientation2sh(atoms,basis,l,neighbs=None,rcut=None,debug=False):
    atoms = array(atoms)
    basis = array(basis)    
    atoms = rectify(atoms,basis)

    if neighbs==None:
        bounds=[[0,basis[0][0]],[0,basis[1][1]],[0,basis[2][2]]]

        if rcut==None:
            rcut = generateRCut(atoms,basis,debug=debug)
            #print "Automatically generating r-cutoff=",rcut

        neighbs = secondShell( neighbors(atoms,bounds,rcut) )

    #sum the spherical harmonic over ever neighbor pair
    a = 4*np.pi / (2*l+1.)
    Ql=list()
    for i,ineighbs in enumerate(neighbs):
        n=len(ineighbs)

        shij = np.vectorize(complex)(zeros(2*l+1)) #spherical harmonic for bond i-j
        for j in ineighbs:
            shij += pairSphereHarms(atoms[i],minImageAtom(atoms[i],atoms[j],basis),l)/n
        shi = a * sum( scipy.real( scipy.multiply(shij,scipy.conj(shij)) ) )
        Ql.append(shi**0.5)
    
    return Ql,rcut
Exemplo n.º 2
0
        lmpFile = inputFile
        atomByteNums = lammpsIO.atomsBytes(lmpFile)
        nAtom = lammpsIO.nAtoms(lmpFile)
        basis = lammpsIO.basis(lmpFile)
        bounds=[[0,basis[0][0]],[0,basis[1][1]],[0,basis[2][2]]]

        configIterator = parserGens.parseLammpsAtoms(atomByteNums,lmpFile,nAtom)
        atomsTime = [array(atoms) for atoms in configIterator]
    bounds=[[0,basis[0][0]],[0,basis[1][1]],[0,basis[2][2]]]
    
    if len(crTime)+1 == nAtom:
        crTime=crTime[1:] #chop off the average if necessary

    if sh2Enable:
        rcut = 3.1
        neighbs = secondShell( neighbors(array(atomsTime[-1]),bounds,rcut) )
        ns = map(len,neighbs)
        crTime = [sum([crTime[j] for j in neighbs[i]])/ns[i] if ns[i]>0 else crTime[i] for i in range(len(neighbs))]

    if isfType == "total":
        steps,isfs = ISFFull(atomsTime,basis,crTime,nqVecs=3,nStep=nStep,criteria=criteria)
    elif isfType == "self":
        steps,isfs = ISFSelf(atomsTime,basis,crTime,nqVecs=3,nStep=nStep,criteria=criteria)

    scale /= 1E-12 #picosecond conversion
    steps = [i*scale for i in steps]
    if logtEnable:
        steps=log10(steps)

    #Write Data
    outputFile = criteFile + ".isf" + isfType[0].upper() + "_" + criteria