Coverage for biobb_amber/pmemd/pmemd_mdrun.py: 9%

200 statements  

« prev     ^ index     » next       coverage.py v7.6.10, created at 2025-01-28 08:28 +0000

1#!/usr/bin/env python3 

2 

3"""Module containing the PmemdMDRun class and the command line interface.""" 

4import argparse 

5from typing import Optional 

6import re 

7from pathlib import Path 

8from biobb_common.generic.biobb_object import BiobbObject 

9from biobb_common.configuration import settings 

10from biobb_common.tools import file_utils as fu 

11from biobb_common.tools.file_utils import launchlogger 

12from biobb_amber.pmemd.common import check_input_path, check_output_path 

13 

14 

15class PmemdMDRun(BiobbObject): 

16 """ 

17 | biobb_amber PmemdMDRun 

18 | Wrapper of the `AmberTools (AMBER MD Package) pmemd tool <https://ambermd.org/AmberTools.php>`_ module. 

19 | Runs molecular dynamics using pmemd tool from the AMBER MD package. 

20 

21 Args: 

22 input_top_path (str): Input topology file (AMBER ParmTop). File type: input. `Sample file <https://github.com/bioexcel/biobb_amber/raw/master/biobb_amber/test/data/pmemd/cln025.prmtop>`_. Accepted formats: top (edam:format_3881), parmtop (edam:format_3881), prmtop (edam:format_3881). 

23 input_crd_path (str): Input coordinates file (AMBER crd). File type: input. `Sample file <https://github.com/bioexcel/biobb_amber/raw/master/biobb_amber/test/data/pmemd/cln025.inpcrd>`_. Accepted formats: crd (edam:format_3878), mdcrd (edam:format_3878), inpcrd (edam:format_3878), rst (edam:format_3886), rst7 (edam:format_3886), netcdf (edam:format_3650), nc (edam:format_3650), ncrst (edam:format_3886). 

24 input_mdin_path (str) (Optional): Input configuration file (MD run options) (AMBER mdin). File type: input. `Sample file <https://github.com/bioexcel/biobb_amber/raw/master/biobb_amber/test/data/pmemd/npt.mdin>`_. Accepted formats: mdin (edam:format_2330), in (edam:format_2330), txt (edam:format_2330). 

25 input_cpin_path (str) (Optional): Input constant pH file (AMBER cpin). File type: input. `Sample file <https://github.com/bioexcel/biobb_amber/raw/master/biobb_amber/test/data/pmemd/cln025.cpin>`_. Accepted formats: cpin (edam:format_2330). 

26 input_ref_path (str) (Optional): Input reference coordinates for position restraints. File type: input. `Sample file <https://github.com/bioexcel/biobb_amber/raw/master/biobb_amber/test/data/pmemd/sander.rst>`_. Accepted formats: crd (edam:format_3878), mdcrd (edam:format_3878), inpcrd (edam:format_3878), rst (edam:format_3886), rst7 (edam:format_3886), netcdf (edam:format_3650), nc (edam:format_3650), ncrst (edam:format_3886). 

27 output_log_path (str): Output log file. File type: output. `Sample file <https://github.com/bioexcel/biobb_amber/raw/master/biobb_amber/test/reference/pmemd/sander.log>`_. Accepted formats: log (edam:format_2330), out (edam:format_2330), txt (edam:format_2330), o (edam:format_2330). 

28 output_traj_path (str): Output trajectory file. File type: output. `Sample file <https://github.com/bioexcel/biobb_amber/raw/master/biobb_amber/test/reference/pmemd/sander.x>`_. Accepted formats: trj (edam:format_3878), crd (edam:format_3878), mdcrd (edam:format_3878), x (edam:format_3878), netcdf (edam:format_3650), nc (edam:format_3650). 

29 output_rst_path (str): Output restart file. File type: output. `Sample file <https://github.com/bioexcel/biobb_amber/raw/master/biobb_amber/test/reference/pmemd/sander.rst>`_. Accepted formats: rst (edam:format_3886), rst7 (edam:format_3886), netcdf (edam:format_3650), nc (edam:format_3650), ncrst (edam:format_3886). 

30 output_cpout_path (str) (Optional): Output constant pH file (AMBER cpout). File type: output. `Sample file <https://github.com/bioexcel/biobb_amber/raw/master/biobb_amber/test/reference/pmemd/sander.cpout>`_. Accepted formats: cpout (edam:format_2330). 

31 output_cprst_path (str) (Optional): Output constant pH restart file (AMBER rstout). File type: output. `Sample file <https://github.com/bioexcel/biobb_amber/raw/master/biobb_amber/test/reference/pmemd/sander.cprst>`_. Accepted formats: cprst (edam:format_3886), rst (edam:format_3886), rst7 (edam:format_3886). 

32 output_mdinfo_path (str) (Optional): Output MD info. File type: output. `Sample file <https://github.com/bioexcel/biobb_amber/raw/master/biobb_amber/test/reference/pmemd/sander.mdinfo>`_. Accepted formats: mdinfo (edam:format_2330). 

33 properties (dict - Python dictionary object containing the tool parameters, not input/output files): 

34 * **mdin** (*dict*) - ({}) pmemd MD run options specification. (Used if *input_mdin_path* is None) 

35 * **binary_path** (*str*) - ("pmemd") pmemd binary path to be used. 

36 * **simulation_type** (*str*) - ("minimization") Default options for the mdin file. Each creates a different mdin file. Values: `minimization <https://biobb-amber.readthedocs.io/en/latest/_static/mdin/minimization.mdin>`_ (Runs an energy minimization), `min_vacuo <https://biobb-amber.readthedocs.io/en/latest/_static/mdin/min_vacuo.mdin>`_ (Runs an energy minimization in vacuo), `NVT <https://biobb-amber.readthedocs.io/en/latest/_static/mdin/NVT.mdin>`_ (Runs an NVT equilibration), `npt <https://biobb-amber.readthedocs.io/en/latest/_static/mdin/NPT.mdin>`_ (Runs an NPT equilibration), `free <https://biobb-amber.readthedocs.io/en/latest/_static/mdin/free.mdin>`_ (Runs a MD simulation). 

37 * **mpi_bin** (*str*) - (None) Path to the MPI runner. Usually "mpirun" or "srun". 

38 * **mpi_np** (*int*) - (0) [0~1000|1] Number of MPI processes. Usually an integer bigger than 1. 

39 * **mpi_flags** (*str*) - (None) Path to the MPI hostlist file. 

40 * **remove_tmp** (*bool*) - (True) [WF property] Remove temporal files. 

41 * **restart** (*bool*) - (False) [WF property] Do not execute if output files exist. 

42 * **sandbox_path** (*str*) - ("./") [WF property] Parent path to the sandbox directory. 

43 

44 Examples: 

45 This is a use example of how to use the building block from Python:: 

46 

47 from biobb_amber.pmemd.pmemd_mdrun import pmemd_mdrun 

48 prop = { 

49 'simulation_type' : 'npt', 

50 'mdin' : { 

51 'dt' : 0.002 

52 } 

53 } 

54 pmemd_mdrun(input_top_path='/path/to/topology.top', 

55 input_crd_path='/path/to/coordinates.crd', 

56 output_traj_path='/path/to/newTrajectory.crd', 

57 output_rst_path='/path/to/newRestart.rst', 

58 output_log_path='/path/to/newAmberlog.log', 

59 properties=prop) 

60 

61 Info: 

62 * wrapped_software: 

63 * name: AMBER pmemd 

64 * version: >20 

65 * license: other 

66 * multinode: mpi 

67 * ontology: 

68 * name: EDAM 

69 * schema: http://edamontology.org/EDAM.owl 

70 

71 """ 

72 

73 def __init__(self, input_top_path: str, input_crd_path: str, output_log_path: str, output_traj_path: str, output_rst_path: str, 

74 input_ref_path: Optional[str] = None, input_mdin_path: Optional[str] = None, input_cpin_path: Optional[str] = None, output_cpout_path: Optional[str] = None, output_cprst_path: Optional[str] = None, output_mdinfo_path: Optional[str] = None, 

75 properties: Optional[dict] = None, **kwargs) -> None: 

76 

77 properties = properties or {} 

78 

79 # Call parent class constructor 

80 super().__init__(properties) 

81 self.locals_var_dict = locals().copy() 

82 

83 # Input/Output files 

84 self.io_dict = { 

85 'in': {'input_top_path': input_top_path, 

86 'input_crd_path': input_crd_path, 

87 'input_mdin_path': input_mdin_path, 

88 'input_ref_path': input_ref_path, 

89 'input_cpin_path': input_cpin_path}, 

90 'out': {'output_log_path': output_log_path, 

91 'output_traj_path': output_traj_path, 

92 'output_rst_path': output_rst_path, 

93 'output_cpout_path': output_cpout_path, 

94 'output_cprst_path': output_cprst_path, 

95 'output_mdinfo_path': output_mdinfo_path} 

96 } 

97 

98 # Properties specific for BB 

99 self.properties = properties 

100 self.simulation_type = properties.get('simulation_type', "minimization") 

101 self.binary_path = properties.get('binary_path', "pmemd") 

102 self.mdin = {k: str(v) for k, v in properties.get('mdin', dict()).items()} 

103 

104 # Properties for MPI 

105 self.mpi_bin = properties.get('mpi_bin') 

106 self.mpi_np = properties.get('mpi_np') 

107 self.mpi_flags = properties.get('mpi_flags') 

108 

109 # Check the properties 

110 self.check_properties(properties) 

111 self.check_arguments() 

112 

113 def check_data_params(self, out_log, err_log): 

114 """ Checks input/output paths correctness """ 

115 

116 # Check input(s) 

117 self.io_dict["in"]["input_top_path"] = check_input_path(self.io_dict["in"]["input_top_path"], "input_top_path", False, out_log, self.__class__.__name__) 

118 self.io_dict["in"]["input_crd_path"] = check_input_path(self.io_dict["in"]["input_crd_path"], "input_crd_path", False, out_log, self.__class__.__name__) 

119 self.io_dict["in"]["input_mdin_path"] = check_input_path(self.io_dict["in"]["input_mdin_path"], "input_mdin_path", True, out_log, self.__class__.__name__) 

120 self.io_dict["in"]["input_cpin_path"] = check_input_path(self.io_dict["in"]["input_cpin_path"], "input_cpin_path", True, out_log, self.__class__.__name__) 

121 self.io_dict["in"]["input_ref_path"] = check_input_path(self.io_dict["in"]["input_ref_path"], "input_ref_path", True, out_log, self.__class__.__name__) 

122 

123 # Check output(s) 

124 self.io_dict["out"]["output_log_path"] = check_output_path(self.io_dict["out"]["output_log_path"], "output_log_path", False, out_log, self.__class__.__name__) 

125 self.io_dict["out"]["output_traj_path"] = check_output_path(self.io_dict["out"]["output_traj_path"], "output_traj_path", False, out_log, self.__class__.__name__) 

126 self.io_dict["out"]["output_rst_path"] = check_output_path(self.io_dict["out"]["output_rst_path"], "output_rst_path", False, out_log, self.__class__.__name__) 

127 self.io_dict["out"]["output_cpout_path"] = check_output_path(self.io_dict["out"]["output_cpout_path"], "output_cpout_path", True, out_log, self.__class__.__name__) 

128 self.io_dict["out"]["output_cprst_path"] = check_output_path(self.io_dict["out"]["output_cprst_path"], "output_cprst_path", True, out_log, self.__class__.__name__) 

129 self.io_dict["out"]["output_mdinfo_path"] = check_output_path(self.io_dict["out"]["output_mdinfo_path"], "output_mdinfo_path", True, out_log, self.__class__.__name__) 

130 

131 def create_mdin(self, path: Optional[str] = None) -> str: 

132 """Creates an AMBER MD configuration file (mdin) using the properties file settings""" 

133 mdin_list = [] 

134 mdin_firstPart = [] 

135 mdin_middlePart = [] 

136 mdin_lastPart = [] 

137 

138 self.output_mdin_path = path 

139 

140 if self.io_dict['in']['input_mdin_path']: 

141 # MDIN parameters read from an input mdin file 

142 mdin_firstPart.append("Mdin read from input file: " + self.io_dict['in']['input_mdin_path']) 

143 mdin_firstPart.append("and modified by the biobb_amber module from the BioBB library ") 

144 with open(self.io_dict['in']['input_mdin_path']) as input_params: 

145 firstPart = True 

146 secondPart = False 

147 for line in input_params: 

148 if '=' in line and not secondPart: 

149 firstPart = False 

150 mdin_middlePart.append(line.rstrip()) 

151 else: 

152 if (firstPart): 

153 mdin_firstPart.append(line.rstrip()) 

154 elif (secondPart): 

155 mdin_lastPart.append(line.rstrip()) 

156 else: 

157 secondPart = True 

158 mdin_lastPart.append(line.rstrip()) 

159 

160 for line in mdin_middlePart: 

161 if ('!' in line or '#' in line) and not ('!@' in line or '!:' in line): 

162 # Parsing lines with comments (#,!), e.g. : 

163 # ntc=2, ntf=2, ! SHAKE, constrain lenghts of the bonds having H 

164 params = re.split('!|#', line) 

165 for param in params[0].split(','): 

166 if param.strip(): 

167 mdin_list.append(" " + param.strip() + " ! " + params[1]) 

168 elif ('@' in line or ':' in line): 

169 # Parsing masks, e.g. : 

170 # restraintmask = ":1-40@P,O5',C5',C4',C3',O3'", restraint_wt = 0.5 

171 mylist = re.findall(r'(?:[^,"]|"(?:\\.|[^"])*")+', line) 

172 [mdin_list.append(" " + i.lstrip()) for i in mylist] # type: ignore 

173 else: 

174 for param in line.split(','): 

175 if param.strip(): 

176 if not param.strip().startswith('!'): 

177 mdin_list.append(" " + param.strip()) 

178 

179 else: 

180 # MDIN parameters added by the biobb_amber module 

181 mdin_list.append("This mdin file has been created by the biobb_amber module from the BioBB library ") 

182 

183 sim_type = self.properties.get('simulation_type', 'minimization') 

184 # sim_type = self.mdin.get('simulation_type', 'minimization') 

185 minimization = (sim_type == 'minimization') 

186 min_vacuo = (sim_type == 'min_vacuo') 

187 heat = (sim_type == 'heat') 

188 nvt = (sim_type == 'nvt') 

189 npt = (sim_type == 'npt') 

190 free = (sim_type == 'free') 

191 md = (nvt or npt or free or heat) 

192 

193 mdin_list.append("Type of mdin: " + sim_type) 

194 mdin_list.append("&cntrl") 

195 

196 # Pre-configured simulation type parameters 

197 if minimization: 

198 mdin_list.append(" imin = 1 ! BioBB simulation_type minimization") 

199 if min_vacuo: 

200 mdin_list.append(" imin = 1 ! BioBB simulation_type min_vacuo") 

201 mdin_list.append(" ncyc = 250 ! BioBB simulation_type min_vacuo") 

202 mdin_list.append(" ntb = 0 ! BioBB simulation_type min_vacuo") 

203 mdin_list.append(" igb = 0 ! BioBB simulation_type min_vacuo") 

204 mdin_list.append(" cut = 12 ! BioBB simulation_type min_vacuo") 

205 if md: 

206 mdin_list.append(" imin = 0 ! BioBB simulation_type nvt|npt|free|heat") 

207 mdin_list.append(" cut = 10.0 ! BioBB simulation_type nvt|npt|free|heat") 

208 mdin_list.append(" ntr = 0 ! BioBB simulation_type nvt|npt|free|heat") 

209 mdin_list.append(" ntc = 2 ! BioBB simulation_type nvt|npt|free|heat") 

210 mdin_list.append(" ntf = 2 ! BioBB simulation_type nvt|npt|free|heat") 

211 mdin_list.append(" ntt = 3 ! BioBB simulation_type nvt|npt|free|heat") 

212 mdin_list.append(" ig = -1 ! BioBB simulation_type nvt|npt|free|heat") 

213 mdin_list.append(" ioutfm = 1 ! BioBB simulation_type nvt|npt|free|heat") 

214 mdin_list.append(" iwrap = 1 ! BioBB simulation_type nvt|npt|free|heat") 

215 mdin_list.append(" nstlim = 5000 ! BioBB simulation_type nvt|npt|free|heat") 

216 mdin_list.append(" dt = 0.002 ! BioBB simulation_type nvt|npt|free|heat") 

217 if npt: 

218 mdin_list.append(" irest = 1 ! BioBB simulation_type npt") 

219 mdin_list.append(" gamma_ln = 5.0 ! BioBB simulation_type npt") 

220 mdin_list.append(" pres0 = 1.0 ! BioBB simulation_type npt") 

221 mdin_list.append(" ntp = 1 ! BioBB simulation_type npt") 

222 mdin_list.append(" taup = 2.0 ! BioBB simulation_type npt") 

223 mdin_list.append(" ntx = 5 ! BioBB simulation_type npt") 

224 if nvt: 

225 mdin_list.append(" irest = 1 ! BioBB simulation_type nvt") 

226 mdin_list.append(" gamma_ln = 5.0 ! BioBB simulation_type nvt") 

227 mdin_list.append(" ntb = 1 ! BioBB simulation_type nvt") 

228 mdin_list.append(" ntx = 5 ! BioBB simulation_type nvt") 

229 if heat: 

230 mdin_list.append(" tempi = 0.0 ! BioBB simulation_type heat") 

231 mdin_list.append(" temp0 = 300.0 ! BioBB simulation_type heat") 

232 mdin_list.append(" irest = 0 ! BioBB simulation_type heat") 

233 mdin_list.append(" ntb = 1 ! BioBB simulation_type heat") # periodic boundaries 

234 mdin_list.append(" gamma_ln = 1.0 ! BioBB simulation_type heat") 

235 # mdin_list.append(" nmropt = 1 ! BioBB simulation_type heat") 

236 

237 # mdin_lastPart.append("/") 

238 # mdin_lastPart.append("&wt") 

239 # mdin_lastPart.append(" TYPE = 'TEMP0' ! BioBB simulation_type heat") 

240 # mdin_lastPart.append(" ISTEP1 = 1 ! BioBB simulation_type heat") 

241 # mdin_lastPart.append(" ISTEP2 = 4000 ! BioBB simulation_type heat") 

242 # mdin_lastPart.append(" VALUE1 = 10.0 ! BioBB simulation_type heat") 

243 # mdin_lastPart.append(" VALUE2 = 300.0 ! BioBB simulation_type heat") 

244 # mdin_lastPart.append("/") 

245 # mdin_lastPart.append("&wt") 

246 # mdin_lastPart.append(" TYPE = 'END' ! BioBB simulation_type heat") 

247 # mdin_lastPart.append("/") 

248 

249 # Adding the rest of parameters in the config file to the mdin file 

250 # if the parameter has already been added replace the value 

251 parameter_keys = [parameter.split('=')[0].strip() for parameter in mdin_list] 

252 for k, v in self.mdin.items(): 

253 config_parameter_key = str(k).strip() 

254 if config_parameter_key in parameter_keys: 

255 mdin_list[parameter_keys.index(config_parameter_key)] = ' ' + config_parameter_key + ' = ' + str(v) + ' ! BioBB property' 

256 else: 

257 mdin_list.append(' ' + config_parameter_key + ' = '+str(v) + ' ! BioBB property') 

258 

259 # Writing MD configuration file (mdin) 

260 with open(str(self.output_mdin_path), 'w') as mdin: 

261 # Start of file keyword(s) 

262 if mdin_firstPart: 

263 for line in mdin_firstPart: 

264 mdin.write(line + '\n') 

265 

266 # MD config parameters 

267 for line in mdin_list: 

268 mdin.write(line + '\n') 

269 

270 # End of file keyword(s) 

271 if mdin_lastPart: 

272 for line in mdin_lastPart: 

273 mdin.write(line + '\n') 

274 else: 

275 mdin.write("&end\n") 

276 

277 return str(self.output_mdin_path) 

278 

279 @launchlogger 

280 def launch(self): 

281 """Launches the execution of the PmemdMDRun module.""" 

282 

283 # check input/output paths and parameters 

284 self.check_data_params(self.out_log, self.err_log) 

285 

286 # Setup Biobb 

287 if self.check_restart(): 

288 return 0 

289 self.stage_files() 

290 

291 # Creating temporary folder 

292 self.tmp_folder = fu.create_unique_dir() 

293 fu.log('Creating %s temporary folder' % self.tmp_folder, self.out_log) 

294 

295 # if self.io_dict['in']['input_mdin_path']: 

296 # self.output_mdin_path = self.io_dict['in']['input_mdin_path'] 

297 # else: 

298 # self.output_mdin_path = self.create_mdin(path=str(Path(self.tmp_folder).joinpath("pmemd.mdin"))) 

299 self.output_mdin_path = self.create_mdin(path=str(Path(self.tmp_folder).joinpath("pmemd.mdin"))) 

300 

301 # Command line 

302 # pmemd -O -i mdin/min.mdin -p $1.cpH.prmtop -c ph$i/$1.inpcrd -r ph$i/$1.min.rst7 -o ph$i/$1.min.o 

303 self.cmd = [self.binary_path, 

304 '-O', 

305 '-i', self.output_mdin_path, 

306 '-p', self.io_dict['in']['input_top_path'], 

307 '-c', self.io_dict['in']['input_crd_path'], 

308 '-r', self.io_dict['out']['output_rst_path'], 

309 '-o', self.io_dict['out']['output_log_path'], 

310 '-x', self.io_dict['out']['output_traj_path'] 

311 ] 

312 

313 if self.io_dict['in']['input_ref_path']: 

314 self.cmd.append('-ref') 

315 self.cmd.append(self.io_dict['in']['input_ref_path']) 

316 

317 if self.io_dict['in']['input_cpin_path']: 

318 self.cmd.append('-cpin') 

319 self.cmd.append(self.io_dict['in']['input_cpin_path']) 

320 

321 if self.io_dict['out']['output_mdinfo_path']: 

322 self.cmd.append('-inf') 

323 self.cmd.append(self.io_dict['out']['output_mdinfo_path']) 

324 

325 if self.io_dict['out']['output_cpout_path']: 

326 self.cmd.append('-cpout') 

327 self.cmd.append(self.io_dict['out']['output_cpout_path']) 

328 

329 if self.io_dict['out']['output_cprst_path']: 

330 self.cmd.append('-cprestrt') 

331 self.cmd.append(self.io_dict['out']['output_cprst_path']) 

332 

333 # general mpi properties 

334 if self.mpi_bin: 

335 mpi_cmd = [self.mpi_bin] 

336 if self.mpi_np: 

337 mpi_cmd.append('-n') 

338 mpi_cmd.append(str(self.mpi_np)) 

339 if self.mpi_flags: 

340 mpi_cmd.extend(self.mpi_flags) 

341 self.cmd = mpi_cmd + self.cmd 

342 

343 # Run Biobb block 

344 self.run_biobb() 

345 

346 # Copy files to host 

347 self.copy_to_host() 

348 

349 # remove temporary folder(s) 

350 self.tmp_files.extend([ 

351 # self.stage_io_dict.get("unique_dir", ""), 

352 self.tmp_folder, 

353 "mdinfo" 

354 ]) 

355 self.remove_tmp_files() 

356 

357 self.check_arguments(output_files_created=True, raise_exception=False) 

358 

359 return self.return_code 

360 

361 

362def pmemd_mdrun(input_top_path: str, input_crd_path: str, 

363 output_log_path: str, output_traj_path: str, output_rst_path: str, 

364 input_mdin_path: Optional[str] = None, input_cpin_path: Optional[str] = None, 

365 output_cpout_path: Optional[str] = None, output_cprst_path: Optional[str] = None, 

366 output_mdinfo_path: Optional[str] = None, input_ref_path: Optional[str] = None, 

367 properties: Optional[dict] = None, **kwargs) -> int: 

368 """Create :class:`PmemdMDRun <pmemd.pmemd_mdrun.PmemdMDRun>`pmemd.pmemd_mdrun.PmemdMDRun class and 

369 execute :meth:`launch() <pmemd.pmemd_mdrun.PmemdMDRun.launch>` method""" 

370 

371 return PmemdMDRun(input_top_path=input_top_path, 

372 input_crd_path=input_crd_path, 

373 input_mdin_path=input_mdin_path, 

374 input_cpin_path=input_cpin_path, 

375 input_ref_path=input_ref_path, 

376 output_log_path=output_log_path, 

377 output_traj_path=output_traj_path, 

378 output_rst_path=output_rst_path, 

379 output_cpout_path=output_cpout_path, 

380 output_cprst_path=output_cprst_path, 

381 output_mdinfo_path=output_mdinfo_path, 

382 properties=properties).launch() 

383 

384 pmemd_mdrun.__doc__ = PmemdMDRun.__doc__ 

385 

386 

387def main(): 

388 parser = argparse.ArgumentParser(description='Running molecular dynamics using pmemd tool from the AMBER MD package.', formatter_class=lambda prog: argparse.RawTextHelpFormatter(prog, width=99999)) 

389 parser.add_argument('--config', required=False, help='Configuration file') 

390 

391 # Specific args 

392 required_args = parser.add_argument_group('required arguments') 

393 required_args.add_argument('--input_top_path', required=True, help='Input topology file (AMBER ParmTop). Accepted formats: top, prmtop, parmtop.') 

394 required_args.add_argument('--input_crd_path', required=True, help='Input coordinates file (AMBER crd). Accepted formats: crd, mdcrd.') 

395 required_args.add_argument('--input_mdin_path', required=False, help='Input configuration file (MD run options) (AMBER mdin). Accepted formats: mdin, in, txt.') 

396 required_args.add_argument('--input_cpin_path', required=False, help='Input constant pH file (AMBER cpin). Accepted formats: cpin.') 

397 required_args.add_argument('--input_ref_path', required=False, help='Input reference coordinates for position restraints. Accepted formats: rst, rst7.') 

398 required_args.add_argument('--output_log_path', required=True, help='Output log file. Accepted formats: log, out, txt.') 

399 required_args.add_argument('--output_traj_path', required=True, help='Output trajectory file. Accepted formats: trj, crd, mdcrd, x.') 

400 required_args.add_argument('--output_rst_path', required=True, help='Output restart file. Accepted formats: rst, rst7.') 

401 required_args.add_argument('--output_cpout_path', required=False, help='Output constant pH file (AMBER cpout). Accepted formats: cpout.') 

402 required_args.add_argument('--output_cprst_path', required=False, help='Output constant pH restart file (AMBER rstout). Accepted formats: cprst.') 

403 required_args.add_argument('--output_mdinfo_path', required=False, help='Output MD info. Accepted formats: mdinfo.') 

404 

405 args = parser.parse_args() 

406 config = args.config if args.config else None 

407 properties = settings.ConfReader(config=config).get_prop_dic() 

408 

409 # Specific call 

410 pmemd_mdrun(input_top_path=args.input_top_path, 

411 input_crd_path=args.input_crd_path, 

412 input_mdin_path=args.input_mdin_path, 

413 input_cpin_path=args.input_cpin_path, 

414 input_ref_path=args.input_ref_path, 

415 output_log_path=args.output_log_path, 

416 output_traj_path=args.output_traj_path, 

417 output_rst_path=args.output_rst_path, 

418 output_cpout_path=args.output_cpout_path, 

419 output_cprst_path=args.output_cprst_path, 

420 output_mdinfo_path=args.output_mdinfo_path, 

421 properties=properties) 

422 

423 

424if __name__ == '__main__': 

425 main()