-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove _ConfigSet_loc from Atoms in do_remotely() when iterable is no…
…t a ConfigSet (see #344)
- Loading branch information
Showing
3 changed files
with
65 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
from wfl.configset import ConfigSet, OutputSpec | ||
from wfl.calculators.generic import calculate | ||
from wfl.generate.md import md | ||
|
||
import ase.io | ||
from ase.atoms import Atoms | ||
from ase.calculators.emt import EMT | ||
|
||
import pytest | ||
|
||
pytestmark = pytest.mark.remote | ||
|
||
def test_list_with_nested_configset_info(tmp_path, expyre_systems, remoteinfo_env): | ||
for sys_name in expyre_systems: | ||
if sys_name.startswith('_'): | ||
continue | ||
|
||
do_test_list_with_nested_configset_info(tmp_path, sys_name, remoteinfo_env) | ||
|
||
def do_test_list_with_nested_configset_info(tmp_path, sys_name, remoteinfo_env): | ||
ri = {'sys_name': sys_name, 'job_name': 'pytest_'+sys_name, | ||
'resources': {'max_time': '1h', 'num_nodes': 1}, | ||
'num_inputs_per_queued_job': 1, 'check_interval': 10} | ||
|
||
remoteinfo_env(ri) | ||
|
||
print('RemoteInfo', ri) | ||
|
||
cs = [Atoms('Al', cell=[3.0] * 3, pbc=[True] * 3) for _ in range(20)] | ||
|
||
for at_i, at in enumerate(cs): | ||
at.info["_ConfigSet_loc"] = f" / {at_i} / 0 / 10000" | ||
|
||
ase.io.write(tmp_path / "tt.extxyz", cs) | ||
|
||
configs = ConfigSet("tt.extxyz", file_root=tmp_path) | ||
|
||
os = OutputSpec("t1.extxyz", file_root=tmp_path) | ||
cc = md(configs, os, (EMT, [], {}), steps=10, dt=1.0, autopara_info={'remote_info': ri}) | ||
|
||
traj_final_configs = [] | ||
for traj_grp in cc.groups(): | ||
traj_final_configs.append([atoms for atoms in traj_grp][-1]) | ||
|
||
# ConfigSet should work | ||
print("trying t2") | ||
configs = ConfigSet(traj_final_configs) | ||
|
||
os = OutputSpec("t2.extxyz", file_root=tmp_path) | ||
_ = md(configs, os, (EMT, [], {}), steps=10, dt=1.0, autopara_info={'remote_info': {'num_inputs_per_queued_job': 1, | ||
'sys_name': 'tin', 'job_name': 'wif_test', 'resources': {'num_cores': 16, 'max_time': '1h', 'partitions': 'n2013,n2016'}}}) | ||
|
||
# list originally failed, as in https://github.com/libAtoms/workflow/issues/344 | ||
print("trying t3") | ||
configs = traj_final_configs | ||
|
||
os = OutputSpec("t3.extxyz", file_root=tmp_path) | ||
_ = md(configs, os, (EMT, [], {}), steps=10, dt=1.0, autopara_info={'remote_info': {'num_inputs_per_queued_job': 1, | ||
'sys_name': 'tin', 'job_name': 'wif_test', 'resources': {'num_cores': 16, 'max_time': '1h', 'partitions': 'n2013,n2016'}}}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters