Ejemplo n.º 1
0
def test_disp100(nq, ne):
    """Calculates the scattering intensity for phonon dispersions
    for B2 FeAl along q // [100].
    nq = number of q points to calculate.
    ne = number of e points to calculate."""

    uc = UnitCell( )
    at1=Atom(symbol='Fe', mass=57) ; pos1=(0.0,0.0,0.0)
    at2=Atom(symbol='Al') ; pos2=(0.5,0.5,0.5)
    site1 = Site(pos1, at1)
    site2 = Site(pos2, at2)
    uc.addAtom( at1, pos1, "Fe1" )
    uc.addAtom( at2, pos2, "Al1" )
    print uc

    kptlist = uc.getMonkhorstPackGrid((20,20,20)).reshape(8000,3)
    sqecalc = AbInitio.kernelGenerator.SqeCalculator.SqeCalculator(uc, kpoints=kptlist)

    sqecalc.readIDFeigenvectors(filename='polarizations.idf')
    sqecalc.readEigenvaluesFromIDFomega2(filename='omega2s.idf')

    sqecalc._DebyeWallerCalculator._energies = sqecalc._energies
    sqecalc._DebyeWallerCalculator._polvecs = sqecalc._polvecs

    estart = 0.0
    deltae = 50.0 / ne
    sqecalc._etransferTol = deltae

    deltaqx = 3.0 / nq
    sqecalc._qtransferTolRadius = deltaqx
    qstart = numpy.array([0.0, 0.0, 0.0])
    deltaq = numpy.array([deltaqx, 0.0, 0.0])

    sqe = numpy.zeros((nq,ne), dtype='float')

    for iq in range(nq):
        for ie in range(ne):
            qtransfer = qstart + iq * deltaq
            etransfer = estart + ie * deltae
            print "Q= %s , E= %s" % (qtransfer, etransfer)
            sqe[iq,ie] = sqecalc.calcSqeCohCreateAllmodes(qtransfer, etransfer)
            print "S(Q,E) = ", sqe[iq,ie]

    pylab.imshow(sqe)
    pylab.show()
    end = raw_input()
    return
Ejemplo n.º 2
0
def listOfAtom2UnitCell(loa):
    """Utility to convert a ListOfAtom instance to a UnitCell instance."""
    import ASE.ListOfAtoms
    import ASE.Atom
    
    symbols = [x.symbol for x in loa]
    cartpos = [x.position for x in loa]

    cellvectors = loa.cell
    uc = UnitCell()
    uc.setCellVectors(cellvectors)
    # note: by default, loa stores cartesian coordinates
    fracpos = [uc.cartesianToFractional(x) for x in cartpos]

    for n in range(len(symbols)):
        atom = Atom(symbol=symbols[n])
        uc.addAtom(atom, fracpos[n], '')

    return uc
Ejemplo n.º 3
0
def listOfAtom2UnitCell(loa):
    """Utility to convert a ListOfAtom instance to a UnitCell instance."""
    import ASE.ListOfAtoms
    import ASE.Atom

    symbols = [x.symbol for x in loa]
    cartpos = [x.position for x in loa]

    cellvectors = loa.cell
    uc = UnitCell()
    uc.setCellVectors(cellvectors)
    # note: by default, loa stores cartesian coordinates
    fracpos = [uc.cartesianToFractional(x) for x in cartpos]

    for n in range(len(symbols)):
        atom = Atom(symbol=symbols[n])
        uc.addAtom(atom, fracpos[n], '')

    return uc