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)
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)
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)
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)
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()