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__ReactionDescription: Libnucnet__Reaction is a structure that stores data for a reaction in a nuclear reaction network. Routines act on the structure to retrieve data, update data, or use data to compute reaction rates based on the data. The contents of the structure are not made public by the API. |
|
|
Name: Libnucnet__ReacDescription: Libnucnet__Reac is a structure that stores a collection of reactions for a nuclear network. Routines act on the structure to retrieve data, update data, or use data to compute reaction rates based on the data. The contents of the structure are not made public by the API. |
|
|
| Routines |
|---|
Name: Libnucnet__Reac__addNonSmokerReaction()Description: Add a reaction to a Libnucnet__Reac structure providing non-smoker data. Syntax:
void Libnucnet__Reac__addNonSmokerReaction(
Libnucnet__Reac *self, const char *s_source,
char **a_reactants, int i_reactants,
char **a_other_reactants, int i_other_reactants, char **a_products,
int i_products, char **a_other_products, int i_other_products,
double a[], double d_spint, double d_spinf, double d_tlowhf,
double d_tlowfit, double d_acc
);
Input:
For valid input, the routine updates the Libnucnet__Reac structure to include the new reaction. If the reaction data are already in the structure, they are overwritten with this data. If the input in invalid or the reaction cannot be added, Libnucnet__Reac error handling is invoked. Example: Add reaction "h1 + n -> h2 + gamma" to Libnucnet__Reac *p_my_reac with non-smoker data values a, spint, spinf, tlowhf, tlowfit, and acc:
a_reactants[0] = "h1";
a_reactants[1] = "n";
a_products[0] = "h2";
a_other_products[0] = "gamma";
Libnucnet__Reac__addNonSmokerReaction(
p_my_reac, "non_smoker example", a_reactants, 2, a_other_reactants,
0, a_products, 1, // a_other_products, 0, a, spint, spinf, tlowhf,
tlowfit, acc
);
|
|
|
Name: Libnucnet__Reac__addRateTableReaction()Description: Add a reaction to a Libnucnet__Reac structure providing a rate table. Syntax:
void Libnucnet__Reac__addRateTableReaction(
Libnucnet__Reac *self, const char *s_source,
char **a_reactants, int i_reactants,
char **a_other_reactants, int i_other_reactants, char **a_products,
int i_products, char **a_other_products, int i_other_products,
double *a_t9, double *a_rate, double *a_sef, int i_entries
);
Input:
For valid input, the routine updates the Libnucnet__Reac structure to include the new reaction. If the reaction data are already in the structure, they are overwritten with this data. If the input in invalid or the reaction cannot be added, Libnucnet__Reac error handling is invoked. Example: Add reaction "h1 + n -> h2 + gamma" to Libnucnet__Reac *p_my_reac giving 20 rate table values a_t9, a_rate, and a_sef:
a_reactants[0] = "h1";
a_reactants[1] = "n";
a_products[0] = "h2";
a_other_products[0] = "gamma";
Libnucnet__Reac__addSingleRateReaction(
p_my_reac, "example", a_reactants, 2, a_other_reactants, 0, a_products, 1,
a_other_products, 0, a_t9, a_rate, a_sef, 20
);
|
|
|
Name: Libnucnet__Reac__addSingleRateReaction()Description: Add a reaction to a Libnucnet__Reac structure providing a single rate. Syntax:
void Libnucnet__Reac__addSingleRateReaction(
Libnucnet__Reac *self, const char *s_source,
char **a_reactants, int i_reactants,
char **a_other_reactants, int i_other_reactants, char **a_products,
int i_products, char **a_other_products, int i_other_products,
double d_forward
);
Input:
For valid input, the routine updates the Libnucnet__Reac structure to include the new reaction. If the reaction data are already in the structure, they are overwritten with this data. If the input in invalid or the reaction cannot be added, Libnucnet__Reac error handling is invoked. Example: Add reaction "h1 + n -> h2" to Libnucnet__Reac *p_my_reac with a forward rate of 0.5:
a_reactants[0] = "h1";
a_reactants[1] = "n";
a_products[0] = "h2";
Libnucnet__Reac__addSingleRateReaction(
p_my_reac, "single rate example", a_reactants, 2, a_other_reactants,
0, a_products, 1, // a_other_products, 0, 0.5
);
|
|
|
Name: Libnucnet__Reac__free()Description: Free the memory allocated for a Libnucnet reaction network structure. Syntax:
void Libnucnet__Reac__free( Libnucnet__Reac *self );
Input:
Upon successful return, the memory for the network has been freed. If the input is invalid, Libnucnet__Reac error handling is invoked. Example: Free up memory used for Libnucnet__Reac *p_my_reac:
Libnucnet__Reac__free( p_my_reac );
|
|
|
Name: Libnucnet__Reac__getFirstReaction()Description: Routine to return the pointer to the first reaction in a Libnucnet__Reac structure. Syntax:
Libnucnet__Reaction *Libnucnet__Reac__getFirstReaction(
Libnucnet__Reac *self
);
Input:
Returns the pointer to the first reaction in the network. If the input reaction pointer is invalid, error handling is invoked. Example: Get the first reaction in the Libnucnet structure p_my_reac:
Libnucnet__Reaction *p_reaction =
Libnucnet__Reac__getFirstReaction( p_my_reac );
|
|
|
Name: Libnucnet__Reac__getLastReaction()Description: Routine to return the pointer to the last reaction in a Libnucnet__Reac structure. Syntax:
Libnucnet__Reaction *Libnucnet__Reac__getLastReaction(
Libnucnet__Reac *self
);
Input:
Returns the pointer to the last reaction in the network. Example: Get the last reaction in the Libnucnet structure p_my_reac: If the input reaction pointer is invalid, error handling is invoked.
Libnucnet__Reaction *p_reaction =
Libnucnet__Reac__getLastReaction( p_my_reac );
|
|
|
Name: Libnucnet__Reac__getNumberOfReactions()Description: Retrieves the number of reactions. Syntax:
int Libnucnet__Reac__getNumberOfReactions(
Libnucnet__Reac *self
);
Input:
Routine returns an integer representing the number of reactions. If the input reaction pointer is invalid, error handling is invoked. Example: Retrieve the number of reactions stored in p_reaction_list:
int i_num_reac;
i_num_reac =
Libnucnet__Reac__getNumberOfReactions(
p_reaction_list
);
|
|
|
Name: Libnucnet__Reac__getReactionByString()Description: Routine to retrieve a reaction by its string. Syntax:
Libnucnet__Reaction *Libnucnet__Reac__getReactionByString(
Libnucnet__Reac * self, char * s_reaction
);
Input:
For valid input, the routine returns a pointer to the requested reaction. If the reaction does not exist in the Libnucnet__Reac structure, the routine returns NULL. If the input Libnucnet__Reac structure is not valid, error handling is invoked. Example: Return a pointer to the reaction li7 + h1 -> he4 + he4 from the Libnucnet__Reac structure p_my_reactions and store it in Libnucnet__Reaction structure p_reaction:
p_reaction =
Libnucnet__Reac__getReactionByString(
p_my_reactions, "li7 + h1 -> he4 + he4"
);
|
|
|
Name: Libnucnet__Reac__is_valid_input_xml()Description: Validate an xml file for Libnucnet__Reac. Syntax:
int Libnucnet__Reac__is_valid_input_xml(
const char *s_xml_filename
);
Input:
For a valid input nuclear reaction data xml file, the routine returns 1 (true). For an invalid file, routine returns 0 (false). If the schema file is invalid, or if the schema file cannot be read over the web, routine stops and prints error message. Example: Validate the input xml file "reaction_data.xml":
if( Libnucnet__Reac__is_valid_input_xml( "reaction_data.xml" ) ) {
printf( "Valid xml!\" );
}
|
|
|
Name: Libnucnet__Reac__new()Description: Create a new Libnucnet__Reac structure. Syntax:
Libnucnet__Reac *Libnucnet__Reac__new( );
Output:The routine returns a pointer to a Libnucnet reaction structure. If the routine cannot allocate memory for the structure, Libnucnet_Reac error handling is invoked. Example: Create a Libnucnet reaction structure p_my_reac:
p_my_reac = Libnucnet__Reac__new();
|
|
|
Name: Libnucnet__Reac__new_from_xml()Description: Reads in nuclear network reaction data from xml file and stores the reactions in a structure. The reactions to be stored are selected with an xpath expression. Syntax:
Libnucnet__Reac *Libnucnet__Reac__new_from_xml(
const char *s_xml_filename, char *s_xpath
);
Input:
If the input is valid, routine returns a pointer to a Libnucnet reaction structure containing reactions selected by the xpath expression. If no reactions were found, p_reactions_list is empty. If the input file or xpath expression is invalid, Libnucnet__Reac error handling is invoked. Examples: Store all the reactions from "reactions.xml" to p_reactions_list:
p_reactions_list =
Libnucnet__Reac__new_from_xml( "reactions.xml", NULL );
Store the reactions from "reactions.xml" containing 'h1' as a reactant
to p_h1_reactions_list:
p_h1_reactions_list = Libnucnet__Reac__new_from_xml(
"reactions.xml", "[reactant = 'h1']"
);
|
|
|
Name: Libnucnet__Reac__removeReaction()Description: Remove a reaction from a Libnucnet__Reac structure. Syntax:
void Libnucnet__Reac__removeReaction(
Libnucnet__Reac *self, Libnucnet__Reaction *p_reaction
);
Input:
Upon successful return, the species has been removed from the Libnucnet__Reac structure. If the input reaction is invalid, Libnucnet__Reac error handling is invoked. Example: Remove the first reaction from Libnucnet__Reac *p_my_reac:
Libnucnet__Reaction *p_reaction;
p_reaction = Libnucnet__Reac__getFirstReaction( p_my_reac );
Libnucnet__Reac__removeReaction( p_my_reac, p_reaction );
|
|
|
Name: Libnucnet__Reac__updateFromXml()Description: Updates nuclear network reaction data in a Libnucnet__Reac structure from and xml file. Syntax:
Libnucnet__Reac__updateFromXml(
Libnucnet__Reac *self, const char *s_xml_filename, char *s_xpath
);
Input:
If the input is valid, routine returns a pointer to a Libnucnet Example: Update the reaction data in p_my_reaction, with data from the file "reactions_new.xml"
Libnucnet__Reac__updateFromXml( p_my_reactions, "reactions_new.xml", NULL );
|
|
|
Name: Libnucnet__Reac__writeToXmlFile()Description: Output a Libnucnet__Reac structure to an xml file. Syntax:
void Libnucnet__Reac__writeToXmlFile(
Libnucnet__Reac *self,
const char *s_xml_filename
);
Input:
Upon successful return, the contents of the collection of reactions Example: Dump the contents of Libnucnet__Reac *p_my_reactions to the xml file my.xml:
Libnucnet__Reac__writeToXmlFile( p_my_reactions, "my.xml" );
|
|
|
Name: Libnucnet__Reaction__computeRate()Description: Computes the rate of the reaction at the input temperature. Syntax:
double Libnucnet__Reaction__computeRate(
Libnucnet__Reaction *self, double d_t9
);
Input:
Routine returns the rate for the input temperature. If the input reaction or the temperature is invalid, Libnucnet__Reac error handling is invoked. Example: Print the rate for Libnucnet__Reaction * p_reaction at t9 = 3.:
printf( "Rate = %e\n",
Libnucnet__Reaction__computeRate( p_reaction, 3. )
);
|
|
|
Name: Libnucnet__Reaction__getDuplicateProductFactor()Description: Routine to retrieve the factor by which to divide a reverse reaction rate to account for duplicate products. Syntax:
double Libnucnet__Reaction__getDuplicateProductFactor(
Libnucnet__Reaction * self
);
Input:
For valid input, the routine returns a double giving the appropriate duplicate product factor for the reaction. If the reaction does not exist in the Libnucnet__Reac structure, error handling is invoked. Example: Print the duplicate product factor for the reaction he3 + he3 -> h1 + h1 + he4 the Libnucnet__Reac structure p_my_reactions (the result is 2! = 2 since there are two h1 products):
printf( "Duplicate product factor = %e\n",
Libnucnet__Reaction__getDuplicateProductFactor(
Libnucnet__Reac__getReactionByString(
p_my_reactions, "he3 + he3 -> h1 + h1 + he4"
)
)
);
|
|
|
Name: Libnucnet__Reaction__getDuplicateReactantFactor()Description: Routine to retrieve the factor by which to divide a forward reaction rate to account for duplicate reactants. Syntax:
double Libnucnet__Reaction__getDuplicateReactantFactor(
Libnucnet__Reaction * self
);
Input:
For valid input, the routine returns a double giving the appropriate duplicate reactant factor for the reaction. If the reaction does not exist in the Libnucnet__Reac structure, error handling is invoked. Example: Print the duplicate reactant factor for the reaction he4 + he4 + he4 -> c12 + gamma from the Libnucnet__Reac structure p_my_reactions (the result is 3! = 6 since there are three he4 reactants):
printf( "Duplicate reactant factor = %e\n",
Libnucnet__Reaction__getDuplicateReactantFactor(
Libnucnet__Reac__getReactionByString(
p_my_reactions, "he4 + he4 + he4 -> c12 + gamma"
)
)
);
|
|
|
Name: Libnucnet__Reaction__getIndex()Description: Routine to return the index of a reaction in a Libnucnet__Reac structure. Syntax:
int Libnucnet__Reaction__getIndex( Libnucnet__Reaction *self );
Input:
Returns the index of the reaction in the network. If the reaction is invalid, Libnucnet__Reac error handling is invoked. Example: Retrieve the index of reaction p_reaction:
int i_index = Libnucnet__Reaction__getIndex( p_reaction );
|
|
|
Name: Libnucnet__Reaction__getNext()Description: Routine to return the pointer to the next reaction in a Libnucnet__Reac structure. Syntax:
Libnucnet__Reaction *Libnucnet__Reaction__getNext(
Libnucnet__Reaction *self
);
Input:
Returns the pointer to the next reaction in the network. If the input reaction is invalid, error handling is invoked. Example: Given p_reaction, get the next reaction in the network structure:
p_reaction = Libnucnet__Reaction__getNext( p_reaction );
|
|
|
Name: Libnucnet__Reaction__getNumberOfProducts()Description: Retrieves the number of products for the specified reaction. Syntax:
int Libnucnet__Reaction__getNumberOfProducts( Libnucnet__Reac *self );
Input:
Routine returns the number of products for reaction number i_reac. If the reaction is invalid, error handling is invoked. Example: Get the number of products in reaction p_reaction:
int i_products;
i_products = Libnucnet__Reaction__getNumberOfProducts( p_reaction );
|
|
|
Name: Libnucnet__Reaction__getNumberOfReactants()Description: Retrieves the number of reactants for the specified reaction. Syntax:
int Libnucnet__Reaction__getNumberOfReactants( Libnucnet__Reaction *self );
Input:
Routine returns the number of reactants for reaction number i_reac. If the reaction is invalid, error handling is invoked. Example: Get the number of reactants in reaction p_reaction:
int i_reactants;
i_reactants = Libnucnet__Reaction__getNumberOfReactants( p_reaction );
|
|
|
Name: Libnucnet__Reaction__getPrevious()Description: Routine to return the pointer to the previous reaction in a Libnucnet__Reac structure. Syntax:
Libnucnet__Reaction *Libnucnet__Reaction__getPrevious(
Libnucnet__Reaction *self
);
Input:
Returns the pointer to the previous reaction in the network. If the input reaction is invalid, error handling is invoked. Example: Given p_reaction, get the previous reaction in the network structure:
p_reaction = Libnucnet__Reaction__getPrevious( p_reaction );
|
|
|
Name: Libnucnet__Reaction__getSource()Description: Retrieves the string containing the message about the source of the data for the specified reaction. Syntax:
char *Libnucnet__Reaction__getString( Libnucnet__Reaction *self );
Input:
Routine returns a char * containing the message about the source of the data for the reaction. If there is no information about the reaction's source, the routine returns an empty string. If the reaction is not found, error handling is invoked. Example: Print the data source for p_reaction:
printf( "Data source: %s\n", Libnucnet__Reaction__getSource( p_reaction ) );
|
|
|
Name: Libnucnet__Reaction__getString()Description: Retrieves the reaction string of the specified reaction. Syntax:
char *Libnucnet__Reaction__getString( Libnucnet__Reaction *self );
Input:
Routine returns a char * representing the reaction string. If the reaction is not found, routine returns NULL. Example: Print reaction string for reaction p_reaction:
printf( "%s\n", Libnucnet__Reaction__getString( p_reaction ) );
|
|
|
Name: Libnucnet__Reaction__printRateData()Description: Prints the rate data for a reaction. Syntax:
void Libnucnet__Reaction__printRateData( Libnucnet__Reaction *self );
Input:
Libnucnet__Reaction__printRateData( p_reaction );
|
|
|