CYCLUS
Loading...
Searching...
No Matches
pyne::Material Class Reference

Detailed Description

Material composed of nuclides.

Definition at line 4800 of file pyne.h.

#include <pyne.h>

Public Member Functions

void _load_comp_protocol0 (hid_t db, std::string datapath, int row)
 
void _load_comp_protocol1 (hid_t db, std::string datapath, int row)
 
comp_map activity ()
 
Material collapse_elements (int **int_ptr_arry)
 
Material collapse_elements (std::set< int > exception_znum)
 
Material decay (double t)
 
comp_map decay_heat ()
 
Material del_mat (std::set< int > nucset)
 
Material del_mat (std::set< std::string > nucset)
 
Material del_range (int lower=0, int upper=10000000)
 
comp_map dose_per_g (std::string dose_type, int source=0)
 
Json::Value dump_json ()
 
Material expand_elements ()
 
std::string fluka (int id, std::string frac_type="mass")
 
std::string fluka_compound_str (int id, std::string frac_type="mass")
 
std::string fluka_format_field (float field)
 
std::string fluka_material_component (int fid, int nucid, std::string fluka_name)
 
std::string fluka_material_line (int znum, double atomic_mass, int fid, std::string fluka_name)
 
std::string fluka_material_str (int id)
 
void from_atom_frac (std::map< int, double > atom_fracs)
 
void from_hdf5 (char *filename, char *datapath, int row=-1, int protocol=1)
 
void from_hdf5 (std::string filename, std::string datapath="/material", int row=-1, int protocol=1)
 
void from_json (char *filename)
 
void from_json (std::string filname)
 
void from_text (char *filename)
 
void from_text (std::string filename)
 
std::vector< std::pair< double, double > > gammas ()
 
void load_json (Json::Value)
 
double mass_density (double num_dens=-1.0, double apm=-1.0)
 
 Material ()
 
 Material (char *filename, double m=-1.0, double d=-1.0, double apm=-1.0, Json::Value attributes=Json::Value(Json::objectValue))
 
 Material (comp_map cm, double m=-1.0, double d=-1.0, double apm=-1.0, Json::Value attributes=Json::Value(Json::objectValue))
 
 Material (std::string filename, double m=-1.0, double d=-1.0, double apm=-1.0, Json::Value attributes=Json::Value(Json::objectValue))
 
std::string mcnp (std::string frac_type="mass")
 
double molecular_mass (double apm=-1.0)
 
comp_map mult_by_mass ()
 
void norm_comp ()
 
void normalize ()
 
std::vector< std::pair< double, double > > normalize_radioactivity (std::vector< std::pair< double, double > > unnormed)
 
bool not_fluka_builtin (std::string fluka_name)
 
double number_density (double mass_dens=-1.0, double apm=-1.0)
 
Material operator* (double)
 
Material operator+ (double)
 
Material operator+ (Material)
 
Material operator/ (double)
 
std::vector< std::pair< double, double > > photons (bool norm)
 
Material set_mat (std::set< int > nucset, double value)
 
Material set_mat (std::set< std::string > nucset, double value)
 
Material set_range (int lower=0, int upper=10000000, double value=0.0)
 
Material sub_act ()
 
Material sub_elem (int element)
 
Material sub_fp ()
 
Material sub_lan ()
 
Material sub_ma ()
 
Material sub_mat (std::set< int > nucset)
 
Material sub_mat (std::set< std::string > nucset)
 
Material sub_range (int lower=0, int upper=10000000)
 
Material sub_tru ()
 
std::map< int, double > to_atom_dens ()
 
std::map< int, double > to_atom_frac ()
 
void write_hdf5 (char *filename, char *datapath, char *nucpath, float row=-0.0, int chunksize=100)
 
void write_hdf5 (std::string filename, std::string datapath="/material", std::string nucpath="/nucid", float row=-0.0, int chunksize=100)
 
void write_json (char *filename)
 
void write_json (std::string filename)
 
void write_text (char *filename)
 
void write_text (std::string filename)
 
std::vector< std::pair< double, double > > xrays ()
 
 ~Material ()
 

Public Attributes

double atoms_per_molecule
 
comp_map comp
 
double density
 
double mass
 
Json::Value metadata
 

Protected Member Functions

double get_comp_sum ()
 

Constructor & Destructor Documentation

◆ Material() [1/4]

pyne::Material::Material ( )

empty constructor

Definition at line 18016 of file pyne.cc.

◆ Material() [2/4]

pyne::Material::Material ( pyne::comp_map cm,
double m = -1.0,
double d = -1.0,
double apm = -1.0,
Json::Value attributes = Json::Value(Json::objectValue) )

Constructor from composition map.

Parameters
cmcomposition map
mmass value, the mass is set to the sum of the values in the composition if m is negative.
ddensity value
apmatoms per mole
attributesinitial metadata

Definition at line 18025 of file pyne.cc.

◆ Material() [3/4]

pyne::Material::Material ( char * filename,
double m = -1.0,
double d = -1.0,
double apm = -1.0,
Json::Value attributes = Json::Value(Json::objectValue) )

Constructor from file.

Parameters
filenamepath to file on disk, this file may be either in plaintext or HDF5 format.
mmass value, the mass is set to the sum of the values in the composition if m is negative, may be overridden by the value from disk.
ddensity value, may be overridden by the value from disk.
apmatoms per mole, may be overridden by the value from disk.
attributesinitial metadata, may be overridden by the value from disk.

Definition at line 18039 of file pyne.cc.

◆ Material() [4/4]

pyne::Material::Material ( std::string filename,
double m = -1.0,
double d = -1.0,
double apm = -1.0,
Json::Value attributes = Json::Value(Json::objectValue) )

Constructor from file.

Parameters
filenamepath to file on disk, this file may be either in plaintext or HDF5 format.
mmass value, the mass is set to the sum of the values in the composition if m is negative, may be overridden by the value from disk.
ddensity value, may be overridden by the value from disk.
apmatoms per mole, may be overridden by the value from disk.
attributesinitial metadata, may be overridden by the value from disk.

Definition at line 18060 of file pyne.cc.

◆ ~Material()

pyne::Material::~Material ( )

default destructor

Definition at line 18081 of file pyne.cc.

Member Function Documentation

◆ _load_comp_protocol0()

void pyne::Material::_load_comp_protocol0 ( hid_t db,
std::string datapath,
int row )

Loads the matrial composition from an HDF5 file according to the layout defined by protocol 0.

This protocol is depratacted.

Parameters
dbHDF5 id for the open HDF5 file.
datapathPath to the base node for the material in db.
rowThe index to read out, may be negative.

Definition at line 17087 of file pyne.cc.

◆ _load_comp_protocol1()

void pyne::Material::_load_comp_protocol1 ( hid_t db,
std::string datapath,
int row )

Loads the matrial composition from an HDF5 file according to the layout defined by protocol 1.

This protocol should be used in favor of protocol 0.

Parameters
dbHDF5 id for the open HDF5 file.
datapathPath to the base node for the material in db.
rowThe index to read out, may be negative.

Definition at line 17125 of file pyne.cc.

◆ activity()

pyne::comp_map pyne::Material::activity ( )

Calculates the activity of a material based on the composition and each nuclide's mass, decay_const, and atmoic_mass.

Definition at line 18125 of file pyne.cc.

◆ collapse_elements() [1/2]

pyne::Material pyne::Material::collapse_elements ( int ** int_ptr_arry)

Definition at line 18291 of file pyne.cc.

◆ collapse_elements() [2/2]

pyne::Material pyne::Material::collapse_elements ( std::set< int > exception_znum)

Definition at line 18247 of file pyne.cc.

◆ decay()

pyne::Material pyne::Material::decay ( double t)

Decays this material for a given amount of time in seconds.

Definition at line 18642 of file pyne.cc.

◆ decay_heat()

pyne::comp_map pyne::Material::decay_heat ( )

Calculates the decay heat of a material based on the composition and each nuclide's mass, q_val, decay_const, and atomic_mass.

This assumes input mass of grams. Return values is in megawatts.

Definition at line 18136 of file pyne.cc.

◆ del_mat() [1/2]

pyne::Material pyne::Material::del_mat ( std::set< int > nucset)

Creates a new Material with the all nuclides in nucset removed.

Elements of nucset may be either in id form or simple Z numbers.

Definition at line 18387 of file pyne.cc.

◆ del_mat() [2/2]

pyne::Material pyne::Material::del_mat ( std::set< std::string > nucset)

Creates a new Material with the all nuclides in nucset removed.

Elements of nucset may be in any form.

Definition at line 18404 of file pyne.cc.

◆ del_range()

pyne::Material pyne::Material::del_range ( int lower = 0,
int upper = 10000000 )

Creates a new Material with the all nuclides in the id range removed.

Definition at line 18461 of file pyne.cc.

◆ dose_per_g()

pyne::comp_map pyne::Material::dose_per_g ( std::string dose_type,
int source = 0 )

Caclulates the dose per gram using the composition of the the material, the dose type desired, and the source for dose factors dose_type is one of: ext_air – returns mrem/h per g per m^3 ext_soil – returns mrem/h per g per m^2 ingest – returns mrem per g inhale – returns mrem per g source is: {EPA=0, DOE=1, GENII=2}, default is EPA.

Definition at line 18148 of file pyne.cc.

◆ dump_json()

Json::Value pyne::Material::dump_json ( )

Dumps the Material out to a JSON instance tree.

Definition at line 17958 of file pyne.cc.

◆ expand_elements()

pyne::Material pyne::Material::expand_elements ( )

Returns a copy of the current material where all natural elements in the composition are expanded to their natural isotopic abundances.

Definition at line 18205 of file pyne.cc.

◆ fluka()

std::string pyne::Material::fluka ( int id,
std::string frac_type = "mass" )

Return a fluka input deck MATERIAL card as a string.

------------------------------------------------------------------------—// fluka ------------------------------------------------------------------------—// Main external call

Definition at line 17623 of file pyne.cc.

◆ fluka_compound_str()

std::string pyne::Material::fluka_compound_str ( int id,
std::string frac_type = "mass" )

Return FLUKA compound card and the material card for the named compound but not the material cards of the components.

------------------------------------------------------------------------—// fluka_compound_str ------------------------------------------------------------------------—// Returns – MATERIAL line for compound – COMPOUND lines

Definition at line 17758 of file pyne.cc.

◆ fluka_format_field()

std::string pyne::Material::fluka_format_field ( float field)

Convenience function to format a single fluka field.

------------------------------------------------------------------------—// fluka_format_field ------------------------------------------------------------------------—// Convenience function that returns a 10-character formatted string 999 -> 999.

999.12 -> 999.12 999.123 -> 999.123 999.1234 -> 999.123

Definition at line 17734 of file pyne.cc.

◆ fluka_material_component()

std::string pyne::Material::fluka_material_component ( int fid,
int nucid,
std::string fluka_name )

Intermediate level call to prepare final info and call material_line(..)

------------------------------------------------------------------------—// fluka_material_component ------------------------------------------------------------------------—// Material has only one component, Density is either object density or it is ignored ==> use object density This function is not called for a compound, but it is called on the material-ized components of compounds

Definition at line 17681 of file pyne.cc.

◆ fluka_material_line()

std::string pyne::Material::fluka_material_line ( int znum,
double atomic_mass,
int fid,
std::string fluka_name )

Format information into a FLUKA material card.

------------------------------------------------------------------------—// fluka_material_line ------------------------------------------------------------------------—// Given all the info, return the Material string

Definition at line 17700 of file pyne.cc.

◆ fluka_material_str()

std::string pyne::Material::fluka_material_str ( int id)

High level call to get details and call material_component(..)

------------------------------------------------------------------------—// fluka_material_str ------------------------------------------------------------------------—//

Requirement: the material upon which this function is called has exactly one nucid component, i.e. it is elemental Do not assume fluka_name is defined in the metadata. This function may be called from a user-defined material, i.e. on that is not read out of a UW^2-tagged geometry file, and thus does not have certain metadata.

Definition at line 17648 of file pyne.cc.

◆ from_atom_frac()

void pyne::Material::from_atom_frac ( std::map< int, double > atom_fracs)

Sets the composition, mass, and atoms_per_molecule of this material to those calculated from atom_fracs, a mapping of nuclides to atom fractions values.

Definition at line 18545 of file pyne.cc.

◆ from_hdf5() [1/2]

void pyne::Material::from_hdf5 ( char * filename,
char * datapath,
int row = -1,
int protocol = 1 )

Loads a material from an HDF5 file into this object.

Parameters
filenamePath on disk to the HDF5 file.
datapathPath to the the material in the file.
rowThe index to read out, may be negative.
protocolFlag for layout of material on disk.

Definition at line 17230 of file pyne.cc.

◆ from_hdf5() [2/2]

void pyne::Material::from_hdf5 ( std::string filename,
std::string datapath = "/material",
int row = -1,
int protocol = 1 )

Loads a material from an HDF5 file into this object.

Parameters
filenamePath on disk to the HDF5 file.
datapathPath to the the material in the file.
rowThe index to read out, may be negative.
protocolFlag for layout of material on disk.

Definition at line 17238 of file pyne.cc.

◆ from_json() [1/2]

void pyne::Material::from_json ( char * filename)

Reads data from a JSON file at filename into this Material instance.

Definition at line 17972 of file pyne.cc.

◆ from_json() [2/2]

void pyne::Material::from_json ( std::string filname)

Reads data from a JSON file at filename into this Material instance.

Definition at line 17977 of file pyne.cc.

◆ from_text() [1/2]

void pyne::Material::from_text ( char * filename)

Reads data from a plaintext file at filename into this Material instance.

Definition at line 17848 of file pyne.cc.

◆ from_text() [2/2]

void pyne::Material::from_text ( std::string filename)

Reads data from a plaintext file at filename into this Material instance.

Definition at line 17854 of file pyne.cc.

◆ gammas()

std::vector< std::pair< double, double > > pyne::Material::gammas ( )

Returns a list of gamma-rays energies in keV and intensities in decays/s/atom material unnormalized.

Definition at line 18576 of file pyne.cc.

◆ get_comp_sum()

double pyne::Material::get_comp_sum ( )
protected

Computes the total mass stored in the composition.

Definition at line 17060 of file pyne.cc.

◆ load_json()

void pyne::Material::load_json ( Json::Value json)

Loads a JSON instance tree into this Material.

Definition at line 17943 of file pyne.cc.

◆ mass_density()

double pyne::Material::mass_density ( double num_dens = -1.0,
double apm = -1.0 )

Computes, sets, and returns the mass density when num_dens is greater than or equal zero.

If num_dens is negative, this simply returns the current value of the density member variable. You may also use / set the atoms per molecule (atoms_per_molecule) in this function using apm.

Definition at line 18303 of file pyne.cc.

◆ mcnp()

std::string pyne::Material::mcnp ( std::string frac_type = "mass")

Return an mcnp input deck record as a string.

Definition at line 17514 of file pyne.cc.

◆ molecular_mass()

double pyne::Material::molecular_mass ( double apm = -1.0)

Calculates the atomic weight of this material based on the composition and the number of atoms per mol.

If apm is non-negative then it is used (and stored on the instance) as the atoms_per_molecule for this calculation. If apm and atoms_per_molecule on this instance are both negative, then the best guess value calculated from the normailized composition is used here.

Definition at line 18182 of file pyne.cc.

◆ mult_by_mass()

pyne::comp_map pyne::Material::mult_by_mass ( )

Returns a composition map that has been unnormalized by multiplying each mass weight by the actual mass of the material.

Definition at line 18111 of file pyne.cc.

◆ norm_comp()

void pyne::Material::norm_comp ( )

Normalizes the mass values in the composition.

Definition at line 17071 of file pyne.cc.

◆ normalize()

void pyne::Material::normalize ( )

Normalizes the mass.

Definition at line 18105 of file pyne.cc.

◆ normalize_radioactivity()

std::vector< std::pair< double, double > > pyne::Material::normalize_radioactivity ( std::vector< std::pair< double, double > > unnormed)

Takes a list of photon energies and intensities and normalizes them so the sum of the intensities is one.

Definition at line 18624 of file pyne.cc.

◆ not_fluka_builtin()

bool pyne::Material::not_fluka_builtin ( std::string fluka_name)

Convenience function to tell whether a given name needs a material card.

------------------------------------------------------------------------—// not_fluka_builtin ------------------------------------------------------------------------—// Convenience function This is written as a negative because that is what we care about

Definition at line 17615 of file pyne.cc.

◆ number_density()

double pyne::Material::number_density ( double mass_dens = -1.0,
double apm = -1.0 )

Computes and returns the number density of the material using the mass density if mass_dens is greater than or equal to zero.

If mass_dens is negative, the denisty member variable is used instead. You may also use / set the atoms per molecule (atoms_per_molecule) in this function using apm.

Definition at line 18312 of file pyne.cc.

◆ operator*()

pyne::Material pyne::Material::operator* ( double y)

Multiplies a material's mass.

Definition at line 18681 of file pyne.cc.

◆ operator+() [1/2]

pyne::Material pyne::Material::operator+ ( double y)

Adds mass to a material instance.

Definition at line 18651 of file pyne.cc.

◆ operator+() [2/2]

pyne::Material pyne::Material::operator+ ( Material y)

Adds two materials together.

Definition at line 18658 of file pyne.cc.

◆ operator/()

pyne::Material pyne::Material::operator/ ( double y)

Divides a material's mass.

Definition at line 18688 of file pyne.cc.

◆ photons()

std::vector< std::pair< double, double > > pyne::Material::photons ( bool norm)

Returns a list of photon energies in keV and intensities in decays/s/atom material unnormalized.

Definition at line 18614 of file pyne.cc.

◆ set_mat() [1/2]

pyne::Material pyne::Material::set_mat ( std::set< int > nucset,
double value )

Creates a new Material with the mass weights for all nuclides in nucset set to value.

Elements of nucset may be either in id form or simple Z numbers.

Definition at line 18351 of file pyne.cc.

◆ set_mat() [2/2]

pyne::Material pyne::Material::set_mat ( std::set< std::string > nucset,
double value )

Creates a new Material with the mass weights for all nuclides in nucset set to value.

Elements of nucset may be in any form.

Definition at line 18373 of file pyne.cc.

◆ set_range()

pyne::Material pyne::Material::set_range ( int lower = 0,
int upper = 10000000,
double value = 0.0 )

Creates a new Material with the mass weights for all nuclides in the id range set to value.

Definition at line 18440 of file pyne.cc.

◆ sub_act()

pyne::Material pyne::Material::sub_act ( )

Creates a sub-Material of only actinides.

Definition at line 18501 of file pyne.cc.

◆ sub_elem()

pyne::Material pyne::Material::sub_elem ( int element)

Creates a sub-Material of only the given element.

Assumes element is id form.

Definition at line 18487 of file pyne.cc.

◆ sub_fp()

pyne::Material pyne::Material::sub_fp ( )

Creates a sub-Material of only fission products.

Definition at line 18521 of file pyne.cc.

◆ sub_lan()

pyne::Material pyne::Material::sub_lan ( )

Creates a sub-Material of only lanthanides.

Definition at line 18494 of file pyne.cc.

◆ sub_ma()

pyne::Material pyne::Material::sub_ma ( )

Creates a sub-Material of only minor actinides.

Definition at line 18514 of file pyne.cc.

◆ sub_mat() [1/2]

pyne::Material pyne::Material::sub_mat ( std::set< int > nucset)

Creates a sub-Material with only the nuclides present in nucset.

Elements of this set may be either in id form or simple Z numbers.

Definition at line 18323 of file pyne.cc.

◆ sub_mat() [2/2]

pyne::Material pyne::Material::sub_mat ( std::set< std::string > nucset)

Creates a sub-Material with only the nuclides present in nucset.

Elements of this set may be in any form.

Definition at line 18338 of file pyne.cc.

◆ sub_range()

pyne::Material pyne::Material::sub_range ( int lower = 0,
int upper = 10000000 )

Creates a sub-Material based on a range of id-form integers.

Definition at line 18420 of file pyne.cc.

◆ sub_tru()

pyne::Material pyne::Material::sub_tru ( )

Creates a sub-Material of only transuranics.

Definition at line 18507 of file pyne.cc.

◆ to_atom_dens()

std::map< int, double > pyne::Material::to_atom_dens ( )

Returns a mapping of the nuclides in this material to their atom densities.

This calculation is based off of the material's density.

Definition at line 18563 of file pyne.cc.

◆ to_atom_frac()

std::map< int, double > pyne::Material::to_atom_frac ( )

Returns a mapping of the nuclides in this material to their atom fractions.

This calculation is based off of the material's molecular weight.

Definition at line 18531 of file pyne.cc.

◆ write_hdf5() [1/2]

void pyne::Material::write_hdf5 ( char * filename,
char * datapath,
char * nucpath,
float row = -0.0,
int chunksize = 100 )

Writes this material out to an HDF5 file.

This happens according to protocol 1.

Parameters
filenamePath on disk to the HDF5 file.
datapathPath to the the material in the file.
nucpathPath to the nuclides set in the file.
rowThe index to read out, may be negative. Also note that this is a float. A value of -0.0 indicates that the material should be appended to the end of the dataset.
chunksizeThe chunksize for all material data on disk.

Definition at line 17285 of file pyne.cc.

◆ write_hdf5() [2/2]

void pyne::Material::write_hdf5 ( std::string filename,
std::string datapath = "/material",
std::string nucpath = "/nucid",
float row = -0.0,
int chunksize = 100 )

Writes this material out to an HDF5 file.

This happens according to protocol 1.

Parameters
filenamePath on disk to the HDF5 file.
datapathPath to the the material in the file.
nucpathPath to the nuclides set in the file.
rowThe index to read out, may be negative. Also note that this is a float. A value of -0.0 indicates that the material should be appended to the end of the dataset.
chunksizeThe chunksize for all material data on disk.

Definition at line 17294 of file pyne.cc.

◆ write_json() [1/2]

void pyne::Material::write_json ( char * filename)

Writes the Material out to a JSON file.

Definition at line 17994 of file pyne.cc.

◆ write_json() [2/2]

void pyne::Material::write_json ( std::string filename)

Writes the Material out to a JSON file.

Definition at line 17999 of file pyne.cc.

◆ write_text() [1/2]

void pyne::Material::write_text ( char * filename)

Writes the Material out to a simple plaintext file readable by from_text().

Definition at line 17905 of file pyne.cc.

◆ write_text() [2/2]

void pyne::Material::write_text ( std::string filename)

Writes the Material out to a simple plaintext file readable by from_text().

Definition at line 17911 of file pyne.cc.

◆ xrays()

std::vector< std::pair< double, double > > pyne::Material::xrays ( )

Returns a list of x-rays average energies in keV and intensities in decays/s material unnormalized.

Definition at line 18595 of file pyne.cc.

Member Data Documentation

◆ atoms_per_molecule

double pyne::Material::atoms_per_molecule

The number of atoms per molecule.

Definition at line 4956 of file pyne.h.

◆ comp

comp_map pyne::Material::comp

composition, maps nuclides in id form to normalized mass weights.

Definition at line 4953 of file pyne.h.

◆ density

double pyne::Material::density

density (in arbitrary units) of the Material.

Definition at line 4955 of file pyne.h.

◆ mass

double pyne::Material::mass

mass (in arbitrary units) of the Material.

Definition at line 4954 of file pyne.h.

◆ metadata

Json::Value pyne::Material::metadata

container for arbitrary metadata, following the JSON rules.

Definition at line 4958 of file pyne.h.


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