diff --git a/janus_core/cli/descriptors.py b/janus_core/cli/descriptors.py index d5c475d7..9041d11a 100644 --- a/janus_core/cli/descriptors.py +++ b/janus_core/cli/descriptors.py @@ -79,8 +79,7 @@ def descriptors( calc_per_atom Whether to calculate descriptors for each atom. Default is False. arch - MLIP architecture to use for single point calculations. - Default is "mace_mp". + MLIP architecture to use for calculations. Default is "mace_mp". device Device to run model on. Default is "cpu". model_path @@ -111,8 +110,9 @@ def descriptors( carbon_summary, check_config, end_summary, + get_config, + get_struct_info, parse_typer_dicts, - save_struct_calc, start_summary, ) @@ -127,6 +127,14 @@ def descriptors( if "filename" in write_kwargs: raise ValueError("'filename' must be passed through the --out option") + # Set initial config + all_kwargs = { + "read_kwargs": read_kwargs.copy(), + "calc_kwargs": calc_kwargs.copy(), + "write_kwargs": write_kwargs.copy(), + } + config = get_config(params=ctx.params, all_kwargs=all_kwargs) + # Set default filname for writing structure with descriptors if not specified if out: write_kwargs["filename"] = out @@ -162,24 +170,14 @@ def descriptors( ).absolute() log = descript.log_kwargs["filename"] - # Store inputs for yaml summary - inputs = descriptors_kwargs.copy() - # Add structure, MLIP information, and log to inputs - save_struct_calc( - inputs=inputs, + info = get_struct_info( struct=descript.struct, struct_path=struct, - arch=arch, - device=device, - model_path=model_path, - read_kwargs=read_kwargs, - calc_kwargs=calc_kwargs, - log=log, ) # Save summary information before calculation begins - start_summary(command="descriptors", summary=summary, inputs=inputs) + start_summary(command="descriptors", summary=summary, config=config, info=info) # Calculate descriptors descript.run() diff --git a/janus_core/cli/eos.py b/janus_core/cli/eos.py index f9202c0d..58060976 100644 --- a/janus_core/cli/eos.py +++ b/janus_core/cli/eos.py @@ -143,8 +143,9 @@ def eos( carbon_summary, check_config, end_summary, + get_config, + get_struct_info, parse_typer_dicts, - save_struct_calc, set_read_kwargs_index, start_summary, ) @@ -160,6 +161,15 @@ def eos( if eos_type not in get_args(EoSNames): raise ValueError(f"Fit type must be one of: {get_args(EoSNames)}") + # Set initial config + all_kwargs = { + "read_kwargs": read_kwargs.copy(), + "calc_kwargs": calc_kwargs.copy(), + "minimize_kwargs": minimize_kwargs.copy(), + "write_kwargs": write_kwargs.copy(), + } + config = get_config(params=ctx.params, all_kwargs=all_kwargs) + # Read only first structure by default and ensure only one image is read set_read_kwargs_index(read_kwargs) @@ -205,24 +215,14 @@ def eos( ).absolute() log = equation_of_state.log_kwargs["filename"] - # Store inputs for yaml summary - inputs = eos_kwargs.copy() - # Add structure, MLIP information, and log to inputs - save_struct_calc( - inputs=inputs, + info = get_struct_info( struct=equation_of_state.struct, struct_path=struct, - arch=arch, - device=device, - model_path=model_path, - read_kwargs=read_kwargs, - calc_kwargs=calc_kwargs, - log=log, ) - # Save summary information before calculations begin - start_summary(command="eos", summary=summary, inputs=inputs) + # Save summary information before calculation begins + start_summary(command="eos", summary=summary, config=config, info=info) # Run equation of state calculations equation_of_state.run() diff --git a/janus_core/cli/geomopt.py b/janus_core/cli/geomopt.py index 4adb89bd..93ae16b1 100644 --- a/janus_core/cli/geomopt.py +++ b/janus_core/cli/geomopt.py @@ -223,8 +223,9 @@ def geomopt( carbon_summary, check_config, end_summary, + get_config, + get_struct_info, parse_typer_dicts, - save_struct_calc, set_read_kwargs_index, start_summary, ) @@ -236,6 +237,15 @@ def geomopt( [read_kwargs, calc_kwargs, minimize_kwargs, write_kwargs] ) + # Set initial config + all_kwargs = { + "read_kwargs": read_kwargs.copy(), + "calc_kwargs": calc_kwargs.copy(), + "minimize_kwargs": minimize_kwargs.copy(), + "write_kwargs": write_kwargs.copy(), + } + config = get_config(params=ctx.params, all_kwargs=all_kwargs) + # Read only first structure by default and ensure only one image is read set_read_kwargs_index(read_kwargs) @@ -296,24 +306,14 @@ def geomopt( ).absolute() log = optimizer.log_kwargs["filename"] - # Store inputs for yaml summary - inputs = optimize_kwargs.copy() - # Add structure, MLIP information, and log to inputs - save_struct_calc( - inputs=inputs, + info = get_struct_info( struct=optimizer.struct, struct_path=struct, - arch=arch, - device=device, - model_path=model_path, - read_kwargs=read_kwargs, - calc_kwargs=calc_kwargs, - log=log, ) - # Save summary information before optimization begins - start_summary(command="geomopt", summary=summary, inputs=inputs) + # Save summary information before calculation begins + start_summary(command="geomopt", summary=summary, config=config, info=info) # Run geometry optimization and save output structure optimizer.run() diff --git a/janus_core/cli/md.py b/janus_core/cli/md.py index d802cd1e..5dc76250 100644 --- a/janus_core/cli/md.py +++ b/janus_core/cli/md.py @@ -354,8 +354,9 @@ def md( carbon_summary, check_config, end_summary, + get_config, + get_struct_info, parse_typer_dicts, - save_struct_calc, set_read_kwargs_index, start_summary, ) @@ -385,6 +386,17 @@ def md( if ensemble not in get_args(Ensembles): raise ValueError(f"ensemble must be in {get_args(Ensembles)}") + # Set initial config + all_kwargs = { + "read_kwargs": read_kwargs.copy(), + "calc_kwargs": calc_kwargs.copy(), + "minimize_kwargs": minimize_kwargs.copy(), + "ensemble_kwargs": ensemble_kwargs.copy(), + "write_kwargs": write_kwargs.copy(), + "post_process_kwargs": post_process_kwargs.copy(), + } + config = get_config(params=ctx.params, all_kwargs=all_kwargs) + # Read only first structure by default and ensure only one image is read set_read_kwargs_index(read_kwargs) @@ -553,23 +565,14 @@ def md( log = dyn.log_kwargs["filename"] # Store inputs for yaml summary - inputs = dyn_kwargs | {"ensemble": ensemble} - # Add structure, MLIP information, and log to inputs - save_struct_calc( - inputs=inputs, + info = get_struct_info( struct=dyn.struct, struct_path=struct, - arch=arch, - device=device, - model_path=model_path, - read_kwargs=read_kwargs, - calc_kwargs=calc_kwargs, - log=log, ) - # Save summary information before simulation begins - start_summary(command="md", summary=summary, inputs=inputs) + # Save summary information before calculation begins + start_summary(command="md", summary=summary, config=config, info=info) # Run molecular dynamics dyn.run() diff --git a/janus_core/cli/neb.py b/janus_core/cli/neb.py index 2e111301..2f755106 100644 --- a/janus_core/cli/neb.py +++ b/janus_core/cli/neb.py @@ -24,7 +24,7 @@ Summary, WriteKwargs, ) -from janus_core.cli.utils import dict_paths_to_strs, yaml_converter_callback +from janus_core.cli.utils import yaml_converter_callback app = Typer() @@ -175,8 +175,9 @@ def neb( carbon_summary, check_config, end_summary, + get_config, + get_struct_info, parse_typer_dicts, - save_struct_calc, start_summary, ) from janus_core.helpers.janus_types import Interpolators @@ -204,6 +205,18 @@ def neb( ] ) + # Set initial config + all_kwargs = { + "write_kwargs": write_kwargs.copy(), + "neb_kwargs": neb_kwargs.copy(), + "interpolator_kwargs": interpolator_kwargs.copy(), + "optimizer_kwargs": optimizer_kwargs.copy(), + "minimize_kwargs": minimize_kwargs.copy(), + "read_kwargs": read_kwargs.copy(), + "calc_kwargs": calc_kwargs.copy(), + } + config = get_config(params=ctx.params, all_kwargs=all_kwargs) + if band_structs: if init_struct or final_struct: raise ValueError( @@ -256,40 +269,24 @@ def neb( summary = neb._build_filename("neb-summary.yml", filename=summary).absolute() log = neb.log_kwargs["filename"] - # Store inputs for yaml summary - inputs = neb_inputs.copy() - - del inputs["init_struct"] - del inputs["final_struct"] - del inputs["band_structs"] - # Add structure, MLIP information, and log to inputs - save_struct_calc( - inputs=inputs, + info = get_struct_info( struct=neb.struct, struct_path=init_struct, - arch=arch, - device=device, - model_path=model_path, - read_kwargs=read_kwargs, - calc_kwargs=calc_kwargs, - log=log, ) + if band_structs: - inputs["band_structs"] = inputs.pop("traj") + info["band_structs"] = info.pop("traj") else: - inputs["init_struct"] = inputs.pop("struct") - inputs["final_struct"] = { + info["init_struct"] = info.pop("struct") + info["final_struct"] = { "n_atoms": len(neb.final_struct), "struct_path": final_struct, "formula": neb.final_struct.get_chemical_formula(), } - # Convert all paths to strings in inputs nested dictionary - dict_paths_to_strs(inputs) - # Save summary information before calculations begin - start_summary(command="neb", summary=summary, inputs=inputs) + start_summary(command="neb", summary=summary, config=config, info=info) # Run equation of state calculations neb.run() diff --git a/janus_core/cli/phonons.py b/janus_core/cli/phonons.py index 18beb94d..b78a2da2 100644 --- a/janus_core/cli/phonons.py +++ b/janus_core/cli/phonons.py @@ -232,10 +232,10 @@ def phonons( from janus_core.cli.utils import ( carbon_summary, check_config, - dict_tuples_to_lists, end_summary, + get_config, + get_struct_info, parse_typer_dicts, - save_struct_calc, set_read_kwargs_index, start_summary, ) @@ -261,6 +261,17 @@ def phonons( ] ) + # Set initial config + all_kwargs = { + "displacement_kwargs": displacement_kwargs.copy(), + "read_kwargs": read_kwargs.copy(), + "calc_kwargs": calc_kwargs.copy(), + "minimize_kwargs": minimize_kwargs.copy(), + "dos_kwargs": dos_kwargs.copy(), + "pdos_kwargs": pdos_kwargs.copy(), + } + config = get_config(params=ctx.params, all_kwargs=all_kwargs) + # Read only first structure by default and ensure only one image is read set_read_kwargs_index(read_kwargs) @@ -340,27 +351,14 @@ def phonons( summary = phonon._build_filename("phonons-summary.yml", filename=summary).absolute() log = phonon.log_kwargs["filename"] - # Store inputs for yaml summary - inputs = phonons_kwargs.copy() - # Add structure, MLIP information, and log to inputs - save_struct_calc( - inputs=inputs, + info = get_struct_info( struct=phonon.struct, struct_path=struct, - arch=arch, - device=device, - model_path=model_path, - read_kwargs=read_kwargs, - calc_kwargs=calc_kwargs, - log=log, ) - # Convert all tuples to list in inputs nested dictionary - dict_tuples_to_lists(inputs) - - # Save summary information before calculations begin - start_summary(command="phonons", summary=summary, inputs=inputs) + # Save summary information before calculation begins + start_summary(command="phonons", summary=summary, config=config, info=info) # Run phonon calculations phonon.run() diff --git a/janus_core/cli/preprocess.py b/janus_core/cli/preprocess.py index 2eac487d..10270f93 100644 --- a/janus_core/cli/preprocess.py +++ b/janus_core/cli/preprocess.py @@ -49,10 +49,15 @@ def preprocess( from janus_core.cli.utils import carbon_summary, end_summary, start_summary from janus_core.training.preprocess import preprocess as run_preprocess - inputs = {"mlip_config": str(mlip_config)} + config = { + "mlip_config": mlip_config, + "log": log, + "tracker": tracker, + "summary": summary, + } # Save summary information before preprocessing begins - start_summary(command="preprocess", summary=summary, inputs=inputs) + start_summary(command="preprocess", summary=summary, config=config, info={}) log_kwargs = {"filemode": "w"} if log: diff --git a/janus_core/cli/singlepoint.py b/janus_core/cli/singlepoint.py index 4ee457e5..47c2986b 100644 --- a/janus_core/cli/singlepoint.py +++ b/janus_core/cli/singlepoint.py @@ -112,8 +112,9 @@ def singlepoint( carbon_summary, check_config, end_summary, + get_config, + get_struct_info, parse_typer_dicts, - save_struct_calc, start_summary, ) @@ -127,6 +128,15 @@ def singlepoint( # Check filename for results not duplicated if "filename" in write_kwargs: raise ValueError("'filename' must be passed through the --out option") + + # Set initial config + all_kwargs = { + "read_kwargs": read_kwargs.copy(), + "calc_kwargs": calc_kwargs.copy(), + "write_kwargs": write_kwargs.copy(), + } + config = get_config(params=ctx.params, all_kwargs=all_kwargs) + if out: write_kwargs["filename"] = out @@ -160,24 +170,14 @@ def singlepoint( ).absolute() log = s_point.log_kwargs["filename"] - # Store inputs for yaml summary - inputs = singlepoint_kwargs.copy() - # Add structure, MLIP information, and log to inputs - save_struct_calc( - inputs=inputs, + info = get_struct_info( struct=s_point.struct, struct_path=struct, - arch=arch, - device=device, - model_path=model_path, - read_kwargs=read_kwargs, - calc_kwargs=calc_kwargs, - log=log, ) - # Save summary information before singlepoint calculation begins - start_summary(command="singlepoint", summary=summary, inputs=inputs) + # Save summary information before calculation begins + start_summary(command="singlepoint", summary=summary, config=config, info=info) # Run singlepoint calculation s_point.run() diff --git a/janus_core/cli/train.py b/janus_core/cli/train.py index 52077dfa..34698c25 100644 --- a/janus_core/cli/train.py +++ b/janus_core/cli/train.py @@ -75,10 +75,16 @@ def train( elif "foundation_model" in config: raise ValueError("Please include the `--fine-tune` option for fine-tuning") - inputs = {"mlip_config": str(mlip_config), "fine_tune": fine_tune} + config = { + "mlip_config": mlip_config, + "fine_tune": fine_tune, + "log": log, + "tracker": tracker, + "summary": summary, + } # Save summary information before training begins - start_summary(command="train", summary=summary, inputs=inputs) + start_summary(command="train", summary=summary, config=config, info={}) log_kwargs = {"filemode": "w"} if log: diff --git a/janus_core/cli/utils.py b/janus_core/cli/utils.py index be2b66f1..f31e9286 100644 --- a/janus_core/cli/utils.py +++ b/janus_core/cli/utils.py @@ -17,9 +17,6 @@ from janus_core.cli.types import TyperDict from janus_core.helpers.janus_types import ( - Architectures, - ASEReadArgs, - Devices, MaybeSequence, ) @@ -51,7 +48,7 @@ def dict_tuples_to_lists(dictionary: dict) -> None: """ for key, value in dictionary.items(): if isinstance(value, dict): - dict_paths_to_strs(value) + dict_tuples_to_lists(value) elif isinstance(value, tuple): dictionary[key] = list(value) @@ -150,7 +147,9 @@ def yaml_converter_loader(config_file: str) -> dict[str, Any]: yaml_converter_callback = conf_callback_factory(yaml_converter_loader) -def start_summary(*, command: str, summary: Path, inputs: dict) -> None: +def start_summary( + *, command: str, summary: Path, config: dict[str, Any], info: dict[str, Any] +) -> None: """ Write initial summary contents. @@ -160,16 +159,26 @@ def start_summary(*, command: str, summary: Path, inputs: dict) -> None: Name of CLI command being used. summary Path to summary file being saved. - inputs + config Inputs to CLI command to save. + info + Extra information to save. """ - save_info = { + config.pop("config", None) + + summary_contents = { "command": f"janus {command}", "start_time": datetime.datetime.now().strftime("%d/%m/%Y, %H:%M:%S"), - "inputs": inputs, + "config": config, + "info": info, } + + # Convert all paths to strings in inputs nested dictionary + dict_paths_to_strs(summary_contents) + dict_tuples_to_lists(summary_contents) + with open(summary, "w", encoding="utf8") as outfile: - yaml.dump(save_info, outfile, default_flow_style=False) + yaml.dump(summary_contents, outfile, default_flow_style=False) def carbon_summary(*, summary: Path, log: Path) -> None: @@ -214,65 +223,38 @@ def end_summary(summary: Path) -> None: logging.shutdown() -def save_struct_calc( +def get_struct_info( *, - inputs: dict, struct: MaybeSequence[Atoms], struct_path: Path, - arch: Architectures, - device: Devices, - model_path: str, - read_kwargs: ASEReadArgs, - calc_kwargs: dict[str, Any], - log: Path, -) -> None: +) -> dict[str, Any]: """ - Add structure and calculator input information to a dictionary. + Add structure information to a dictionary. Parameters ---------- - inputs - Inputs dictionary to add information to. struct Structure to be simulated. struct_path Path of structure file. - arch - MLIP architecture. - device - Device to run calculations on. - model_path - Path to MLIP model. - read_kwargs - Keyword arguments to pass to ase.io.read. - calc_kwargs - Keyword arguments to pass to the calculator. - log - Path to log file. + + Returns + ------- + dict[str, Any] + Dictionary with structure information. """ from ase import Atoms - # Clean up duplicate parameters - for key in ( - "struct", - "struct_path", - "arch", - "device", - "model_path", - "read_kwargs", - "calc_kwargs", - "log_kwargs", - ): - inputs.pop(key, None) + info = {} if isinstance(struct, Atoms): - inputs["struct"] = { + info["struct"] = { "n_atoms": len(struct), "struct_path": struct_path, "formula": struct.get_chemical_formula(), } elif isinstance(struct, Sequence): - inputs["traj"] = { + info["traj"] = { "length": len(struct), "struct_path": struct_path, "struct": { @@ -281,18 +263,30 @@ def save_struct_calc( }, } - inputs["calc"] = { - "arch": arch, - "device": device, - "model_path": model_path, - "read_kwargs": read_kwargs, - "calc_kwargs": calc_kwargs, - } + return info - inputs["log"] = log - # Convert all paths to strings in inputs nested dictionary - dict_paths_to_strs(inputs) +def get_config(*, params: dict[str, Any], all_kwargs: dict[str, Any]) -> dict[str, Any]: + """ + Get configuration and set kwargs dictionaries. + + Parameters + ---------- + params + CLI input parameters from ctx. + all_kwargs + Name and contents of all kwargs dictionaries. + + Returns + ------- + dict[str, Any] + Input parameters with parsed kwargs dictionaries substituted in. + """ + for param in params: + if param in all_kwargs: + params[param] = all_kwargs[param] + + return params def check_config(ctx: Context) -> None: diff --git a/tests/test_descriptors_cli.py b/tests/test_descriptors_cli.py index cbec3b31..7c586809 100644 --- a/tests/test_descriptors_cli.py +++ b/tests/test_descriptors_cli.py @@ -77,7 +77,8 @@ def test_descriptors(): assert "command" in descriptors_summary assert "janus descriptors" in descriptors_summary["command"] assert "start_time" in descriptors_summary - assert "inputs" in descriptors_summary + assert "config" in descriptors_summary + assert "info" in descriptors_summary assert "end_time" in descriptors_summary assert "emissions" in descriptors_summary diff --git a/tests/test_eos_cli.py b/tests/test_eos_cli.py index 2a21387d..9661a40a 100644 --- a/tests/test_eos_cli.py +++ b/tests/test_eos_cli.py @@ -86,7 +86,8 @@ def test_eos(): assert "command" in eos_summary assert "janus eos" in eos_summary["command"] assert "start_time" in eos_summary - assert "inputs" in eos_summary + assert "config" in eos_summary + assert "info" in eos_summary assert "end_time" in eos_summary assert "emissions" in eos_summary diff --git a/tests/test_geomopt_cli.py b/tests/test_geomopt_cli.py index 4f17885b..18fce3f1 100644 --- a/tests/test_geomopt_cli.py +++ b/tests/test_geomopt_cli.py @@ -381,10 +381,12 @@ def test_summary(tmp_path): assert "start_time" in geomopt_summary assert "end_time" in geomopt_summary - assert "inputs" in geomopt_summary - assert "opt_kwargs" in geomopt_summary["inputs"] - assert "struct" in geomopt_summary["inputs"] - assert "n_atoms" in geomopt_summary["inputs"]["struct"] + assert "config" in geomopt_summary + assert "minimize_kwargs" in geomopt_summary["config"] + + assert "info" in geomopt_summary + assert "struct" in geomopt_summary["info"] + assert "n_atoms" in geomopt_summary["info"]["struct"] assert "emissions" in geomopt_summary assert geomopt_summary["emissions"] > 0 @@ -418,8 +420,8 @@ def test_config(tmp_path): with open(summary_path, encoding="utf8") as file: geomopt_summary = yaml.safe_load(file) - assert "alpha" in geomopt_summary["inputs"]["opt_kwargs"] - assert geomopt_summary["inputs"]["opt_kwargs"]["alpha"] == 100 + assert "alpha" in geomopt_summary["config"]["minimize_kwargs"]["opt_kwargs"] + assert geomopt_summary["config"]["minimize_kwargs"]["opt_kwargs"]["alpha"] == 100 def test_invalid_config(): diff --git a/tests/test_md_cli.py b/tests/test_md_cli.py index 0cd0315c..752d7dd8 100644 --- a/tests/test_md_cli.py +++ b/tests/test_md_cli.py @@ -298,12 +298,13 @@ def test_summary(tmp_path): assert "command" in summary assert "janus md" in summary["command"] assert "start_time" in summary - assert "inputs" in summary + assert "config" in summary + assert "info" in summary assert "end_time" in summary - assert "ensemble" in summary["inputs"] - assert "struct" in summary["inputs"] - assert "n_atoms" in summary["inputs"]["struct"] + assert "ensemble" in summary["config"] + assert "struct" in summary["info"] + assert "n_atoms" in summary["info"]["struct"] assert "emissions" in summary assert summary["emissions"] > 0 @@ -339,12 +340,12 @@ def test_config(tmp_path): md_summary = yaml.safe_load(file) # Check temperature is passed correctly - assert md_summary["inputs"]["temp"] == 200 + assert md_summary["config"]["temp"] == 200 # Check explicit option overwrites config - assert md_summary["inputs"]["ensemble"] == "nve" + assert md_summary["config"]["ensemble"] == "nve" # Check nested dictionary assert ( - md_summary["inputs"]["minimize_kwargs"]["filter_kwargs"]["hydrostatic_strain"] + md_summary["config"]["minimize_kwargs"]["filter_kwargs"]["hydrostatic_strain"] is True ) diff --git a/tests/test_neb_cli.py b/tests/test_neb_cli.py index 21bc7632..c2ee193c 100644 --- a/tests/test_neb_cli.py +++ b/tests/test_neb_cli.py @@ -81,7 +81,8 @@ def test_neb(): assert "command" in neb_summary assert "janus neb" in neb_summary["command"] assert "start_time" in neb_summary - assert "inputs" in neb_summary + assert "config" in neb_summary + assert "info" in neb_summary assert "end_time" in neb_summary assert "emissions" in neb_summary diff --git a/tests/test_phonons_cli.py b/tests/test_phonons_cli.py index b66c8d2a..20655648 100644 --- a/tests/test_phonons_cli.py +++ b/tests/test_phonons_cli.py @@ -73,7 +73,8 @@ def test_phonons(): assert "command" in phonon_summary assert "janus phonons" in phonon_summary["command"] assert "start_time" in phonon_summary - assert "inputs" in phonon_summary + assert "config" in phonon_summary + assert "info" in phonon_summary assert "end_time" in phonon_summary assert "emissions" in phonon_summary @@ -123,9 +124,8 @@ def test_bands_simple(tmp_path): assert "command" in phonon_summary assert "janus phonons" in phonon_summary["command"] - assert "inputs" in phonon_summary - assert "calcs" in phonon_summary["inputs"] - assert phonon_summary["inputs"]["calcs"][0] == "bands" + assert "config" in phonon_summary + assert phonon_summary["config"]["bands"] def test_hdf5(tmp_path): @@ -268,9 +268,9 @@ def test_plot(tmp_path): assert summary_path.exists() with open(summary_path, encoding="utf8") as file: phonon_summary = yaml.safe_load(file) - assert phonon_summary["inputs"]["calcs"][0] == "bands" - assert phonon_summary["inputs"]["calcs"][1] == "dos" - assert phonon_summary["inputs"]["calcs"][2] == "pdos" + assert phonon_summary["config"]["bands"] + assert phonon_summary["config"]["dos"] + assert phonon_summary["config"]["pdos"] test_data = [ diff --git a/tests/test_preprocess_cli.py b/tests/test_preprocess_cli.py index 37129a7c..e750edd3 100644 --- a/tests/test_preprocess_cli.py +++ b/tests/test_preprocess_cli.py @@ -103,7 +103,7 @@ def test_preprocess(tmp_path): assert "command" in preprocess_summary assert "janus preprocess" in preprocess_summary["command"] assert "start_time" in preprocess_summary - assert "inputs" in preprocess_summary + assert "config" in preprocess_summary assert "end_time" in preprocess_summary assert "emissions" in preprocess_summary diff --git a/tests/test_singlepoint_cli.py b/tests/test_singlepoint_cli.py index 099fe6b7..84111b73 100644 --- a/tests/test_singlepoint_cli.py +++ b/tests/test_singlepoint_cli.py @@ -250,14 +250,15 @@ def test_summary(tmp_path): assert "command" in sp_summary assert "janus singlepoint" in sp_summary["command"] assert "start_time" in sp_summary - assert "inputs" in sp_summary + assert "config" in sp_summary + assert "info" in sp_summary assert "end_time" in sp_summary - assert "properties" in sp_summary["inputs"] - assert "traj" in sp_summary["inputs"] - assert "length" in sp_summary["inputs"]["traj"] - assert "struct" in sp_summary["inputs"]["traj"] - assert "n_atoms" in sp_summary["inputs"]["traj"]["struct"] + assert "properties" in sp_summary["config"] + assert "traj" in sp_summary["info"] + assert "length" in sp_summary["info"]["traj"] + assert "struct" in sp_summary["info"]["traj"] + assert "n_atoms" in sp_summary["info"]["traj"]["struct"] assert "emissions" in sp_summary assert sp_summary["emissions"] > 0 @@ -293,8 +294,8 @@ def test_config(tmp_path): with open(summary_path, encoding="utf8") as file: sp_summary = yaml.safe_load(file) - assert "index" in sp_summary["inputs"]["calc"]["read_kwargs"] - assert sp_summary["inputs"]["calc"]["read_kwargs"]["index"] == 0 + assert "index" in sp_summary["config"]["read_kwargs"] + assert sp_summary["config"]["read_kwargs"]["index"] == 0 def test_invalid_config(): diff --git a/tests/test_train_cli.py b/tests/test_train_cli.py index db9db2d5..41a54457 100644 --- a/tests/test_train_cli.py +++ b/tests/test_train_cli.py @@ -113,7 +113,7 @@ def test_train(tmp_path): assert "command" in train_summary assert "janus train" in train_summary["command"] assert "start_time" in train_summary - assert "inputs" in train_summary + assert "config" in train_summary assert "end_time" in train_summary assert "emissions" in train_summary