示例#1
0
/****************************************
 Function name	  : paw_solve_pseudo_orbitals
 Description	    :
 Return type		  : void
 Author     		  : Marat Valiev
 Date & Time		  : 5/15/00
****************************************/
void paw_scattering_test(double e1,double e2,int number_points ,int l, double r )
{

    int i;
    int k;
    int i_end_point;
    int Ngrid;
    double *rgrid;
    FILE   *fp;
    double *V_ks;


    double *psi1;
    double *psi1_prime;

    double *psi;
    double *psi_prime;

    double *log_grid_ae;
    double *log_grid_paw;

    double de;
    double* e3;
    double e_test;
    double log_amesh;

    /*char output[30];*/
    char data_filename[300];
    char script_filename[300];

    Ngrid = paw_N_LogGrid();
    rgrid = paw_r_LogGrid();
    log_amesh = paw_log_amesh_LogGrid();

    psi1       = paw_alloc_LogGrid();
    psi1_prime = paw_alloc_LogGrid();

    psi       = paw_alloc_LogGrid();
    psi_prime = paw_alloc_LogGrid();

    log_grid_ae = paw_alloc_1d_array(number_points);
    log_grid_paw = paw_alloc_1d_array(number_points);
    e3 = paw_alloc_1d_array(number_points);

    de = (e2-e1)/number_points;
    V_ks = paw_get_kohn_sham_potential();

    i_end_point = paw_get_grid_index(r);

    for (i=0;i<= number_points-1;i++)
    {
        e_test = e1+de*i;
        e3[i] = e_test;


        paw_solve_paw_scattering(l, r, e_test, psi,psi_prime);

        paw_R_Schrodinger_Fixed_E(
            l,
            V_ks,
            i_end_point,
            e_test,
            psi1,
            psi1_prime
        );




        log_grid_ae[i] =  psi1_prime[i_end_point-1]/(psi1[i_end_point-1]*rgrid[i_end_point-1]*log_amesh);
        log_grid_paw[i]  =  psi_prime[i_end_point-1]/(psi[i_end_point-1]*rgrid[i_end_point-1]*log_amesh);

    }

    if (paw_debug())
    {
        sprintf(data_filename,"%s%s_%s_scat_test.dat", paw_sdir(),paw_get_atom_name(),paw_spd_Name(l));
        fp = fopen(data_filename,"w+");

        for (k=0; k<=number_points-1; k++)
        {
            fprintf(fp,"%le\t%le\t%le\n", e3[k],log_grid_ae[k],log_grid_paw[k]);

        }
        fclose(fp);

        sprintf(script_filename,"%s%s_%s_scat_test.plt", paw_sdir(),paw_get_atom_name(),paw_spd_Name(l));
        printf("script_filename: %s\n",script_filename);
        fp = fopen(script_filename,"w+");

        fprintf(fp,"set style data lines \n");
        fprintf(fp,"set nolabel \n");
        fprintf(fp,"set autoscale \n");
        fprintf(fp,"set xr[%f:%f] \n",e1,e2);
        fprintf(fp,"set grid \n");
        fprintf(fp,"set nolabel \n");

        fprintf(fp,"set xlabel \"e (Hartree)\" \n");
        fprintf(fp,"set ylabel \"logarithmic derivative at r=%f\" \n",r);
        fprintf(fp,"set title \" %s %s channel scattering test\n",paw_get_atom_name(),paw_spd_Name(l));

        fprintf(fp,"plot \"%s\" using 1:2 title \"all electron\",",data_filename);
        fprintf(fp,"\"\" using 1:3 title \"paw\" \n");

        fprintf(fp,"\n");
        fprintf(fp,"pause -1\n");
        fclose(fp);
    }


}
示例#2
0
/****************************************
 Function name	  : paw_solve_scattering_orbitals
 Description	    :
 Return type		  : void
 Author     		  : Marat Valiev
 Date & Time		  : 4/10/99 4:58:27 PM
****************************************/
void paw_solve_scattering_orbitals()
{
    int i;
    int j;
    int k;
    int i_match;
    int Ngrid;
    double sum;
    double *V;
    double *rgrid;
    double r_sphere;
    double Zion;

    Ngrid = paw_N_LogGrid();
    rgrid = paw_r_LogGrid();
    Zion = paw_get_ion_charge();

    /*normalization sphere radius*/
    r_sphere = 2.0;

    /*check if the occupied orbitals are done*/
    if (!(occupied_orbitals_done))
    {
        printf("cannot calculate scattering orbitals\n");
        printf("calculate occupied states first\n");
    }


    /*get Kohn-Sham potential*/
    V = paw_get_kohn_sham_potential();


    for (i=Nbound;i<Ntotal;i++)
    {

        /*set the end point*/
        i_match = Ngrid-1;

        if (Solver_Type==Schrodinger)
        {
           paw_R_Schrodinger_Fixed_E(l[i],V,i_match,eigenvalue[i],psi[i],psi_prime[i]);
        }
        else
        {
           paw_R_Pauli_Fixed_E(n[i],l[i],Zion,V,i_match,eigenvalue[i],psi[i],psi_prime[i]);
        }

        for (j=0;j<i-1;j++)
        {

            if (l[i]==l[j])
            {
                sum = paw_dot_product(psi[i],psi[j]);
                for (k=0;k<Ngrid;++k)
                    psi[i][k] = psi[i][k] - sum*psi[j][k];
            }

        }

        /*normalize*/
        sum = paw_dot_product1(paw_get_grid_index(r_sphere),psi[i],psi[i]);
        sum = 1.0/sqrt(sum);

        for (k=0;k<Ngrid;++k)
        {
            psi[i][k] = psi[i][k]*sum;
            psi_prime[i][k] = psi_prime[i][k]*sum;

        }


    }

    /*debug
    printf("orthogonality\n");
    for(i=0;i<=Ntotal-1;i++)
    {
        for(j=0;j<=Ntotal-1;j++)
        {
          if(l[i]==l[j])
          {
            printf("%d\t %d\t %f\n",i,j, paw_dot_product(psi[i],psi[j]));
          }
      
        }  
     }
        exit(1);
    end debug  */
}