File: node6.html

package info (click to toggle)
espresso 6.7-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 311,068 kB
  • sloc: f90: 447,429; ansic: 52,566; sh: 40,631; xml: 37,561; tcl: 20,077; lisp: 5,923; makefile: 4,503; python: 4,379; perl: 1,219; cpp: 761; fortran: 618; java: 568; awk: 128
file content (138 lines) | stat: -rw-r--r-- 4,587 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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">

<!--Converted with LaTeX2HTML 2019.2 (Released June 5, 2019) -->
<HTML lang="EN">
<HEAD>
<TITLE>3.2 Format of arrays containing charge density, potential, etc.</TITLE>
<META NAME="description" CONTENT="3.2 Format of arrays containing charge density, potential, etc.">
<META NAME="keywords" CONTENT="user_guide">
<META NAME="resource-type" CONTENT="document">
<META NAME="distribution" CONTENT="global">

<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=utf-8">
<META NAME="viewport" CONTENT="width=device-width, initial-scale=1.0">
<META NAME="Generator" CONTENT="LaTeX2HTML v2019.2">

<LINK REL="STYLESHEET" HREF="user_guide.css">

<LINK REL="previous" HREF="node5.html">
<LINK REL="next" HREF="node7.html">
</HEAD>

<BODY >
<!--Navigation Panel-->
<A
 HREF="node7.html">
<IMG WIDTH="37" HEIGHT="24" ALT="next" SRC="next.png"></A> 
<A
 HREF="node4.html">
<IMG WIDTH="26" HEIGHT="24" ALT="up" SRC="up.png"></A> 
<A
 HREF="node5.html">
<IMG WIDTH="63" HEIGHT="24" ALT="previous" SRC="prev.png"></A> 
<A ID="tex2html50"
  HREF="node1.html">
<IMG WIDTH="65" HEIGHT="24" ALT="contents" SRC="contents.png"></A>  
<BR>
<B> Next:</B> <A
 HREF="node7.html">4 Using CP</A>
<B> Up:</B> <A
 HREF="node4.html">3 Input data</A>
<B> Previous:</B> <A
 HREF="node5.html">3.1 Data files</A>
 &nbsp; <B>  <A ID="tex2html51"
  HREF="node1.html">Contents</A></B> 
<BR>
<BR>
<!--End of Navigation Panel-->

<H2><A ID="SECTION00042000000000000000">
3.2 Format of arrays containing charge density, potential, etc.</A>
</H2>

<P>
The index of arrays used to store functions defined on 3D meshes is
actually a shorthand for three indices, following the FORTRAN convention 
("leftmost index runs faster"). An example will explain this better. 
Suppose you have a 3D array <TT>psi(nr1x,nr2x,nr3x)</TT>. FORTRAN 
compilers store this array sequentially  in the computer RAM in the following way:
<PRE>
        psi(   1,   1,   1)
        psi(   2,   1,   1)
        ...
        psi(nr1x,   1,   1)
        psi(   1,   2,   1)
        psi(   2,   2,   1)
        ...
        psi(nr1x,   2,   1)
        ...
        ...
        psi(nr1x,nr2x,   1)
        ...
        psi(nr1x,nr2x,nr3x)
etc
</PRE>
Let <TT>ind</TT> be the position of the <TT>(i,j,k)</TT> element in the above list: 
the following relation
<PRE>
        ind = i + (j - 1) * nr1x + (k - 1) *  nr2x * nr1x
</PRE>
holds. This should clarify the relation between 1D and 3D indexing. In real
space, the <TT>(i,j,k)</TT> point of the FFT grid with dimensions 
<TT>nr1</TT> (≤<TT>nr1x</TT>), 
<TT>nr2</TT>  (≤<TT>nr2x</TT>), , <TT>nr3</TT> (≤<TT>nr3x</TT>), is
<P><!-- MATH
 \begin{displaymath}
r_{ijk}=\frac{i-1}{nr1} \tau_1  +  \frac{j-1}{nr2} \tau_2 +
\frac{k-1}{nr3} \tau_3
\end{displaymath}
 -->
</P>
<DIV ALIGN="CENTER">
<I>r</I><SUB>ijk</SUB> = <IMG STYLE="height: 4.78ex; vertical-align: -1.69ex; " SRC="img2.png"
 ALT="$\displaystyle {\frac{{i-1}}{{nr1}}}$"><I>τ</I><SUB>1</SUB> + <IMG STYLE="height: 4.78ex; vertical-align: -1.69ex; " SRC="img3.png"
 ALT="$\displaystyle {\frac{{j-1}}{{nr2}}}$"><I>τ</I><SUB>2</SUB> + <IMG STYLE="height: 4.84ex; vertical-align: -1.69ex; " SRC="img4.png"
 ALT="$\displaystyle {\frac{{k-1}}{{nr3}}}$"><I>τ</I><SUB>3</SUB>
</DIV><P></P>
where the <I>τ</I><SUB>i</SUB> are the basis vectors of the Bravais lattice. 
The latter are stored row-wise in the <TT>at</TT> array:
<I>τ</I><SUB>1</SUB> = <TT>at(:, 1)</TT>, 
<I>τ</I><SUB>2</SUB> = <TT>at(:, 2)</TT>, 
<I>τ</I><SUB>3</SUB> = <TT>at(:, 3)</TT>.

<P>
The distinction between the dimensions of the FFT grid,
<TT>(nr1,nr2,nr3)</TT> and the physical dimensions of the array,
<TT>(nr1x,nr2x,nr3x)</TT> is done only because it is computationally
convenient in some cases that the two sets are not the same.
In particular, it is often convenient to have <TT>nrx1</TT>=<TT>nr1</TT>+1
to reduce memory conflicts.

<P>
<HR>
<!--Navigation Panel-->
<A
 HREF="node7.html">
<IMG WIDTH="37" HEIGHT="24" ALT="next" SRC="next.png"></A> 
<A
 HREF="node4.html">
<IMG WIDTH="26" HEIGHT="24" ALT="up" SRC="up.png"></A> 
<A
 HREF="node5.html">
<IMG WIDTH="63" HEIGHT="24" ALT="previous" SRC="prev.png"></A> 
<A ID="tex2html50"
  HREF="node1.html">
<IMG WIDTH="65" HEIGHT="24" ALT="contents" SRC="contents.png"></A>  
<BR>
<B> Next:</B> <A
 HREF="node7.html">4 Using CP</A>
<B> Up:</B> <A
 HREF="node4.html">3 Input data</A>
<B> Previous:</B> <A
 HREF="node5.html">3.1 Data files</A>
 &nbsp; <B>  <A ID="tex2html51"
  HREF="node1.html">Contents</A></B> 
<!--End of Navigation Panel-->

</BODY>
</HTML>