This tutorial demonstrates how to use example codes in the liblvls distribution examples/ directory.
Example 1: Read a level data ascii file and output to liblvls xml file.
The example code is create_spcoll_xml.c
To run create_spcoll_xml, type the following on the command line:
./create_spcoll_xml ../data_pub/levels.txt ex1_output.xml
The result is ex1_output.xml
Example 2: Read in a NIST atomic level and transition data ascii file and output to liblvls xml file.
The example code is nist_lines_xml.c
To run nist_lines_xml, type the following on the command line:
./nist_lines_xml ../data_pub/FeI_trans.txt FeI ex2_output.xml
The result is ex2_output.xml
Example 3: Print out level data for species included in an XML file.
The example code is print_species.c
To run print_species, type the following on the command line:
./print_species ../data_pub/spcoll.xml > ex3_output.txt
The result is ex3_output.txt
It is also possible to retrieve the XML level data from a remote host over the web. For example, to retrieve the level data from the webnucleo server, type:
./print_species http://liblvls.sourceforge.net/data_pub/2011-11-25/spcoll.xml > ex3_output_web.txt
The result is ex3_output_web.txt
Example 4: Read in level data from an XML file, create a Liblvls structure, and print out data for the levels for a given species in the selected units.
The example code is print_levels.c
To run print_levels, type the following on the command line:
./print_levels ../data_pub/spcoll.xml al26 keV > ex4_output.txt
The result is ex4_output.txt
It is possible to use liblvls for atomic or molecular level data as well as nuclear. For example, to view data for neutral helium (He I), type:
./print_levels ../data_pub/he_i.xml "He I" eV > ex4_output_atomic.txt
The result is ex4_output_atomic.txt
Example 5: Read in level data from an XML file, create a Liblvls structure, and print out data for the levels and for a subset of levels for a given species in the selected units.
The example code is extract_level_subset.c
To run extract_level_subset, type the following on the command line:
./extract_level_subset ../data_pub/spcoll.xml al26 keV "[properties/energy <= '2000']" > ex5_output.txt
The result is ex5_output.txt
Example 6: Read in level data from an XML file, create a Liblvls structure, and compute the partition function for each species at the input temperature.
The example code is compute_partition_functions.c
To run compute_partition_functions, type the following on the command line:
./compute_partition_functions ../data_pub/spcoll.xml 5.e8 > ex6_output.txt
The result is ex6_output.txt
Example 7: Read in level data from an XML file, create a Liblvls structure, and compute the partition function for the input species at a variety of temperatures.
The example code is compute_species_partf.c
To run compute_species_partf, type the following on the command line:
./compute_species_partf ../data_pub/spcoll.xml al26 > ex7_output.txt
The result is ex7_output.txt
Example 8: Read in level data from an XML file, create a Liblvls structure, and compute the equilibrium probabilities for the input species at the input temperature.
The example code is compute_eq_probs.c
To run compute_eq_probs, type the following on the command line:
./compute_eq_probs ../data_pub/spcoll.xml al26 1.5e9 > ex8_output.txt
The result is ex8_output.txt
Example 9: Read in level data from an XML file, create a Liblvls structure, and print the spontaneous transitions into and out of the input level for a species.
The example code is print_level_transitions.c
To run print_level_transitions, type the following on the command line:
./print_level_transitions ../data_pub/spcoll.xml al26 10 keV > ex9_output.txt
The result is ex9_output.txt
Example 10: Read in level data from an XML file, create a Liblvls structure, and compute the Einstein coefficients between two levels for the given species.
The example code is einstein_coeff.c
To run einstein_coeff, type the following on the command line:
./einstein_coeff ../data_pub/spcoll.xml al26 7 2 > ex10_output.txt
The result is ex10_output.txt
Example 11: Read in level data from an XML file, create a Liblvls structure, and compute the transition rates between two levels for the given species at the given temperature.
The example code is compute_rates.c
To run compute_rates, type the following on the command line:
./compute_rates ../data_pub/spcoll.xml al26 2.e9 7 2 > ex11_output.txt
The result is ex11_output.txt
Example 12: Read in level data from an XML file, create a Liblvls structure, and compute the rate matrix for the given species at the given temperature.
The example code is rate_matrix.c
To run rate_matrix, type the following on the command line:
./rate_matrix ../data_pub/spcoll.xml al26 1.e9 ex12_output.txt
The result is ex12_output.txt
Example 13: Read in level data from XML file(s), create a Liblvls structure, and print the input probabilities for a given species for a given zone.
The example code is zone_probs.c
To run zone_probs, type the following on the command line:
./zone_probs ../data_pub/spcoll.xml ../data_pub/zone_data.xml al26 1 0 0 > ex13_output.txt
The result is ex13_output.txt
The species collection and zone data XML files may be combined into a single liblvls input file. Use xsltproc (which you should have installed as described in the compile tutorial):
xsltproc --stringparam zone_doc ../data_pub/zone_data.xml ../xsl_pub/merge.xsl ../data_pub/spcoll.xml > ../data_pub/levels.xml
The new liblvls XML input file may be used in place of the species collection and zone data files:
./zone_probs ../data_pub/levels.xml al26 1 0 0 > ex13_output_combined.txt
The result is ex13_output_combined.txt
Example 14: Read in level data from an XML file, create a Liblvls structure, and evolve the level probabilities in the input zone for the input time, using the temperature given in the optional properties for the zone.
The example code is evolve_levels.c
To run evolve_levels, type the following on the command line:
./evolve_levels ../data_pub/levels.xml al26 1. 2 0 0 > ex14_output.txt
The result is ex14_output.txt
Example 15: Create a zone xml file from ascii input.
The example code is create_zone_xml.c
To run create_zone_xml, type the following on the command line:
./create_zone_xml ../data_pub/zone.txt ex15_output.xml
The result is ex15_output.xml
Example 16: Run a multi-zone level probability evolution calculation for for the input species for the given duration and mixing time between zones, using the temperatures given in the optional properties for the zones.
The example code is multi_zone.c
To run multi_zone, type the following on the command line:
./multi_zone ../data_pub/levels.xml al26 1. 0.1 > ex16_output.txt
The result is ex16_output.txt
Example 17: Read in a liblvls input file and calculate transition rates for any down-transitions that do not exist in the file, then write this new data to an xml file.
The example code is weisskopf.c
To run weisskopf, type the following on the command line:
./weisskopf ../data_pub/levels.xml ex17_output.xml
The result is ex17_output.xml
Example 18: Read in a liblvls input file and calculate the rates of photonic and collisional excitation between two provided levels using a temperature and hydrogen number density provided as optional zone properties.
The example code is collision.c
To run collision, type the following on the command line:
./collision ../data_pub/CO_data.xml 11 0 3 0 0 > ex18_output.txt
The result is ex18_output.txt