Example #1
0
def run_nuclide(nuc):
    bateman = defaultdict(emptytime)
    bateman[nuc][0] = 1
    crammed = defaultdict(emptytime)
    crammed[nuc][0] = 1
    diagexp = defaultdict(emptytime)
    diagexp[nuc][0] = 1
    n0 = Material({nuc: 1.0}, mass=1.0, atoms_per_molecule=1.0)
    for i, t in enumerate(TIMES[1:], 1):
        # compute Bateman
        try:
            b1 = n0.decay(t).to_atom_frac()
        except RuntimeError:
            # decay can't handle all of the same nuclides CRAM can
            b1 = {}
        for key, val in b1.items():
            n = nucname.name(key)
            bateman[n][i] = val
        # compute CRAM
        c1 = n0.cram(DECAY_MATS[t], order=16).to_atom_frac()
        for key, val in c1.items():
            n = nucname.name(key)
            crammed[n][i] = val
        # compute e^x of the diagonal of the decay matrix, ie the nuc itself
        nuc_idx = cram.NUCS_IDX[nuc]
        mat_idx = cram.IJ[nuc_idx, nuc_idx]
        diagexp[nuc][i] = exp(-DECAY_MATS[t][mat_idx]).evalf(n=30)
    return bateman, crammed, diagexp