def setUp(self): self.generic_parameters_empty = GenericParameters() self.generic_parameters_str = GenericParameters() my_str = '''\ par_1 1 par_2 ab count 0 write_restart True read_restart False''' self.generic_parameters_str.load_string(my_str)
def __init__(self): super(MetadynInput, self).__init__() self.iconst = GenericParameters(input_file_name=None, table_name="iconst", val_only=True, comment_char="!") self.penaltypot = GenericParameters(input_file_name=None, table_name="penaltypot", val_only=True, comment_char="!") self._constraint_dict = dict() self._complex_constraints = dict()
def setUpClass(cls): cls.generic_parameters_empty = GenericParameters(table_name='empty') cls.generic_parameters_str = GenericParameters(table_name='str') my_str = '''\ par___1 1 par_2 all count 0 write_restart True dict {"a": 1, "b": 2} list [1, "s"] read_restart False''' cls.file_location = os.path.dirname(os.path.abspath(__file__)) cls.generic_parameters_str.load_string(my_str)
def __init__(self, project, job_name): super(SxUniqDispl, self).__init__(project, job_name) self.__version__ = "0.1" self.__name__ = "SxUniqDispl" self.input = GenericParameters(table_name="displacement") self.input["displacement"] = 0.01 self.structure_lst = []
def __init__(self, project, job_name): self._input = GenericParameters("parameters") super(ListMaster, self).__init__(project, job_name=job_name) self.__name__ = "ListMaster" self.__version__ = "0.1" self._input["mode"] = "parallel" self.submission_status = SubmissionStatus(db=project.db, job_id=self.job_id) self.refresh_submission_status()
def __init__(self, project, job_name): self.input = GenericParameters("parameters") super(ParallelMaster, self).__init__(project, job_name=job_name) self.__name__ = "ParallelMaster" self.__version__ = "0.3" self._ref_job = None self._output = GenericOutput() self._job_generator = None self.submission_status = SubmissionStatus(db=project.db, job_id=self.job_id) self.refresh_submission_status()
def __init__(self, project, job_name): super(SxHarmPotTst, self).__init__(project, job_name) self.__version__ = "0.1" self.__name__ = "SxHarmPotTst" self.input = GenericParameters(table_name="interaction") self.input["interaction_radius"] = 4.0 self.input["maximum_noise"] = 0.26 self._positions_lst = [] self._forces_lst = [] self._md_job_id = None self._md_job = None
def get_custom_dict(): folder = Path('.').cwd().parts[-1] hdf_file = Path('.').cwd().parents[1]/folder hdf_file = str(hdf_file)+'.h5' if Path(hdf_file).exists(): hdf = FileHDFio(hdf_file) custom_dict = GenericParameters() for k, v in zip(hdf[folder+'/input/custom_dict/data_dict']['Parameter'], hdf[folder+'/input/custom_dict/data_dict']['Value']): custom_dict[k] = v return custom_dict else: print(hdf_file, 'not found') return None
def __init__(self, project, job_name): self._input = GenericParameters("parameters") # e.g. convergence goal super(SerialMasterBase, self).__init__(project, job_name=job_name) self.__name__ = "SerialMaster" self.__version__ = "0.3" self._output = GenericOutput() self._max_iterations = 100 self._start_job = None self._run_fast = False self._logger.debug("run_fast: {}".format(self._run_fast)) self._convergence_goal = None self._convergence_goal_qwargs = {} self._convergence_goal_str = None
def get_custom_dict(): folder = Path(".").cwd().parts[-1] hdf_file = Path(".").cwd().parents[1] / folder hdf_file = str(hdf_file) + ".h5" if Path(hdf_file).exists(): hdf = FileHDFio(hdf_file) custom_dict = GenericParameters() for k, v in zip( hdf[folder + "/input/custom_dict/data_dict"]["Parameter"], hdf[folder + "/input/custom_dict/data_dict"]["Value"], ): custom_dict[k] = v return custom_dict else: print(hdf_file, "not found") return None
def test_hdf(self): pr = Project(self.file_location) file_name = os.path.join(self.file_location, 'genericpara.h5') hdf = ProjectHDFio(project=pr, file_name=file_name, h5_path="/test", mode="a") hdf.create_group('test') self.generic_parameters_str.to_hdf(hdf=hdf, group_name='input') gp_reload = GenericParameters(table_name='str') gp_reload.from_hdf(hdf=hdf, group_name='input') self.assertEqual(gp_reload.get("par___1"), 1) self.assertEqual(gp_reload.get("par_2"), 'all') self.assertEqual(gp_reload.get("count"), 0) self.assertTrue(gp_reload.get("write_restart")) self.assertFalse(gp_reload.get("read_restart")) self.assertEqual(gp_reload.get("dict"), {"a": 1, "b": 2}) self.assertEqual(gp_reload.get("list"), [1, "s"]) os.remove(file_name)
def __init__(self, project, job_name): super().__init__(project, job_name) self.input = GenericParameters(table_name="input")
def __init__(self, project, job_name): super(InteractiveWrapper, self).__init__(project, job_name) self._ref_job = None self.input = GenericParameters("parameters")
def __init__(self, project, job_name): super(ScriptJob, self).__init__(project, job_name) self.__version__ = "0.1" self.__name__ = "Script" self._script_path = None self.input = GenericParameters(table_name="custom_dict")