File: TRAN_Deallocate_Electrode_Grid.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 (54 lines) | stat: -rw-r--r-- 1,217 bytes parent folder | download | duplicates (3)
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
43
44
45
46
47
48
49
50
51
52
53
54
/**********************************************************************
  TRAN_Deallocate_Electrode_Grid.c:

  TRAN_Deallocate_Electrode_Grid.c is a subroutine to deallocate arrays
  storing data of electrodes.

  Log of TRAN_Deallocate_Electrode_Grid.c:

     11/Dec/2005   Released by H.Kino

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

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include "tran_variables.h"


void TRAN_Deallocate_Electrode_Grid(int Ngrid2)
{

  int side,spin,n1,n2;

  for (side=0; side<2; side++) {

    for (spin=0; spin<=SpinP_switch_e[side]; spin++) {
      free( ElectrodeDensity_Grid[side][spin] );
    }

    free( ElectrodeDensity_Grid[side] );
    free( ElectrodedVHart_Grid[side] ); 
    free( ElectrodeADensity_Grid[side] );

    for (n1=0; n1<Ngrid1_e[side]; n1++){
      for (n2=0; n2<Ngrid2; n2++){
	free(VHart_Boundary[side][n1][n2]);
      }
      free(VHart_Boundary[side][n1]);
    }
    free(VHart_Boundary[side]);

    for (n1=0; n1<IntNgrid1_e[side]; n1++){
      for (n2=0; n2<Ngrid2; n2++){
	free(dDen_IntBoundary[side][n1][n2]);
      }
      free(dDen_IntBoundary[side][n1]);
    }
    free(dDen_IntBoundary[side]);
  }

}