Examples

Fortran

program example_in_f
    use ciaaw
    implicit none

    type(saw_type) :: elmt

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

    print '(A)', '########### CIAAW SAW ##########'
    elmt = H
    print '(A, A)', 'Element: ', elmt%element
    print '(A, A)', 'Symbol: ', elmt%symbol
    print '(A, I3)', 'Z: ', elmt%z
    print '(A, F23.16)', 'standard atomic weight max: ', elmt%saw_max
    print '(A, F23.16)', 'standard atomic weight min: ', elmt%saw_min
    print '(A, F23.16)', 'standard atomic weight: ', elmt%saw
    print '(A, F23.16)', 'standard atomic weight uncertainty: ', elmt%saw_u
    print '(A, F23.16)', 'abredged standard atomic weight: ', elmt%asaw
    print '(A, F23.16)', 'abredged standard atomic weight uncertainty: ', elmt%asaw_u
    print '(A)', '' 
    elmt = F
    print '(A, A)', 'Element: ', elmt%element
    print '(A, A)', 'Symbol: ', elmt%symbol
    print '(A, I3)', 'Z: ', elmt%z
    print '(A, F23.16)', 'standard atomic weight max: ', elmt%saw_max
    print '(A, F23.16)', 'standard atomic weight min: ', elmt%saw_min
    print '(A, F23.16)', 'standard atomic weight: ', elmt%saw
    print '(A, F23.16)', 'standard atomic weight uncertainty: ', elmt%saw_u
    print '(A, F23.16)', 'abredged standard atomic weight: ', elmt%asaw
    print '(A, F23.16)', 'abredged standard atomic weight uncertainty: ', elmt%asaw_u

end program

C

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


int main(void){

    struct ciaaw_saw_type elmt;

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

    printf("%s\n", "########## CIAAW SAW ##########");
    elmt = ciaaw_saw_H;
    printf("%s %s\n", "Element: ", elmt.element);
    printf("%s %s\n", "Symbol: ", elmt.symbol);
    printf("%s %d\n", "Z: ", elmt.z);
    printf("%s %23.16f\n", "standard atomic weight max: ", elmt.saw_max);
    printf("%s %23.16f\n", "standard atomic weight min: ", elmt.saw_min);
    printf("%s %23.16f\n", "standard atomic weight: ", elmt.saw);
    printf("%s %23.16f\n", "standard atomic weight uncertainty: ", elmt.saw_u);
    printf("%s %23.16f\n", "abredged standard atomic weight: ", elmt.asaw);
    printf("%s %23.16f\n", "abredged standard atomic weight uncertainty: ", elmt.asaw_u);
    printf("%s\n", "");

    elmt = ciaaw_saw_F;
    printf("%s %s\n", "Element: ", elmt.element);
    printf("%s %s\n", "Symbol: ", elmt.symbol);
    printf("%s %d\n", "Z: ", elmt.z);
    printf("%s %23.16f\n", "standard atomic weight max: ", elmt.saw_max);
    printf("%s %23.16f\n", "standard atomic weight min: ", elmt.saw_min);
    printf("%s %23.16f\n", "standard atomic weight: ", elmt.saw);
    printf("%s %23.16f\n", "standard atomic weight uncertainty: ", elmt.saw_u);
    printf("%s %23.16f\n", "abredged standard atomic weight: ", elmt.asaw);
    printf("%s %23.16f\n", "abredged standard atomic weight uncertainty: ", elmt.asaw_u);

    return EXIT_SUCCESS;
}

Python

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

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

print("########## CIAAW SAW ##########")
elmt = pyciaaw.H
print("Element: ", elmt["element"])
print("Symbol: ", elmt["symbol"])
print("Z: ", elmt["z"])
print("standard atomic weight max: ", elmt["saw_max"])
print("standard atomic weight min: ", elmt["saw_min"])
print("standard atomic weight: ", elmt["saw"])
print("standard atomic weight uncertainty: ", elmt["saw_u"])
print("abredged standard atomic weight: ", elmt["asaw"])
print("abredged standard atomic weight uncertainty: ", elmt["asaw_u"])
print()

elmt = pyciaaw.F
print("Element: ", elmt["element"])
print("Symbol: ", elmt["symbol"])
print("Z: ", elmt["z"])
print("standard atomic weight max: ", elmt["saw_max"])
print("standard atomic weight min: ", elmt["saw_min"])
print("standard atomic weight: ", elmt["saw"])
print("standard atomic weight uncertainty: ", elmt["saw_u"])
print("abredged standard atomic weight: ", elmt["asaw"])
print("abredged standard atomic weight uncertainty: ", elmt["asaw_u"])