@@ -782,7 +782,7 @@ def _setup(self, files: TaskFiles) -> TaskFiles:
782
782
return files
783
783
784
784
def _run_md (
785
- self , instance : str , files : TaskFiles , continue_md : bool = False
785
+ self , instance : str , files : TaskFiles , continue_md : bool = False , time : float | None = None
786
786
) -> TaskFiles :
787
787
"""General MD simulation"""
788
788
logger = files .logger
@@ -820,12 +820,20 @@ def _run_md(
820
820
if self .latest_files .get ("trr" ) is not None :
821
821
trr = files .input ["trr" ]
822
822
grompp_cmd += f" -t { trr } "
823
- if self .latest_files .get ("edr" ) is not None :
824
- edr = files .input ["edr" ]
825
- if edr is not None and edr .exists ():
826
- grompp_cmd += f" -e { edr } "
827
- else :
828
- logger .warning (f"edr file { edr } not found" )
823
+ if time is not None :
824
+ # start the relaxation or next MD from the chosen reaction time
825
+ # that is already rounded to the nearest trr frame in _decide_recipe.
826
+ grompp_cmd += f" -time { time } "
827
+ logger .info (f"Starting MD from time: { time } ps of the trr" )
828
+
829
+ # TODO: remove this, edr files just do weird things.
830
+ # if self.latest_files.get("edr") is not None:
831
+ # edr = files.input["edr"]
832
+ # if edr is not None and edr.exists():
833
+ # grompp_cmd += f" -e {edr}"
834
+ # else:
835
+ # logger.warning(f"edr file {edr} not found")
836
+
829
837
logger .debug (f"grompp cmd: { grompp_cmd } " )
830
838
831
839
mdrun_cmd = (
@@ -1124,8 +1132,9 @@ def _apply_recipe(self, files: TaskFiles) -> TaskFiles:
1124
1132
if ttime is not None :
1125
1133
write_coordinate_files_at_reaction_time (files = files , time = ttime )
1126
1134
self .latest_files ["gro" ] = files .output ["gro" ]
1127
- self .latest_files ["trr" ] = files .output ["trr" ]
1128
- self .latest_files ["edr" ] = files .output ["edr" ]
1135
+ # don't use trr and edr, use the `-time` flag of gmx grompp instead
1136
+ # self.latest_files["trr"] = files.output["trr"]
1137
+ # self.latest_files["edr"] = files.output["edr"]
1129
1138
1130
1139
top_initial = deepcopy (self .top )
1131
1140
for step in recipe .recipe_steps :
@@ -1245,7 +1254,7 @@ def _apply_recipe(self, files: TaskFiles) -> TaskFiles:
1245
1254
relax_task = Task (
1246
1255
self ,
1247
1256
f = self ._run_md ,
1248
- kwargs = {"instance" : md_instance },
1257
+ kwargs = {"instance" : md_instance , "time" : self . kmcresult . time_start },
1249
1258
out = md_instance ,
1250
1259
)
1251
1260
relax_task_files = relax_task ()
0 commit comments