Generated from get_phase.c with ROBODoc v3.2.2 on Fri Sep 14 14:23:17 2001

TABLE OF CONTENTS

  1. QMD-MGDFT/get_phase.c

QMD-MGDFT/get_phase.c

NAME
   Ab initio real space code with multigrid acceleration
   Quantum molecular dynamics package.
   Version: 2.1.5
COPYRIGHT
   Copyright (C) 1995  Emil Briggs
   Copyright (C) 1998  Emil Briggs, Charles Brabec, Mark Wensell, 
                       Dan Sullivan, Chris Rapcewicz, Jerzy Bernholc
   Copyright (C) 2001  Emil Briggs, Wenchang Lu,
                       Marco Buongiorno Nardelli,Charles Brabec, 
                       Mark Wensell,Dan Sullivan, Chris Rapcewicz,
                       Jerzy Bernholc
FUNCTION
   void get_phase(ION *iptr, REAL *rtptr, int ip, int icount, int *dvec)
   Generates the phase factors for the k-points 
INPUTS
   iptr: point to structure ION (see md.h )
   ip:   momentum l
   icount: number of grid point in the sphere
   dvec:  true indicates the point is in the sphere
          fault indicate not
OUTPUT
   rtptr: pct.phaseptr (see md.h )
PARENTS
   get_nloc_smp.c
CHILDREN
   to_cartesian.c
SOURCE
    #include <float.h>
    #include <math.h>
    #include <stdio.h>
    #include <stdlib.h>
    #include "md.h"
    #include "inline.h"
    
    void get_phase(ION *iptr, REAL *rtptr, int ip, int icount, int *dvec)
    {
    
      int kpt, idx, ix, iy, iz, docount;
      REAL ax[3], bx[3], xc, yc, zc;
      REAL kdr;
      SPECIES *sp;
    
    
      if(rtptr == NULL) return;
    
      /* Get species type */
      sp = ct.sp[iptr->species];
    
    
      for(kpt = 0;kpt < ct.num_kpts;kpt++) {
    
        idx = docount = 0;
        xc = iptr->nlxcstart;
        for(ix = 0;ix < sp->nldim;ix++) {
    
            yc = iptr->nlycstart;
            for(iy = 0;iy < sp->nldim;iy++) {
    
                zc = iptr->nlzcstart;
                for(iz = 0;iz < sp->nldim;iz++) {
    
                    if(dvec[idx]) {
    
                        ax[0] = xc - iptr->xtal[0];
                        ax[1] = yc - iptr->xtal[1];
                        ax[2] = zc - iptr->xtal[2];
                        to_cartesian(ax, bx);  
                        kdr = ct.kp[kpt].kvec[0] * bx[0] +
                              ct.kp[kpt].kvec[1] * bx[1] +
                              ct.kp[kpt].kvec[2] * bx[2];
                                                                                         
                      
                        rtptr[docount+2*kpt*icount] = cos(kdr);
                        rtptr[docount+2*kpt*icount+icount] = sin(kdr);
                        docount++;
    
                    } /* end if */
    
                    idx++;
    
    
                    zc += ct.hzgrid;
                } /* end for */
    
                yc += ct.hygrid;
            } /* end for */
    
            xc += ct.hxgrid;
        } /* end for */
    
      } /* end for */
    
    
    } /* end get_phase */