1
1
#!/usr/bin/env python3
2
2
3
3
"""Module containing the Cpptraj Density class and the command line interface."""
4
+ from pathlib import PurePath
4
5
from biobb_common .generic .biobb_object import BiobbObject
5
6
from biobb_common .tools .file_utils import launchlogger
6
7
@@ -92,9 +93,11 @@ def __init__(self, input_top_path, input_traj_path, output_cpptraj_path,
92
93
def create_instructions_file (self , stage_io_dict , out_log , err_log ):
93
94
"""Creates an input file using the properties file settings."""
94
95
instructions_list = []
95
- # different path if container execution or not
96
- self .instructions_file = self .create_tmp_file (self .instructions_file )
97
- # fu.create_name(prefix=self.prefix, step=self.step, name=self.instructions_file)
96
+ # Different path if container execution or not
97
+ if self .container_path :
98
+ self .instructions_file = str (PurePath (self .container_volume_path ).joinpath (self .instructions_file ))
99
+ else :
100
+ self .instructions_file = self .create_tmp_file (self .instructions_file )
98
101
instructions_list .append ('parm ' + stage_io_dict ["in" ]["input_top_path" ])
99
102
instructions_list .append ('trajin ' + stage_io_dict ["in" ]["input_traj_path" ] + self .slice )
100
103
density_command = f'density { self .density_type } out { stage_io_dict ["out" ]["output_cpptraj_path" ]} { self .mask } delta { self .delta } { self .axis } { self .bintype } '
@@ -108,7 +111,7 @@ def create_instructions_file(self, stage_io_dict, out_log, err_log):
108
111
if ("output_traj_path" in stage_io_dict ["out" ]):
109
112
instructions_list .append ('trajout ' + stage_io_dict ["out" ]["output_traj_path" ])
110
113
111
- # create .in file
114
+ # Create .in file
112
115
with open (self .instructions_file , 'w' ) as mdp :
113
116
for line in instructions_list :
114
117
mdp .write (line .strip () + '\n ' )
@@ -128,15 +131,13 @@ def launch(self) -> int:
128
131
self .create_instructions_file (self .stage_io_dict , self .out_log , self .err_log )
129
132
# create cmd and launch execution
130
133
self .cmd = [self .binary_path , '-i' , self .instructions_file ]
131
-
132
134
# Run Biobb block
133
135
self .run_biobb ()
134
136
# Copy files to host
135
137
self .copy_to_host ()
136
138
# remove temporary folder(s)
137
139
self .remove_tmp_files ()
138
140
self .check_arguments (output_files_created = True , raise_exception = False )
139
-
140
141
return self .return_code
141
142
142
143
0 commit comments