Main Page   Data Structures   File List   Data Fields   Globals  

ccp4_fftmap_p1.h File Reference

#include <fftw.h>
#include <rfftw.h>

Go to the source code of this file.

Data Structures

struct  ccp4_fftmap_p1_
union  real_complex_pointer

Typedefs

typedef struct ccp4_fftmap_p1_  ccp4_fftmap_p1

Functions

ccp4_fftmap_p1ccp4_fftmap_p1_new (const int nu, const int nv, const int nw)
void ccp4_fftmap_p1_delete (ccp4_fftmap_p1 *map)
void ccp4_fftmap_p1_zero (ccp4_fftmap_p1 *map)
fftw_real ccp4_fftmap_p1_get_real (const ccp4_fftmap_p1 *map, const int u, const int v, const int w)
void ccp4_fftmap_p1_set_real (ccp4_fftmap_p1 *map, const int u, const int v, const int w, const fftw_real r)
fftw_complex ccp4_fftmap_p1_get_reci (const ccp4_fftmap_p1 *map, const int h, const int k, const int l)
void ccp4_fftmap_p1_set_reci (ccp4_fftmap_p1 *map, const int h, const int k, const int l, fftw_complex c)
void ccp4_fftmap_p1_scale_reci (ccp4_fftmap_p1 *map, const double sc_re, const double sc_im)
void ccp4_fftmap_p1_fft (ccp4_fftmap_p1 *map, const double vol)
void ccp4_fftmap_p1_invfft (ccp4_fftmap_p1 *map, const double vol)


Detailed Description

Header file for P1 fft map

(C) 2001 Kevin Cowtan, derived from code by Airlie McCoy A joint copyright is also assigned to Working Group 1 of the CCP4 project, whether they want it or not, and whether it exists or not. This code is provided as free software under the CCP4 license part (i).

The P1 fftmap class is a class for performing FFTs between 3D real and Hermitian data.

The fftmap is created by a call to ccp4_fftmap_p1_new(), and the memory free'd again using ccp4_fftmap_p1_delete(). Data are set or retrieved using accssor methods in either real or reiprocal space, which handle real or complex data respectively. The precision of the data depends upon the compilation options used for the fftw library. (I recommend this routine is made available in both precisions).

Hermitian data is stored for the l>=0 Hemisphere. The get and set functions automatically select Friedel opposites where required. Consistency of the l=0 plane is handled automatically.

  ccp4_fftmap_p1* map;
  fftw_complex c;
  int h, k, l, u, v, w, nu, nv, nw;

  // set grid dimensions
  nu = 12;
  nv = 16;
  nw = 20;

  // create the map
  map = ccp4_fftmap_p1_new( nu, nv, nw );
  ccp4_fftmap_p1_zero( map );

  // set the data here
  while ( scanf( "%i %i %i %f %f ", &h, &k, &l, &c.re, &c.im ) > 0 ) {
    ccp4_fftmap_p1_set_reci( map, h, k, l, c );
  }

  // now perform an fft
  ccp4_fftmap_p1_fft( map, cell_volume );

  // now print the map
  for ( w = 0; w < nw; w++ ) {
    printf ("\n w = %2i : ", w);
    for ( v = 0; v < nv; v++ ) {
      printf ("\n v = %2i : ", v);
      for ( u = 0; u < nu; u++ ) {
        printf ( "%5f ", ccp4_fftmap_p1_get_real( map, u, v, w ) );
      }
      printf ("\n");
    }
  }

  // finally free the map
  ccp4_fftmap_p1_delete( map );


Typedef Documentation

typedef struct ccp4_fftmap_p1_ ccp4_fftmap_p1
 

the fft map data structure


Function Documentation

void ccp4_fftmap_p1_delete ( ccp4_fftmap_p1 * map )
 

destroy an fftmap_p1 and deallocate memory

Parameters:
map   the map to destroy

void ccp4_fftmap_p1_fft ( ccp4_fftmap_p1 * map,
const double vol )
 

fft from reciprocal space to real space

Parameters:
map   The map in which to access the data
vol   the volume of the unit cell

fftw_real ccp4_fftmap_p1_get_real ( const ccp4_fftmap_p1 * map,
const int u,
const int v,
const int w )
 

get real data from the real space map. Map indices must be in the range (0..nu-1, 0..nv-1, 0..nw-1)

Parameters:
map   The map in which to access the data
u   u index of data to fetch
v   v index of data to fetch
w   w index of data to fetch

fftw_complex ccp4_fftmap_p1_get_reci ( const ccp4_fftmap_p1 * map,
const int h,
const int k,
const int l )
 

get complex data from the reciprocal space map Reflection indices must be in the range (-nu/2..nu/2-1, -nv/2..nv/2-1, -nw/2..nw/2-1)

Parameters:
map   The map in which to access the data
h   H index of data to fetch
k   K index of data to fetch
l   L index of data to fetch

void ccp4_fftmap_p1_invfft ( ccp4_fftmap_p1 * map,
const double vol )
 

fft from real space to reciprocal space

Parameters:
map   The map in which to access the data
vol   the volume of the unit cell

ccp4_fftmap_p1 * ccp4_fftmap_p1_new ( const int nu,
const int nv,
const int nw )
 

create and allocate an fftmap_p1

Parameters:
nu   grid u dimension
nv   grid v dimension
nw   grid w dimension

void ccp4_fftmap_p1_scale_reci ( ccp4_fftmap_p1 * map,
const double sc_re,
const double sc_im )
 

scale a reciprocal space map by scaling real and reciprocal parts separately

Parameters:
map   The map in which to access the data
sc_re   the scale factor for the real parts
sc_im   the scale factor for the imaginary parts

void ccp4_fftmap_p1_set_real ( ccp4_fftmap_p1 * map,
const int u,
const int v,
const int w,
const fftw_real r )
 

set real data from the real space map Map indices must be in the range (0..nu-1, 0..nv-1, 0..nw-1)

Parameters:
map   The map in which to access the data
u   u index of data to set
v   v index of data to set
w   w index of data to set
r   the value to be set

void ccp4_fftmap_p1_set_reci ( ccp4_fftmap_p1 * map,
const int h,
const int k,
const int l,
fftw_complex c )
 

get complex data from the reciprocal space map Reflection indices must be in the range (-nu/2..nu/2-1, -nv/2..nv/2-1, -nw/2..nw/2-1)

Parameters:
map   The map in which to access the data
h   H index of data to set
k   K index of data to set
l   L index of data to set
c   the complex value to be set

void ccp4_fftmap_p1_zero ( ccp4_fftmap_p1 * map )
 

zero an fftmap_p1

Parameters:
map   the map to zero


Generated at Tue Sep 25 15:03:15 2001 for ccp4_fftmap by doxygen1.2.8.1 written by Dimitri van Heesch, © 1997-2001