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
-
User-Supplied Routine
-
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. |
|
|
| User-Supplied Routine |
|---|
Name: Libnucnet__Reaction__iterateFunction()Description: User-supplied routine to be applied during an iteration over the species in the species collection. Syntax:
int
Libnucnet__Reaction__iterateFunction(
Libnucnet__Reaction *self,
void *p_user_data
);
Input:
User's routine must return 1 to continue or 0 to stop. User's routine must not modify self, that is, the pointer to the input Libnucnet__Reaction structure. |
|
|
| Routines |
|---|
Name: Libnucnet__Reac__addReaction()Description: Add a reaction to a reaction collection. Syntax:
void
Libnucnet__Reac__addReaction(
Libnucnet__Reac *self,
Libnucnet__Reaction *p_reaction_to_add
);
Input:
Upon successful return, the reaction pointed to by p_reaction_to_add has been added to self. If any input is invalid, error handling is invoked. Example: Add the reaction p_reaction_to_add to p_my_reactions:
Libnucnet__Reac__addReaction(
p_my_reactions, p_reaction_to_add
);
|
|
|
Name: Libnucnet__Reac__free()Description: Free the memory allocated for a Libnucnet reaction collection 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__getDuplicateReactions()Description: Routine to get duplicate reactions in a structure. A duplicate reaction is one that either has the same reactants and products as another in the reaction collection. For example, c12 + h1 to n13 + gamma and h1 + c12 to n13 + gamma are duplicate reactions. Alternatively, a duplicate reaction may be the reverse of one already in the reaction collection since libnucnet computes reverse rates from detailed balance. For example, c14 + h1 to n14 + n and n14 + n to c14 + h1 are duplicate reactions. Syntax:
Libnucnet__Reac *
Libnucnet__Reac__getDuplicateReactions(
const Libnucnet__Reac *self
);
Input:
Returns the pointer to a new Libnucnet__Reac structure. The new structure contains the duplicate reactions. If the input reaction is invalid, error handling is invoked. Example: Given p_my_reactions, get Libnucnet__Reac structure p_my_duplicates containing the duplicate reactions.
p_my_duplicates =
Libnucnet__Reac__getDuplicateReactions( p_my_reactions );
|
|
|
Name: Libnucnet__Reac__getNumberOfReactions()Description: Retrieves the number of reactions. Syntax:
size_t
Libnucnet__Reac__getNumberOfReactions(
Libnucnet__Reac *self
);
Input:
Routine returns a size_t integer giving 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:
size_t 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,
const 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:
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__iterateReactions()Description: Iterate through the reactions and apply the user-supplied iterate function. Syntax:
void
Libnucnet__Reac__iterateReactions(
Libnucnet__Reac *self,
Libnucnet__Reaction__iterateFunction pfFunc,
void *p_user_data
);
Input:
The routine iterates through the reaction collection and applies the user-supplied routine to each reaction. If any input is invalid, error handling in invoked. Example: Iterate through the reactions in p_my_reactions and apply the function my_iterate_function and the extra data in p_user_data:
Libnucnet__Reac__iterateReactions(
p_my_reactions,
(Libnucnet__Reaction__iterateFunction) my_iterate_function,
p_user_data
);
|
|
|
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 reaction has been removed from the Libnucnet__Reac structure. If the input reaction is invalid, Libnucnet__Reac error handling is invoked. Example: Remove the reaction p_reaction from Libnucnet__Reac *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:
void
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 are written to s_xml_filename. 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__addNonSmokerFit()Description: Add a non-smoker fit to a Libnucnet__Reaction structure. Syntax:
void
Libnucnet__Reaction__addNonSmokerFit(
Libnucnet__Reaction *self,
const char *s_note,
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__Reaction structure to include the new non-smoker reaction fit data. If the input is invalid or the reaction data cannot be added, Libnucnet__Reac error handling is invoked. Example: Add the non-smoker data to a Libnucnet__Reaction *p_reaction with non-smoker data values a, spint, spinf, tlowhf, tlowfit, and acc:
Libnucnet__Reac__addNonSmokerFit(
p_reaction,
"My fit data",
a,
spint,
spinf,
tlowhf,
tlowfit,
acc
);
|
|
|
Name: Libnucnet__Reaction__addProduct()Description: Add a product to a reaction. Syntax:
void
Libnucnet__Reaction__addProduct(
Libnucnet__Reaction *self,
const char *s_product
);
Input:
For valid input, the routine updates the Libnucnet__Reaction structure to include the product. If the input is invalid or the product cannot be added, Libnucnet__Reac error handling is invoked. Example: Add the product "n13" to the reaction p_reaction:
Libnucnet__Reaction__addProduct(
p_my_reaction,
"n13"
);
|
|
|
Name: Libnucnet__Reaction__addReactant()Description: Add a reactant to a reaction. Syntax:
void
Libnucnet__Reaction__addReactant(
Libnucnet__Reaction *self,
const char *s_reactant
);
Input:
For valid input, the routine updates the Libnucnet__Reaction structure to include the reactant. If the input is invalid or the reactant cannot be added, Libnucnet__Reac error handling is invoked. Example: Add the reactant "h1" to the reaction p_reaction:
Libnucnet__Reaction__addReactant(
p_my_reaction,
"h1"
);
|
|
|
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__getNumberOfProducts()Description: Retrieves the number of products for the specified reaction. Syntax:
size_t
Libnucnet__Reaction__getNumberOfProducts( Libnucnet__Reac *self );
Input:
Routine returns the number of products for the input reaction. If the reaction is invalid, error handling is invoked. Example: Get the number of products in reaction p_reaction:
size_t i_products;
i_products = Libnucnet__Reaction__getNumberOfProducts( p_reaction );
|
|
|
Name: Libnucnet__Reaction__getNumberOfReactants()Description: Retrieves the number of reactants for the specified reaction. Syntax:
size_t
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:
size_t i_reactants;
i_reactants = Libnucnet__Reaction__getNumberOfReactants( p_reaction );
|
|
|
Name: Libnucnet__Reaction__getParentDuplicate()Description: Get the reaction of which the current reaction is a duplicate. Syntax:
Libnucnet__Reaction *
Libnucnet__Reaction__getParentDuplicate(
Libnucnet__Reaction *self
);
Input:
The routine returns a pointer to the reaction the current reaction is a duplicate of (in the Libnucnet__Reac structure that was originally scanned for duplicates). If the parent reaction is no longer present, the routine returns NULL. If the input reaction is invalid, error handling is invoked. Example: Print the reaction of which p_reaction is a duplicate:
printf(
"%s is a duplicate of %s\n",
Libnucnet__Reaction__getString( p_reaction ),
Libnucnet__Reaction__getString(
Libnucnet__Reaction__getParentDuplicate( p_reaction )
)
);
|
|
|
Name: Libnucnet__Reaction__getSource()Description: Retrieves the string containing the message about the source of the data for the specified reaction. Syntax:
const char *
Libnucnet__Reaction__getSource( 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:
const 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 );
|
|
|
Name: Libnucnet__Reaction__updateRateTable()Description: Update rate table for a reaction. Syntax:
void
Libnucnet__Reaction__updateRateTable(
Libnucnet__Reaction *self,
gsl_vector *p_t9,
gsl_vector *p_rate,
gsl_vector *p_sef
);
Input:
For valid input, the routine updates the rate table for the input Libnucnet__Reaction structure to include the new data. If the data are already in the structure, they are overwritten with these new data. If the input is invalid or the data cannot be added, Libnucnet__Reac error handling is invoked. Example: Update a Libnucnet__Reaction p_reaction table with the rate table values contained in the gsl_vectors p_t9, p_rate, and p_sef:
Libnucnet__Reaction__addRateTable(
p_reaction,
p_t9,
p_rate,
p_sef
);
|
|
|
Name: Libnucnet__Reaction__updateSingleRate()Description: Update the single reaction rate for a reaction. Syntax:
void
Libnucnet__Reaction__updateSingleRate(
Libnucnet__Reaction *self,
double d_forward
);
Input:
For valid input, the routine updates the Libnucnet__Reaction structure to have the new single rate. If the reaction data are already in the structure, they are overwritten with this data. If the input is invalid, Libnucnet__Reac error handling is invoked. Example: Update Libnucnet__Reaction *p_my_reaction with a forward rate of 0.5:
Libnucnet__Reaction__updateSingleRate(
p_my_reaction,
0.5
);
|
|
|
Name: Libnucnet__Reaction__updateSource()Description: Update the source string for a reaction. Syntax:
void
Libnucnet__Reaction__updateSource(
Libnucnet__Reaction *self,
const char *s_source
);
Input:
For valid input, the routine updates the Libnucnet__Reaction structure to have the new source string. If the reaction source string is already in the structure, it is overwritten with this data. If the input is invalid, Libnucnet__Reac error handling is invoked. Example: Update the reaction Libnucnet__Reaction *p_my_reaction with a message "My data":
Libnucnet__Reaction__updateSource(
p_my_reaction,
"My data"
);
|
|
|