File: Pot_NeutralAtom.c

package info (click to toggle)
openmx 3.7.6-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd, stretch
  • size: 325,856 kB
  • ctags: 3,575
  • sloc: ansic: 152,655; f90: 2,080; python: 876; makefile: 675; sh: 25; perl: 18
file content (42 lines) | stat: -rw-r--r-- 930 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
/**********************************************************************
  Pot_NeutralAtom.c:

     Pot_NeutralAtom.c is a subroutine to calculate the neutral atom
     potential at (Gx,Gy,Gz).

  Log of Pot_NeutralAtom.c:

     22/Nov/2001  Released by T.Ozaki

***********************************************************************/

#include <stdio.h>
#include <math.h>
#include "openmx_common.h"

double Pot_NeutralAtom(int ct_AN, double Gx, double Gy, double Gz)
{
  int h_AN,Gh_AN,wan,Rn;
  double sum,x,y,z,dx,dy,dz,r;

  sum = 0.0;
  for (h_AN=0; h_AN<=FNAN[ct_AN]; h_AN++){
    Gh_AN = natn[ct_AN][h_AN];
    Rn = ncn[ct_AN][h_AN];
    wan = WhatSpecies[Gh_AN];

    x = Gxyz[Gh_AN][1] + atv[Rn][1];
    y = Gxyz[Gh_AN][2] + atv[Rn][2];
    z = Gxyz[Gh_AN][3] + atv[Rn][3];
    
    dx = Gx - x;
    dy = Gy - y;
    dz = Gz - z;
    r = sqrt(dx*dx + dy*dy + dz*dz);  

    sum = sum + VNAF(wan,r);
  }

  return sum;
}