0 5 10 15 20

0 5 10 15 20

frequency (THz)

frequency (THz)

0 100 200 300 400 500 600

0 100 200 300 400 500 600

wavenumber (cm-1)

wavenumber (cm-1)

Figure 12.4 Fluctuating distance between Cu and S atoms in the copper protein

azurin, from an MD simulation, and its spectral density. (a) Time series of 10 000

points, time step 2 fs, duration 20 ps. (b) Spectral intensity (square of absolute

value of FFT) by direct FFT of time series. (c) The same after low-pass ¬ltering

by applying a Gaussian window to the autocorrelation function (data from Marieke

van de Bosch, Leiden).

s.d. of 300 points (600 fs). Fourier transformation then gave the smoothed

spectrum of Fig. 12.4c. Here are the few Python lines that do the trick.

python program 12.1 Spectrum from time series

Computes the smoothed spectral density from a simulated time series.

01 from fftpack import fft,ifft

02 # load data array f

03 fdev=f-f.mean()

04 N = len(fdev)

05 F = fft(fdev)

12.9 Multidimensional Fourier transforms 331

06 FF = F.real**2 + F.imag**2

07 spec1 = FF[:400]

08 acf = ifft(FF).real

09 sigma = 300.

10 window = exp(-0.5*(arange(N)/sigma)**2)

11 acf2 = acf*window

12 spec2 = fft(acf2).real[:400]

Comments

Line 2: ¬ll array f with data read from ¬le. Subtract average in line 4. Line 6 computes F — F

and line 7 produces the relevant part of the raw spectrum. Line 12 produces the relevant part of

the smoothed spectrum. The window function is a Gaussian function with s.d. (σ) of 300 points.

Only some 1000 points (3 σ) are relevant, but the full length of N (10 000) is retained to provide

a dense grid for plotting.

12.9 Multidimensional Fourier transforms

Fourier transforms are easily generalized to multidimensional periodic funct-

ions. For example, if f (x, y) is periodic in both x and y:

f (x + n1 a, y + n2 b) = f (x, y), n1 , n2 ∈ Z2 , (12.83)

then (12.60) and (12.61) generalize to

Fk1 k2 ei(k1 x+k2 y) ,

f (x, y) = (12.84)

k1 k2

a b

1

dy e’i(k1 x+k2 y) ,

Fk1 k2 = dx (12.85)

ab 0 0

where k1 = 2πn1 /a and k2 = 2πn2 /b; n1 , n2 ∈ Z2 . In vector notation:

Fk eik·r ,

f (r) = (12.86)

k

1

dr f (r)e’ik·r ,

Fk = (12.87)

V V

where V is the volume ab . . .. Thus 3D FTs for periodic spatial functions

with a rectangular unit cell, which ful¬ll the periodicity rule of (12.83), are

simple products of three 1D FTs. This simple product decomposition does

not apply to periodic spaces with monoclinic or triclinic unit cells.9 If the

unit cell is spanned by (cartesian) base vectors a, b, c, the periodicity is

expressed as

f (r + n1 a + n2 b + n3 c) = f (r + Tn) = f (r), n ∈ Z3 , (12.88)

9 See page 142 for the description of general periodicity in 3D space.

332 Fourier transforms

b*

b

a

a*

Figure 12.5 A two-dimensional real lattice with base vectors a = (a, 0) and b =

The reciprocal vectors are a— = (1/a, ’0.5/a) and b— = (0, 2/a). For

(0.25a, 0.5a).√

a the value 2 is taken. Note that a large spacing in real space means a small

spacing in “reciprocal space.”

where T is the transformation matrix

⎛ ⎞

ax bx cx

T = ⎝ ay by cy ⎠ . (12.89)

az bz cz

This is not of the form of (12.83), but functions expressed in relative coor-

dinates ρ = (ξ, ·, ζ):

r = ξa + ·b + ζc, (12.90)

r = Tρ, (12.91)

are periodic in the sense of (12.83):

f (ρ) = f (ρ + n), n ∈ Z3 . (12.92)

Fourier transforms now involve exp(±iκ · ρ), with κ = 2πm; m ∈ Z3 .

These exponentials can be rewritten as exp(±ik · r) as follows (in matrix

notation):

κ · ρ = κT ρ = 2πmT T’1 r = kT r = k · r, (12.93)

if k is de¬ned as

k = 2π(T’1 )T m.

def

(12.94)

De¬ning the (cartesian) reciprocal lattice vectors 10 a—, b—, c— by the rows of

the inverse transformation matrix T’1 :

⎛— ⎞

ax a— a—

y z

⎝ b— b— b— ⎠ ,

’1

T= (12.95)

x y z

— — c—

cx cy z

10 Note that the asterisk does not represent a complex conjugate here.

Exercises 333

we see that

k = 2π(m1 a— + m2 b— + m3 c— ). (12.96)

With this de¬nition of k in terms of reciprocal lattice vectors, the Fourier

pair (12.86) and (12.87) remain fully valid. In crystallography, where f (r)

represents an electron density, the quantities Fk are usually called structure

factors and the indices m1 , m2 , m3 are often indicated by h, k, l. The volume

V of the unit cell equals the determinant of T. The reciprocal lattice vectors

have a scalar product of 1 with their corresponding base vectors and are

perpendicular to the other base vectors:

a · a— = 1, (12.97)

a · b— = 0, (12.98)