Examples

Fortran

program example_in_f
    use ciaaw
    implicit none

    character(len=8) :: s

    ! ASAW = Abridged Standard Atomic Weight
    ! SAW  = Standard Atomic Weight
    ! ICE  = Isotopic Composition of the Element
    ! NAW  = Nuclide Atomic Weight
    ! U    = Uncertainty

    print '(A)', '########### CIAAW VERSION ##########'
    print *, "version ", get_version()  

    print '(A)', '########### CIAAW SAW ##########'
    print '(A10, F10.5)', 'ASAW H   = ', get_saw("H", abridged=.true.)
    print '(A10, F10.5)', 'U ASAW H = ', get_saw("H", uncertainty=.true.)
    print '(A10, F10.5)', 'SAW H    = ', get_saw("H", abridged = .false.)
    print '(A10, F10.5)', 'U SAW H  =  ', get_saw("H", abridged = .false., uncertainty = .true.)
    print '(A10, F10.5)', 'ASAW T   = ', get_saw("Tc", abridged=.true.)

    print '(A)', '########### CIAAW ICE ##########'
    print '(A, I3)',        'N ICE H    = ', get_nice("H")
    print '(A, F12.6)',   'ICE H 1    = ', get_ice("H", A=1)
    print '(A, ES23.16)', 'U ICE H 1  = ', get_ice("H", A=1, uncertainty=.true.)
    print '(A, F12.6)',   'ICE H 2    = ', get_ice("H", A=2)
    print '(A, ES23.16)', 'U ICE H 2  = ', get_ice("H", A=2, uncertainty=.true.)
    print '(A, I3)',        'N ICE Tc   = ', get_nice("Tc")
    print '(A, I3)',        'N ICE C    = ', get_nice("C")

    print '(A)', '########### CIAAW NAW ##########'
    print '(A, ES23.16)',   'NAW H 2     = ', get_naw("H", A=2)
    print '(A, ES23.16)',   'U NAW H 2   = ', get_naw("H", A=2, uncertainty=.true.)
    print '(A, I3)',          'N NAW Tc    = ', get_nnaw("Tc")

end program

C

#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <stdbool.h>
#include "ciaaw.h"


    // ASAW = Abridged Standard Atomic Weight
    // SAW  = Standard Atomic Weight
    // ICE  = Isotopic Composition of the Element
    // NAW  = Nuclide Atomic Weight
    // U    = Uncertainty

int main(void){


    printf("%s\n", "########## CIAAW VERSION ##########");
    printf("version %s\n", ciaaw_get_version());

    printf("%s\n", "########## CIAAW SAW ##########");
    printf("%s %10.5f\n", "ASAW H   = ", ciaaw_get_saw("H", 1, true, false));
    printf("%s %10.5f\n", "U ASAW H = ", ciaaw_get_saw("H", 1, true, true));
    printf("%s %10.5f\n", "SAW H    = ", ciaaw_get_saw("H", 1, false, false));
    printf("%s %10.5f\n", "U SAW H  = ", ciaaw_get_saw("H", 1, false, true));
    printf("%s %10.5f\n", "ASAW Tc  = ", ciaaw_get_saw("Tc", 2, true, false));

    printf("%s\n", "########## CIAAW ICE ##########");
    printf("%s %d\n",     "N ICE H      = ", ciaaw_get_nice("H", 1));
    printf("%s %12.6f\n", "ICE H 1      = ", ciaaw_get_ice("H", 1, 1, false)); 
    printf("%s %23.16e\n","U ICE H 1    = ", ciaaw_get_ice("H", 1, 1, true)); 
    printf("%s %12.6f\n", "ICE H 2      = ", ciaaw_get_ice("H", 1, 2, false)); 
    printf("%s %23.16e\n","U ICE H 2    = ", ciaaw_get_ice("H", 1, 2, true)); 
    printf("%s %d\n",     "N ICE Tc     = ", ciaaw_get_nice("Tc", 2));
    printf("%s %d\n",     "N ICE C      = ", ciaaw_get_nice("C", 1));

    printf("%s\n", "########## CIAAW NAW ##########");
    printf("%s %23.16f\n", "NAW H 2      = ", ciaaw_get_naw("H", 1, 2, false)); 
    printf("%s %23.16e\n", "U NAW H 2    = ", ciaaw_get_naw("H", 1, 2, true)); 
    printf("%s %d\n",      "N NAW Tc     = ", ciaaw_get_nnaw("Tc", 2));

    return EXIT_SUCCESS;
    }

Python

r"""Example in python"""
import sys
sys.path.insert(0, "../py/src/")
import pyciaaw

# ASAW = Abridged Standard Atomic Weight
# SAW  = Standard Atomic Weight
# ICE  = Isotopic Composition of the Element
# NAW  = Nuclide Atomic Weight
# U    = Uncertainty

print("########## CIAAW VERSION ##########")
print("version ", pyciaaw.__version__)

print("########## CIAAW SAW  ##########")
print("ASAW H   = ", pyciaaw.get_saw("H"))
print("U ASAW H = ", pyciaaw.get_saw("H", uncertainty=True))
print("SAW H    = ", pyciaaw.get_saw("H", abridged=False, uncertainty=False))
print("U SAW H  = ", pyciaaw.get_saw("H", abridged=False, uncertainty=True))
print("ASAW Tc  = ", pyciaaw.get_saw("Tc"))


print("########## CIAAW ICE  ##########")
print("N ICE H   = ", pyciaaw.get_nice("H"))
print('ICE H 1   = ', pyciaaw.get_ice("H", A=1))
print('U ICE H 1 = ', pyciaaw.get_ice("H", A=1, uncertainty=True))
print('ICE H 2   = ', pyciaaw.get_ice("H", A=2))
print('U ICE H 2 = ', pyciaaw.get_ice("H", A=2, uncertainty=True))
print("N ICE Tc  = ", pyciaaw.get_nice("Tc"))
print("N ICE C   = ", pyciaaw.get_nice("C"))

print("########## CIAAW NAW  ##########")
print('NAW H 2   = ', pyciaaw.get_naw("H", A=2))
print('U NAW H 2 = ', pyciaaw.get_naw("H", A=2, uncertainty=True))
print("N NAW Tc  = ", pyciaaw.get_nnaw("Tc"))