Esempio n. 1
0
def gen_cry2qwalk(dftfn):
    loc = '/'.join([os.getcwd()] + dftfn.split('/')[:-1])
    root = dftfn.split('/')[-1].replace('.d12', '')
    propfn = root + '.d3'
    dftdat = read_cryinp(open(dftfn, 'r'))
    shrink = dftdat['kdens']
    proplines = []
    proplines.append('NEWK')
    proplines.append('{0} {1}'.format(shrink, 2 * shrink))
    proplines.append('0 1')
    proplines.append('67 999')
    proplines.append('END')
    with open('/'.join((loc, propfn)), 'w') as propf:
        propf.write('\n'.join(proplines))
    exe = '~/bin/properties < {0}'.format(propfn)
    out = propfn + '.out'
    fc = []
    fc.append('cat {root}.d12.out {root}.d3.out > tmp'.format(root=root))
    fc.append(
        'addline=`grep -n "HAMILTONIAN EIGENVECTORS" tmp | head -1 | cut -d":" -f1`'
    )
    fc.append('sed "$addline i NEWK EIGENVECTORS" tmp > crystal2qmc.inp')
    fc.append('rm -f tmp')
    fc.append(
        '~/bin/crystal2qmc -o {root} crystal2qmc.inp &>> crystal2qmc.out'.
        format(root=root))
    return gen_qsub(exe,
                    stdout=out,
                    loc=loc,
                    name=loc + ' gen_cry2qwalk',
                    time='02:00:00',
                    queue='secondary',
                    final_commands=fc)
Esempio n. 2
0
def gen_cry2qwalk(dftfn):
  loc = '/'.join([os.getcwd()]+dftfn.split('/')[:-1])
  root = dftfn.split('/')[-1].replace('.d12','')
  propfn = root+'.d3'
  dftdat = read_cryinp(open(dftfn,'r'))
  shrink = dftdat['kdens']
  proplines = []
  proplines.append('NEWK')
  proplines.append('{0} {1}'.format(shrink,2*shrink))
  proplines.append('0 1')
  proplines.append('67 999')
  proplines.append('END')
  with open('/'.join((loc,propfn)),'w') as propf:
    propf.write('\n'.join(proplines))
  exe = '~/bin/properties < {0}'.format(propfn)
  out = propfn+'.out'
  fc = []
  fc.append('cat {root}.d12.out {root}.d3.out > tmp'.format(root=root))
  fc.append('addline=`grep -n "HAMILTONIAN EIGENVECTORS" tmp | head -1 | cut -d":" -f1`')
  fc.append('sed "$addline i NEWK EIGENVECTORS" tmp > crystal2qmc.inp')
  fc.append('rm -f tmp')
  fc.append('~/bin/crystal2qmc -o {root} crystal2qmc.inp &>> crystal2qmc.out'.format(root=root))
  return gen_qsub(exe,stdout=out,loc=loc,
                  name=loc+' gen_cry2qwalk',
                  time='02:00:00',
                  queue='secondary',
                  final_commands=fc)
Esempio n. 3
0
def submit_job(base, lines, cwd):
    if not os.path.exists(base): os.mkdir(base)
    os.chdir(base)
    with open("%s.inp" % base, 'w') as outf:
        outf.write("\n".join([" ".join(l) for l in lines]))
    pc = ["module load openmpi/1.4-gcc+ifort"]
    qin = gen_qsub("~/bin/pw.x < %s.inp" % (base),
                   stdout="%s.out" % (base),
                   queue="physics",
                   name="%s/%s.out" % (cwd, base),
                   time="72:00:00",
                   nn=1,
                   prep_commands=pc)
    print sp.check_output("qsub %s" % qin, shell=True)
    os.chdir(cwd)
Esempio n. 4
0
def submit_job(base, lines, cwd):
    if not os.path.exists(base):
        os.mkdir(base)
    os.chdir(base)
    with open("%s.inp" % base, "w") as outf:
        outf.write("\n".join([" ".join(l) for l in lines]))
    pc = ["module load openmpi/1.4-gcc+ifort"]
    qin = gen_qsub(
        "~/bin/pw.x < %s.inp" % (base),
        stdout="%s.out" % (base),
        queue="physics",
        name="%s/%s.out" % (cwd, base),
        time="72:00:00",
        nn=1,
        prep_commands=pc,
    )
    print sp.check_output("qsub %s" % qin, shell=True)
    os.chdir(cwd)
Esempio n. 5
0
def gen_optimize(dftfn,time='02:00:00'):
  loc = '/'.join([os.getcwd()]+dftfn.split('/')[:-1])
  root = dftfn.split('/')[-1].replace('.d12','')

  opt1fn = root+'_0.opt1'
  with open('/'.join((loc,opt1fn)),'w') as opt1f:
    opt1lines = []
    opt1lines.append('method{ optimize }')
    opt1lines.append('include %s_0.sys'%root)
    opt1lines.append('trialfunc{ slater-jastrow ')
    opt1lines.append('wf1{ include %s_0.slater }'%root)
    opt1lines.append('wf2{ include %s.jast2  }'%root)
    opt1lines.append('}')
    opt1f.write('\n'.join(opt1lines))

  optfn  = root+'_0.opt'
  with open('/'.join((loc,optfn)),'w') as optf:
    optlines = []
    optlines.append('method{ optimize }')
    optlines.append('include %s_0.sys'%root)
    optlines.append('trialfunc{ include %s_0.opt.wfout }'%root)
    optf.write('\n'.join(optlines))

  exe = '~/bin/qwalk $inpfile'
  out = optfn+'.out'
  pc =  ['module load openmpi/1.4-gcc+ifort']
  pc += ['if [ -f {root}_0.opt.wfout ]'.format(root=root)]
  pc += ['then inpfile={0}'.format(optfn)]
  pc += ['else inpfile={0}'.format(opt1fn)]
  pc += ['fi']
  fc = []
  fc += ['if [ ! -f {root}_0.opt.wfout ]'.format(root=root)]
  fc += ['then cp {root}_0.opt1.wfout {root}_0.opt.wfout'.format(root=root)]
  fc += ['fi']
  fc += ['~/bin/separate_jastrow {root}_0.opt.wfout > {root}_0.opt.jast2'.format(root=root)]

  return my.gen_qsub(exe,stdout=out,loc=loc,
                  name=loc+' gen_optimize',
                  time=time,
                  nn=2,np=12,
                  queue='secondary',
                  prep_commands=pc,
                  final_commands=fc)
Esempio n. 6
0
def gen_optimize(dftfn,time='02:00:00'):
  loc = '/'.join([os.getcwd()]+dftfn.split('/')[:-1])
  root = dftfn.split('/')[-1].replace('.d12','')

  opt1fn = root+'_0.opt1'
  with open('/'.join((loc,opt1fn)),'w') as opt1f:
    opt1lines = []
    opt1lines.append('method{ optimize }')
    opt1lines.append('include %s_0.sys'%root)
    opt1lines.append('trialfunc{ slater-jastrow ')
    opt1lines.append('wf1{ include %s_0.slater }'%root)
    opt1lines.append('wf2{ include %s.jast2  }'%root)
    opt1lines.append('}')
    opt1f.write('\n'.join(opt1lines))

  optfn  = root+'_0.opt'
  with open('/'.join((loc,optfn)),'w') as optf:
    optlines = []
    optlines.append('method{ optimize }')
    optlines.append('include %s_0.sys'%root)
    optlines.append('trialfunc{ include %s_0.opt.wfout }'%root)
    optf.write('\n'.join(optlines))

  exe = '~/bin/qwalk $inpfile'
  out = optfn+'.out'
  pc =  ['module load openmpi/1.4-gcc+ifort']
  pc += ['if [ -f {root}_0.opt.wfout ]'.format(root=root)]
  pc += ['then inpfile={0}'.format(optfn)]
  pc += ['else inpfile={0}'.format(opt1fn)]
  pc += ['fi']
  fc = []
  fc += ['if [ ! -f {root}_0.opt.wfout ]'.format(root=root)]
  fc += ['then cp {root}_0.opt1.wfout {root}_0.opt.wfout'.format(root=root)]
  fc += ['fi']
  fc += ['~/bin/separate_jastrow {root}_0.opt.wfout > {root}_0.opt.jast2'.format(root=root)]

  return my.gen_qsub(exe,stdout=out,loc=loc,
                  name=loc+' gen_optimize',
                  time=time,
                  nn=2,np=12,
                  queue='secondary',
                  prep_commands=pc,
                  final_commands=fc)
Esempio n. 7
0
    sh.copyfile(use_fort,name+'/fort.20')
  os.chdir(name)
  tmplines[4] = " ".join(map(str,geo[:2]))
  se_part = tmplines[7].split(" ")
  se_part[-1] = str(geo[-1])
  tmplines[7] = " ".join(se_part)

  with open(name+".d12",'w') as outf:
    outf.write("\n".join(tmplines))

  pc[-1] = "cp %s.d12 INPUT"%name
  qsub = my.gen_qsub(exe,
    stdout = name+".d12.out",
    loc = os.getcwd(),
    name = "%s %s"%(os.getcwd(),name),
    time = time,
    nn = nn,
    queue = queue,
    prep_commands = pc,
    final_commands = fc
  )
  print name, sub.check_output("qsub %s"%qsub,shell=True)
  os.chdir(cwd)

################################################################################
# Edit options.

shrinklist = []#[2,4,6,8,10,12]
tmplines  = deepcopy(baselines)
for shrink in shrinklist:
  name = "shrink_%d"%shrink
  if not os.path.isdir(name):
Esempio n. 8
0
    inplines = inpstr.split("\n")

    if needs_guessp:
        i = 0
        while inplines[-i] != "END":
            i += 1
        inplines[-i] = "GUESSP"
        try:
            inplines[-i + 1] = "END"
        except IndexError:
            inplines.append("END")

    newinpfn = "new." + inpfn
    with open(newinpfn, 'w') as outf:
        outf.write("\n".join(inplines))

    sh.copyfile(use_fort, "fort.20")
    pc[-1] = "cp %s INPUT" % newinpfn
    qsub = my.gen_qsub(exe,
                       stdout=newinpfn + ".out",
                       loc=os.getcwd(),
                       name="%s %s" % (os.getcwd(), newinpfn),
                       time=time,
                       nn=nn,
                       queue=queue,
                       prep_commands=pc,
                       final_commands=fc)
    print newinpfn, sub.check_output("qsub %s" % qsub, shell=True)

    os.chdir(cwd)
Esempio n. 9
0
import qefiles_io as qeio
import os
import mython as my
import sys
import subprocess as sub

qpts = [(0.0, 0.0, 0.0), (0.25, 0.0, 0.0), (0.5, 0.0, 0.0), (0.75, 0.0, 0.0)]
scfinp = open(sys.argv[1], 'r')
inps = qeio.gen_phonon(qpts, scfinp, bundle=True)

cwd = os.getcwd()
for fname in inps:
    if '/' in fname:
        dname = '/'.join(fname.split('/')[:-1])
        fname = fname.split('/')[-1]
        os.chdir(dname)

    qsub = my.gen_qsub('~/bin/ph.x < %s' % fname,
                       stdout=fname.replace('inp', 'out'),
                       loc=os.getcwd(),
                       nn=1,
                       np=8)
    print sub.check_output("qsub %s" % qsub, shell=True)
    os.chdir(cwd)
Esempio n. 10
0
with open('base.d12','w') as outf:
  outf.write(lines2str(baselines))

for hy in hyb_list:
  for dx in dx_list:
    dr = 'hy_%d_dx_%.2f'%(hy,dx)
    baselines[spot[0]][spot[1]] = val+dx
    baselines[hyb_spot][0] = hy
    if not os.path.exists(dr):
      os.makedirs(dr)
    with open('{dr}/{dr}.d12'.format(dr=dr),'w') as outf:
      outf.write(lines2str(baselines))

    loc = '/'.join((os.getcwd(),dr))
    pc  = ['module load openmpi/1.4-gcc+ifort',
           'cp {dr}.d12 INPUT'.format(dr=dr)]
    fc = ['rm *.pe[0-9] *.pe[0-9][0-9]']
    qin = gen_qsub('~/bin/Pcrystal',
                   loc=loc,
                   name='_'.join((sys.argv[1][:3],dr)),
                   stdout=dr+'.d12.out',
                   time='4:00:00',
                   nn=2,np=12,
                   queue='secondary',
                   prep_commands = pc,
                   final_commands = fc)
    #print check_output('cp -v {0}/fort.79 {0}/fort.20'.format(dr),shell=True)
    print check_output('cp -v fort.9 {0}/fort.20'.format(dr),shell=True)
    print check_output('qsub {0}'.format(qin),shell=True)
Esempio n. 11
0
        qsub = []
        qsub.append('qsub')
        qsub.append('-q prod')
        qsub.append('-A SuperMatSim')
        qsub.append('-t {time}'.format(time=time))
        qsub.append('-n {nproc}'.format(nproc=nproc))
        qsub.append('--mode c32')
        qsub.append('-o {gamma}.dmc.out'.format(gamma=gamma))
        qsub.append('~/bin/qwalk')
        qsub += dmcfns
        qin = ' '.join(qsub)
        print check_output(qin, shell=True)
        #print qin
    elif system == 'taub':
        pc = ['module load openmpi/1.4-gcc+ifort']
        for dmcfn in dmcfns:
            qin = gen_qsub('~/bin/qwalk {0}'.format(dmcfn),
                           stdout=dmcfn + '.out',
                           name='/'.join((os.getcwd(), dmcfn)),
                           time='4:00:00',
                           nn=4,
                           np=12,
                           queue='secondary',
                           prep_commands=pc)
            print check_output('qsub ' + qin, shell=True)
            #print qin
    else:
        print "You need to add appropriate submission routine."

    os.chdir(wd)
Esempio n. 12
0
import qefiles_io as qeio
import os
import mython as my
import sys
import subprocess as sub

qpts = [(0.0,0.0,0.0),(0.25,0.0,0.0),(0.5,0.0,0.0),(0.75,0.0,0.0)]
scfinp = open(sys.argv[1],'r')
inps = qeio.gen_phonon(qpts,scfinp,bundle=True)

cwd = os.getcwd()
for fname in inps:
  if '/' in fname:
    dname = '/'.join(fname.split('/')[:-1])
    fname = fname.split('/')[-1]
    os.chdir(dname)

  qsub = my.gen_qsub(
    '~/bin/ph.x < %s'%fname,
    stdout=fname.replace('inp','out'),
    loc=os.getcwd(),
    nn=1,np=8)
  print sub.check_output("qsub %s"%qsub,shell=True)
  os.chdir(cwd)
Esempio n. 13
0
    nproc=512*4
    qsub = []
    qsub.append('qsub')
    qsub.append('-q prod')
    qsub.append('-A SuperMatSim')
    qsub.append('-t {time}'.format(time=time))
    qsub.append('-n {nproc}'.format(nproc=nproc))
    qsub.append('--mode c32')
    qsub.append('-o {gamma}.dmc.out'.format(gamma=gamma))
    qsub.append('~/bin/qwalk')
    qsub += dmcfns
    qin = ' '.join(qsub)
    print check_output(qin,shell=True)
    #print qin
  elif system == 'taub':
    pc =  ['module load openmpi/1.4-gcc+ifort']
    for dmcfn in dmcfns:
      qin = gen_qsub('~/bin/qwalk {0}'.format(dmcfn),
                     stdout=dmcfn+'.out',
                     name='/'.join((os.getcwd(),dmcfn)),
                     time='4:00:00',
                     nn=4,np=12,
                     queue='secondary',
                     prep_commands=pc)
      print check_output('qsub '+qin,shell=True)
      #print qin
  else:
    print "You need to add appropriate submission routine."

  os.chdir(wd)
Esempio n. 14
0
    pprfns = [
        gen_ppr(root,
                gosling="/home/busemey2/bin/gosling",
                jast=gamma + '.opt.jast2') for root in roots
    ]

    pc = []
    pc += ['module load openmpi/1.4-gcc+ifort']
    pc += ['module load gcc/4.7.1']
    pc += ['module load intel/11.1']

    for root in roots:
        if not os.path.isfile(root + ".dmc.tracele"):
            print "Swapping endian of %s." % (root + ".dmc.trace")
            sub.call("/home/busemey2/bin/swap_endian {0} {1}".format(
                root + ".dmc.trace", root + ".dmc.tracele"),
                     shell=True)

    for pprfn in pprfns:
        qin = gen_qsub('~/bin/qwalk {0}'.format(pprfn),
                       stdout=pprfn + '.out',
                       name='/'.join((os.getcwd(), pprfn)),
                       time='04:00:00',
                       nn=2,
                       queue='secondary',
                       prep_commands=pc)
        print sub.check_output('qsub ' + qin, shell=True)

    os.chdir(wd)
Esempio n. 15
0
  loc    = '/'.join(dftloc.split('/')[:-1])

  os.chdir(wd + '/' + loc)

  pprfns = [gen_ppr(root,gosling="/home/busemey2/bin/gosling",
                         jast=gamma+'.opt.jast2') for root in roots]
    
  pc = []
  pc += ['module load openmpi/1.4-gcc+ifort']
  pc += ['module load gcc/4.7.1']
  pc += ['module load intel/11.1']

  for root in roots:
    if not os.path.isfile(root+".dmc.tracele"):
      print "Swapping endian of %s."%(root+".dmc.trace")
      sub.call("/home/busemey2/bin/swap_endian {0} {1}".format(
        root+".dmc.trace",root+".dmc.tracele"),
        shell=True)

  for pprfn in pprfns:
    qin = gen_qsub('~/bin/qwalk {0}'.format(pprfn),
                   stdout=pprfn+'.out',
                   name='/'.join((os.getcwd(),pprfn)),
                   time='04:00:00',
                   nn=2,
                   queue='secondary',
                   prep_commands=pc)
    print sub.check_output('qsub '+qin,shell=True)

  os.chdir(wd)
Esempio n. 16
0
  if needs_guessp:
    i=0
    while inplines[-i] != "END":
      i += 1
    inplines[-i] = "GUESSP"
    try:
      inplines[-i+1] = "END"
    except IndexError:
      inplines.append("END")

  newinpfn = "new."+inpfn
  with open(newinpfn,'w') as outf:
    outf.write("\n".join(inplines))

  sh.copyfile(use_fort,"fort.20")
  pc[-1] = "cp %s INPUT"%newinpfn
  qsub = my.gen_qsub(exe,
    stdout = newinpfn+".out",
    loc = os.getcwd(),
    name = "%s %s"%(os.getcwd(),newinpfn),
    time = time,
    nn = nn,
    queue = queue,
    prep_commands = pc,
    final_commands = fc
  )
  print newinpfn, sub.check_output("qsub %s"%qsub,shell=True)

  os.chdir(cwd)
Esempio n. 17
0
for hy in hyb_list:
    for dx in dx_list:
        dr = 'hy_%d_dx_%.2f' % (hy, dx)
        baselines[spot[0]][spot[1]] = val + dx
        baselines[hyb_spot][0] = hy
        if not os.path.exists(dr):
            os.makedirs(dr)
        with open('{dr}/{dr}.d12'.format(dr=dr), 'w') as outf:
            outf.write(lines2str(baselines))

        loc = '/'.join((os.getcwd(), dr))
        pc = [
            'module load openmpi/1.4-gcc+ifort',
            'cp {dr}.d12 INPUT'.format(dr=dr)
        ]
        fc = ['rm *.pe[0-9] *.pe[0-9][0-9]']
        qin = gen_qsub('~/bin/Pcrystal',
                       loc=loc,
                       name='_'.join((sys.argv[1][:3], dr)),
                       stdout=dr + '.d12.out',
                       time='4:00:00',
                       nn=2,
                       np=12,
                       queue='secondary',
                       prep_commands=pc,
                       final_commands=fc)
        #print check_output('cp -v {0}/fort.79 {0}/fort.20'.format(dr),shell=True)
        print check_output('cp -v fort.9 {0}/fort.20'.format(dr), shell=True)
        print check_output('qsub {0}'.format(qin), shell=True)