Пример #1
0
 def test_firefly(self):
     """
     Tests (pychemia.searcher.firefly) with LJ Clusters           :
     """
     if not has_connection():
         return
     pcm_log.debug('FireFly')
     popu = LJCluster('test',
                      composition='Xe13',
                      refine=True,
                      direct_evaluation=True)
     popu.pcdb.clean()
     searcher = FireFly(popu, generation_size=8, stabilization_limit=3)
     searcher.run()
     popu.pcdb.clean()
     searcher = FireFly(popu, {
         'delta': 0.1,
         'gamma': 0.1,
         'beta0': 0.8,
         'alpha0': 0,
         'multi_move': True
     },
                        generation_size=8,
                        stabilization_limit=3)
     searcher.run()
     popu.pcdb.clean()
Пример #2
0
 def test_firefly(self):
     """
     Tests (pychemia.searcher.firefly)                            :
     """
     pcm_log.debug('FireFly')
     mini = Sphere().minimum(3)
     popu = RealFunction(Sphere.function,
                         3, [-1, 1],
                         local_minimization=False)
     searcher = FireFly(popu, generation_size=16, stabilization_limit=5)
     searcher.run()
     popu = RealFunction(Sphere.function,
                         3, [-1, 1],
                         local_minimization=True)
     searcher = FireFly(popu, {
         'delta': 0.1,
         'gamma': 0.1,
         'beta0': 0.8,
         'alpha0': 0,
         'multi_move': True
     },
                        generation_size=16,
                        stabilization_limit=5)
     searcher.run()
     assert np.linalg.norm(
         np.array(searcher.population.db[searcher.population.best_candidate]
                  ['x']) - mini) < 0.2
def search(db_settings, search_settings, abipath):
    pcdb = get_database(db_settings)
    print("[%s] Path for abinit.in: %s" % (pcdb.name, abipath))
    popu = OrbitalDFTU(pcdb, abipath + os.sep + 'abinit.in')

    if 'generation_size' in search_settings:
        generation_size = search_settings.pop('generation_size')
    else:
        generation_size = 32

    if 'stabilization_limit' in search_settings:
        stabilization_limit = search_settings.pop('stabilization_limit')
    else:
        stabilization_limit = 10

    fire = FireFly(popu, params=search_settings, generation_size=generation_size,
                   stabilization_limit=stabilization_limit)
    fire.run()
Пример #4
0
def search(db_settings, search_settings, abipath):
    pcdb = get_database(db_settings)
    print("[%s] Path for abinit.in: %s" % (pcdb.name, abipath))
    popu = OrbitalDFTU(pcdb, abipath + os.sep + 'abinit.in')

    if 'generation_size' in search_settings:
        generation_size = search_settings.pop('generation_size')
    else:
        generation_size = 32

    if 'stabilization_limit' in search_settings:
        stabilization_limit = search_settings.pop('stabilization_limit')
    else:
        stabilization_limit = 10

    fire = FireFly(popu,
                   params=search_settings,
                   generation_size=generation_size,
                   stabilization_limit=stabilization_limit)
    fire.run()
Пример #5
0
    def test_firefly(self):
        """
        Test (pychemia.searcher.firefly) with NonCollinearMagMoms   :
        """
        logging.basicConfig(level=logging.DEBUG)
        if not HAS_PYMONGO:
            print('Could not load pymongo, leaving now')
            return
        else:
            if not has_local_mongo():
                return

        pcm_log.debug('HarmonySearch')

        source = 'tests/data/vasp_02'
        assert os.path.isfile(source + os.sep + 'INCAR')
        assert os.path.isfile(source + os.sep + 'POSCAR')
        popu = NonCollinearMagMoms('test', source, debug=True)
        popu.pcdb.clean()
        searcher = FireFly(popu, generation_size=16, stabilization_limit=5)
        searcher.run()
        popu.pcdb.clean()
    def test_firefly(self):
        """
        Tests (pychemia.searcher.firefly) with NonCollinearMagMoms   :
        """
        logging.basicConfig(level=logging.DEBUG)
        if not HAS_PYMONGO:
            print('Could not load pymongo, leaving now')
            return
        else:
            if not has_local_mongo():
                return

        pcm_log.debug('HarmonySearch')

        source = 'pychemia/test/data/vasp_02'
        assert os.path.isfile(source + os.sep + 'INCAR')
        assert os.path.isfile(source + os.sep + 'POSCAR')
        popu = NonCollinearMagMoms('test', source, debug=True)
        popu.pcdb.clean()
        searcher = FireFly(popu, generation_size=16, stabilization_limit=5)
        searcher.run()
        popu.pcdb.clean()
Пример #7
0
 def test_firefly(self):
     """
     Tests (pychemia.searcher.firefly)                            :
     """
     pcm_log.debug('FireFly')
     mini = Sphere().minimum(3)
     popu = RealFunction(Sphere.function, 3, [-1, 1], local_minimization=False)
     searcher = FireFly(popu, generation_size=16, stabilization_limit=5)
     searcher.run()
     popu = RealFunction(Sphere.function, 3, [-1, 1], local_minimization=True)
     searcher = FireFly(popu, {'delta': 0.1, 'gamma': 0.1, 'beta0': 0.8, 'alpha0': 0, 'multi_move': True},
                                          generation_size=16, stabilization_limit=5)
     searcher.run()
     assert np.linalg.norm(np.array(searcher.population.db[searcher.population.best_candidate]['x']) - mini) < 0.2
Пример #8
0
    def test_firefly(self):
        """
        Tests (pychemia.searcher.firefly) with LJ Clusters           :
        """

        pcm_log.debug('FireFly')
        popu = LJCluster('test', composition='Xe13', refine=True, direct_evaluation=True)
        popu.pcdb.clean()
        searcher = FireFly(popu, generation_size=8, stabilization_limit=3)
        searcher.run()
        popu.pcdb.clean()
        searcher = FireFly(popu, {'delta': 0.1, 'gamma': 0.1, 'beta0': 0.8, 'alpha0': 0, 'multi_move': True},
                           generation_size=8, stabilization_limit=3)
        searcher.run()
        popu.pcdb.clean()