Webnucleo.org

Mail Lists | Developers
small logo


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.

This tutorial demonstrates how to use example codes in the libnucnet distribution src/examples directory. The sample input files used in the tutorial are included in the distribution release and may be located in the data_pub directory.

Example 1: Create a collection of nuclei, add species from a text file, and remove them.

libnucnet routines demonstrated in example1.c are:

To run example1, type the following on the command line:


./example1 > ex1_output.txt

The result is ex1_output.txt

-top-

Example 2: Create a collection of nuclei, add species, and write data to an xml file.

libnucnet routines demonstrated in example2.c are:

To run example2, type the following on the command line:


./example2 ../../data_pub/example_nuc.txt ex2_output.xml

The result is ex2_output.xml

-top-

Example 3: Validate a Libnucnet__Nuc input xml file against Webnucleo's schema.

libnucnet routines demonstrated in example3.c are:

To run example3, type the following on the command line:


./example3 ../../data_pub/example_nuc.xml

The result is


Valid input Libnucnet__Nuc xml file!

To see what happens when the input xml is invalid (the following input file has a negative mass number for the neutron), type:


./example3 ../../data_pub/example_nuc_wrong.xml

The result is



../../data_pub/example_nuc_wrong.xml:58: element a: Schemas validity error : Element 'a': '-1' is not a valid value of the atomic type '{http://www.webnucleo.org/home/modules/libnucnet/0.5/xsd_pub/libnucnet__nuc__types/}a_type'.
        

-top-

Example 4: Create a collection of nuclei from an input xml file and output the data about each species.

libnucnet routines demonstrated in example4.c are:

To run example4, type the following on the command line:


./example4 ../../data_pub/example_nuc.xml > ex4_output.txt

The result is ex4_output.txt

You can also select out certain species with an xpath expression. For example, to select only isotopes of elements between and including neon and calcium, type:


./example4 ../../data_pub/example_nuc.xml "[ z >= 10 and z <= 20 ]" > ex4_xpath_output.txt

The result is ex4_xpath_output.txt

Finally note you can also read data over the web. For example, to select data from the original example xml file residing on Webnucleo's server, type:


./example4 http://www.webnucleo.org/home/modules/libnucnet/0.5/data_pub/example_nuc.xml > ex4_web_output.txt

The result is ex4_web_output.txt

-top-

Example 5: Sort the species in a collection of nuclei according to a user-supplied function.

libnucnet routines demonstrated in example5.c are:

To run example5, type the following on the command line:


./example5 ../../data_pub/example_nuc.xml > ex5_output.txt

The result is ex5_output.txt

-top-

Example 6: Create a collection of nuclei from an input xml file and output a subset chosen by an xpath expression to a new file.

libnucnet routines demonstrated in example6.c are:

To output data about nuclei in the input file with atomic number less than or equal to 10, type:


./example6 ../../data_pub/example_nuc.xml "[z <= 10]" ex6_output.xml

The result is ex6_output.xml

-top-

Example 7: Create a collection of nuclei from data read over the web, output the data, modify the nuclear data with data from a local file, and output the updated data.

libnucnet routines demonstrated in example7.c are:

To modify data for Z < 5 from the original Webnucleo.org nuclear data file with data from a local file (the changes are modified data for beryllium-7 and the addition of carbon 12), type at the command line:


./example7 http://www.webnucleo.org/home/modules/libnucnet/0.5/data_pub/example_nuc.xml ../../data_pub/example_nuc_new.xml "[ z < 5 ]" > ex7_output.txt

The result is ex7_output.txt

-top-

Example 8: Create a collection of nuclei from an input xml file and print out data about a particular species selected by its name.

libnucnet routines demonstrated in example8.c are:

To run example8, type the following on the command line:


./example8 ../../data_pub/example_nuc.xml si28 > ex8_output.txt

The result is ex8_output.txt

-top-

Example 9: Create a collection of nuclei from an input xml file and output data about a particular species selected by its charge, mass, and state.

libnucnet routines demonstrated in example9.c are:

To run example9, type the following on the command line:


./example9 ../../data_pub/example_nuc.xml 13 27 > ex9_output.txt

The result is ex9_output.txt

When there are multiple states present for the isotope, select them by their state index (for example, g or m):


./example9 ../../data_pub/example_nuc.xml 13 26 m > ex9_state_output.txt

The result is ex9_state_output.txt

-top-

Example 10: Create a collection of nuclei from an input xml file and print out the nuclear partition function for a particular species selected by its name.

libnucnet routines demonstrated in example10.c are:

To run example10, type the following on the command line:


./example10 ../../data_pub/example_nuc.xml ca42 > ex10_output.txt

The result is ex10_output.txt

-top-

Example 11: Create a collection of nuclei from an input xml file and print out the nuclear partition function for a particular species selected by its charge, mass, and state.

libnucnet routines demonstrated in example11.c are:

To run example11, type the following on the command line:


./example11 ../../data_pub/example_nuc.xml 13 27 > ex11_output.txt

The result is ex11_output.txt

When there are multiple states present for the isotope, select them by their state index (for example, g or m):


./example11 ../../data_pub/example_nuc.xml 13 26 m > ex11_state_output.txt

The result is ex11_state_output.txt

-top-



Valid XHTML 1.1        Copyright © 2001-2012, Clemson University. All rights reserved.        Valid CSS!
Page last modified on 2010/01/11 22:08