$darkmode
DENOPTIM
MMBuilderParameters.java
Go to the documentation of this file.
1/*
2 * DENOPTIM
3 * Copyright (C) 2019 Vishwesh Venkatraman <vishwesh.venkatraman@ntnu.no> and
4 * Marco Foscato <marco.foscato@uib.no>
5 *
6 * This program is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU Affero General Public License as published
8 * by the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU Affero General Public License for more details.
15 *
16 * You should have received a copy of the GNU Affero General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19
20package denoptim.programs.moldecularmodelbuilder;
21
22import java.lang.reflect.Field;
23import java.util.ArrayList;
24import java.util.HashMap;
25
26import denoptim.exception.DENOPTIMException;
27import denoptim.integration.tinker.TinkerUtils;
28import denoptim.molecularmodeling.MMBuilderUtils;
29import denoptim.programs.RunTimeParameters;
30
38{
42 protected boolean debug = false;
43
47 protected String toolPSSROT;
48
52 protected String toolXYZINT;
53
57 protected String toolINTXYZ;
58
62 protected boolean keepDummy = false;
63
67 protected String forceFieldFile;
68
72 protected String pssrotFile;
73
77 protected String rsPssrotFile;
78
82 protected String keyFile;
83
87 protected String rsKeyFile;
88
92 protected ArrayList<String> pssrotParams_Init;
93
97 protected ArrayList<String> pssrotParams_Rest;
98
102 protected ArrayList<String> keyFileParams;
103
107 protected ArrayList<String> rsPssrotParams_Init;
108
112 protected ArrayList<String> rsPssrotParams_Rest;
113
117 protected ArrayList<String> rsKeyFileParams;
118
124 protected int atomOrderingScheme = 1;
125
129 protected HashMap<String, Integer> TINKER_MAP;
130
134 protected int taskID;
135
139 protected String inpSDFFile;
140
144 protected String outSDFFile;
145
149 protected String rcoServerHostname = "localhost";
150
154 protected Integer rcoServerPort = 5972;
155
160 protected String rcoServerRequestsFileName = null;
161
162//------------------------------------------------------------------------------
163
168 {
170 }
171
172//------------------------------------------------------------------------------
173
174 public int getTaskID()
175 {
176 return taskID;
177 }
178
179//------------------------------------------------------------------------------
180
181 public String getInputSDFFile()
182 {
183 return inpSDFFile;
184 }
185
186//------------------------------------------------------------------------------
187
188 public String getOutputSDFFile()
189 {
190 return outSDFFile;
191 }
192
193//------------------------------------------------------------------------------
194
195 public String getPSSROTTool()
196 {
197 return toolPSSROT;
198 }
199
200//------------------------------------------------------------------------------
201
202 public String getXYZINTTool()
203 {
204 return toolXYZINT;
205 }
206
207//------------------------------------------------------------------------------
208
209 public String getINTXYZTool()
210 {
211 return toolINTXYZ;
212 }
213
214//------------------------------------------------------------------------------
215
216 public String getParamFile()
217 {
218 return forceFieldFile;
219 }
220
221//------------------------------------------------------------------------------
222
223 public ArrayList<String> getInitPSSROTParams()
224 {
225 return pssrotParams_Init;
226 }
227
228//------------------------------------------------------------------------------
229
230 public ArrayList<String> getRSInitPSSROTParams()
231 {
232 return rsPssrotParams_Init;
233 }
234
235//------------------------------------------------------------------------------
236
237 public ArrayList<String> getRestPSSROTParams()
238 {
239 return pssrotParams_Rest;
240 }
241
242//------------------------------------------------------------------------------
243
244 public ArrayList<String> getRSRestPSSROTParams()
245 {
246 return rsPssrotParams_Rest;
247 }
248
249//------------------------------------------------------------------------------
250
251 public ArrayList<String> getKeyFileParams()
252 {
253 return keyFileParams;
254 }
255
256//------------------------------------------------------------------------------
257
258 public boolean getKeepDummyFlag()
259 {
260 return keepDummy;
261 }
262
263//------------------------------------------------------------------------------
264
265 public ArrayList<String> getRSKeyFileParams()
266 {
267 return rsKeyFileParams;
268 }
269
270//------------------------------------------------------------------------------
271
272 public boolean debug()
273 {
274 return debug;
275 }
276
277//------------------------------------------------------------------------------
278
280 {
281 return atomOrderingScheme;
282 }
283
284//------------------------------------------------------------------------------
285
286 public HashMap<String, Integer> getTinkerMap()
287 {
288 return TINKER_MAP;
289 }
290
291//------------------------------------------------------------------------------
292
293 public String getWorkingDirectory()
294 {
295 return workDir;
296 }
297
298//------------------------------------------------------------------------------
299
300 public String getRCOServerHostname() {
301 return rcoServerHostname;
302 }
303
304//------------------------------------------------------------------------------
305
306 public Integer getRCOServerPort() {
307 return rcoServerPort;
308 }
309
310//------------------------------------------------------------------------------
311
314 }
315
316//-----------------------------------------------------------------------------
317
325 public void interpretKeyword(String key, String value)
326 throws DENOPTIMException
327 {
328 String msg = "";
329 switch (key.toUpperCase())
330 {
331 case "TOOLPSSROT=":
332 toolPSSROT = value;
333 break;
334 case "TOOLXYZINT=":
335 toolXYZINT = value;
336 break;
337 case "TOOLINTXYZ=":
338 toolINTXYZ = value;
339 break;
340 case "FORCEFIELDFILE=":
341 forceFieldFile = value;
342 break;
343 case "KEYFILE=":
344 keyFile = value;
345 break;
346 case "RCKEYFILE=":
347 rsKeyFile = value;
348 break;
349 case "VERBOSITY=":
350 try
351 {
352 verbosity = Integer.parseInt(value);
353 }
354 catch (Throwable t)
355 {
356 msg = "Unable to understand value " + key + "'" + value + "'";
357 throw new DENOPTIMException(msg);
358 }
359 break;
360 case "DEBUG=":
361 debug = true;
362 break;
363 case "PSSROTPARAMS=":
364 pssrotFile = value;
365 break;
366 case "RCPSSROTPARAMS=":
367 rsPssrotFile = value;
368 break;
369 case "KEEPDUMMYATOMS":
370 keepDummy = true;
371 break;
372 case "ATOMORDERINGSCHEME=":
373 try
374 {
375 atomOrderingScheme = Integer.parseInt(value);
376 }
377 catch (Throwable t)
378 {
379 msg = "Unable to understand value " + key + "'" + value + "'";
380 throw new DENOPTIMException(msg);
381 }
382 break;
383 case "INPSDF=":
384 inpSDFFile = value;
385 break;
386 case "OUTSDF=":
387 outSDFFile = value;
388 break;
389 case "WORKDIR=":
390 workDir = value;
391 break;
392 case "RCOSERVERHOSTNAME=":
393 rcoServerHostname = value;
394 break;
395 case "RCOSERVERPORT=":
396 rcoServerPort = Integer.parseInt(value);
397 break;
398 case "RECORDRCOSERVERREQUESTSTOFILE=":
400 break;
401
402/*
403 case "=":
404 = value;
405 break;
406*/
407
408 default:
409 msg = "Keyword " + key + " is not a known keyword for the "
410 + "3d-molecular model builder. Check input files.";
411 throw new DENOPTIMException(msg);
412 }
413 }
414
415//------------------------------------------------------------------------------
416
422 {
423 ensureNotNull("wrkDir",workDir,"WORKDIR");
425
426 ensureNotNull("inpSDFFile",inpSDFFile,"INPSDF");
428
429 ensureNotNull("outSDFFile",outSDFFile,"OUTSDF");
430
431 if (atomOrderingScheme < 1 || atomOrderingScheme > 2)
432 {
433 throw new Error("ERROR! Parameter 'atomOrderingScheme' can only "
434 + "be 1 or 2");
435 }
436
438 }
439
440//------------------------------------------------------------------------------
447 public String getPrintedList()
448 {
449 StringBuilder sb = new StringBuilder(1024);
450 sb.append(" " + paramTypeName() + " ").append(NL);
451 for (Field f : this.getClass().getDeclaredFields())
452 {
453 try
454 {
455 sb.append(f.getName()).append(" = ").append(
456 f.get(this)).append(NL);
457 }
458 catch (Throwable t)
459 {
460 sb.append("ERROR! Unable to print " + paramTypeName()
461 + " parameters. Cause: " + t);
462 break;
463 }
464 }
465 for (RunTimeParameters otherCollector : otherParameters.values())
466 {
467 sb.append(otherCollector.getPrintedList());
468 }
469 return sb.toString();
470 }
471
472//------------------------------------------------------------------------------
473
475 {
476 pssrotParams_Init = new ArrayList<>();
477 pssrotParams_Rest = new ArrayList<>();
478 keyFileParams = new ArrayList<>();
479 rsPssrotParams_Init = new ArrayList<>();
480 rsPssrotParams_Rest = new ArrayList<>();
481 rsKeyFileParams = new ArrayList<>();
482
483 if (keyFile!=null)
484 {
486 }
487 if (pssrotFile!=null)
488 {
491 }
492 if (forceFieldFile!=null)
493 {
495 }
496
498 {
499 if (rsPssrotFile!=null)
500 {
503 }
504 if (rsKeyFile!=null)
505 {
507 }
508 }
510 }
511
512//------------------------------------------------------------------------------
513}
Toolbox of utilities for Tinker style molecular representation.
static HashMap< String, Integer > readTinkerAtomTypes(String filename)
Read the Tinker atom mapping from Tinker Force Field.
static void readPSSROTParams(String filename, List< String > initPars, List< String > restPars)
Read the parameter settings to be used by PSSROT.
Utilities for molecular models builder.
static void readKeyFileParams(String filename, ArrayList< String > data)
Read the parameter settings to be used by PSSROT.
Collection of parameters controlling the behavior of the software.
Map< ParametersType, RunTimeParameters > otherParameters
Collection of other parameters by type.
void ensureFileExists(String pathname)
Ensures a pathname does lead to an existing file or triggers an error.
void ensureNotNull(String paramName, String param, String paramKey)
Ensures that a parameter is not null or triggers an error.
String paramTypeName()
Returns a string defining the type the parameters collected here.
void checkOtherParameters()
Checks any of the parameter collections contained in this instance.
final String NL
New line character.
void processOtherParameters()
Processes any of the parameter collections contained in this instance.
int verbosity
Verbosity level for logger.
Parameters for the conformer generator (3D builder).
String keyFile
Pathname to keywords file for Tinker's conformational search.
ArrayList< String > keyFileParams
Keywords for Tinker's conformational search.
String toolXYZINT
Pathname to Tinker's xyzint executable.
String rcoServerRequestsFileName
Pathname to file where to record requests sent to the RCOServer.
void processParameters()
Processes all parameters and initialize related objects.
ArrayList< String > rsKeyFileParams
Keywords for Tinker's ring-closing conformational search.
String getPrintedList()
Returns the list of parameters in a string with newline characters as delimiters.
ArrayList< String > pssrotParams_Init
Parameters for PSS part of Tinker's PSSROT step.
String pssrotFile
Pathname to parameters file for PSS part of Tinker's PSSROT.
String rsPssrotFile
Pathname to parameters file for PSS part of Tinker's ring-closing PSSROT.
String toolINTXYZ
Pathname to Tinker's intxyz executable.
String forceFieldFile
Pathname to force field parameters file for Tinker.
ArrayList< String > rsPssrotParams_Init
Parameters for PSS part of Tinker's ring-closing PSSROT step.
int atomOrderingScheme
Flag controlling the criterion used to reorder atom lists.
HashMap< String, Integer > TINKER_MAP
Atom type map for Tinker.
void interpretKeyword(String key, String value)
Processes a keyword/value pair and assign the related parameters.
ArrayList< String > pssrotParams_Rest
Parameters for linear search part of Tinker's PSSROT step.
boolean keepDummy
Flag controlling removal of dummy atoms from output geometry.
ArrayList< String > rsPssrotParams_Rest
Parameters for linear search part of Tinker's ring-closing PSSROT step.
String rsKeyFile
Pathname to keywords file for Tinker's ring-closing conformational search.
String toolPSSROT
Pathname to Tinker's pssrot executable.
MMB_PARAM
Parameters pertaining the construction of three-dimensional molecular models using the Tinker-based m...
RC_PARAMS
Parameters pertaining to ring closures in graphs.