def compute_dr(z, dr_type, path=""): """ Main routine, computes DR for given element and recombination process """ elem = fac.ATOMICSYMBOL[z] # Initialise fac.Reinit() fac.SetAtom(elem) # Execute problem specific configuration type_name = dr_type() # Generate filenames f_stub = path + elem + "_" + type_name f_lev = f_stub + ".lev" f_lev_b = f_lev + ".b" # temp binary f_tr = f_stub + ".tr" f_tr_b = f_tr + ".b" # temp binary f_ai = f_stub + ".ai" f_ai_b = f_ai + ".b" # temp binary # Start solving fac.ConfigEnergy(0) # According to the manual we should Optimize on the recombined ion # (have seen other things out in the wild) fac.OptimizeRadial(["final"]) fac.ConfigEnergy(1) # Compute structure and energy levels fac.Structure(f_lev_b, ["initial", "transient", "final"]) fac.MemENTable(f_lev_b) fac.PrintTable(f_lev_b, f_lev, 1) # Compute the transisiton table for radiative decay # Transition Table defaults to m=0 since FAC1.0.7 (not in current docs) # which computes all multipoles according to new (unreleased) docs fac.TransitionTable(f_tr_b, ["final"], ["transient"]) fac.PrintTable(f_tr_b, f_tr, 1) # Compute the Autoionisation table fac.AITable(f_ai_b, ["transient"], ["initial"]) fac.PrintTable(f_ai_b, f_ai, 1) # Clean up for f in [f_lev_b, f_tr_b, f_ai_b]: try: os.remove(f) except OSError as e: ## if failed, report it back to the user ## print("Error: %s - %s." % (e.filename, e.strerror)) print("Element:" + elem + " DR: " + type_name + " done.")
fac.Config('T3.4f.5*', '2s1 2p5 4f1 5*1') fac.Config('T3.4f.6*', '2s1 2p5 4f1 6*1') fac.Config('T3.4f.7*', '2s1 2p5 4f1 7*1') fac.Config('T11.5*.5*', '2*6 5*2') fac.Config('T11.5*.6*', '2*6 5*1 6*1') fac.Config('T11.5*.7*', '2*6 5*1 7*1') fac.Config('T11.6*.6*', '2*6 6*2') fac.Config('T11.6*.7*', '2*6 6*1 7*1') fac.Config('T11.7*.7*', '2*6 7*2') #Now compute the structures fac.ConfigEnergy(0) fac.OptimizeRadial(['T1.2*']) fac.ConfigEnergy(1) #Create the directory to contain output files. os.system('if [ -d outfile ]; then rm -rf outfile; fi; mkdir outfile') outfile_lev_b = 'outfile/fe18b.en' outfile_lev_a = outfile_lev_b[:-4]+'a.en' outfile_rr_b = 'outfile/fe18b.rr' outfile_rr_a = outfile_rr_b[:-4]+'a.rr' outfile_tr_b = 'outfile/fe18b.tr' outfile_tr_a = outfile_rr_b[:-4]+'a.tr' #Structure
"""calculate the electron impact excitation cross sections """ # import the modules from pfac import fac fac.SetAtom('Fe') # 1s shell is closed fac.Closed('1s') fac.Config('2*8', group='n2') fac.Config('2*7 3*1', group='n3') # Self-consistent iteration for optimized central potential fac.ConfigEnergy(0) fac.OptimizeRadial('n2') fac.ConfigEnergy(1) fac.Structure('ne.lev.b') fac.MemENTable('ne.lev.b') fac.PrintTable('ne.lev.b', 'ne.lev', 1) fac.CETable('ne.ce.b', ['n2'], ['n3']) fac.PrintTable('ne.ce.b', 'ne.ce', 1)
if use_openmp: # enable openmp with 2 cores fac.InitializeMPI(2) fac.SetAtom('Fe') # 1s shell is closed fac.Closed('1s') fac.Config('2*8', group = 'n2') # instead of a keyword, the group name can also # be given as the first argument. fac.Config('n3', '2*7 3*1') # Self-consistent iteration for optimized central potential fac.ConfigEnergy(0) # the configurations passed to OptimizeRadial should always # be one or two of the lowest lying ones. and it is often best to # just use the ground configurations. If you need more highly # excited levels, such as n=4, 5, 6, ..., do not put them # in the OptimizeRadial. fac.OptimizeRadial(['n2']) fac.ConfigEnergy(1) fac.GetPotential('ne.pot') fac.Structure('ne.lev.b', ['n2', 'n3']) fac.MemENTable('ne.lev.b') fac.PrintTable('ne.lev.b', 'ne.lev', 1) fac.TransitionTable('ne.tr.b', ['n2'], ['n3']) fac.PrintTable('ne.tr.b', 'ne.tr', 1) if use_openmp: fac.FinalizeMPI()
""" calculate the electron impact ionization cross sections """ # import the modules from pfac import fac fac.SetAtom('Fe') # 1s shell is closed fac.Closed('1s') # Ne-like ground state fac.Config('2*8', group='fe17') # F-like configuations fac.Config('2*7', group='fe18') # solve the structure problem fac.ConfigEnergy(0) fac.OptimizeRadial(['fe17']) fac.ConfigEnergy(1) fac.Structure('ne_f.lev.b', ['fe17']) fac.Structure('ne_f.lev.b', ['fe18']) fac.MemENTable('ne_f.lev.b') fac.PrintTable('ne_f.lev.b', 'ne_f.lev', 1) # set the output collision energies e = [500.0, 900.0, 1.3e3, 1.7e3, 2.1e3, 4.2e3, 6.0e3, 8.0e3] fac.SetUsrCIEGrid(e) fac.CITable('ne.ci.b', ['fe17'], ['fe18']) fac.PrintTable('ne.ci.b', 'ne.ci', 1)
""" calculate the autoionization rates for Ne-like Se. """ # import the modules from pfac import fac fac.SetAtom('Se') # configurations for the F-like ion fac.Closed('1s') fac.Closed('2s') fac.Config('2p5', group='n2') # configurations of doubly excited Ne-like ion fac.Config('2p4 3s2', '2p4 3s1 3p1', group='n33') fac.ConfigEnergy(0) fac.OptimizeRadial('n33') fac.ConfigEnergy(1) fac.Structure('se.lev.b', ['n2']) fac.Structure('se.lev.b', ['n33']) fac.MemENTable('se.lev.b') fac.PrintTable('se.lev.b', 'se.lev', 1) fac.AITable('se.ai.b', ['n33'], ['n2']) fac.PrintTable('se.ai.b', 'se.ai', 1)
import time start = time.clock() fac.SetUTA(0) fac.SetAtom('Ho') fac.Closed('1s', '2s', '2p', '3s', '3p', '3d', '4s') fac.Config('4p6 4d2', group='Gnd.0') fac.Config('4p5 4d3', group='Gnd.1') fac.Config('4p6 4d1 4f1', group='Gnd.3') fac.Config('4p5 4d2 4f1', group='Exc.1') fac.Config('4p4 4d4', group='Exc.2') fac.Config('4p6 4d0 4f2', group='Exc.3') fac.ConfigEnergy(0) fac.OptimizeRadial(['Gnd.0']) fac.ConfigEnergy(1) fac.Structure('Ho.lev.b', ['Gnd.0', 'Gnd.1', 'Gnd.3', 'Exc.1', 'Exc.2', 'Exc.3']) fac.MemENTable('Ho.lev.b') fac.TransitionTable('Ho.tr.b', ['Gnd.1'], ['Exc.1'], -1) fac.TransitionTable('Ho.tr.b', ['Gnd.1'], ['Exc.2'], -1) fac.TransitionTable('Ho.tr.b', ['Gnd.3'], ['Exc.3'], -1) fac.PrintTable('Ho.lev.b', 'Ho30.lev', 1) fac.PrintTable('Ho.tr.b', 'Ho30.tr', 1) end = time.clock() runtime = end - start
fac.SetAtom('C') fac.Config('1s2 2s', group='lithium') fac.Config('1s2 2*2', group='ground') fac.Config('1s2 2*1 3*1', group='2exc3') fac.Config('1s2 2*1 4*1', group='2exc4') fac.Config('1s2 2*1 5*1', group='2exc5') fac.Config('1s 2*3', group='1exc2') fac.Config('1s 2*2 3*1', group='1exc3') fac.Config('1s 2*2 4*1', group='1exc4') fac.Config('1s 2*2 5*1', group='1exc5') fac.ConfigEnergy(0) fac.OptimizeRadial(['ground']) fac.ConfigEnergy(1) fac.Structure('beb.en', ['ground']) fac.Structure('beb.en', ['2exc3']) fac.Structure('beb.en', ['2exc4']) fac.Structure('beb.en', ['2exc5']) fac.Structure('beb.en', ['1exc2']) fac.Structure('beb.en', ['1exc3']) fac.Structure('beb.en', ['1exc4']) fac.Structure('beb.en', ['1exc5']) fac.Structure('beb.en', ['lithium']) g = ['ground', '2exc3', '2exc4', '2exc5', '1exc2', '1exc3', '1exc4', '1exc5'] fac.MemENTable('beb.en')