Skip to content

Commit eb3d0e2

Browse files
committed
Add path for container instructions
1 parent 619f4f9 commit eb3d0e2

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

biobb_mem/ambertools/cpptraj_density.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#!/usr/bin/env python3
22

33
"""Module containing the Cpptraj Density class and the command line interface."""
4+
from pathlib import PurePath
45
from biobb_common.generic.biobb_object import BiobbObject
56
from biobb_common.tools.file_utils import launchlogger
67

@@ -92,9 +93,11 @@ def __init__(self, input_top_path, input_traj_path, output_cpptraj_path,
9293
def create_instructions_file(self, stage_io_dict, out_log, err_log):
9394
"""Creates an input file using the properties file settings."""
9495
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)
98101
instructions_list.append('parm ' + stage_io_dict["in"]["input_top_path"])
99102
instructions_list.append('trajin ' + stage_io_dict["in"]["input_traj_path"] + self.slice)
100103
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):
108111
if ("output_traj_path" in stage_io_dict["out"]):
109112
instructions_list.append('trajout ' + stage_io_dict["out"]["output_traj_path"])
110113

111-
# create .in file
114+
# Create .in file
112115
with open(self.instructions_file, 'w') as mdp:
113116
for line in instructions_list:
114117
mdp.write(line.strip() + '\n')
@@ -128,15 +131,13 @@ def launch(self) -> int:
128131
self.create_instructions_file(self.stage_io_dict, self.out_log, self.err_log)
129132
# create cmd and launch execution
130133
self.cmd = [self.binary_path, '-i', self.instructions_file]
131-
132134
# Run Biobb block
133135
self.run_biobb()
134136
# Copy files to host
135137
self.copy_to_host()
136138
# remove temporary folder(s)
137139
self.remove_tmp_files()
138140
self.check_arguments(output_files_created=True, raise_exception=False)
139-
140141
return self.return_code
141142

142143

0 commit comments

Comments
 (0)