コード例 #1
0
def write_configuration_file(filename='pyposmat.config'):
    configuration = PyposmatConfigurationFile()
    configuration.qois = qoi_db.qois
    configuration.qoi_constraints = qoi_constraints
    configuration.structures = structure_db
    configuration.potential = potential_formalism
    configuration.sampling_type = sampling
    configuration.sampling_distribution = parameter_distribution
    configuration.sampling_constraints = parameter_constraints
    configuration.write(filename=filename)
コード例 #2
0
def write_configuration_file(
        filename,
        qois,
        potential_definition,
        structures):
    configuration = PyposmatConfigurationFile()
    configuration.qois = qois
    configuration.potential = potential_definition
    configuration.sampling_distribution = parameter_distribution
    configuration.structures = structures
    configuration.write(filename=filename)
コード例 #3
0
def write_configuration_file(config_fn):
    import Si_sw

    #------------------------------------------------------------------------------
    # WRITE CONFIGURATION FILE
    #------------------------------------------------------------------------------
    Si_sw_configuration = PyposmatConfigurationFile()
    Si_sw_configuration.qois = Si_sw.Si_sw_qoi_db.qois
    Si_sw_configuration.potential = Si_sw.Si_sw_potential
    Si_sw_configuration.structures = Si_sw.Si_sw_structures
    Si_sw_configuration.sampling_type = Si_sw.Si_sw_sampling
    Si_sw_configuration.sampling_distribution = Si_sw.Si_sw_parameter_distribution
    Si_sw_configuration.write(filename=config_fn)
    Si_sw_configuration.read(filename=config_fn)
コード例 #4
0
def write_configuration_file(config_fn):
    """
    Args:
        config_fn(str): the name of the configuration file

    """
    from pypospack.pyposmat.data import PyposmatDataFile
    import Ni__eam__morse_exp_universal as Ni__eam
    Ni_eam_configuration = PyposmatConfigurationFile()
    Ni_eam_configuration.qois = Ni_eam.Ni_qoi_db.qois
    Ni_eam_configuration.potential = Ni_eam.Ni_eam_potential_formalism
    Ni_eam_configuration.structures = Ni_eam.Ni_structure_db
    Ni_eam_configuration.sampling_type = Ni_eam.Ni_eam_sampling
    Ni_eam_configuration.sampling_distribution =Ni_eam.Ni_eam_parameter_distribution
    Ni_eam_configuration.write(filename=config_fn)
    Ni_eam_configuration.read(filename=config_fn)
コード例 #5
0
ファイル: MgO__buck.py プロジェクト: mastricker/pypospack
qoi_db.add_qoi(qoi_name="MgO_NaCl.G",
               qoi_type='shear_modulus',
               structures=OrderedDict([('ideal', 'MgO_NaCl')]),
               target=92.66)
qoi_db.add_qoi(qoi_name="MgO_NaCl.001s",
               qoi_type="E_surface",
               structures=OrderedDict([
                   ('slab', 'MgO_NaCl_001s'),
                   ('ideal', 'MgO_NaCl'),
               ], ),
               target=0.05595)

qoi_constraints = OrderedDict()
#------------------------------------------------------------------------------
# WRITE CONFIGURATION FILE
# this is currently creating a race condition, where the file is being written
# by multiple ranks to the same location.
#------------------------------------------------------------------------------
if __name__ == '__main__':
    from pypospack.pyposmat.data import PyposmatConfigurationFile
    pyposmat_filename_in = 'pyposmat.config.in'
    configuration = PyposmatConfigurationFile()
    configuration.qois = qoi_db.qois
    configuration.qoi_constraints = qoi_constraints
    configuration.structures = structure_db
    configuration.potential = potential_formalism
    configuration.sampling_type = sampling
    configuration.sampling_distribution = parameter_distribution
    configuration.sampling_constraints = parameter_constraints
    configuration.write(filename=pyposmat_filename_in)
コード例 #6
0
    # make new configuration file from the old configuration file

    from pypospack.pyposmat.data import PyposmatConfigurationFile
    _o_config = PyposmatConfigurationFile()
    _o_config.read(filename=_pyposmat_config_fn)

    pn1 = 'p_NiNi_phi0'
    pn2 = 'e_Ni_F0'

    # change to normal distribution for parameters of interest
    for pn in [pn1,pn2]:
        _o_config.configuration['sampling_dist'][pn] = ['normal',{'mu':_best_params[pn],'sigma':_std_params[pn]}]

    # change the rest of the free parameters to static
    for pn in _o_config.free_parameter_names:
        if pn != pn1 and pn != pn2:
            _o_config.configuration['sampling_dist'][pn] = ['equals',_best_params[pn]]

    _pyposmat_config_fn = os.path.join('data','pyposmat.config.in')

    # change the first iteration type to parametric
    _o_config.configuration['sampling_type'][0]['type'] = 'parametric'
    for k,v in _o_config.configuration['sampling_type'].items():
        if type(k) is int:
            _o_config.configuration['sampling_type'][k]['n_samples'] = _n_samples
        
    print(_o_config.configuration['sampling_type'])
    print("new pyposmat configuration file in:{}".format(_pyposmat_config_fn))
    _o_config.write(filename=_pyposmat_config_fn) 

コード例 #7
0
    _configuration_filename = 'pyposmat.config.in'
    #--------------------------------------------------------------------------
    # DEFINE CONFIGURATION FILED
    #--------------------------------------------------------------------------
    import Si_sw as config
    configuration = PyposmatConfigurationFile()
    configuration.qois = config.qoi_db.qois
    configuration.qoi_constraints = config.qoi_constraints
    configuration.structures = config.structure_db
    configuration.potential = config.potential_formalism
    configuration.sampling_type = config.sampling
    configuration.sampling_distribution = config.parameter_distribution
    configuration.sampling_constraints = config.parameter_constraints
    #<------------- write configuration file
    configuration.write(filename=_configuration_filename)
    #--------------------------------------------------------------------------
    # TEST CONFIGURATION FILE
    #--------------------------------------------------------------------------
    configuration.read(filename=_configuration_filename)

    #--------------------------------------------------------------------------
    # ANALYZE DATA
    #--------------------------------------------------------------------------
    data_directory = 'data'
    pyposmat_data_filename = 'pyposmat.results.9.out'
    pyposmat_configuration_filename = 'pyposmat.config.in'
    data_analyzer = PyposmatDataAnalyzer()
    data_analyzer.read_configuration_file(
        filename=pyposmat_configuration_filename)
    data_analyzer.read_data_file(
コード例 #8
0
from pypospack.pyposmat.data import PyposmatDataFile
from pypospack.pyposmat.data import PyposmatDataAnalyzer
import pypospack.pareto as pareto

if __name__ == "__main__":

    import Ni__eam__morse_exp_fs_0 as config
    configuration = PyposmatConfigurationFile()
    configuration.qois = config.qoi_db.qois
    configuration.qoi_constraints = config.qoi_constraints
    configuration.structures = config.structure_db
    configuration.potential = config.potential_formalism
    configuration.sampling_type = config.sampling
    configuration.sampling_distribution = config.parameter_distribution
    configuration.sampling_constraints = config.parameter_constraints
    configuration.write(filename='pyposmat.config.in')

    data_directory = 'data__morse_exp_fs'
    pyposmat_data_filename = 'pyposmat.results.4.out'
    pyposmat_configuration_filename = 'pyposmat.config.in'
    data_analyzer = PyposmatDataAnalyzer()
    data_analyzer.read_configuration_file(
        filename=pyposmat_configuration_filename)
    data_analyzer.read_data_file(
        filename=os.path.join(data_directory, pyposmat_data_filename))
    #data_analyzer.filter_performance_requirements()
    #data_analyzer.calculate_pareto_set()

    data_analyzer.write_kde_file(filename='pyposmat.kde.out')
    exit()
コード例 #9
0
        s = [80 * '-']
        s += ['{:^80}'.format('ERROR_NAMES')]
        s += [80 * '-']
        s += [p for p in _error_names]

        self.log("\n".join(s))


if __name__ == "__main__":
    import Ni__eam__morse_exp_universal as Ni_eam

    #------------------------------------------------------------------------------
    # WRITE CONFIGURATION FILE
    #------------------------------------------------------------------------------
    Ni_eam_configuration = PyposmatConfigurationFile()
    Ni_eam_configuration.qois = Ni_eam.Ni_qoi_db.qois
    Ni_eam_configuration.potential = Ni_eam.Ni_eam_potential_formalism
    Ni_eam_configuration.structures = Ni_eam.Ni_structure_db
    Ni_eam_configuration.sampling_type = Ni_eam.Ni_eam_sampling
    Ni_eam_configuration.sampling_distribution = Ni_eam.Ni_eam_parameter_distribution
    Ni_eam_configuration.write(filename='pypospack.config.in')
    Ni_eam_configuration.read(filename='pypospack.config.in')

    pypospack_filename_in = 'pypospack.config.in'
    pyposmat_app = PyposmatIterativeSampler(
        configuration_filename=pypospack_filename_in)
    pyposmat_app.read_configuration_file()
    #pyposmat_app.read_configuration_file(filename=pyposmat_configuration_filename)
    pyposmat_app.run_all()
コード例 #10
0
import os,shutil,sys
import numpy as np
from mpi4py import MPI
from pypospack.pyposmat.data import PyposmatConfigurationFile
from pypospack.pyposmat.data import PyposmatDataAnalyzer
from pypospack.pyposmat.engines import PyposmatIterativeSampler
if __name__ == "__main__":
    import Ni__eam__morse_exp_universal as Ni_eam

    _configuration_filename = 'pyposmat.config.in'
    #------------------------------------------------------------------------------
    # WRITE CONFIGURATION FILE
    #------------------------------------------------------------------------------
    Ni_eam_configuration = PyposmatConfigurationFile()
    Ni_eam_configuration.qois = Ni_eam.Ni_qoi_db.qois
    Ni_eam_configuration.potential = Ni_eam.Ni_eam_potential_formalism
    Ni_eam_configuration.structures = Ni_eam.Ni_structure_db
    Ni_eam_configuration.sampling_type = Ni_eam.Ni_eam_sampling
    Ni_eam_configuration.sampling_distribution =Ni_eam.Ni_eam_parameter_distribution
    Ni_eam_configuration.write(filename=_configuration_filename)
    Ni_eam_configuration.read(filename=_configuration_filename)
    
    pyposmat_app = PyposmatIterativeSampler(
        configuration_filename = _configuration_filename)
    pyposmat_app.read_configuration_file()
    pyposmat_app.run_all()