$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
156//------------------------------------------------------------------------------
157
162 {
164 }
165
166//------------------------------------------------------------------------------
167
168 public int getTaskID()
169 {
170 return taskID;
171 }
172
173//------------------------------------------------------------------------------
174
175 public String getInputSDFFile()
176 {
177 return inpSDFFile;
178 }
179
180//------------------------------------------------------------------------------
181
182 public String getOutputSDFFile()
183 {
184 return outSDFFile;
185 }
186
187//------------------------------------------------------------------------------
188
189 public String getPSSROTTool()
190 {
191 return toolPSSROT;
192 }
193
194//------------------------------------------------------------------------------
195
196 public String getXYZINTTool()
197 {
198 return toolXYZINT;
199 }
200
201//------------------------------------------------------------------------------
202
203 public String getINTXYZTool()
204 {
205 return toolINTXYZ;
206 }
207
208//------------------------------------------------------------------------------
209
210 public String getParamFile()
211 {
212 return forceFieldFile;
213 }
214
215//------------------------------------------------------------------------------
216
217 public ArrayList<String> getInitPSSROTParams()
218 {
219 return pssrotParams_Init;
220 }
221
222//------------------------------------------------------------------------------
223
224 public ArrayList<String> getRSInitPSSROTParams()
225 {
226 return rsPssrotParams_Init;
227 }
228
229//------------------------------------------------------------------------------
230
231 public ArrayList<String> getRestPSSROTParams()
232 {
233 return pssrotParams_Rest;
234 }
235
236//------------------------------------------------------------------------------
237
238 public ArrayList<String> getRSRestPSSROTParams()
239 {
240 return rsPssrotParams_Rest;
241 }
242
243//------------------------------------------------------------------------------
244
245 public ArrayList<String> getKeyFileParams()
246 {
247 return keyFileParams;
248 }
249
250//------------------------------------------------------------------------------
251
252 public boolean getKeepDummyFlag()
253 {
254 return keepDummy;
255 }
256
257//------------------------------------------------------------------------------
258
259 public ArrayList<String> getRSKeyFileParams()
260 {
261 return rsKeyFileParams;
262 }
263
264//------------------------------------------------------------------------------
265
266 public boolean debug()
267 {
268 return debug;
269 }
270
271//------------------------------------------------------------------------------
272
274 {
275 return atomOrderingScheme;
276 }
277
278//------------------------------------------------------------------------------
279
280 public HashMap<String, Integer> getTinkerMap()
281 {
282 return TINKER_MAP;
283 }
284
285//------------------------------------------------------------------------------
286
287 public String getWorkingDirectory()
288 {
289 return workDir;
290 }
291
292//------------------------------------------------------------------------------
293
294 public String getRCOServerHostname() {
295 return rcoServerHostname;
296 }
297
298//------------------------------------------------------------------------------
299
300 public Integer getRCOServerPort() {
301 return rcoServerPort;
302 }
303
304//-----------------------------------------------------------------------------
305
313 public void interpretKeyword(String key, String value)
314 throws DENOPTIMException
315 {
316 String msg = "";
317 switch (key.toUpperCase())
318 {
319 case "TOOLPSSROT=":
320 toolPSSROT = value;
321 break;
322 case "TOOLXYZINT=":
323 toolXYZINT = value;
324 break;
325 case "TOOLINTXYZ=":
326 toolINTXYZ = value;
327 break;
328 case "FORCEFIELDFILE=":
329 forceFieldFile = value;
330 break;
331 case "KEYFILE=":
332 keyFile = value;
333 break;
334 case "RCKEYFILE=":
335 rsKeyFile = value;
336 break;
337 case "VERBOSITY=":
338 try
339 {
340 verbosity = Integer.parseInt(value);
341 }
342 catch (Throwable t)
343 {
344 msg = "Unable to understand value " + key + "'" + value + "'";
345 throw new DENOPTIMException(msg);
346 }
347 break;
348 case "DEBUG=":
349 debug = true;
350 break;
351 case "PSSROTPARAMS=":
352 pssrotFile = value;
353 break;
354 case "RCPSSROTPARAMS=":
355 rsPssrotFile = value;
356 break;
357 case "KEEPDUMMYATOMS":
358 keepDummy = true;
359 break;
360 case "ATOMORDERINGSCHEME=":
361 try
362 {
363 atomOrderingScheme = Integer.parseInt(value);
364 }
365 catch (Throwable t)
366 {
367 msg = "Unable to understand value " + key + "'" + value + "'";
368 throw new DENOPTIMException(msg);
369 }
370 break;
371 case "INPSDF=":
372 inpSDFFile = value;
373 break;
374 case "OUTSDF=":
375 outSDFFile = value;
376 break;
377 case "WORKDIR=":
378 workDir = value;
379 break;
380 case "RCOSERVERHOSTNAME=":
381 rcoServerHostname = value;
382 break;
383 case "RCOSERVERPORT=":
384 rcoServerPort = Integer.parseInt(value);
385 break;
386
387/*
388 case "=":
389 = value;
390 break;
391*/
392
393 default:
394 msg = "Keyword " + key + " is not a known keyword for the "
395 + "3d-molecular model builder. Check input files.";
396 throw new DENOPTIMException(msg);
397 }
398 }
399
400//------------------------------------------------------------------------------
401
407 {
408 ensureNotNull("wrkDir",workDir,"WORKDIR");
410
411 ensureNotNull("inpSDFFile",inpSDFFile,"INPSDF");
413
414 ensureNotNull("outSDFFile",outSDFFile,"OUTSDF");
415
416 if (atomOrderingScheme < 1 || atomOrderingScheme > 2)
417 {
418 throw new Error("ERROR! Parameter 'atomOrderingScheme' can only "
419 + "be 1 or 2");
420 }
421
423 }
424
425//------------------------------------------------------------------------------
432 public String getPrintedList()
433 {
434 StringBuilder sb = new StringBuilder(1024);
435 sb.append(" " + paramTypeName() + " ").append(NL);
436 for (Field f : this.getClass().getDeclaredFields())
437 {
438 try
439 {
440 sb.append(f.getName()).append(" = ").append(
441 f.get(this)).append(NL);
442 }
443 catch (Throwable t)
444 {
445 sb.append("ERROR! Unable to print " + paramTypeName()
446 + " parameters. Cause: " + t);
447 break;
448 }
449 }
450 for (RunTimeParameters otherCollector : otherParameters.values())
451 {
452 sb.append(otherCollector.getPrintedList());
453 }
454 return sb.toString();
455 }
456
457//------------------------------------------------------------------------------
458
460 {
461 pssrotParams_Init = new ArrayList<>();
462 pssrotParams_Rest = new ArrayList<>();
463 keyFileParams = new ArrayList<>();
464 rsPssrotParams_Init = new ArrayList<>();
465 rsPssrotParams_Rest = new ArrayList<>();
466 rsKeyFileParams = new ArrayList<>();
467
468 if (keyFile!=null)
469 {
471 }
472 if (pssrotFile!=null)
473 {
476 }
477 if (forceFieldFile!=null)
478 {
480 }
481
483 {
484 if (rsPssrotFile!=null)
485 {
488 }
489 if (rsKeyFile!=null)
490 {
492 }
493 }
495 }
496
497//------------------------------------------------------------------------------
498}
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.
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.