Skip to content

Commit

Permalink
Connect the new parameters to TrajectoryWriter
Browse files Browse the repository at this point in the history
  • Loading branch information
MBartkowiakSTFC committed Jan 29, 2024
1 parent bbd7fa4 commit c86794c
Show file tree
Hide file tree
Showing 17 changed files with 40 additions and 8 deletions.
4 changes: 4 additions & 0 deletions MDANSE/Src/MDANSE/Framework/Converters/ASE.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,8 @@ def initialize(self):
self.configuration["output_file"]["file"],
self._chemicalSystem,
self.numberOfSteps,
positions_dtype=self.configuration["output_file"]["dtype"],
compression=self.configuration["output_file"]["compression"],
)

self._nameToIndex = dict(
Expand Down Expand Up @@ -328,6 +330,8 @@ def initialize(self):
self.configuration["output_file"]["file"],
self._chemicalSystem,
self.numberOfSteps,
positions_dtype=self.configuration["output_file"]["dtype"],
compression=self.configuration["output_file"]["compression"],
)

self._nameToIndex = dict(
Expand Down
2 changes: 2 additions & 0 deletions MDANSE/Src/MDANSE/Framework/Converters/CASTEP.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,8 @@ def initialize(self):
self.configuration["output_file"]["file"],
self._chemical_system,
self.numberOfSteps,
positions_dtype=self.configuration["output_file"]["dtype"],
compression=self.configuration["output_file"]["compression"],
)

def run_step(self, index):
Expand Down
3 changes: 2 additions & 1 deletion MDANSE/Src/MDANSE/Framework/Converters/CP2K.py
Original file line number Diff line number Diff line change
Expand Up @@ -299,8 +299,9 @@ def initialize(self):
self.configuration["output_file"]["file"],
self._chemical_system,
self.numberOfSteps,
positions_dtype=self.configuration["output_file"]["dtype"],
compression=self.configuration["output_file"]["compression"],
)
# A MMTK trajectory is opened for writing.

data_to_be_written = ["configuration", "time"]
if self.configuration["vel_file"]:
Expand Down
2 changes: 2 additions & 0 deletions MDANSE/Src/MDANSE/Framework/Converters/DCD.py
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,8 @@ def initialize(self):
self.configuration["output_file"]["file"],
self._chemical_system,
self.numberOfSteps,
positions_dtype=self.configuration["output_file"]["dtype"],
compression=self.configuration["output_file"]["compression"],
)

def run_step(self, index):
Expand Down
2 changes: 2 additions & 0 deletions MDANSE/Src/MDANSE/Framework/Converters/DL_POLY.py
Original file line number Diff line number Diff line change
Expand Up @@ -424,6 +424,8 @@ def initialize(self):
self.configuration["output_files"]["files"][0],
self._chemicalSystem,
self.numberOfSteps,
positions_dtype=self.configuration["output_file"]["dtype"],
compression=self.configuration["output_file"]["compression"],
)

self._velocities = None
Expand Down
2 changes: 2 additions & 0 deletions MDANSE/Src/MDANSE/Framework/Converters/Discover.py
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,8 @@ def initialize(self):
self.configuration["output_file"]["file"],
self._chemicalSystem,
self.numberOfSteps,
positions_dtype=self.configuration["output_file"]["dtype"],
compression=self.configuration["output_file"]["compression"],
)

def run_step(self, index):
Expand Down
2 changes: 2 additions & 0 deletions MDANSE/Src/MDANSE/Framework/Converters/Forcite.py
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,8 @@ def initialize(self):
self.configuration["output_file"]["file"],
self._chemicalSystem,
self.numberOfSteps,
positions_dtype=self.configuration["output_file"]["dtype"],
compression=self.configuration["output_file"]["compression"],
)

def run_step(self, index):
Expand Down
3 changes: 2 additions & 1 deletion MDANSE/Src/MDANSE/Framework/Converters/Gromacs.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,8 @@ def initialize(self):
self.configuration["output_file"]["file"],
chemical_system,
self.numberOfSteps,
positions_dtype=np.float32,
positions_dtype=self.configuration["output_file"]["dtype"],
compression=self.configuration["output_file"]["compression"],
)

def run_step(self, index):
Expand Down
2 changes: 2 additions & 0 deletions MDANSE/Src/MDANSE/Framework/Converters/LAMMPS.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,8 @@ def initialize(self):
self.configuration["output_file"]["file"],
self._chemicalSystem,
self.numberOfSteps,
positions_dtype=self.configuration["output_file"]["dtype"],
compression=self.configuration["output_file"]["compression"],
)

self._nameToIndex = dict(
Expand Down
2 changes: 2 additions & 0 deletions MDANSE/Src/MDANSE/Framework/Converters/VASP.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,8 @@ def initialize(self):
self.configuration["output_file"]["file"],
self._chemicalSystem,
self.numberOfSteps,
positions_dtype=self.configuration["output_file"]["dtype"],
compression=self.configuration["output_file"]["compression"],
)

def run_step(self, index):
Expand Down
2 changes: 2 additions & 0 deletions MDANSE/Src/MDANSE/Framework/Jobs/CenterOfMassesTrajectory.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,8 @@ def initialize(self):
self.configuration["output_file"]["files"][0],
chemical_system,
self.numberOfSteps,
positions_dtype=self.configuration["output_file"]["dtype"],
compression=self.configuration["output_file"]["compression"],
)

self._grouped_atoms = group_atoms(
Expand Down
2 changes: 2 additions & 0 deletions MDANSE/Src/MDANSE/Framework/Jobs/CroppedTrajectory.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@ def initialize(self):
self.configuration["trajectory"]["instance"].chemical_system,
self.numberOfSteps,
self._selectedAtoms,
positions_dtype=self.configuration["output_file"]["dtype"],
compression=self.configuration["output_file"]["compression"],
)

def run_step(self, index):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,8 @@ def initialize(self):
self.configuration["trajectory"]["instance"].chemical_system,
self.numberOfSteps,
self._selected_atoms.atom_list,
positions_dtype=self.configuration["output_file"]["dtype"],
compression=self.configuration["output_file"]["compression"],
)

# This will store the configuration used as the reference for the following step.
Expand Down
2 changes: 2 additions & 0 deletions MDANSE/Src/MDANSE/Framework/Jobs/MoleculeFinder.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ def initialize(self):
self.configuration["output_files"]["files"][0],
chemical_system,
self.numberOfSteps,
positions_dtype=self.configuration["output_file"]["dtype"],
compression=self.configuration["output_file"]["compression"],
)

def run_step(self, index):
Expand Down
2 changes: 2 additions & 0 deletions MDANSE/Src/MDANSE/Framework/Jobs/RigidBodyTrajectory.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,8 @@ def initialize(self):
trajectory.chemical_system,
self.configuration["frames"]["number"],
selectedAtoms,
positions_dtype=self.configuration["output_file"]["dtype"],
compression=self.configuration["output_file"]["compression"],
)

self._group_atoms = [group.atom_list for group in self._groups]
Expand Down
2 changes: 2 additions & 0 deletions MDANSE/Src/MDANSE/Framework/Jobs/UnfoldedTrajectory.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@ def initialize(self):
self.configuration["trajectory"]["instance"].chemical_system,
self.numberOfSteps,
self._selectedAtoms,
positions_dtype=self.configuration["output_file"]["dtype"],
compression=self.configuration["output_file"]["compression"],
)

def run_step(self, index):
Expand Down
12 changes: 6 additions & 6 deletions MDANSE/Tests/UnitTests/test_converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def test_lammps_mdt_conversion_file_exists_and_loads_up_successfully():
parameters["config_file"] = lammps_config
parameters["mass_tolerance"] = 0.05
parameters["n_steps"] = 0
parameters["output_file"] = (temp_name, "MDTFormat")
parameters["output_file"] = (temp_name, 64, 'lza')
parameters["smart_mass_association"] = True
parameters["time_step"] = 1.0
parameters["trajectory_file"] = lammps_lammps
Expand Down Expand Up @@ -65,7 +65,7 @@ def test_vasp_mdt_conversion_file_exists_and_loads_up_successfully():

parameters = {
"fold": False,
"output_file": (temp_name, "MDTFormat"),
"output_file": (temp_name, 64, 'lza'),
"time_step": 1.0,
"xdatcar_file": vasp_xdatcar,
}
Expand All @@ -85,7 +85,7 @@ def test_discover_mdt_conversion_file_exists_and_loads_up_successfully():
parameters = {
"fold": True,
"his_file": discover_his,
"output_file": (temp_name, "MDTFormat"),
"output_file": (temp_name, 64, 'lza'),
"xtd_file": discover_xtd,
}

Expand All @@ -105,7 +105,7 @@ def test_charmm_mdt_conversion_file_exists_and_loads_up_successfully():
parameters = {
"dcd_file": hem_cam_dcd,
"fold": False,
"output_file": (temp_name, "MDTFormat"),
"output_file": (temp_name, 64, 'lza'),
"pdb_file": hem_cam_pdb,
"time_step": 1.0,
}
Expand All @@ -126,7 +126,7 @@ def test_ase_mdt_conversion_file_exists_and_loads_up_successfully():
parameters = {
"trajectory_file": ase_traj,
"fold": False,
"output_file": (temp_name, "MDTFormat"),
"output_file": (temp_name, 64, 'lza'),
"n_steps": 0,
"time_step": 50.0,
"time_unit": "fs",
Expand All @@ -142,7 +142,7 @@ def test_xyz_mdt_conversion_file_exists_and_loads_up_successfully():
parameters = {
"trajectory_file": xyz_traj,
"fold": False,
"output_file": (temp_name, "MDTFormat"),
"output_file": (temp_name, 64, 'lza'),
"n_steps": 0,
"time_step": 50.0,
"time_unit": "fs",
Expand Down

0 comments on commit c86794c

Please sign in to comment.