From 9f1a5692247af0f9e911bd640c9d0fe8c6b94662 Mon Sep 17 00:00:00 2001 From: Marvin Poul Date: Wed, 30 Jun 2021 15:07:59 +0200 Subject: [PATCH 1/3] Save all VCSGC in generic input --- pyiron_atomistics/lammps/base.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/pyiron_atomistics/lammps/base.py b/pyiron_atomistics/lammps/base.py index cb7df893e..09556cb84 100644 --- a/pyiron_atomistics/lammps/base.py +++ b/pyiron_atomistics/lammps/base.py @@ -786,7 +786,18 @@ def calc_vcsgc( mu[el] = 0. self._generic_input["calc_mode"] = "vcsgc" + self._generic_input["mu"] = mu + if target_concentration is not None: + self._generic_input["target_concentration"] = target_concentration + self._generic_input["kappa"] = kappa + self._generic_input["mc_step_interval"] = mc_step_interval + self._generic_input["swap_fraction"] = swap_fraction self._generic_input["temperature"] = temperature + self._generic_input["temperature_mc"] = temperature_mc + if window_size is not None: + self._generic_input["window_size"] = window_size + if window_moves is not None: + self._generic_input["window_moves"] = window_moves self._generic_input["n_ionic_steps"] = n_ionic_steps self._generic_input["n_print"] = n_print self._generic_input.remove_keys(["max_iter"]) From b457eaa5d83c357eb4677f6dd82132c44f5f3efd Mon Sep 17 00:00:00 2001 From: Marvin Poul Date: Mon, 5 Jul 2021 21:19:48 +0200 Subject: [PATCH 2/3] Delete spurious comma --- tests/lammps/test_base.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/lammps/test_base.py b/tests/lammps/test_base.py index 38368e25c..bc5a10128 100644 --- a/tests/lammps/test_base.py +++ b/tests/lammps/test_base.py @@ -506,7 +506,7 @@ def test_vcsgc_input(self): self.job_vcsgc_input.calc_vcsgc(**args) self.assertEqual(self.job_vcsgc_input.input.control['fix___vcsgc'], input_string) - args['temperature_mc'] = 100., + args['temperature_mc'] = 100. input_string = 'all sgcmc {0} {1} {2} {3} randseed {4}'.format( args['mc_step_interval'], args['swap_fraction'], From c8b65e3dc8fad7cd6de7cb0acde3490de3fba593 Mon Sep 17 00:00:00 2001 From: Marvin Poul Date: Wed, 14 Jul 2021 12:16:34 +0200 Subject: [PATCH 3/3] Add tests --- tests/lammps/test_base.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/tests/lammps/test_base.py b/tests/lammps/test_base.py index bc5a10128..13341e469 100644 --- a/tests/lammps/test_base.py +++ b/tests/lammps/test_base.py @@ -538,6 +538,17 @@ def test_vcsgc_input(self): self.job_vcsgc_input.calc_vcsgc(**args) self.assertEqual(self.job_vcsgc_input.input.control['fix___vcsgc'], input_string) + self.job_vcsgc_input.to_hdf() + for k, v in args.items(): + if k not in ("mu", "target_concentration", "mc_step_interval", "swap_fraction", "temperature_mc"): + continue + self.assertEqual(self.job_vcsgc_input._generic_input[k], v, + f"Wrong value stored in generic input for parameter {k}!") + # decode saved GenericParameters manually... + data = self.job_vcsgc_input["input/generic/data_dict"] + self.assertEqual(data["Value"][data["Parameter"].index(k)], str(v), + f"Wrong value stored in HDF for parameter {k}!") + def test_calc_minimize_input(self): # Ensure that defaults match control defaults atoms = Atoms("Fe8", positions=np.zeros((8, 3)), cell=np.eye(3)) @@ -694,6 +705,5 @@ def test_potential_check(self): potential['Species'][0][0] = 'Al' self.job.potential = potential # shouldn't raise ValueError - if __name__ == "__main__": unittest.main()