In [ ]:
XATOMPATH = "YOURPATH_TO_XATOM_BINARY" # enter your path to the xatom binary
In [ ]:
import subprocess
In [ ]:
system = 'O'
photonEnergy = 750
configurations = [
    "1s" + str(n1) + "_2s" + str(n2) + "_2p" + str(n3) for n1 in range(3)
    for n2 in range(3) for n3 in range(5)
]
In [ ]:
with open(f"results_{system}_{photonEnergy}.dat", 'w') as f:
    for c in configurations:
        print(c)
        sp = subprocess.run([
            XATOMPATH, "-s", system, "-conf", c, "-pcs", "-PE",
            str(photonEnergy), "-decay", "-xmdyn", "-silent"
        ],
                            stdout=subprocess.PIPE,
                            stderr=subprocess.PIPE,
                            stdin=subprocess.PIPE)
        #print(sp.stderr)
        for line in sp.stdout.decode('utf8').split('\n'):
            #print(line)
            if '#' in line:
                f.write(line + '\n')
    f.close()
In [ ]: