示例#1
0
def get_energies(rootdir, reanalyze):
    FORMAT = "%(relativeCreated)d msecs : %(message)s"
    logging.basicConfig(level=logging.INFO, format=FORMAT)
    drone = VaspToComputedEntryDrone(inc_structure=True, data=['filename'])
    ncpus = multiprocessing.cpu_count()
    logging.info('Detected {} cpus'.format(ncpus))
    queen = BorgQueen(drone, number_of_drones=ncpus)
    if os.path.exists('vasp_analyzer_data.gz') and not reanalyze:
        logging.info('Using previously assimilated data file vasp_analyzer_data.gz. Use -f to force re-analysis')
        queen.load_data('vasp_analyzer_data.gz')
    else:
        queen.parallel_assimilate(rootdir)
        queen.save_data('vasp_analyzer_data.gz')
    entries = queen.get_assimilated_data()
    entries = sorted(entries, key=lambda x:x.data['filename'])
    all_data = [(e.data['filename'].replace("./", ""), e.composition.formula, "{:.5f}".format(e.energy), "{:.5f}".format(e.energy_per_atom), "{:.2f}".format(e.structure.volume)) for e in entries]
    print str_aligned(all_data, ("Directory", "Formula", "Energy", "E/Atom", "Vol"))
示例#2
0
class BorgQueenTest(unittest.TestCase):

    def setUp(self):
        drone = VaspToComputedEntryDrone()
        self.queen = BorgQueen(drone, test_dir, 1)

    def test_get_assimilated_data(self):
        data = self.queen.get_assimilated_data()
        self.assertEqual(len(data), 1)

    def test_load_data(self):
        drone = VaspToComputedEntryDrone()
        queen = BorgQueen(drone)
        queen.load_data(os.path.join(test_dir, "assimilated.json"))
        self.assertEqual(len(queen.get_assimilated_data()), 1)
示例#3
0
 def test_load_data(self):
     drone = VaspToComputedEntryDrone()
     queen = BorgQueen(drone)
     queen.load_data(os.path.join(test_dir, "assimilated.json"))
     self.assertEqual(len(queen.get_assimilated_data()), 1)
示例#4
0
 def setUp(self):
     drone = VaspToComputedEntryDrone()
     self.queen = BorgQueen(drone, test_dir, 1)