clipper::CNSMAPfile Class Reference

MAP import/export parent class for clipper objects. More...

#include <cns_map_io.h>

List of all members.

Public Member Functions

 CNSMAPfile (unsigned int sg_num=1)
 Constructor: from CNS spacegroup number.
 CNSMAPfile (Spacegroup spacegroup)
 Constructor: from Spacegroup.
 ~CNSMAPfile ()
 Destructor: close any file that was left open.
void open_read (const String filename_in)
 Open a file for read access.
void close_read ()
 Close a file after reading.
void open_write (const String filename_out)
 Open a file for read access.
void close_write ()
 Close a file after reading.
void set_cell (const Cell &cell)
 set cell desription (NXmap write only)
const Spacegroupspacegroup () const
 get file spacegroup
const Cellcell () const
 get file cell
const Grid_samplinggrid_sampling () const
 get file grid_sampling
template<class T>
void import_xmap (Xmap< T > &xmap)
 import data to Xmap
template<class T>
void export_xmap (const Xmap< T > &xmap)
 export data from Xmap
template<class T>
void import_nxmap (NXmap< T > &nxmap)
 import data to NXmap
template<class T>
void export_nxmap (const NXmap< T > &nxmap)
 export data from NXmap

Protected Types

enum  MAPmode { NONE, READ, WRITE }

Protected Attributes

String filename
 filename
MAPmode mode
 mode
Spacegroup spacegroup_
 map spacegroup
Cell cell_
 map cell
Grid_sampling grid_sam_
 cell grid sampling
Grid_range grid_map_
 map grid extent


Detailed Description

MAP import/export parent class for clipper objects.

This is the import/export class which can be linked to a CNS map file and be used to transfer data into or out of a Clipper data structure.


Constructor & Destructor Documentation

clipper::CNSMAPfile::CNSMAPfile ( unsigned int  sg_num = 1  ) 

Constructor: from CNS spacegroup number.

Constructing an CNSMAPfile does nothing except set the spacegroup and flag the object as not attached to any file for either input or output. The default CNS setting is selected by spacegroup number.

Parameters:
sg_num The spacegroup number of the CNS setting.

References clipper::Message::message(), mode, and spacegroup_.

clipper::CNSMAPfile::CNSMAPfile ( Spacegroup  spacegroup  ) 

Constructor: from Spacegroup.

Constructing an CNSMAPfile does nothing except et the spacegroup and flag the object as not attached to any file for either input or output.

Parameters:
spacegroup The spacegroup.

References mode, and spacegroup_.

clipper::CNSMAPfile::~CNSMAPfile (  ) 

Destructor: close any file that was left open.

Close any files which were left open. This is particularly important since to access the MAP file efficiently, data reads and writes are deferred until the file is closed.

References close_read(), close_write(), and mode.


Member Function Documentation

void clipper::CNSMAPfile::open_read ( const String  filename_in  ) 

Open a file for read access.

The file is opened for reading. This CNSMAPfile object will remain attached to this file until it is closed. Until that occurs, no other file may be opened with this object, however another CNSMAPfile object could be used to access another file.

Parameters:
filename_in The input filename or pathname.

References filename, clipper::Message::message(), and mode.

void clipper::CNSMAPfile::close_read (  ) 

Close a file after reading.

Close the file after reading.

References clipper::Message::message(), and mode.

Referenced by ~CNSMAPfile().

void clipper::CNSMAPfile::open_write ( const String  filename_out  ) 

Open a file for read access.

The file is opened for writing. This will be a new file, created entirely from data from within the program, rather than by extending an existing file. Similar restrictions apply as for open_read().

Parameters:
filename_out The output filename or pathname.

References filename, clipper::Message::message(), and mode.

void clipper::CNSMAPfile::close_write (  ) 

Close a file after reading.

Close the file after writing.

References clipper::Message::message(), and mode.

Referenced by ~CNSMAPfile().

void clipper::CNSMAPfile::set_cell ( const Cell cell  ) 

set cell desription (NXmap write only)

When writing an NXmap, the cell for the output map must be set using set_cell(). Note that the NXmap is rather more general than the CNS map, since it can take an arbitrary rotation+skew matrix. The resulting map will only be sensible if the NXmap grid skew matrix reflects the supplied cell. This is not possible in the general case. (Alternatively, opening an equivalent map for read and then closing it again will also set the cell).

Parameters:
cell The cell description for the output map file.

References cell_, clipper::Message::message(), and mode.

const Spacegroup & clipper::CNSMAPfile::spacegroup (  )  const

get file spacegroup

Get the spacegroup from the MTZ file.

Returns:
The spacegroup.

References spacegroup_.

const Cell & clipper::CNSMAPfile::cell (  )  const

get file cell

Get the base cell from the MTZ file.

Returns:
The cell.

References cell_.

Referenced by export_xmap().

const Grid_sampling & clipper::CNSMAPfile::grid_sampling (  )  const

get file grid_sampling

Get the grid sampling from the MTZ file.

Returns:
The grid sampling.

References grid_sam_.

template<class T>
void clipper::CNSMAPfile::import_xmap ( Xmap< T > &  xmap  )  [inline]

import data to Xmap

Import a complete Xmap object. The supplied Xmap object is examined, and if any of the parameters (spacegroup, cell, or grid_sampling) are unset, then they will be set using values from the file. The data is the imported from the file.

If the spacegroups mismatch, the resulting map will obey its spacegroup symmetry, but no expansion will be performed if the file has a higher symmetry and only holds an asymmetric unit.

Parameters:
xmap The Xmap to be imported.

References cell_, filename, grid_map_, grid_sam_, clipper::Xmap< T >::init(), clipper::Message::message(), mode, clipper::Xmap_base::Map_reference_coord::set_coord(), and spacegroup_.

template<class T>
void clipper::CNSMAPfile::export_xmap ( const Xmap< T > &  xmap  )  [inline]


The documentation for this class was generated from the following files:

Generated on Mon Feb 18 18:09:38 2008 for Clipper_cns by  doxygen 1.5.5