コード例 #1
0
    phon_error_relaxed = ezff.error_phonon_dispersion(MD=md_relax_disp_GS,
                                                      GT=gt_relax_disp_GS,
                                                      weights='acoustic')
    phon_error_expanded = ezff.error_phonon_dispersion(MD=md_expanded_disp_GS,
                                                       GT=gt_expanded_disp_GS,
                                                       weights='acoustic')
    phon_error_compressed = ezff.error_phonon_dispersion(
        MD=md_compressed_disp_GS, GT=gt_compressed_disp_GS, weights='acoustic')

    return [
        a_lattice_error, b_lattice_error, modulus_error, phon_error_relaxed,
        phon_error_compressed, phon_error_expanded
    ]


pool = ezff.Pool()
problem = ezff.OptProblem(num_errors=6,
                          variable_bounds=bounds,
                          error_function=my_error_function,
                          template=template)
algo1 = ezff.Algorithm(problem, 'NSGAIII', population=64, pool=pool)
iter1 = 10
algo2 = ezff.Algorithm(problem, 'NSGAII', population=128, pool=pool)
iter2 = 5
algo3 = ezff.Algorithm(problem, 'IBEA', population=32, pool=pool)
iter3 = 10
algorithms = [algo1, algo2, algo3]
iterations = [iter1, iter2, iter3]
ezff.optimize(problem, algorithms, iterations)
pool.close()
コード例 #2
0
    expanded_job.options['relax_atoms'] = True
    expanded_job.options['relax_cell'] = False
    expanded_job.options['phonon_dispersion'] = True

    # Submit job and read output
    expanded_job.options['phonon_dispersion_from'] = '0 0 0'
    expanded_job.options['phonon_dispersion_to'] = '0.5 0.5 0'
    expanded_job.write_script_file()
    expanded_job.run(command='gulp')
    md_expanded_disp_GS = gulp.read_phonon_dispersion(expanded_job.path +
                                                      '/out.gulp.disp')
    phon_error_expanded = ezff.error_phonon_dispersion(md_expanded_disp_GS,
                                                       gt_expanded_disp_GS,
                                                       weights='acoustic')
    expanded_job.cleanup()  # FINISH EXPANDED JOB

    return [
        a_latt_error, b_latt_error, modulus_error, phon_error_relax,
        phon_error_compressed, phon_error_expanded
    ]


pool = ezff.Pool()
problem = ezff.OptProblem(num_errors=6,
                          variable_bounds=bounds,
                          error_function=my_error_function,
                          template=template)
algorithm = ezff.Algorithm(problem, 'NSGAII', population=128, pool=pool)
ezff.optimize(problem, algorithm, iterations=10)
pool.close()
コード例 #3
0
ファイル: run.py プロジェクト: AnkitMish/EZFF
    # Calculate error
    md_dis_scan_energies = np.array(md_dis_scan_energies)
    gt_dis_scan_energies = np.array(gt_dis_scan_energies)
    md_gs_energy = np.array(md_gs_energy)
    gt_gs_energy = np.array(gt_gs_energy)

    dis_error = ezff.error_PES_scan( md_dis_scan_energies-md_gs_energy, gt_dis_scan_energies-gt_gs_energy, weights = 'dissociation')

    return [freq_error, dis_error]

pool = ezff.Pool()

if pool.is_master():
    # Generate forcefield template and variable ranges
    FF = reax_forcefield('ffield')
    FF.make_template_twobody('S','C',double_bond=True)
    FF.make_template_threebody('S','C','S')
    FF.make_template_fourbody('S','C','S','S')
    FF.generate_templates()

time.sleep(5.0)

# Read template and variable ranges
bounds = ffio.read_variable_bounds('param_ranges', verbose=False)
template = ffio.read_forcefield_template('ff.template.generated')

problem = ezff.OptProblem(num_errors = 2, variable_bounds = bounds, error_function = my_error_function, template = template)
algorithm = ezff.Algorithm(problem, 'NSGAII', population = 128, pool = pool)
ezff.optimize(problem, algorithm, iterations = 4, write_forcefields = 5)
pool.close()