Ejemplo n.º 1
0
 def setUp(self):
     self.test_dir = os.path.join(
         os.path.dirname(__file__), "..", "..", "..", "..", "test_files", "molecules"
     )
     self.drone = GaussianToComputedEntryDrone(data=["corrections"])
     self.structure_drone = GaussianToComputedEntryDrone(True)
     warnings.simplefilter("ignore")
Ejemplo n.º 2
0
def get_energies(rootdir, reanalyze, verbose, pretty):
    if verbose:
        FORMAT = "%(relativeCreated)d msecs : %(message)s"
        logging.basicConfig(level=logging.INFO, format=FORMAT)
    drone = GaussianToComputedEntryDrone(inc_structure=True,
                                         parameters=['filename'])
    ncpus = multiprocessing.cpu_count()
    logging.info('Detected {} cpus'.format(ncpus))
    queen = BorgQueen(drone, number_of_drones=ncpus)
    if os.path.exists(save_file) and not reanalyze:
        msg = 'Using previously assimilated data from {}. ' + \
              'Use -f to force re-analysis'.format(save_file)
        queen.load_data(save_file)
    else:
        queen.parallel_assimilate(rootdir)
        msg = 'Results saved to {} for faster reloading.'.format(save_file)
        queen.save_data(save_file)

    entries = queen.get_data()
    entries = sorted(entries, key=lambda x: x.parameters['filename'])
    all_data = [(e.parameters['filename'].replace("./", ""),
                 re.sub("\s+", "", e.composition.formula),
                 "{}".format(e.parameters['charge']),
                 "{}".format(e.parameters['spin_mult']),
                 "{:.5f}".format(e.energy), "{:.5f}".format(e.energy_per_atom),
                 ) for e in entries]
    headers = ("Directory", "Formula", "Charge", "Spin Mult.", "Energy",
               "E/Atom")
    print(tabulate(all_data, headers=headers))
    print("")
    print(msg)
Ejemplo n.º 3
0
 def setUp(self):
     self.test_dir = os.path.join(os.path.dirname(__file__), "..", "..",
                                  "..", "..", 'test_files', "molecules")
     self.drone = GaussianToComputedEntryDrone(data=["corrections"])
     self.structure_drone = GaussianToComputedEntryDrone(True)
Ejemplo n.º 4
0
 def setUp(self):
     self.drone = GaussianToComputedEntryDrone(data=["corrections"])
     self.structure_drone = GaussianToComputedEntryDrone(True)
     warnings.simplefilter("ignore")