def test_with_orb(corb, vorb, v, grid, rc):

    res = "{}\t{}\t{}\t{}\t{}".format(v, el.coulumb(core_orb, v_orb, grid, rc),
                                      el.coulumb_melem(core_orb, v_orb, v_orb,
                                                       grid, rc),
                                      el.exchange(core_orb, v_orb, grid, rc),
                                      el.exchange_melem(core_orb, v_orb, v_orb,
                                                        grid, rc))
    print(res.replace('.', ','))
vsns = sys.argv[2:]  # valent shells
ncc, lc, jc = str2nlj(csn)
p, q, en = hfd[csn]
print("norm function")
core_orb = (p, q, lc, jc)
norm2rc = trapz((p[:nc]**2+q[:nc]**2)*hfd.weights[:nc])*hfd.h
norm2 = trapz((p**2+q**2)*hfd.weights[:hfd.imax])*hfd.h
print("||{}||^2  = {}\t{}".format(csn, norm2rc, norm2))
v_orbs = []
for v in vsns:
    nv, lv, jv = str2nlj(v)
    pv, qv, env = hfd[v]
    v_orb = (pv, qv, lv, jv)
    v_orbs += [v_orb]
    coul = el.coulumb(core_orb, v_orb, grid, rc)
    exc = -el.exchange(core_orb, v_orb, grid, rc)
    out = "{} {}\t{:.6f}\t{:.6f}".format(csn, v, coul, exc)
    print out.replace('.', ',')
# grid info
with open('grid.txt', 'w') as outp:
    for i, r in enumerate(hfd.grid):
        outp.write("{} {}\n".format(i, r))
# orb info
with open('orbs.txt', 'w') as outp:
    r = grid[0]
    for i in xrange(hfd.imax):
        res = "\t".join(str(v_orb[0][i]) for v_orb in v_orbs)
        outp.write("{}\t{}\n".format(r[i], res))

print("electron_melem_test")