#include <cns_map_io.h>
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 Spacegroup & | spacegroup () const |
get file spacegroup | |
const Cell & | cell () const |
get file cell | |
const Grid_sampling & | grid_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 |
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.
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.
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.
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.
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.
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().
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).
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.
References spacegroup_.
const Cell & clipper::CNSMAPfile::cell | ( | ) | const |
get file cell
Get the base cell from the MTZ file.
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.
References grid_sam_.
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.
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_.
void clipper::CNSMAPfile::export_xmap | ( | const Xmap< T > & | xmap | ) | [inline] |
export data from Xmap
xmap | The Xmap to be exported. |
References clipper::Cell::a(), clipper::Cell::alpha_deg(), clipper::Cell::b(), clipper::Cell::beta_deg(), clipper::Cell::c(), clipper::Xmap< T >::cell(), cell(), filename, clipper::Cell::gamma_deg(), clipper::Xmap< T >::grid_asu(), clipper::Xmap< T >::grid_sampling(), clipper::Grid_range::max(), clipper::Message::message(), clipper::Grid_range::min(), mode, clipper::Grid_sampling::nu(), clipper::Grid_sampling::nv(), clipper::Grid_sampling::nw(), clipper::Xmap_base::Map_reference_coord::set_coord(), clipper::Coord_grid::u(), clipper::Coord_grid::v(), and clipper::Coord_grid::w().