File: TRAN_adjust_Ngrid.c

package info (click to toggle)
openmx 3.5-1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 134,876 kB
  • sloc: ansic: 152,771; python: 876; makefile: 576; xml: 63; perl: 18; sh: 4
file content (48 lines) | stat: -rw-r--r-- 1,257 bytes parent folder | download
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
/**********************************************************************
  TRAN_adjust_Ngrid.c:

  TRAN_adjust_Ngrid.c is a subroutine to adjust the number of grids
  along b- and c-axes so that those of electrodes can be consistent
  of the extended system for the NEGF calculation.

  Log of TRAN_adjust_Ngrid.c:

     24/July/2008  Released by H.Kino and T.Ozaki

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

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

#ifdef nompi
#include "mimic_mpi.h"
#else
#include <mpi.h>
#endif

#include "tran_prototypes.h"
#include "tran_variables.h"


void  TRAN_adjust_Ngrid( MPI_Comm comm1, int *Ngrid1,int *Ngrid2, int *Ngrid3)
{
  static int numprocs,myid,ID;
 
  MPI_Comm_size(comm1,&numprocs);
  MPI_Comm_rank(comm1,&myid);

  if ( Ngrid3_e[0] != Ngrid3_e[1]  ||  Ngrid2_e[0] != Ngrid2_e[1] ) {
    printf("TRAN> internal error, Ngrid?_e[0] is different from Ngrid?_e[1]\n");
    printf("TRAN> Ngrid?[0]=%d %d %d Ngrid?[1]=%d %d %d\n", 
	   Ngrid1_e[0],Ngrid2_e[0], Ngrid3_e[0], 
	   Ngrid1_e[1],Ngrid2_e[1], Ngrid3_e[1] );
    exit(0);
  }

  if (myid==Host_ID){
    printf("<TRAN> adjust Ngrid2 and Ngrid3 to fit those of electrodes\n");
  }

  *Ngrid2 = Ngrid2_e[0];
  *Ngrid3 = Ngrid3_e[0];
}