zincware / MDSuite

A post-processing engine for particle simulations
https://mdsuite.readthedocs.io/
Eclipse Public License 2.0
36 stars 7 forks source link

Adding new data in different group impossible after first run #570

Closed SamTov closed 1 year ago

SamTov commented 1 year ago

Describe the bug Currently if I run the following the code will fail:

headers = {
     mdsuite_properties.thermal_flux.name : [
        "Jx",
        "Jy",
        "Jz",
    ]
}
reader = LAMMPSFluxFile(
    file_path="log.lammps",
    sample_rate=1, 
    box_l=3 * [28.9], 
    custom_data_map=headers, 
    n_header_lines=1
)
exp = project.add_experiment(
    name="lj", 
    timestep=1.0, 
    units=mds.units.METAL, 
    simulation_data=["gk_data.lammpstraj", reader],
    temperature=118
)

So here in the experiment creation I am adding some trajectory data and then after the experiment is built, I try to add some flux data. The issue is in the experiment code. When an add_data call is made, the only thing the experiment does is check if the database exists and if so, simply tries to expand the already built datasets which leads to an error if the dataset and group does not exist.