Skip to content

[Code scan] Make RunLmpHDF5 return the trajectory type it declares #355

Description

@njzjz

Found by Codex global repository scan of deepmodeling/dpgen2 at commit 2679611a3704f5c2646c8cb353e34177518db758.

RunLmpHDF5 changes the output signature for traj and model_devi to Artifact(HDF5Datasets):

dpgen2/dpgen2/op/run_lmp.py

Lines 405 to 414 in 2679611

class RunLmpHDF5(RunLmp):
@classmethod
def get_output_sign(cls):
output_sign = super().get_output_sign()
output_sign["traj"] = Artifact(HDF5Datasets)
output_sign["model_devi"] = Artifact(HDF5Datasets)
return output_sign
def get_model_devi(self, model_devi_file):
return np.loadtxt(model_devi_file)

The inherited execute method still returns a filesystem path for traj:

dpgen2/dpgen2/op/run_lmp.py

Lines 203 to 207 in 2679611

ret_dict = {
"log": work_dir / lmp_log_name,
"traj": work_dir / lmp_traj_name,
"model_devi": self.get_model_devi(work_dir / lmp_model_devi_name),
}

Only model_devi is converted by overriding get_model_devi; the trajectory remains work_dir / lmp_traj_name. This creates a signature/serialization contract mismatch for use_hdf5 LAMMPS runs and can break downstream consumers that receive HDF5 datasets.

Suggested fix: either convert trajectory output to the declared HDF5 dataset type, or keep the trajectory signature as Artifact(Path) until HDF5 trajectory support is implemented. Add a test for RunLmpHDF5.execute output types.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    Status
    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions