Gemmi C++ API
Loading...
Searching...
No Matches
Classes | Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
gemmi::Mtz Struct Reference

#include <mtz.hpp>

Classes

struct  Batch
 
struct  Column
 
struct  Dataset
 

Public Member Functions

 Mtz (bool with_base=false)
 
 Mtz (Mtz &&o) noexcept
 
Mtzoperator= (Mtz &&o) noexcept
 
 Mtz (Mtz const &)=delete
 
Mtzoperator= (Mtz const &)=delete
 
void add_base ()
 
double resolution_high () const
 
double resolution_low () const
 
UnitCellget_cell (int dataset=-1)
 
const UnitCellget_cell (int dataset=-1) const
 
void set_cell_for_all (const UnitCell &new_cell)
 
UnitCell get_average_cell_from_batch_headers (double *rmsd) const
 
void set_spacegroup (const SpaceGroup *new_sg)
 
Datasetlast_dataset ()
 
Datasetdataset (int id)
 
const Datasetdataset (int id) const
 
Datasetdataset_with_name (const std::string &name)
 
const Datasetdataset_with_name (const std::string &label) const
 
int count (const std::string &label) const
 
int count_type (char type) const
 
Columncolumn_with_label (const std::string &label, const Dataset *ds=nullptr)
 
const Columncolumn_with_label (const std::string &label, const Dataset *ds=nullptr) const
 
const Columnget_column_with_label (const std::string &label, const Dataset *ds=nullptr) const
 
std::vector< const Column * > columns_with_type (char type) const
 
std::vector< intpositions_of_columns_with_type (char col_type) const
 
std::vector< std::pair< int, int > > positions_of_plus_minus_columns () const
 
const Columncolumn_with_one_of_labels (std::initializer_list< const char * > labels) const
 
Columncolumn_with_type_and_one_of_labels (char type, std::initializer_list< const char * > labels)
 
Columnrfree_column ()
 
const Columnrfree_column () const
 
Columnimean_column ()
 
const Columnimean_column () const
 
Columniplus_column ()
 
const Columniplus_column () const
 
Columniminus_column ()
 
const Columniminus_column () const
 
bool has_data () const
 
bool is_merged () const
 
void extend_min_max_1_d2 (const UnitCell &uc, double &min, double &max) const
 
std::array< double, 2 > calculate_min_max_1_d2 () const
 
void update_reso ()
 
void toggle_endianness ()
 
template<typename Stream >
void read_first_bytes (Stream &stream)
 
template<typename T >
void warn (const T &text) const
 
template<typename Stream >
void seek_headers (Stream &stream)
 
template<typename Stream >
void read_main_headers (Stream &stream)
 
template<typename Stream >
void read_history_and_batch_headers (Stream &stream)
 
void setup_spacegroup ()
 
template<typename Stream >
void read_raw_data (Stream &stream)
 
template<typename Stream >
void read_all_headers (Stream &stream)
 
template<typename Stream >
void read_stream (Stream &&stream, bool with_data)
 
void read_file (const std::string &path)
 
template<typename Input >
void read_input (Input &&input, bool with_data)
 
void read_file_gz (const std::string &path, bool with_data=true)
 the same as read_input(MaybeGzipped(path), with_data)
 
std::vector< intsorted_row_indices (int use_first=3) const
 
bool sort (int use_first=3)
 
Miller get_hkl (size_t offset) const
 
void set_hkl (size_t offset, const Miller &hkl)
 
size_t find_offset_of_hkl (const Miller &hkl, size_t start=0) const
 Returns offset of the first hkl or (size_t)-1. Can be slow.
 
void ensure_asu (bool tnt_asu=false)
 (for merged MTZ only) change HKL to ASU equivalent, adjust phases, etc
 
void reindex (const Op &op, std::ostream *out)
 reindex data, usually followed by ensure_asu()
 
void expand_to_p1 ()
 Change symmetry to P1 and expand reflections.
 
bool switch_to_original_hkl ()
 (for unmerged MTZ only) change HKL according to M/ISYM
 
bool switch_to_asu_hkl ()
 (for unmerged MTZ only) change HKL to ASU equivalent and set ISYM
 
Datasetadd_dataset (const std::string &name)
 
Columnadd_column (const std::string &label, char type, int dataset_id, int pos, bool expand_data)
 
void check_column (size_t idx, const char *msg) const
 
void check_trailing_cols (const Column &src_col, const std::vector< std::string > &trailing_cols) const
 
void do_replace_column (size_t dest_idx, const Column &src_col, const std::vector< std::string > &trailing_cols)
 
Columnreplace_column (size_t dest_idx, const Column &src_col, const std::vector< std::string > &trailing_cols={})
 
Columncopy_column (int dest_idx, const Column &src_col, const std::vector< std::string > &trailing_cols={})
 
void remove_column (size_t idx)
 
template<typename Func >
void remove_rows_if (Func condition)
 
void expand_data_rows (size_t added, int pos_=-1)
 
void set_data (const float *new_data, size_t n)
 
void write_to_cstream (std::FILE *stream) const
 
void write_to_string (std::string &str) const
 
void write_to_file (const std::string &path) const
 

Static Public Member Functions

static const charskip_word (const char *line)
 
static UnitCell read_cell_parameters (const char *line)
 

Public Attributes

std::string source_path
 
bool same_byte_order = true
 
bool indices_switched_to_original = false
 
std::int64_t header_offset = 0
 
std::string version_stamp
 
std::string title
 
int nreflections = 0
 
std::array< int, 5 > sort_order = {}
 
double min_1_d2 = NAN
 
double max_1_d2 = NAN
 
float valm = NAN
 
int nsymop = 0
 
UnitCell cell
 
int spacegroup_number = 0
 
std::string spacegroup_name
 
std::vector< Opsymops
 
const SpaceGroupspacegroup = nullptr
 
std::vector< Datasetdatasets
 
std::vector< Columncolumns
 
std::vector< Batchbatches
 
std::vector< std::string > history
 
std::string appended_text
 
std::vector< floatdata
 
std::ostream * warnings = nullptr
 

Detailed Description

Definition at line 70 of file mtz.hpp.

Constructor & Destructor Documentation

◆ Mtz() [1/3]

gemmi::Mtz::Mtz ( bool  with_base = false)
inlineexplicit

Definition at line 197 of file mtz.hpp.

◆ Mtz() [2/3]

gemmi::Mtz::Mtz ( Mtz &&  o)
inlinenoexcept

Definition at line 201 of file mtz.hpp.

◆ Mtz() [3/3]

gemmi::Mtz::Mtz ( Mtz const )
delete

Member Function Documentation

◆ operator=() [1/2]

Mtz & gemmi::Mtz::operator= ( Mtz &&  o)
inlinenoexcept

Definition at line 202 of file mtz.hpp.

◆ operator=() [2/2]

Mtz & gemmi::Mtz::operator= ( Mtz const )
delete

◆ add_base()

void gemmi::Mtz::add_base ( )
inline

Definition at line 232 of file mtz.hpp.

◆ resolution_high()

double gemmi::Mtz::resolution_high ( ) const
inline

Definition at line 240 of file mtz.hpp.

◆ resolution_low()

double gemmi::Mtz::resolution_low ( ) const
inline

Definition at line 241 of file mtz.hpp.

◆ get_cell() [1/2]

UnitCell & gemmi::Mtz::get_cell ( int  dataset = -1)
inline

Definition at line 243 of file mtz.hpp.

◆ get_cell() [2/2]

const UnitCell & gemmi::Mtz::get_cell ( int  dataset = -1) const
inline

Definition at line 250 of file mtz.hpp.

◆ set_cell_for_all()

void gemmi::Mtz::set_cell_for_all ( const UnitCell new_cell)
inline

Definition at line 254 of file mtz.hpp.

◆ get_average_cell_from_batch_headers()

UnitCell gemmi::Mtz::get_average_cell_from_batch_headers ( double rmsd) const
inline

Definition at line 261 of file mtz.hpp.

◆ set_spacegroup()

void gemmi::Mtz::set_spacegroup ( const SpaceGroup new_sg)
inline

Definition at line 289 of file mtz.hpp.

◆ last_dataset()

Dataset & gemmi::Mtz::last_dataset ( )
inline

Definition at line 295 of file mtz.hpp.

◆ dataset() [1/2]

Dataset & gemmi::Mtz::dataset ( int  id)
inline

Definition at line 300 of file mtz.hpp.

◆ dataset() [2/2]

const Dataset & gemmi::Mtz::dataset ( int  id) const
inline

Definition at line 308 of file mtz.hpp.

◆ dataset_with_name() [1/2]

Dataset * gemmi::Mtz::dataset_with_name ( const std::string &  name)
inline

Definition at line 311 of file mtz.hpp.

◆ dataset_with_name() [2/2]

const Dataset * gemmi::Mtz::dataset_with_name ( const std::string &  label) const
inline

Definition at line 317 of file mtz.hpp.

◆ count()

int gemmi::Mtz::count ( const std::string &  label) const
inline

Definition at line 320 of file mtz.hpp.

◆ count_type()

int gemmi::Mtz::count_type ( char  type) const
inline

Definition at line 327 of file mtz.hpp.

◆ column_with_label() [1/2]

Column * gemmi::Mtz::column_with_label ( const std::string &  label,
const Dataset ds = nullptr 
)
inline

Definition at line 334 of file mtz.hpp.

◆ column_with_label() [2/2]

const Column * gemmi::Mtz::column_with_label ( const std::string &  label,
const Dataset ds = nullptr 
) const
inline

Definition at line 341 of file mtz.hpp.

◆ get_column_with_label()

const Column & gemmi::Mtz::get_column_with_label ( const std::string &  label,
const Dataset ds = nullptr 
) const
inline

Definition at line 345 of file mtz.hpp.

◆ columns_with_type()

std::vector< const Column * > gemmi::Mtz::columns_with_type ( char  type) const
inline

Definition at line 351 of file mtz.hpp.

◆ positions_of_columns_with_type()

std::vector< int > gemmi::Mtz::positions_of_columns_with_type ( char  col_type) const
inline

Definition at line 359 of file mtz.hpp.

◆ positions_of_plus_minus_columns()

std::vector< std::pair< int, int > > gemmi::Mtz::positions_of_plus_minus_columns ( ) const
inline

Definition at line 370 of file mtz.hpp.

◆ column_with_one_of_labels()

const Column * gemmi::Mtz::column_with_one_of_labels ( std::initializer_list< const char * >  labels) const
inline

Definition at line 390 of file mtz.hpp.

◆ column_with_type_and_one_of_labels()

Column * gemmi::Mtz::column_with_type_and_one_of_labels ( char  type,
std::initializer_list< const char * >  labels 
)
inline

Definition at line 398 of file mtz.hpp.

◆ rfree_column() [1/2]

Column * gemmi::Mtz::rfree_column ( )
inline

Definition at line 409 of file mtz.hpp.

◆ rfree_column() [2/2]

const Column * gemmi::Mtz::rfree_column ( ) const
inline

Definition at line 414 of file mtz.hpp.

◆ imean_column() [1/2]

Column * gemmi::Mtz::imean_column ( )
inline

Definition at line 418 of file mtz.hpp.

◆ imean_column() [2/2]

const Column * gemmi::Mtz::imean_column ( ) const
inline

Definition at line 421 of file mtz.hpp.

◆ iplus_column() [1/2]

Column * gemmi::Mtz::iplus_column ( )
inline

Definition at line 425 of file mtz.hpp.

◆ iplus_column() [2/2]

const Column * gemmi::Mtz::iplus_column ( ) const
inline

Definition at line 428 of file mtz.hpp.

◆ iminus_column() [1/2]

Column * gemmi::Mtz::iminus_column ( )
inline

Definition at line 432 of file mtz.hpp.

◆ iminus_column() [2/2]

const Column * gemmi::Mtz::iminus_column ( ) const
inline

Definition at line 435 of file mtz.hpp.

◆ has_data()

bool gemmi::Mtz::has_data ( ) const
inline

Definition at line 439 of file mtz.hpp.

◆ is_merged()

bool gemmi::Mtz::is_merged ( ) const
inline

Definition at line 443 of file mtz.hpp.

◆ extend_min_max_1_d2()

void gemmi::Mtz::extend_min_max_1_d2 ( const UnitCell uc,
double min,
double max 
) const
inline

Definition at line 445 of file mtz.hpp.

◆ calculate_min_max_1_d2()

std::array< double, 2 > gemmi::Mtz::calculate_min_max_1_d2 ( ) const
inline

Definition at line 455 of file mtz.hpp.

◆ update_reso()

void gemmi::Mtz::update_reso ( )
inline

Definition at line 474 of file mtz.hpp.

◆ toggle_endianness()

void gemmi::Mtz::toggle_endianness ( )
inline

Definition at line 482 of file mtz.hpp.

◆ read_first_bytes()

template<typename Stream >
void gemmi::Mtz::read_first_bytes ( Stream stream)
inline

Definition at line 488 of file mtz.hpp.

◆ skip_word()

static const char * gemmi::Mtz::skip_word ( const char line)
inlinestatic

Definition at line 521 of file mtz.hpp.

◆ read_cell_parameters()

static UnitCell gemmi::Mtz::read_cell_parameters ( const char line)
inlinestatic

Definition at line 529 of file mtz.hpp.

◆ warn()

template<typename T >
void gemmi::Mtz::warn ( const T text) const
inline

Definition at line 539 of file mtz.hpp.

◆ seek_headers()

template<typename Stream >
void gemmi::Mtz::seek_headers ( Stream stream)
inline

Definition at line 545 of file mtz.hpp.

◆ read_main_headers()

template<typename Stream >
void gemmi::Mtz::read_main_headers ( Stream stream)
inline

Definition at line 553 of file mtz.hpp.

◆ read_history_and_batch_headers()

template<typename Stream >
void gemmi::Mtz::read_history_and_batch_headers ( Stream stream)
inline

Definition at line 686 of file mtz.hpp.

◆ setup_spacegroup()

void gemmi::Mtz::setup_spacegroup ( )
inline

Definition at line 731 of file mtz.hpp.

◆ read_raw_data()

template<typename Stream >
void gemmi::Mtz::read_raw_data ( Stream stream)
inline

Definition at line 746 of file mtz.hpp.

◆ read_all_headers()

template<typename Stream >
void gemmi::Mtz::read_all_headers ( Stream stream)
inline

Definition at line 759 of file mtz.hpp.

◆ read_stream()

template<typename Stream >
void gemmi::Mtz::read_stream ( Stream &&  stream,
bool  with_data 
)
inline

Definition at line 769 of file mtz.hpp.

◆ read_file()

void gemmi::Mtz::read_file ( const std::string &  path)
inline

Definition at line 775 of file mtz.hpp.

◆ read_input()

template<typename Input >
void gemmi::Mtz::read_input ( Input &&  input,
bool  with_data 
)
inline

Definition at line 786 of file mtz.hpp.

◆ read_file_gz()

void gemmi::Mtz::read_file_gz ( const std::string &  path,
bool  with_data = true 
)

the same as read_input(MaybeGzipped(path), with_data)

◆ sorted_row_indices()

std::vector< int > gemmi::Mtz::sorted_row_indices ( int  use_first = 3) const
inline

Definition at line 801 of file mtz.hpp.

◆ sort()

bool gemmi::Mtz::sort ( int  use_first = 3)
inline

Definition at line 820 of file mtz.hpp.

◆ get_hkl()

Miller gemmi::Mtz::get_hkl ( size_t  offset) const
inline

Definition at line 835 of file mtz.hpp.

◆ set_hkl()

void gemmi::Mtz::set_hkl ( size_t  offset,
const Miller hkl 
)
inline

Definition at line 838 of file mtz.hpp.

◆ find_offset_of_hkl()

size_t gemmi::Mtz::find_offset_of_hkl ( const Miller hkl,
size_t  start = 0 
) const

Returns offset of the first hkl or (size_t)-1. Can be slow.

◆ ensure_asu()

void gemmi::Mtz::ensure_asu ( bool  tnt_asu = false)

(for merged MTZ only) change HKL to ASU equivalent, adjust phases, etc

◆ reindex()

void gemmi::Mtz::reindex ( const Op op,
std::ostream *  out 
)

reindex data, usually followed by ensure_asu()

◆ expand_to_p1()

void gemmi::Mtz::expand_to_p1 ( )

Change symmetry to P1 and expand reflections.

Does not sort. Similar to command EXPAND in SFTOOLS.

◆ switch_to_original_hkl()

bool gemmi::Mtz::switch_to_original_hkl ( )

(for unmerged MTZ only) change HKL according to M/ISYM

◆ switch_to_asu_hkl()

bool gemmi::Mtz::switch_to_asu_hkl ( )

(for unmerged MTZ only) change HKL to ASU equivalent and set ISYM

◆ add_dataset()

Dataset & gemmi::Mtz::add_dataset ( const std::string &  name)
inline

Definition at line 862 of file mtz.hpp.

◆ add_column()

Column & gemmi::Mtz::add_column ( const std::string &  label,
char  type,
int  dataset_id,
int  pos,
bool  expand_data 
)
inline

Definition at line 871 of file mtz.hpp.

◆ check_column()

void gemmi::Mtz::check_column ( size_t  idx,
const char msg 
) const
inline

Definition at line 897 of file mtz.hpp.

◆ check_trailing_cols()

void gemmi::Mtz::check_trailing_cols ( const Column src_col,
const std::vector< std::string > &  trailing_cols 
) const
inline

Definition at line 903 of file mtz.hpp.

◆ do_replace_column()

void gemmi::Mtz::do_replace_column ( size_t  dest_idx,
const Column src_col,
const std::vector< std::string > &  trailing_cols 
)
inline

Definition at line 915 of file mtz.hpp.

◆ replace_column()

Column & gemmi::Mtz::replace_column ( size_t  dest_idx,
const Column src_col,
const std::vector< std::string > &  trailing_cols = {} 
)
inline

Definition at line 962 of file mtz.hpp.

◆ copy_column()

Column & gemmi::Mtz::copy_column ( int  dest_idx,
const Column src_col,
const std::vector< std::string > &  trailing_cols = {} 
)
inline

Definition at line 972 of file mtz.hpp.

◆ remove_column()

void gemmi::Mtz::remove_column ( size_t  idx)
inline

Definition at line 998 of file mtz.hpp.

◆ remove_rows_if()

template<typename Func >
void gemmi::Mtz::remove_rows_if ( Func  condition)
inline

Definition at line 1008 of file mtz.hpp.

◆ expand_data_rows()

void gemmi::Mtz::expand_data_rows ( size_t  added,
int  pos_ = -1 
)
inline

Definition at line 1023 of file mtz.hpp.

◆ set_data()

void gemmi::Mtz::set_data ( const float new_data,
size_t  n 
)
inline

Definition at line 1033 of file mtz.hpp.

◆ write_to_cstream()

void gemmi::Mtz::write_to_cstream ( std::FILE *  stream) const

◆ write_to_string()

void gemmi::Mtz::write_to_string ( std::string &  str) const

◆ write_to_file()

void gemmi::Mtz::write_to_file ( const std::string &  path) const

Member Data Documentation

◆ source_path

std::string gemmi::Mtz::source_path

Definition at line 170 of file mtz.hpp.

◆ same_byte_order

bool gemmi::Mtz::same_byte_order = true

Definition at line 171 of file mtz.hpp.

◆ indices_switched_to_original

bool gemmi::Mtz::indices_switched_to_original = false

Definition at line 172 of file mtz.hpp.

◆ header_offset

std::int64_t gemmi::Mtz::header_offset = 0

Definition at line 173 of file mtz.hpp.

◆ version_stamp

std::string gemmi::Mtz::version_stamp

Definition at line 174 of file mtz.hpp.

◆ title

std::string gemmi::Mtz::title

Definition at line 175 of file mtz.hpp.

◆ nreflections

int gemmi::Mtz::nreflections = 0

Definition at line 176 of file mtz.hpp.

◆ sort_order

std::array<int, 5> gemmi::Mtz::sort_order = {}

Definition at line 177 of file mtz.hpp.

◆ min_1_d2

double gemmi::Mtz::min_1_d2 = NAN

Definition at line 178 of file mtz.hpp.

◆ max_1_d2

double gemmi::Mtz::max_1_d2 = NAN

Definition at line 179 of file mtz.hpp.

◆ valm

float gemmi::Mtz::valm = NAN

Definition at line 180 of file mtz.hpp.

◆ nsymop

int gemmi::Mtz::nsymop = 0

Definition at line 181 of file mtz.hpp.

◆ cell

UnitCell gemmi::Mtz::cell

Definition at line 182 of file mtz.hpp.

◆ spacegroup_number

int gemmi::Mtz::spacegroup_number = 0

Definition at line 183 of file mtz.hpp.

◆ spacegroup_name

std::string gemmi::Mtz::spacegroup_name

Definition at line 184 of file mtz.hpp.

◆ symops

std::vector<Op> gemmi::Mtz::symops

Definition at line 185 of file mtz.hpp.

◆ spacegroup

const SpaceGroup* gemmi::Mtz::spacegroup = nullptr

Definition at line 186 of file mtz.hpp.

◆ datasets

std::vector<Dataset> gemmi::Mtz::datasets

Definition at line 187 of file mtz.hpp.

◆ columns

std::vector<Column> gemmi::Mtz::columns

Definition at line 188 of file mtz.hpp.

◆ batches

std::vector<Batch> gemmi::Mtz::batches

Definition at line 189 of file mtz.hpp.

◆ history

std::vector<std::string> gemmi::Mtz::history

Definition at line 190 of file mtz.hpp.

◆ appended_text

std::string gemmi::Mtz::appended_text

Definition at line 191 of file mtz.hpp.

◆ data

std::vector<float> gemmi::Mtz::data

Definition at line 192 of file mtz.hpp.

◆ warnings

std::ostream* gemmi::Mtz::warnings = nullptr

Definition at line 195 of file mtz.hpp.


The documentation for this struct was generated from the following file: