Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Save all VCSGC parameters in generic input #262

Merged
merged 3 commits into from
Jul 14, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions pyiron_atomistics/lammps/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"])
Expand Down
14 changes: 12 additions & 2 deletions tests/lammps/test_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@liamhuber This broke the tests. I don't think this is intentional or is it and I'm missing it?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a copy-paste error from a function signature I bet.

input_string = 'all sgcmc {0} {1} {2} {3} randseed {4}'.format(
args['mc_step_interval'],
args['swap_fraction'],
Expand Down Expand Up @@ -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))
Expand Down Expand Up @@ -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()