Warning: This is no longer the latest available version of this module. Please see the releases page for the most recent version. The Webnucleo group strongly recommends the use of the latest version of any of its online modules.
Documentation from the file
Table of Contents
-
Structures
-
Routines
| Structures |
|---|
Name: Libnucnet__SpeciesDescription: Libnucnet__Species is a structure that stores nuclear data for a particular nuclear species. Routines act on the structure to retrieve data, update data, or use data to compute functions of the nuclear data, such as the nuclear partition function. The contents of the structure are not made public by the API. |
|
|
Name: Libnucnet__NucDescription: Libnucnet__Nuc is a structure that stores the collection of nuclear species. Routines act on the structure to retrieve species or add or remove them. The contents of the structure are not made public by the API. |
|
|
| Routines |
|---|
Name: Libnucnet__Nuc__addSpecies()Description: Add a species to a Libnucnet__Nuc structure with the input data. Syntax:
void Libnucnet__Nuc__addSpecies(
Libnucnet__Nuc *self, int i_z, int i_a, const char *s_source,
int i_state_flag, const char *s_state, double d_mass_excess,
double d_spin, int i_partf_count, double a_t9[], double a_log10_partf[]
);
Input:
For valid input, the routine updates the Libnucnet__Nuc structure to include the new species. If the species cannot be added, for example, if the species already exists in the structure, Libnucnet__Nuc error handling is invoked. Examples: Add li7 (Z = 3, A = 7, spin = 3/2, mass excess = 14.908 MeV) to Libnucnet__Nuc *p_my_nuclei:
double a_t9[10] = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
double a_log10_partf[10] =
[1., 1.1, 1.2, 1.5, 2.0, 3.0, 5., 10., 20., 100.];
Libnucnet__Nuc__addSpecies(
p_my_nuclei, 3, 7, "example", 0, "", 14.908, 1.5, 10, a_t9, a_log10_partf
);
Add ground state (g) of al26 (Z = 13, A = 26, spin = 5, mass
excess = -12.210 MeV) and metastable state (m) of al26 (Z = 13, A =
26, spin = 0, mass excess = -11.982) to Libnucnet__Nuc *p_my_nuclei:
double a_t9_g[10] = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
double a_log10_partf_g[10] =
[1., 1.1, 1.2, 1.5, 2.0, 3.0, 5., 10., 20., 100.];
double a_t9[10]_m = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
double a_log10_partf[10] =
[1., 1.1, 1.2, 1.5, 2.0, 3.0, 5., 10., 20., 100.];
Libnucnet__Nuc__addSpecies(
p_my_nuclei, 13, 26, "example data", 1, "g", -12.210, 5., 10, a_t9_g,
a_log10_partf_g
);
Libnucnet__Nuc__addSpecies(
p_my_nuclei, 13, 26, "example data", 1, "m", -11.982, 0., 10, a_t9_m,
a_log10_partf_m
);
|
|
|
Name: Libnucnet__Nuc__computeSpeciesNseFactor()Description: Compute the NSE factor of a species in the collection of nuclear species. Syntax:
double Libnucnet__Nuc__computeSpeciesNseFactor(
Libnucnet__ *self, Libnucnet__Species *p_species, double d_t9,
double d_rho
);
Input:
Routine returns a pointer to a double representing the NSE factor of the requested species. Example: Get the NSE factor for p_species at temperature 1 billion K and 100 g/cc in nuclear species collection p_my_nuclei:
d_nse_factor =
Libnucnet__Nuc__computeSpeciesNseFactor(
p_my_nuclei, p_species, 1., 100.
);
|
|
|
Name: Libnucnet__Nuc__free()Description: Free the memory allocated for a Libnucnet nuclear species collection. Syntax:
void Libnucnet__Nuc__free( Libnucnet__Nuc *self );
Input:
Upon successful return, the memory for the collection has been freed. Example: Free up memory used for Libnucnet__Nuc *p_my_nuclei:
Libnucnet__Nuc__free( p_my_nuclei );
|
|
|
Name: Libnucnet__Nuc__getFirstSpecies()Description: Routine to return the pointer to the first species in a Libnucnet__Nuc structure. Syntax:
Libnucnet__Species *Libnucnet__Nuc__getFirstSpecies(
Libnucnet__Nuc *self
);
Input:
Returns the pointer to the first species in the nuclear species collection. If the input structure is not valid, error handling is invoked. Example: Get the first species in the Libnucnet structure p_my_nuclei:
Libnucnet__Species * p_species =
Libnucnet__Nuc__getFirstSpecies( p_my_nuclei );
|
|
|
Name: Libnucnet__Nuc__getLastSpecies()Description: Routine to return the pointer to the last species in a Libnucnet__Nuc structure. Syntax:
Libnucnet__Species *Libnucnet__Nuc__getLastSpecies(
Libnucnet__Nuc *self
);
Input:
Returns the pointer to the last species in the nuclear species collection. If the input structure is not valid, error handling is invoked. Example: Get the last species in the Libnucnet structure p_my_nuclei:
Libnucnet__Species * p_species =
Libnucnet__Nuc__getLastSpecies( p_my_nuclei );
|
|
|
Name: Libnucnet__Nuc__getNumberOfSpecies()Description: Retrieves the number of species in the collection of nuclear species. Syntax:
int Libnucnet__Nuc__getNumberOfSpecies( Libnucnet__Nuc *self );
Input:
Routine returns an integer representing the number of species in the collection of nuclear species. If the input is invalid, error handling is invoked. Example: Get number of species in nuclear data collection p_my_nuclei:
int i_species_count;
i_species_count = Libnucnet__Nuc__getNumberOfSpecies( p_my_nuclei );
|
|
|
Name: Libnucnet__Nuc__getSpeciesByName()Description: Retrieves the specified species. Syntax:
Libnucnet__Species *Libnucnet__Nuc__getSpeciesByName(
Libnucnet__Nuc *self, const char *s_nucname
);
Input:
Routine returns a pointer to a Libnucnet__Species structure. If the species is not found, routine returns NULL. If the input structure is invalid, error handling is invoked. Example: Retrieve he4 from nuclear data collection p_my_nuclei:
p_he4 =
Libnucnet__Nuc__getSpeciesByName( p_my_nuclei, "he4" );
|
|
|
Name: Libnucnet__Nuc__getSpeciesByZA()Description: Retrieves a species in the collection of species given the Z, A, and state of the species. Syntax:
Libnucnet__Species *Libnucnet__Nuc__getSpeciesByZA(
Libnucnet__Nuc *self, int i_z, int i_a, const char *s_state
);
Input:
Routine returns a pointer to the species retrieved. If no such species is found, the routine returns a NULL. Examples: Get the pointer to the species al27 in nuclear data structure p_my_nuclei:
Libnucnet__Species *p_al27;
p_al27 =
Libnucnet__Nuc__getSpeciesByZA( p_my_nuclei, 13, 27, NULL ) );
Get the pointer to species al26m in a collection of species
p_my_nuclei:
Libnucnet__Species *p_al26m;
p_al26_m =
Libnucnet__Nuc__getSpeciesByZA( p_my_nuclei, 13, 26, 'm' ) );
|
|
|
Name: Libnucnet__Nuc__is_valid_input_xml()Description: Validate an xml file for Libnucnet__Nuc. Syntax:
int Libnucnet__Nuc__is_valid_input_xml(
const char *s_xml_filename
);
Input:
For a valid input nuclear data xml file, the routine returns 1 (true). If the input file is not valid, routine returns 0 (false). For an invalid schema file, or if the schema file cannot be read over the web, routine stops and prints error message. Example: Validate the input xml file "nuclear_data.xml":
if( Libnucnet__Nuc__is_valid_input_xml( "nuclear_data.xml" ) ) {
printf( "Valid xml!\n" );
}
|
|
|
Name: Libnucnet__Nuc__new()Description: Create a new Libnucnet__Nuc structure. Syntax:
Libnucnet__Nuc *Libnucnet__Nuc__new( );
Output:The routine returns a pointer to a Libnucnet__Nuc structure, that is, a collection of nuclear species. If it is not possible to allocate memory for the new structure, Libnucnet error handling is invoked. Example: Create a Libnucnet__Nuc structure p_my_nuclei:
p_my_nuclei = Libnucnet__Nuc__new( );
|
|
|
Name: Libnucnet__Nuc__new_from_xml()Description: Creates a Libnucnet__Nuc structure from an input xml nuclear data file. Syntax:
Libnucnet__Nuc *Libnucnet__Nuc__new_from_xml(
const char *s_xml_filename, const char *s_xpath
);
Input:
For a valid input nuclear data xml file, the routine returns a pointer to a Libnucnet__Nuc structure. If the routine cannot allocate enough or if the xpath expression is invalid, Libnucnet__Nuc error handling is invoked. Examples: Store the nuclear data in "nuclear_data.xml" to p_my_nuclei:
p_my_nuclei = Libnucnet__Nuc__new_from_xml( "nuclear_data.xml", NULL );
Store the nuclear data for neutrons and protons and nuclei with
z >= 6 in "nuclear_data.xml" to p_my_nuclei:
p_my_nuclei =
Libnucnet__Nuc__new_from_xml(
"nuclear_data.xml", "[ a = 1 or z >= 6]"
);
|
|
|
Name: Libnucnet__Nuc__removeSpecies()Description: Remove a species from a Libnucnet__Nuc structure. Syntax:
void Libnucnet__Nuc__removeSpecies(
Libnucnet__Nuc *self, Libnucnet__Species *p_species
);
Input:
Upon successful return, the species has been removed from the Libnucnet__Nuc structure. If the input is invalid, Libnucnet__Nuc error handling is invoked. Example: Remove he4 from Libnucnet__Nuc *p_my_nuclei:
Libnucnet__Species *p_he4 =
Libnucnet__Nuc__getSpeciesByName( p_my_nuclei, "he4" );
Libnucnet__Nuc__removeSpecies( p_my_nuclei, p_he4 );
|
|
|
Name: Libnucnet__Nuc__sortSpecies()Description: Sort the species in a Libnucnet__Nuc structure in increasing Z and A. Syntax:
void Libnucnet__Nuc__sortSpecies( Libnucnet__Nuc *self );
Input:
On successful return, the species in the structure have been sorted so that successive species are higher in Z and/or A. If the input structure is not valid, error handling is invoked. Example: Sort the species in p_my_nuclei:
Libnucnet__Nuc__sortSpecies( p_my_nuclei );
|
|
|
Name: Libnucnet__Nuc__updateFromXml()Description: Updates the data in a Libnucnet__Nuc structure from an input xml nuclear data file. Syntax:
void Libnucnet__Nuc__updateFromXml(
Libnucnet__Nuc *self, const char *s_xml_filename, const char *s_xpath
);
Input:
For a valid Libnucnet__Nuc structure and a valid input nuclear data xml file, the routine updates the structure with the data in the input data file. If the routine cannot allocate enough memory or if the xpath expression is invalid, Libnucnet__Nuc error handling is invoked. Example: Update the data in p_my_nuclei with data in "new_nuclear_data.xml":
Libnucnet__Nuc__updateFromXml( p_my_nuclei, "new_nuclear_data.xml", NULL );
|
|
|
Name: Libnucnet__Nuc__writeToXmlFile()Description: Output a Libnucnet__Nuc structure to an xml file. Syntax:
void Libnucnet__Nuc__writeToXmlFile(
Libnucnet__Nuc *self,
const char *s_xml_filename
);
Input:
Upon successful return, the contents of the collection of species have been written to an xml file. If the input is invalid, Libnucnet__Nuc error handling is invoked. Example: Dump the contents of Libnucnet__Nuc *p_my_nuclei to the xml file my.xml:
Libnucnet__Nuc__writeToXmlFile( p_my_nuclei, "my.xml" );
|
|
|
Name: Libnucnet__Species__getA()Description: Retrieves the A of a species in the collection of nuclear species. Syntax:
int Libnucnet__Species__getA( Libnucnet__Species *self );
Input:
Routine returns the A of the input species. If the species is invalid, Libnucnet__Nuc error handling is invoked. Example: Print the A of au197 in p_my_nuclei (should of course be 197!):
p_species = Libnucnet__Nuc__getSpeciesByName( p_my_nuclei, "au197" );
if( p_species )
printf( "A = %d\n", Libnucnet__Species__getA( p_species ) );
|
|
|
Name: Libnucnet__Species__getIndex()Description: Routine to return the index of a species in a Libnucnet__Nuc structure. Syntax:
int Libnucnet__Species__getIndex( Libnucnet__Species *self );
Input:
Returns the index of the species in the nuclear species collection. If the species is invalid, Libnucnet__Nuc error handling is invoked. Example: Print the index of he4 in the Libnucnet structure p_my_nuclei:
if(
p_he4 =
Libnucnet__Nuc__getSpeciesByName(
p_my_nuclei, "he4"
)
) {
printf(
"Index of he4 = %d\n",
Libnucnet__Species__getIndex( p_he4 )
);
}
|
|
|
Name: Libnucnet__Species__getMassExcess()Description: Retrieves the mass excess of a species in the nuclear species collection given the index of the species. Syntax:
double Libnucnet__Species__getMassExcess( Libnucnet__Species *self );
Input:
Routine returns a double giving the mass excess of the requested species. If the input species is invalid, error handling is invoked. Example: Print the mass excess of sn120 in the structure Libnucnet__Nuc *p_my_nuclei:
p_species = Libnucnet__Nuc__getSpeciesByName( p_my_nuclei, "sn120" );
if( p_species ) {
printf(
"Mass excess (MeV) = %lf\n,
Libnucnet__Species__getMassExcess( p_species )
);
}
|
|
|
Name: Libnucnet__Species__getName()Description: Retrieves the name of a species in the collection of nuclear species. Syntax:
char *Libnucnet__Species__getName( Libnucnet__Species *self );
Input:
Routine returns a string representing the name of the requested species. If the species is not valid, Libnucnet__Nuc error handling is invoked. Example: Print the name of the Libnucnet__Species *p_species:
printf( "Name of species = %s\n",
Libnucnet__Species__getName( p_species )
);
|
|
|
Name: Libnucnet__Species__getNext()Description: Routine to return the pointer to the next species in a Libnucnet__Nuc structure. Syntax:
Libnucnet__Species *Libnucnet__Species__getNext(
Libnucnet__Species *self
);
Input:
Returns the pointer to the next species in the nuclear species collection. If the species is invalid, error handling is invoked. Example: Given p_species, get the next species in the nuclear species collection:
p_species = Libnucnet__Species__getNext( p_species );
|
|
|
Name: Libnucnet__Species__getPartitionFunction()Description: Retrieves the partition function of a species in the collection of nuclear species given the temperature. Syntax:
double Libnucnet__Species__getPartitionFunction(
Libnucnet__Species *self, double d_t9
);
Input:
Routine returns a double representing the partition function of the species retrieved. If input is invalid, error handling is invoked. Example: Get the partition function of he4 in the collection of nuclear species p_my_nuclei at a t9 of 0.2:
if(
(
p_species =
Libnucnet__Nuc__getSpeciesByName( p_my_nuclei, "he4" )
)
) {
d_partf =
Libnucnet__Species__getPartitionFunction( p_species, 0.2 );
}
|
|
|
Name: Libnucnet__Species__getPrevious()Description: Routine to return the pointer to the previous species in a Libnucnet__Nuc structure. Syntax:
Libnucnet__Species *Libnucnet__Species__getPrevious(
Libnucnet__Species *self
);
Input:
Returns the pointer to the previous species in the nuclear species collection. If the species is invalid, error handling is invoked. Example: Given p_species, get the previous species in the nuclear species collection:
p_species = Libnucnet__Species__getPrevious( p_species );
|
|
|
Name: Libnucnet__Species__getSource()Description: Retrieves the message about the source of data for a species in the collection of nuclear species. Syntax:
char *Libnucnet__Species__getSource( Libnucnet__Species *self );
Input:
Routine returns a string containing information about the data for the requested species. If there are no data, an empty string is returned. If the species is not valid, Libnucnet__Nuc error handling is invoked. Example: Print the source information about the Libnucnet__Species *p_species:
printf( "Data source for species = %s\n",
Libnucnet__Species__getSource( p_species )
);
|
|
|
Name: Libnucnet__Species__getSpin()Description: Retrieves the spin of a species in the collection of nuclear species. Syntax:
double Libnucnet__Species__getSpin( Libnucnet__Species *self );
Input:
Routine returns a double giving the spin of the requested species. If the species is invalid, Libnucnet__Nuc error handling is invoked. Example: Print the spin of bi209 in the Libnucnet__Nuc structure *p_my_nuclei:
if(
( p_species = Libnucnet__Nuc__getSpeciesByName( p_my_nuclei, "bi209 ) )
)
{
printf( "Spin = "%lf\n", Libnucnet__Species__getSpin( p_species ) );
}
|
|
|
Name: Libnucnet__Species__getZ()Description: Retrieves the Z of a species in the collection of nuclear species. Syntax:
int Libnucnet__Species__getZ( Libnucnet__Species *self );
Input:
Routine returns the Z of the input species. If the species is invalid, Libnucnet__Nuc error handling is invoked. Example: Print the Z of au197 in p_my_nuclei:
p_species = Libnucnet__Nuc__getSpeciesByName( p_my_nuclei, "au197" );
if( p_species )
printf( "Z = %d\n", Libnucnet__Species__getZ( p_species ) );
|
|
|