Exemplo n.º 1
0
void createHamiltonian(Geometry const &geometry, DynVars const &dynVars,
                       MyMatrix<std::complex<double> >& matrix,Parameters const &ether,Aux &aux,int type)
// Modified by IS Nov-08-04

{
    int	col, volume, i = 0, p,dir;
    tpem_t hopping,hopping2,bandHop;
    double	 tmp,tmp2;
    int	j,iTmp;
    volume = ether.linSize;
    tpem_t S_ij;
    //static vector<double> phonon_q1(volume);
    //static vector<double> phonon_q2(volume);
    //static vector<double> phonon_q3(volume);


    Phonons<Parameters,Geometry> phonons(ether,geometry);
    for (p = 0; p < matrix.getRank(); p++)
        for (col = 0; col < matrix.getRank(); col++)
            matrix(p,col)=0;

    for (p = 0; p < volume; p++) {
        double phonon_q1=phonons.calcPhonon(p,dynVars,0);
        double phonon_q2=phonons.calcPhonon(p,dynVars,1);
        double phonon_q3=phonons.calcPhonon(p,dynVars,2);
        matrix(p,p) = ether.phononEjt[0]*phonon_q1+ether.phononEjt[2]*phonon_q3+ether.potential[p];
        matrix(p+volume,p+volume) = -ether.phononEjt[2]*phonon_q3+ether.phononEjt[0]*phonon_q1+ether.potential[p];
        matrix(p,p+volume) = (ether.phononEjt[1]*phonon_q2);
        matrix(p+volume,p) = conj(matrix(p,p+volume));

        for (j = 0; j < geometry.z(p); j++) {	/* hopping elements */
            iTmp=geometry.borderId(p,j);;
            if (iTmp>=0) hopping = ether.hoppings[iTmp];
            else hopping= -1.0;
            col = geometry.neighbor(p,j);
            tmp=cos(0.5*dynVars.theta[p])*cos(0.5*dynVars.theta[col]);
            tmp2=sin(0.5*dynVars.theta[p])*sin(0.5*dynVars.theta[col]);
            S_ij=tpem_t(tmp+tmp2*cos(dynVars.phi[p]-dynVars.phi[col]),
                        -tmp2*sin(dynVars.phi[p]-dynVars.phi[col]));

            if (p>col) hopping2 = conj(hopping);
            else hopping2=hopping;
            dir = int(j/2);

            bandHop=ether.bandHoppings[0+0*2+dir*4];
            hopping=hopping2 * bandHop ;
            matrix(p,col) = hopping * S_ij;
            matrix(col,p) = conj(hopping * S_ij);

            bandHop=ether.bandHoppings[0+1*2+dir*4];
            hopping= hopping2 * bandHop;
            matrix(p, col+volume)=hopping * S_ij;
            matrix(col+volume,p)=conj(matrix(p,col+volume));

            //
            bandHop=ether.bandHoppings[1+0*2+dir*4];
            hopping= hopping2 * bandHop;
            matrix(p+volume,col) =  hopping * S_ij;
            matrix(col,p+volume) =  conj(matrix(p+volume,col));

            bandHop=ether.bandHoppings[1+1*2+dir*4];
            hopping=hopping2 * bandHop;
            matrix(p+volume,col+volume) =  hopping * S_ij;
            matrix(col+volume,p+volume) = conj(matrix(p+volume,col+volume));
        }

        if (ether.isSet("tprime")) {
            for (j = 0; j < geometry.z(p,2); j++) {	/* hopping elements */
                iTmp=geometry.borderId(p,j,2);
                hopping= -1.0;
                if (iTmp>=0) hopping = ether.hoppings[iTmp];

                col = geometry.neighbor(p,j,2);
                tmp=cos(0.5*dynVars.theta[p])*cos(0.5*dynVars.theta[col]);
                tmp2=sin(0.5*dynVars.theta[p])*sin(0.5*dynVars.theta[col]);
                S_ij=tpem_t(tmp+tmp2*cos(dynVars.phi[p]-dynVars.phi[col]),
                            -tmp2*sin(dynVars.phi[p]-dynVars.phi[col]));

                if (p>col) hopping2 = conj(hopping);
                else hopping2=hopping;
                dir = int(j/2);

                bandHop=ether.bandHoppings[0+0*2+dir*4]*ether.tprime;
                hopping=hopping2 * bandHop ;
                matrix(p,col) = hopping * S_ij;
                matrix(col,p) = conj(hopping * S_ij);

                bandHop=ether.bandHoppings[0+1*2+dir*4]*ether.tprime;
                hopping= hopping2 * bandHop;
                matrix(p, col+volume)=hopping * S_ij;
                matrix(col+volume,p)=conj(matrix(p,col+volume));

                //
                bandHop=ether.bandHoppings[1+0*2+dir*4]*ether.tprime;
                hopping= hopping2 * bandHop;
                matrix(p+volume,col) =  hopping * S_ij;
                matrix(col,p+volume) =  conj(matrix(p+volume,col));

                bandHop=ether.bandHoppings[1+1*2+dir*4]*ether.tprime;
                hopping=hopping2 * bandHop;
                matrix(p+volume,col+volume) =  hopping * S_ij;
                matrix(col+volume,p+volume) = conj(matrix(p+volume,col+volume));
            }
        }
    }
    //if (!matrix.isHermitian()) throw std::runtime_error("I'm barking\n");


}