Exemplo n.º 1
0
if avg==1:
    cntavg=zeros(nbins)

cnt=0
while True:
    try:
        dump,bounds,types,atoms,head = dumpReadNext(dump)
        cnt+=1
    except Exception as inst:
        #last of the configurations
        if avg==0:
            print "No more configs in dump file."
        else:
            print "Found %d configurations."%cnt
        break

    bounds=[[0,bounds[0][0]],[0,bounds[1][1]],[0,bounds[2][2]]]
    Qis=orderParam.bondOrientation(array(atoms),array(bounds),l,neighbCut=cutoff,ortho=True)
    (cnts,bins) = histogram(Qis,bins=nbins,range=(0,cutoff))
    
    if avg==0:
        if smooth==1:
            smCnts = wsmooth(cnts,nbins/10)
            plotting(bins,smCnts)
        else:
            plotting(bins,cnts)
    else:
        cntavg+=cnts
if avg==1:
    plotting(bins,cntavg/cnt)
Exemplo n.º 2
0
    outcar = open(filename, "r")
    bondOrderOut = open(filename + ".BO%d" % lval, "w")
    if sh2:
        bondOrderOut = open(filename + ".BO%dsh2" % lval, "w")

    bondOrderOut.write("AverageBO%d PerAtomBO%d\n" % (lval, lval))
    for i, b in enumerate(bytenums):
        outcar.seek(b)
        outcar.readline()
        outcar.readline()

        atoms = [map(float, outcar.readline().split()[:3]) for a in range(nAtoms)]
        if sh2:
            q, rcut = orderParam.bondOrientation2sh(atoms, basis, lval)
        else:
            q, rcut = orderParam.bondOrientation(atoms, basis, lval)

        qAvg = sum(q) / len(q)
        qs = " ".join(map(str, q))
        bondOrderOut.write(str(qAvg) + " " + qs + "\n")
        # print i

if lammpsFlag:
    nAtoms = lammpsIO.nAtoms(filename)
    basisByteNums = lammpsIO.basisBytes(filename)
    atomsByteNums = lammpsIO.atomsBytes(filename)

    bondOrderOut = open(filename + ".BO%d" % lval, "w")
    if sh2:
        bondOrderOut = open(filename + ".BO%dsh2" % lval, "w")
Exemplo n.º 3
0
while True:
    try:
        dump, bounds, types, atoms, head = dumpReadNext(dump)
        cnt += 1
    except Exception as inst:
        #last of the configurations
        if avg == 0:
            print "No more configs in dump file."
        else:
            print "Found %d configurations." % cnt
        break

    bounds = [[0, bounds[0][0]], [0, bounds[1][1]], [0, bounds[2][2]]]
    Qis = orderParam.bondOrientation(array(atoms),
                                     array(bounds),
                                     l,
                                     neighbCut=cutoff,
                                     ortho=True)
    (cnts, bins) = histogram(Qis, bins=nbins, range=(0, cutoff))

    if avg == 0:
        if smooth == 1:
            smCnts = wsmooth(cnts, nbins / 10)
            plotting(bins, smCnts)
        else:
            plotting(bins, cnts)
    else:
        cntavg += cnts
if avg == 1:
    plotting(bins, cntavg / cnt)