def main(): if len(sys.argv) == 1: print "syntax: %s <EZFIO_Archive.ezar>"%(sys.argv[0]) sys.exit(1) ezfio_filename = sys.argv[1].split(".ezar")[0] file = open(ezfio_filename+".ezar","r") dump = file.read() file.close() ezfio.set_filename(ezfio_filename) d = pickle.loads(zlib.decompress(dump)) set_functions = d.keys() nerrors_old = len(d)+1 nerrors = nerrors_old+1 while nerrors != nerrors_old: nerrors_old = nerrors nerrors = 0 failed = [] for f_name in set_functions: try: exec """ezfio.%s = d['%s']"""%(f_name,f_name) except: nerrors += 1 failed.append(f_name) if nerrors != 0: print "Unarchive failed:" for i in failed: print i sys.exit(1)
def main(): do_verbose = False if "-v" in sys.argv: do_verbose = True sys.argv.remove("-v") if len(sys.argv) == 1: print "syntax: %s <EZFIO_Filename>"%(sys.argv[0]) sys.exit(1) ezfio_filename = sys.argv[1] while ezfio_filename[-1] == "/": ezfio_filename = ezfio_filename[:-1] ezfio.set_filename(ezfio_filename) get_functions = filter( lambda x: x.startswith("has_"), ezfio_obj.__dict__.keys() ) d = {} for f in get_functions: f_name = f[4:] try: exec """d['%s'] = ezfio.%s"""%(f_name,f_name) except: if do_verbose: print "%-40s [%5s]"%(f_name, "Empty") else: if do_verbose: print "%-40s [%5s]"%(f_name, " OK ") dump = zlib.compress(pickle.dumps(d)) file = open(ezfio_filename+".ezar","w") file.write(dump) file.close()
#!/usr/bin/env python import os import sys sys.path = [ os.environ["QP_ROOT"]+"/install/EZFIO/Python" ] + sys.path from ezfio import ezfio ezfio.set_filename(sys.argv[1]) nb = 0 for charge in ezfio.nuclei_nucl_charge: if charge < 5: pass elif charge < 13: nb += 1 else: nb += 5 mo_tot_num = ezfio.mo_basis_mo_tot_num if nb == 0: os.system( """qp_set_mo_class -act "[1-%d]" %s"""%(mo_tot_num, sys.argv[1]) ) else: os.system( """qp_set_mo_class -core "[1-%d]" -act "[%d-%d]" %s"""%(nb, nb+1, mo_tot_num, sys.argv[1]) )
#!/usr/bin/env python import os import sys sys.path = [os.environ["QP_ROOT"] + "/install/EZFIO/Python"] + sys.path from ezfio import ezfio ezfio.set_filename(sys.argv[1]) nb = 0 for charge in ezfio.nuclei_nucl_charge: if charge < 5: pass elif charge < 13: nb += 1 else: nb += 5 mo_tot_num = ezfio.mo_basis_mo_tot_num if nb == 0: os.system("""qp_set_mo_class -act "[1-%d]" %s""" % (mo_tot_num, sys.argv[1])) else: os.system("""qp_set_mo_class -core "[1-%d]" -act "[%d-%d]" %s""" % (nb, nb + 1, mo_tot_num, sys.argv[1]))
#!/usr/bin/env python2 import os import sys sys.path = [os.environ["QP_ROOT"] + "/install/EZFIO/Python"] + sys.path from ezfio import ezfio filename = sys.argv[1] if filename == '-q': filename = sys.argv[2] ezfio.set_filename(filename) nb = 0 if not ezfio.pseudo_do_pseudo: for charge in ezfio.nuclei_nucl_charge: if charge < 5: pass elif charge < 13: nb += 1 else: nb += 5 mo_tot_num = ezfio.mo_basis_mo_tot_num if len(sys.argv) > 2: if '-q' in sys.argv: print nb sys.exit(0) if nb == 0: