def main():

    # command-line options
    parser = optparse.OptionParser()
    parser.add_option("-f", "--file", dest="tran_info_file", help="name of the *_tran_info.dat file")
    parser.add_option(
        "-p", "--print", dest="output_deviations", action="store_true", help="prints the deviations in a file"
    )
    options, remainder = parser.parse_args()
    # if the program is called without options it prints the help menu
    if len(sys.argv[1:]) == 0:
        parser.print_help()
        sys.exit(0)

    # Printing some information with date and time
    print header
    print " program visualize_defect_influence.py"
    print " program started on %s at %s" % (
        time.strftime("%A, %d %B %Y", time.localtime()),
        time.strftime("%H:%M:%S", time.localtime()),
    )
    print ""

    # making sure the user properly tuned the constraints function
    print " Did you modify the 'constraints.py' module"
    print " to fit your system ?"
    constraints_modified = "dummy"
    while constraints_modified not in ["yes", "no"]:
        constraints_modified = str(raw_input("\n -> type 'yes' or 'no' : "))
    if constraints_modified == "no":
        print ""
        sys.exit(1)
    print ""

    # loading the data in the *_tran_info.dat file
    (
        wf_total,
        wf_per_pl,
        cells_per_pl,
        cond_dir,
        second_dir,
        wannier_functions,
        atom_number,
        atomic_coordinates,
    ) = read_tran_info(options.tran_info_file)

    # calling the program's main routine
    main_routine(
        wf_total,
        wf_per_pl,
        cells_per_pl,
        cond_dir,
        wannier_functions,
        atom_number,
        atomic_coordinates,
        options.output_deviations,
    )
    print ""

    return
def main():

  # command-line options
  parser = optparse.OptionParser()
  parser.add_option('-f', '--file',     
                    dest="tran_info_file",
                    help="name of the *_tran_info.dat file")
  parser.add_option('-m', '--matrix',
                    dest="hamiltonian_matrix",
                    help="name of the Hamiltonian matrix (*_htC.dat)")
  options, remainder = parser.parse_args()
  # if the program is called without options it prints the help menu
  if len(sys.argv[1:])==0:
    parser.print_help()
    sys.exit(0)

  # Printing some information with date and time
  print header
  print " program compactify_conductor.py"
  print " program started on %s at %s" %(time.strftime("%A, %d %B %Y",time.localtime()),
                                         time.strftime("%H:%M:%S",time.localtime()))
  print ""

  # loading the data in the *_tran_info.dat file
  (wf_total,
   wf_per_pl,
   cells_per_pl,
   cond_dir,
   second_dir,
   wannier_functions,
   atom_number,
   atomic_coordinates) = read_tran_info(options.tran_info_file)

  # loading the Hamiltonian matrix
  hamiltonian_matrix = read_htC(options.hamiltonian_matrix)

  # calling the program's main routine
  t_start = time.time()
  main_routine(wf_total,
               wf_per_pl,
               cells_per_pl,
               cond_dir,
               second_dir,
               wannier_functions,
               atom_number,
               atomic_coordinates,
               hamiltonian_matrix)
  t_stop = time.time()

  # printing some timing informations
  print ""
  elapsed_time = t_stop - t_start
  if elapsed_time < 1.0:
    print " Execution time : %6.2f ms" %(elapsed_time*1000)
  else:
    print " Execution time : %6.2f s " %(elapsed_time)
  print ""

  return
Exemple #3
0
def main():

  # command-line options
  parser = optparse.OptionParser()
  parser.add_option('-f', '--file',     
                    dest="tran_info_file",
                    help="name of the *_tran_info.dat file")
  parser.add_option('-m', '--matrix',
                    dest="hamiltonian_matrix",
                    help="name of the Hamiltonian matrix (*_htC.dat)")
  parser.add_option('-p', '--positions',
                    dest="atomic_positions",
                    action="store_true",
                    help="whether of not the atomic positions are\n"+
                         "also printed")
  parser.add_option('-a', '--all',
                    dest="all_permutations",
                    action="store_true",
                    help="if activated, the program prints all the\n"+
                         "hamiltonian matrices resulting from  all\n"+
                         "possible cutting schemes")
  options, remainder = parser.parse_args()
  # if the program is called without options it prints the help menu
  if len(sys.argv[1:])==0:
    parser.print_help()
    sys.exit(0)

  # Printing some information with date and time
  print header
  print " program cut_conductor.py"
  print " program started on %s at %s" %(time.strftime("%A, %d %B %Y",time.localtime()),
                                         time.strftime("%H:%M:%S",time.localtime()))
  print ""

  # loading the data in the *_tran_info.dat file
  (wf_total,
   wf_per_pl,
   cells_per_pl,
   cond_dir,
   second_dir,
   wannier_functions,
   atom_number,
   atomic_coordinates_unsorted) = read_tran_info(options.tran_info_file)

  # loading the Hamiltonian matrix
  hamiltonian_matrix = read_htC(options.hamiltonian_matrix)

  # sort the atomic coordinates in the direction of conduction
  atomic_coordinates = sort_positions(atomic_coordinates_unsorted,cond_dir)

  # calling the program's main routine
  t_start = time.time()
  main_routine(wf_total,
               wf_per_pl,
               cells_per_pl,
               cond_dir,
               wannier_functions,
               atom_number,
               atomic_coordinates,
               hamiltonian_matrix,
               options.atomic_positions,
               options.all_permutations)
  t_stop = time.time()

  # printing some timing informations
  print ""
  elapsed_time = t_stop - t_start
  if elapsed_time < 1.0:
    print " Execution time : %6.2f ms" %(elapsed_time*1000)
  else:
    print " Execution time : %6.2f s " %(elapsed_time)
  print ""

  return
Exemple #4
0
def main():

  # command-line options
  parser = optparse.OptionParser()
  parser.add_option('-f', '--file',     
                    dest="tran_info_file",
                    help="name of the *_tran_info.dat file")
  parser.add_option('-m', '--matrix',
                    dest="hamiltonian_matrix",
                    help="name of the Hamiltonian matrix (*_htC.dat)")
  parser.add_option('-a', '--angle',
                    dest="angle",
                    type="float",
                    default=0.0,
                    help="angle of rotation in radian")
  parser.add_option('-d', '--delta',
                    dest="delta",
                    type="float",
                    default=0.15,
                    help="distance threshold  for  WF grouping.\n"+
                         "use the same value as the one in the\n"+
                         "Wannier90 master input file")
  options, remainder = parser.parse_args()
  # if the program is called without options it prints the help menu
  if len(sys.argv[1:])==0:
    parser.print_help()
    sys.exit(0)

  # Printing some information with date and time
  print header
  print " program rotate_conductor.py"
  print " program started on %s at %s" %(time.strftime("%A, %d %B %Y",time.localtime()),
                                         time.strftime("%H:%M:%S",time.localtime()))
  print ""

  # loading the data in the *_tran_info.dat file
  (wf_total,
   wf_per_pl,
   cells_per_pl,
   cond_dir,
   second_dir,
   wannier_functions,
   atom_number,
   atomic_coordinates) = read_tran_info(options.tran_info_file)

  # loading the Hamiltonian matrix
  hamiltonian_matrix = read_htC(options.hamiltonian_matrix)

  # calling the program's main routine
  t_start = time.time()
  main_routine(wf_total,
               wf_per_pl,
               cells_per_pl,
               cond_dir,
               second_dir,
               wannier_functions,
               atom_number,
               atomic_coordinates,
               hamiltonian_matrix,
               options.angle,
               options.delta)
  t_stop = time.time()

  # printing some timing informations
  print ""
  elapsed_time = t_stop - t_start
  if elapsed_time < 1.0:
    print " Execution time : %6.2f ms" %(elapsed_time*1000)
  else:
    print " Execution time : %6.2f s " %(elapsed_time)
  print ""

  return