File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1212 "top_traj_file" : {
1313 "type" : str ,
1414 "nargs" : "+" ,
15- "help" : "Path to Structure/topology file followed by Trajectory file(s)" ,
15+ "help" : "Path to structure/topology file followed by trajectory file" ,
16+ },
17+ "force_file" : {
18+ "type" : str ,
19+ "nargs" : "+" ,
20+ "default" : None ,
21+ "help" : "Optional path to force file if forces are not in trajectory file" ,
1622 },
1723 "selection_string" : {
1824 "type" : str ,
Original file line number Diff line number Diff line change @@ -250,6 +250,34 @@ def run_entropy_workflow(self):
250250 logger .debug (f"Loading Universe with { tprfile } and { trrfile } " )
251251 u = mda .Universe (tprfile , trrfile )
252252
253+ # If forces are in separate file merge them with the
254+ # coordinates from the trajectory file
255+ forcefile = args .force_file [0 ]
256+ if forcefile is not None :
257+ u_force = mda .Universe (tprfile , forcefile )
258+ select_atom = u .select_atoms ("all" )
259+ select_atom_force = u_force .select_atoms ("all" )
260+
261+ coordinates = (
262+ AnalysisFromFunction (
263+ lambda ag : ag .positions .copy (), select_atom
264+ )
265+ .run ()
266+ .results ["timeseries" ]
267+ )
268+ forces = (
269+ AnalysisFromFunction (
270+ lambda ag : ag .positions .copy (), select_atom_force
271+ )
272+ .run ()
273+ .results ["timeseries" ]
274+ )
275+
276+ new_universe = mda .Merge (select_atom )
277+ new_universe .load_new (coordinates , forces = forces )
278+
279+ u = new_universe
280+
253281 self ._config_manager .input_parameters_validation (u , args )
254282
255283 # Create LevelManager instance
You can’t perform that action at this time.
0 commit comments