def zmultipole(self): if args.local or args.sub: name = "zmultipole" self.writeoptionfile(self.readoptionfile(name), name) with cd(self.path): if args.local: print "Running zmultipole for {}".format(self.name) sp.check_output( "xtp_run -e {} -o OPTIONFILES/{}.xml -f {} -t 4 > zmultipole_local.log" .format(name, name, os.path.basename(self.sql)), shell=True) elif args.sub: print "Running zmultipole for {} on cluster".format( self.name) sp.check_output( "xtp_jobstarterPARALLEL.py -o OPTIONFILES/{}.xml -f {} --sub > zmultipole_cluster.log" .format(name, os.path.basename(self.sql)), shell=True) elif args.read: name = "eimport" self.writeoptionfile(self.readoptionfile(name), name) with cd(self.path): print "Importing site energies from directory ZMULTIPOLE for {}".format( self.name) sp.call("cat ZMULTIPOLE/*.dat > zmultipole.dat", shell=True) sp.check_output( "xtp_run -e {} -o OPTIONFILES/{}.xml -f {} > zmultipole_read.log" .format(name, name, os.path.basename(self.sql)), shell=True)
def egwbse(self): if args.write: name="egwbse" jobfile="egwbse.jobs" root=self.readoptionfile(name) for entry in root.iter(name): dftoptions=entry.find("package").text shutil.copyfile(os.path.join(self.template,"OPTIONFILES/"+dftoptions),self.optfiles) gwbseoptions=entry.find("gwbse").text shutil.copyfile(os.path.join(self.template,"OPTIONFILES/"+gwbseoptions),self.optfiles) entry.find("job_file").text=os.path.join(self.path,jobfile) try: espoptions=entry.find("esp_options").text shutil.copyfile(os.path.join(self.template,"OPTIONFILES/"+espoptions),self.optfiles) except: print "Running without espfits" self.writeoptionfile(root,name) with cd(self.path): print "Running egwbse to write jobfile {} for {}".format(jobfile,self.name) sp.check_output("xtp_parallel -e {} -o OPTIONFILES/{}.xml -f {} -j write -s 0 > egwbse.log".format(name,name,os.path.basename(self.sql)),shell=True) elif args.local: elif args.local: name="egwbselocal" calcname="ewald" self.writeoptionfile(self.readoptionfile(name,calcname=calcname),name) with cd(self.path): print "Running egwbse locally for {}".format(self.name) sp.call("xtp_parallel -e gwbse -o OPTIONFILES/{}.xml -f {} -s 0 -t 1 -c 4 > egwbselocal.log".format(name,os.path.basename(self.sql)),shell=True)
def iexcitoncl(self): name = "iexcitoncl" jobfile = os.path.join(self.path, "{}.jobs".format(name)) mpsfile = os.path.join(self.path, "mps.tab".format(name)) if args.write: root = self.readoptionfile(name) for entry in root.iter(name): entry.find("mapping").text = self.map entry.find("emp_file").text = mpsfile entry.find("job_file").text = jobfile self.writeoptionfile(root, name) with cd(self.path): print "Writing iexcitoncl jobfile for {}".format(self.name) sp.check_output( "xtp_parallel -e {} -o OPTIONFILES/{}.xml -f {} -j write -s 0 > iexcitoncl.log" .format(name, name, os.path.basename(self.sql)), shell=True, stderr=sp.STDOUT) if args.local: with cd(self.path): print "Running iexcitoncl locally for {}".format(self.name) sp.check_output( "xtp_parallel -e {} -o OPTIONFILES/{}.xml -f {} -j run -c 20000 -t 4 -s 0 >> iexcitoncl.log" .format(name, name, os.path.basename(self.sql)), shell=True, stderr=sp.STDOUT) if args.read: with cd(self.path): print "Reading iexcitoncl jobfile for {}".format(self.name) sp.check_output( "xtp_parallel -e {} -o OPTIONFILES/{}.xml -f {} -j read >> iexcitoncl.log" .format(name, name, os.path.basename(self.sql)), shell=True, stderr=sp.STDOUT)
def kmc(self): jobfile = args.kmcjobfile p = re.compile('([-+]?([0-9]*\.[0-9]+|[0-9]+))K\_') temp = p.search(self.name) #print self.name if temp == None: Temperature = 300 else: Temperature = float(temp.group(1)) if args.read: with cd(self.path): sp.call( "xtp_kmc_jobresults.py --jobset {} --jobfolder kmc_jobs". format(jobfile), shell=True) print re.sub(".csv", "_results.csv", jobfile) sp.call("xtp_kmc_jobresults_mobility.py --csv {}".format( re.sub(".csv", "_results.csv", jobfile)), shell=True) else: print "Temperature set to {} for {}".format(Temperature, self.name) shutil.copyfile(os.path.join(self.template, jobfile), os.path.join(self.path, jobfile)) with cd(self.path): if args.sub: print "Running kmc for {} at T={}K".format( self.name, Temperature) sp.call( "xtp_kmc_jobstarterPARALLEL.py -j {} -c parse -sub -T {}" .format(jobfile, Temperature), shell=True)
def xcoupling(self,states): name="excitoncoupling" print "Setting up options for {} for {}".format(name,self.name) if not os.path.isfile(os.path.join(self.path,"molA.orb")): with cd(self.path): sp.call("ln -s {} {}".format(os.path.relpath(os.path.join(self.template,"system.orb")),"molA.orb"),shell=True) #shutil.copyfile(os.path.join(self.template,"system.orb"),os.path.join(self.path,"molA.orb")) for state in states: root=self.readpackagefile("bsecoupling") bsefilename="bsecoupling_{}".format(state) A=root.find("moleculeA") (A.find("occLevels")).text=str(state) (A.find("unoccLevels")).text=str(state) B=root.find("moleculeB") (B.find("occLevels")).text=str(state) (B.find("unoccLevels")).text=str(state) self.writeoptionfile(root,bsefilename) root=self.readoptionfile(name) optionfilename="{}_{}".format(name,state) for entry in root.iter(name): (entry.find("output")).text="excitoncoupling_{}.out.xml".format(state) (entry.find("bsecoupling_options")).text=bsefilename+".xml" (entry.find("orbitalsA")).text="molA.orb" (entry.find("orbitalsB")).text="molB.orb" self.writeoptionfile(root,optionfilename) with cd(self.path): print "Running {} for {} with {} occ/unocc states for each molecule giving {} states".format(name,self.name,state,2*state**2) if args.verbose: sp.check_output("xtp_tools -v -e {0} -o {1}.xml > {1}.log".format(name,optionfilename),shell=True) else: sp.check_output("xtp_tools -e {0} -o {1}.xml > {1}.log".format(name,optionfilename),shell=True)
def ewald(self): if args.write: name='stateserver' self.writeoptionfile(self.readoptionfile(name),name) with cd(self.path): print "Running stateserver for ewald for {}".format(self.name) sp.check_output("xtp_run -e {} -o OPTIONFILES/{}.xml -f {} -s 0 > stateserver.log".format(name,name,os.path.basename(self.sql)),shell=True) name="jobwriter" self.writeoptionfile(self.readoptionfile(name),name) with cd(self.path): print "Running jobwriter for ewald for {}".format(self.name) sp.check_output("xtp_run -e {} -o OPTIONFILES/{}.xml -f {} -s 0 > jobwriter.log".format(name,name,os.path.basename(self.sql)),shell=True) sp.call("mv jobwriter.mps.chrg.xml jobs.ewald.xml",shell=True) elif args.read: name="ewaldparser" with cd(self.path): print "Running ewaldparser for ewald for {}".format(self.name) sp.call("xtp_parseewald.py -j APE_ISO/WORKGROUND/jobs.*.xml~ -f {}".format(os.path.basename(self.sql)),shell=True) elif args.local: name="ewaldlocal" calcname="ewald" self.writeoptionfile(self.readoptionfile(name,calcname=calcname),name) with cd(self.path): print "Running ewald locally for {}".format(self.name) sp.call("xtp_parallel -e pewald3d -o OPTIONFILES/{}.xml -f {} -s 0 -t 4 -c 128 > ewaldlocal.log".format(name,os.path.basename(self.sql)),shell=True) sp.call("xtp_parseewald.py -j jobs.ewald.xml -f {}".format(os.path.basename(self.sql)),shell=True)
def egwbse(self): if args.write: name = "egwbse" jobfile = "egwbse.jobs" root = self.readoptionfile(name) for entry in root.iter(name): dftoptions = entry.find("dftpackage").text shutil.copyfile(os.path.join(self.template, dftoptions), os.path.join(self.path, dftoptions)) gwbseoptions = entry.find("gwbse_options").text shutil.copyfile(os.path.join(self.template, gwbseoptions), os.path.join(self.path, gwbseoptions)) entry.find("job_file").text = os.path.join(self.path, jobfile) try: espoptions = entry.find("esp_options").text shutil.copyfile(os.path.join(self.template, espoptions), os.path.join(self.path, espoptions)) except: print "Running without espfits" self.writeoptionfile(root, name) with cd(self.path): print "Running egwbse to write jobfile {} for {}".format( jobfile, self.name) sp.check_output( "xtp_parallel -e {} -o OPTIONFILES/{}.xml -f {} -j write -s 0 > egwbse.log" .format(name, name, os.path.basename(self.sql)), shell=True) elif args.local: name = "egwbselocal" calcname = "egwbse" self.writeoptionfile(self.readoptionfile(name, calcname=calcname), name) with cd(self.path): print "Running egwbse locally for {}".format(self.name) sp.call( "xtp_parallel -e gwbse -o OPTIONFILES/{}.xml -f {} -s 0 -t 1 -c 4 > egwbselocal.log" .format(name, os.path.basename(self.sql)), shell=True) elif args.read: name = "egwbse" jobfile = "egwbse.jobs" with cd(self.path): print "Running egwbse to read jobfile {} for {}".format( jobfile, self.name) sp.check_output( "xtp_parallel -e {} -o OPTIONFILES/{}.xml -f {} -j read >> egwbse.log" .format(name, name, os.path.basename(self.sql)), shell=True)
def exciton(self,xyzfile): name="exciton" root=self.readoptionfile("exciton",calcname="exciton") for entry in root.iter(name): dft_options=entry.find("dftpackage").text shutil.copyfile(os.path.join(self.template,dft_options),os.path.join(self.path,dft_options)) if not args.skipmonomer: if self.rotation!=None: print "Molecules are rotated with respect to each other, starting monomer calculation" self.createmonomer(xyzfile,"molB.xyz") root=self.readoptionfile("exciton_single",calcname="exciton") for entry in root.iter(name): entry.find("tasks").text="input,dft,parse,gwbse" entry.find("gwbse_options").text="mbgft_single.xml" entry.find("archive").text="molB.orb" molecule=entry.find("molecule") dft_options_single=entry.find("dftpackage").text if dft_options_single!=dft_options: shutil.copyfile(os.path.join(self.template,dft_options_single),os.path.join(self.path,dft_options_single)) molecule.find("xyz").text="molB.xyz" self.writeoptionfile(root,"exciton_single") shutil.copyfile(os.path.join(self.template,"mbgft_single.xml"),os.path.join(self.path,"mbgft_single.xml")) with cd(self.path): print "Running {} monomer for {}".format(name,self.name) if args.verbose: sp.check_output("xtp_tools -v -e {0} -o {0}_single.xml > {0}_single.log".format(name),shell=True) else: sp.check_output("xtp_tools -e {0} -o {0}_single.xml > {0}_single.log".format(name),shell=True) sp.check_output("mv system.log molB.log".format(name),shell=True) sp.check_output("mv fort.7 molB.fort".format(name),shell=True) else: with cd(self.path): print "Molecules are not rotated with respect to each other, just linking orb file" sp.call("ln -s molA.orb molB.orb",shell=True) else: print "Skipping monomer calculation." with cd(self.path): sp.call("ln -s {} {}".format(os.path.relpath(os.path.join(self.template,"system.orb")),"molA.orb"),shell=True) print "Setting up options for {} for {}".format(name,self.name) self.writeoptionfile(self.readoptionfile(name),name) shutil.copyfile(os.path.join(self.template,"mbgft.xml"),os.path.join(self.path,"mbgft.xml")) with cd(self.path): print "Running {} dimer for {}".format(name,self.name) if args.verbose: sp.check_output("xtp_tools -v -e {0} -o {0}.xml > {0}.log".format(name),shell=True) else: sp.check_output("xtp_tools -e {0} -o {0}.xml > {0}.log".format(name),shell=True)
def eanalyze(self): name="eanalyze" self.writeoptionfile(self.readoptionfile(name),name) with cd(self.path): print "Running eanalyze for {}".format(self.name) sp.check_output("xtp_run -e {} -o OPTIONFILES/{}.xml -f {} -s 0 > eanalyze.log".format(name,name,os.path.basename(self.sql)),shell=True)
def neighborlist(self): name="neighborlist" self.writeoptionfile(self.readoptionfile(name),name) #print "xtp_run -e {} -o OPTIONFILES/{}.xml -f {}".format(name,name,os.path.basename(self.sql)) with cd(self.path): print "Setting up neighborlist for {}".format(self.name) sp.check_output("xtp_run -e {} -o OPTIONFILES/{}.xml -f {} > neighborlist.log".format(name,name,os.path.basename(self.sql)),shell=True,stderr=sp.STDOUT)
def ewald(self): if args.write: name = 'stateserver' self.writeoptionfile(self.readoptionfile(name), name) with cd(self.path): print "Running stateserver for ewald for {}".format(self.name) sp.check_output( "xtp_run -e {} -o OPTIONFILES/{}.xml -f {} -s 0 > stateserver.log" .format(name, name, os.path.basename(self.sql)), shell=True) name = "xjobwriter" self.writeoptionfile(self.readoptionfile(name), name) with cd(self.path): print "Running xjobwriter for ewald for {}".format(self.name) sp.check_output( "xtp_run -e {} -o OPTIONFILES/{}.xml -f {} -s 0 > jobwriter.log" .format(name, name, os.path.basename(self.sql)), shell=True) sp.call("mv xjobwriter.mps.chrg.xml ewald.jobs", shell=True) elif args.read: name = "ewaldparser" with cd(self.path): print "Running ewaldparser for ewald for {}".format(self.name) sp.call("xtp_parseewald.py -j ewald.jobs -f {}".format( os.path.basename(self.sql)), shell=True) elif args.local: name = "ewaldlocal" calcname = "ewald" self.writeoptionfile(self.readoptionfile(name, calcname=calcname), name) with cd(self.path): print "Running ewald locally for {}".format(self.name) sp.call( "xtp_parallel -e pewald3d -o OPTIONFILES/{}.xml -f {} -s 0 -t 4 -c 128 > ewaldlocal.log" .format(name, os.path.basename(self.sql)), shell=True) sp.call("xtp_parseewald.py -j ewald.jobs -f {}".format( os.path.basename(self.sql)), shell=True)
def xcoupling(self, states): name = "excitoncoupling" print "Setting up options for {} for {}".format(name, self.name) if not os.path.isfile(os.path.join(self.path, "molA.orb")): with cd(self.path): sp.call("ln -s {} {}".format( os.path.relpath(os.path.join(self.template, "system.orb")), "molA.orb"), shell=True) #shutil.copyfile(os.path.join(self.template,"system.orb"),os.path.join(self.path,"molA.orb")) for state in states: root = self.readpackagefile("bsecoupling") bsefilename = "bsecoupling_{}".format(state) A = root.find("moleculeA") (A.find("occLevels")).text = str(state) (A.find("unoccLevels")).text = str(state) B = root.find("moleculeB") (B.find("occLevels")).text = str(state) (B.find("unoccLevels")).text = str(state) self.writeoptionfile(root, bsefilename) root = self.readoptionfile(name) optionfilename = "{}_{}".format(name, state) for entry in root.iter(name): (entry.find("output") ).text = "excitoncoupling_{}.out.xml".format(state) (entry.find("bsecoupling_options")).text = bsefilename + ".xml" (entry.find("orbitalsA")).text = "molA.orb" (entry.find("orbitalsB")).text = "molB.orb" self.writeoptionfile(root, optionfilename) with cd(self.path): print "Running {} for {} with {} occ/unocc states for each molecule giving {} states".format( name, self.name, state, 2 * state**2) if args.verbose: sp.check_output( "xtp_tools -v -e {0} -o {1}.xml > {1}.log".format( name, optionfilename), shell=True) else: sp.check_output( "xtp_tools -e {0} -o {1}.xml > {1}.log".format( name, optionfilename), shell=True)
def einternal(self): name = "xeinternal" self.writeoptionfile(self.readoptionfile(name), name) with cd(self.path): print "Importing internal energies for {}".format(self.name) sp.check_output("xtp_run -e {} -o OPTIONFILES/{}.xml -f {}".format( name, name, os.path.basename(self.sql)), shell=True, stderr=sp.STDOUT)
def ianalyze(self): name = "xianalyze" self.writeoptionfile(self.readoptionfile(name), name) with cd(self.path): print "Running xianalyze for {}".format(self.name) sp.check_output( "xtp_run -e {} -o OPTIONFILES/{}.xml -f {} -s 0 > ianalyze.log" .format(name, name, os.path.basename(self.sql)), shell=True)
def mapsystem(self,mapfile,tprfile): shutil.copyfile(os.path.join(self.template,mapfile),self.map) tprfile=os.path.join(self.path,"MD_FILES/"+os.path.basename(tprfile)) grofile=os.path.join(self.path,"MD_FILES/"+os.path.basename(self.grofile)) with cd(self.path): print "Mapping {}".format(self.name) #print "xtp_map -s {} -t {} -c {} -f {} ".format(os.path.join(self.path,mapfile),tprfile,grofile,self.sql) sp.check_output("xtp_map -s {} -t {} -c {} -f {} > map.log".format(self.map,tprfile,grofile,self.sql),shell=True,stderr=sp.STDOUT) sp.check_output("xtp_dump -e trajectory2pdb -f {}".format(self.sql),shell=True,stderr=sp.STDOUT)
def izindo(self): name = "izindo" self.writeoptionfile(self.readoptionfile(name), name) with cd(self.path): print "Running izindo for {}".format(self.name) sp.check_output( "xtp_run -e {} -o OPTIONFILES/{}.xml -f {} -t 4 > izindo.log". format(name, name, os.path.basename(self.sql)), shell=True)
def stateserver(self): name = "stateserver" self.writeoptionfile(self.readoptionfile(name), name) with cd(self.path): print "Creating mps.tab file for {}".format(self.name) sp.call( "xtp_run -e {} -o OPTIONFILES/{}.xml -f {} -s 0 > stateserver.log" .format(name, name, os.path.basename(self.sql)), shell=True, stderr=sp.STDOUT)
def iexcitoncl(self): name="stateserver" self.writeoptionfile(self.readoptionfile(name),name) with cd(self.path): print "Creating mps.tab file for {}".format(self.name) sp.call("xtp_run -e {} -o OPTIONFILES/{}.xml -f {} -s 0 > stateserver.log".format(name,name,os.path.basename(self.sql)),shell=True,stderr=sp.STDOUT) name="iexcitoncl" jobfile=os.path.join(self.path,"{}.jobs.iexcitoncl".format(name)) mpsfile=os.path.join(self.path,"mps.tab".format(name)) root=self.readoptionfile(name) for entry in root.iter(name): entry.find("mapping").text=self.map entry.find("emp_file").text=mpsfile entry.find("job_file").text=jobfile self.writeoptionfile(root,name) with cd(self.path): print "Running iexcitoncl for {}".format(self.name) sp.check_output("xtp_parallel -e {} -o OPTIONFILES/{}.xml -f {} -j write -s 0 > iexcitoncl.log".format(name,name,os.path.basename(self.sql)),shell=True,stderr=sp.STDOUT) sp.check_output("xtp_parallel -e {} -o OPTIONFILES/{}.xml -f {} -j run -c 20000 -t 4 -s 0 >> iexcitoncl.log".format(name,name,os.path.basename(self.sql)),shell=True,stderr=sp.STDOUT) sp.check_output("xtp_parallel -e {} -o OPTIONFILES/{}.xml -f {} -j read >> iexcitoncl.log".format(name,name,os.path.basename(self.sql)),shell=True,stderr=sp.STDOUT)
def zmultipole(self): if args.local or args.sub: name="zmultipole" self.writeoptionfile(self.readoptionfile(name),name) with cd(self.path): if args.local: print "Running zmultipole for {}".format(self.name) sp.check_output("xtp_run -e {} -o OPTIONFILES/{}.xml -f {} -t 4 > zmultipole_local.log".format(name,name,os.path.basename(self.sql)),shell=True) elif args.sub: print "Running zmultipole for {} on cluster".format(self.name) sp.check_output("xtp_jobstarterPARALLEL.py -o OPTIONFILES/{}.xml -f {} --sub > zmultipole_cluster.log".format(name,os.path.basename(self.sql)),shell=True) elif args.read: name="eimport" self.writeoptionfile(self.readoptionfile(name),name) with cd(self.path): print "Importing site energies from directory ZMULTIPOLE for {}".format(self.name) sp.call("cat ZMULTIPOLE/*.dat > zmultipole.dat",shell=True) sp.check_output("xtp_run -e {} -o OPTIONFILES/{}.xml -f {} > zmultipole_read.log".format(name,name,os.path.basename(self.sql)),shell=True)
def classicalcoupling(self): name="excitoncoupling_classical" calcname="excitoncoupling" shutil.copyfile(os.path.join(self.template,args.mps),os.path.join(self.path,"molA.mps")) mpsout="molB.mps" self.creatempsdimer(args.mps,mpsout) self.writeoptionfile(self.readoptionfile(name,calcname=calcname),name) with cd(self.path): print "Running {} for {}".format(name,self.name) sp.check_output("xtp_tools -e {0} -o {1}.xml > {1}.log".format(calcname,name),shell=True)
def neighborlist(self): name = "xneighborlist" self.writeoptionfile(self.readoptionfile(name), name) #print "xtp_run -e {} -o OPTIONFILES/{}.xml -f {}".format(name,name,os.path.basename(self.sql)) with cd(self.path): print "Setting up neighborlist for {}".format(self.name) sp.check_output( "xtp_run -e {} -o OPTIONFILES/{}.xml -f {} > neighborlist.log". format(name, name, os.path.basename(self.sql)), shell=True, stderr=sp.STDOUT)
def kmc(self): jobfile=args.kmcjobfile p = re.compile('([-+]?([0-9]*\.[0-9]+|[0-9]+))K\_') temp=p.search(self.name) #print self.name if temp==None: Temperature=300 else: Temperature=float(temp.group(1)) if args.read: with cd(self.path): sp.call("xtp_kmc_jobresults.py --jobset {} --jobfolder kmc_jobs".format(jobfile),shell=True) print re.sub(".csv","_results.csv",jobfile) sp.call("xtp_kmc_jobresults_mobility.py --csv {}".format(re.sub(".csv","_results.csv",jobfile)),shell=True) else: print "Temperature set to {} for {}".format(Temperature,self.name) shutil.copyfile(os.path.join(self.template,jobfile),os.path.join(self.path,jobfile)) with cd(self.path): if args.sub: print "Running kmc for {} at T={}K".format(self.name,Temperature) sp.call("xtp_kmc_jobstarterPARALLEL.py -j {} -c parse -sub -T {}".format(jobfile,Temperature),shell=True)
def makefolder(self): #print self.path copyfromtemplate(self.foldername) root=XmlParser("{}/exciton.xml".format(self.foldername)) exciton=root.find("exciton") exciton.find("tasks").text="input" XmlWriter(root,"{}/exciton.xml".format(self.foldername)) with cd(self.foldername): sp.call("xtp_tools -e exciton -o exciton.xml > exciton.log",shell=True) self.modcomfile("system.com") exciton.find("tasks").text="dft,parse,gwbse" XmlWriter(root,"{}/exciton.xml".format(self.foldername))
def classicalcoupling(self): name = "excitoncoupling_classical" calcname = "excitoncoupling" shutil.copyfile(os.path.join(self.template, args.mps), os.path.join(self.path, "molA.mps")) mpsout = "molB.mps" self.creatempsdimer(args.mps, mpsout) self.writeoptionfile(self.readoptionfile(name, calcname=calcname), name) with cd(self.path): print "Running {} for {}".format(name, self.name) sp.check_output("xtp_tools -e {0} -o {1}.xml > {1}.log".format( calcname, name), shell=True)
def makefolder(self): #print self.path copyfromtemplate(self.foldername) root = XmlParser("{}/exciton.xml".format(self.foldername)) exciton = root.find("exciton") gwbseengine = exciton.find("gwbse_engine") gwbseengine.find("tasks").text = "input" XmlWriter(root, "{}/exciton.xml".format(self.foldername)) with cd(self.foldername): sp.call("xtp_tools -e exciton -o exciton.xml > exciton.log", shell=True) self.modcomfile("system.com") gwbseengine.find("tasks").text = "dft,parse,gwbse" XmlWriter(root, "{}/exciton.xml".format(self.foldername))
def mapsystem(self, mapfile, tprfile): shutil.copyfile(os.path.join(self.template, mapfile), self.map) tprfile = os.path.join(self.path, "MD_FILES/" + os.path.basename(tprfile)) grofile = os.path.join(self.path, "MD_FILES/" + os.path.basename(self.grofile)) with cd(self.path): print "Mapping {}".format(self.name) #print "xtp_map -s {} -t {} -c {} -f {} ".format(os.path.join(self.path,mapfile),tprfile,grofile,self.sql) sp.check_output("xtp_map -s {} -t {} -c {} -f {} > map.log".format( self.map, tprfile, grofile, self.sql), shell=True, stderr=sp.STDOUT) sp.check_output("xtp_dump -e trajectory2pdb -f {}".format( self.sql), shell=True, stderr=sp.STDOUT)
def coupling(self): name="coupling" print "Setting up options for {} for {}".format(name,self.name) shutil.copyfile(os.path.join(self.template,"system.log"),os.path.join(self.path,"molA.log")) shutil.copyfile(os.path.join(self.template,"fort.7"),os.path.join(self.path,"molA.fort")) self.writeoptionfile(self.readoptionfile(name),name) with cd(self.path): if self.rotation is None: sp.call("ln -s molA.log molB.log",shell=True) sp.call("ln -s molA.fort molB.fort",shell=True) sp.call("ln -s fort.7 system.fort",shell=True) print "Running {} for {}".format(name,self.name) if args.verbose: sp.check_output("xtp_tools -v -e {0} -o {0}.xml > {0}.log".format(name),shell=True) else: sp.check_output("xtp_tools -e {0} -o {0}.xml > {0}.log".format(name),shell=True)
def xqmmm(self): name = "xqmmm" root = self.readoptionfile(name) for entry in root.iter(name): dftoptions = entry.find("dftpackage").text shutil.copyfile(os.path.join(self.template, dftoptions), os.path.join(self.path, dftoptions)) gwbse = entry.find("gwbse").text gwbseoptions = gwbse.find("gwbse_options").text shutil.copyfile(os.path.join(self.template, gwbseoptions), os.path.join(self.path, gwbseoptions)) entry.find("job_file").text = os.path.join(self.path, jobfile) self.writeoptionfile(root, name) with cd(self.path): print "Running xqmmm for {}".format(self.name) sp.check_output( "xtp_parallel -e {} -o OPTIONFILES/{}.xml -f {} -t 1 -c 1 -s 0 > xqmmm.log" .format(name, name, os.path.basename(self.sql)), shell=True)
def coupling(self): name = "coupling" print "Setting up options for {} for {}".format(name, self.name) shutil.copyfile(os.path.join(self.template, "system.log"), os.path.join(self.path, "molA.log")) shutil.copyfile(os.path.join(self.template, "fort.7"), os.path.join(self.path, "molA.fort")) self.writeoptionfile(self.readoptionfile(name), name) with cd(self.path): if self.rotation is None: sp.call("ln -s molA.log molB.log", shell=True) sp.call("ln -s molA.fort molB.fort", shell=True) sp.call("ln -s fort.7 system.fort", shell=True) print "Running {} for {}".format(name, self.name) if args.verbose: sp.check_output( "xtp_tools -v -e {0} -o {0}.xml > {0}.log".format(name), shell=True) else: sp.check_output( "xtp_tools -e {0} -o {0}.xml > {0}.log".format(name), shell=True)
def runjob(self): print "Running job {}".format(self.identifier) with cd(self.foldername): sp.call("xtp_tools -e exciton -o exciton.xml > exciton.log",shell=True)
calculator, optfile, sql, threads, cache, logfile) write_cluster_batch(command, tag, outfile=subfile, outlog="{}.log".format(i), errlog="{}.err".format(i), queue=queue, procs=procs, module=modules, source=source, execdir=execdir, rsync=rsync) if args.submit: for submitfile in submitfiles: with cd(currentdir): sp.call("qsub {}".format(os.path.join(workdir, submitfile)), shell=True) if args.merge: "Merging files into {}".format(jobfile) mergejobfiles(jobfiles, jobfile) if args.info: total = 0 complete = 0 available = 0 assigned = 0 failed = 0 print "{:^18}|{:^12}|{:^12}|{:^12}|{:^12}|{:^12}".format( "Jobfile", "TOTAL", "COMPLETE", "AVAILABLE", "ASSIGNED", "FAILED")
def einternal(self): name="einternal" self.writeoptionfile(self.readoptionfile(name),name) with cd(self.path): print "Importing internal energies for {}".format(self.name) sp.check_output("xtp_run -e {} -o OPTIONFILES/{}.xml -f {}".format(name,name,os.path.basename(self.sql)),shell=True,stderr=sp.STDOUT)
def izindo(self): name="izindo" self.writeoptionfile(self.readoptionfile(name),name) with cd(self.path): print "Running izindo for {}".format(self.name) sp.check_output("xtp_run -e {} -o OPTIONFILES/{}.xml -f {} -t 4 > izindo.log".format(name,name,os.path.basename(self.sql)),shell=True)
for i,optfile,jfile,subfile,logfile,tag in zip(rangejobs,optionfiles,jobfiles,submitfiles,logfiles,tags): root=lxml.Element("options") options.find("job_file").text=jfile root.append(options) XmlWriter(root,optfile) if rsync!=False: execdir=None else: execdir=currentdir command="xtp_parallel -e {} -o {} -f {} -s 0 -t {} -c {} > {}".format(calculator,optfile,sql,threads,cache,logfile) write_cluster_batch(command,tag,outfile=subfile,outlog="{}.log".format(i),errlog="{}.err".format(i),queue=queue,procs=procs,module=["gaussian/g03","votca/git_cluster"],source="/sw/linux/gromacs/5.1.2/bin/GMXRC",execdir=execdir,rsync=rsync) if args.submit: for submitfile in submitfiles: with cd(workdir): sp.call("qsub {}".format(submitfile),shell=True) if args.merge: mergejobfiles(jobfiles,jobfile) if args.info: total=0 complete=0 available=0 assigned=0 failed=0 print "{:^18}|{:^12}|{:^12}|{:^12}|{:^12}|{:^12}".format("Jobfile","TOTAL","COMPLETE","AVAILABLE","ASSIGNED","FAILED") print '-' * 83 for jobfile in jobfiles: t,c,ava,ass,f=infojobfile(jobfile)
def exciton(self, xyzfile): name = "exciton" root = self.readoptionfile("exciton", calcname="exciton") for entry in root.iter(name): dft_options = entry.find("dftpackage").text shutil.copyfile(os.path.join(self.template, dft_options), os.path.join(self.path, dft_options)) if not args.skipmonomer: if self.rotation != None: print "Molecules are rotated with respect to each other, starting monomer calculation" self.createmonomer(xyzfile, "molB.xyz") root = self.readoptionfile("exciton_single", calcname="exciton") for entry in root.iter(name): entry.find("tasks").text = "input,dft,parse,gwbse" entry.find("gwbse_options").text = "mbgft_single.xml" entry.find("archive").text = "molB.orb" molecule = entry.find("molecule") dft_options_single = entry.find("dftpackage").text if dft_options_single != dft_options: shutil.copyfile( os.path.join(self.template, dft_options_single), os.path.join(self.path, dft_options_single)) molecule.find("xyz").text = "molB.xyz" self.writeoptionfile(root, "exciton_single") shutil.copyfile( os.path.join(self.template, "mbgft_single.xml"), os.path.join(self.path, "mbgft_single.xml")) with cd(self.path): print "Running {} monomer for {}".format(name, self.name) if args.verbose: sp.check_output( "xtp_tools -v -e {0} -o {0}_single.xml > {0}_single.log" .format(name), shell=True) else: sp.check_output( "xtp_tools -e {0} -o {0}_single.xml > {0}_single.log" .format(name), shell=True) sp.check_output("mv system.log molB.log".format(name), shell=True) sp.check_output("mv fort.7 molB.fort".format(name), shell=True) else: with cd(self.path): print "Molecules are not rotated with respect to each other, just linking orb file" sp.call("ln -s molA.orb molB.orb", shell=True) else: print "Skipping monomer calculation." with cd(self.path): sp.call("ln -s {} {}".format( os.path.relpath(os.path.join(self.template, "system.orb")), "molA.orb"), shell=True) print "Setting up options for {} for {}".format(name, self.name) self.writeoptionfile(self.readoptionfile(name), name) shutil.copyfile(os.path.join(self.template, "mbgft.xml"), os.path.join(self.path, "mbgft.xml")) with cd(self.path): print "Running {} dimer for {}".format(name, self.name) if args.verbose: sp.check_output( "xtp_tools -v -e {0} -o {0}.xml > {0}.log".format(name), shell=True) else: sp.check_output( "xtp_tools -e {0} -o {0}.xml > {0}.log".format(name), shell=True)
def runjob(self): print "Running job {}".format(self.identifier) with cd(self.foldername): sp.call("xtp_tools -e exciton -o exciton.xml > exciton.log", shell=True)