19package denoptim.integration.tinker;
21import java.util.ArrayList;
23import java.util.logging.Level;
24import java.util.logging.Logger;
26import denoptim.constants.DENOPTIMConstants;
27import denoptim.exception.DENOPTIMException;
28import denoptim.files.FileUtils;
29import denoptim.io.DenoptimIO;
30import denoptim.molecularmodeling.ChemicalObjectModel;
31import denoptim.task.ProcessHandler;
32import denoptim.utils.ObjectPair;
45 private final static String
FSEP = System.getProperty(
"file.separator");
81 String runLabel, String ffFilePathName, List<String> keyFileLines,
82 List<String> subParamsInit, List<String> subParamsRest,
83 String pssExePathName, String xyzintPathName, String workDir,
86 for (
int i=0; i<mols.size(); i++)
88 Object molErroProp = mols.get(i).getIAtomContainer().getProperty(
90 if (molErroProp ==
null)
92 logger.log(Level.INFO,
"Field MOL_ERROR is null: proceeding "
93 +
"with conformational search.");
95 runLabel, ffFilePathName, keyFileLines,
96 subParamsInit, subParamsRest,
97 pssExePathName, xyzintPathName,
98 workDir, taskId, logger);
100 logger.log(Level.INFO,
"Field MOL_ERROR is NOT null: skiping "
101 +
"conformational search. Reason: " + molErroProp);
138 int idm, String runLabel,
139 String ffFilePathName, List<String> keyFileLines,
140 List<String> subParamsInit, List<String> subParamsRest,
141 String pssrotPathName, String xyzintPathName, String workDir,
142 int taskId, Logger logger)
145 logger.log(Level.INFO,
"Start conformational search on mol: " + idm);
148 int sz = chemObj.getNumberRotatableBonds();
151 logger.log(Level.FINE,
"No rotatable bond: skiping "
152 +
" PSSROT conformational search.");
157 String molName = chemObj.
getName();
160 String csIntFile = workDir +
FSEP + molName +
"_"+runLabel + idm
165 String csKeyFile = workDir +
FSEP + molName +
"_"+runLabel + idm
167 StringBuilder csSbKey =
new StringBuilder(512);
169 csSbKey.append(
"parameters ").append(ffFilePathName).append(
NL);
170 for (String line : keyFileLines)
172 if (line.toUpperCase().startsWith(
"PARAMETERS"))
174 csSbKey.append(line).append(
NL);
179 String csSubFile = workDir +
FSEP + molName +
"_"+runLabel + idm
181 StringBuilder csSbSub =
new StringBuilder(512);
182 csSbSub.append(csIntFile).append(
NL);
184 for (String line : subParamsInit)
186 csSbSub.append(line).append(
NL);
189 for (
ObjectPair rotBndOp : chemObj.getRotatableBonds())
191 int t1 = ((Integer)rotBndOp.getFirst()).intValue() + 1;
192 int t2 = ((Integer)rotBndOp.getSecond()).intValue() + 1;
193 csSbSub.append(t1).append(
" ").append(t2).append(
NL);
199 for (
int ir=0; ir<subParamsRest.size(); ir++)
204 int maxDirs = Integer.parseInt(subParamsRest.get(ir));
207 csSbSub.append(sz).append(
NL);
209 csSbSub.append(maxDirs).append(
NL);
212 String row = subParamsRest.get(ir);
213 csSbSub.append(row).append(
NL);
220 String firstLine = subParamsRest.get(0);
221 String lastLine = subParamsRest.get(subParamsRest.size()-1);
222 csSbSub.append(firstLine).append(
NL);
223 csSbSub.append(
"N").append(
NL);
224 csSbSub.append(lastLine).append(
NL);
229 logger.log(Level.INFO,
"Submitting PSSTOR Conformational Search");
232 String csLogFile = workDir +
FSEP + molName +
"_" + runLabel + idm
234 String csCmdStr = pssrotPathName +
" < " + csSubFile +
" > " +csLogFile;
235 String csID =
"" + taskId;
236 logger.log(Level.FINE,
"CMD: " + csCmdStr +
" TskID: " + csID);
243 String msg =
"PSSROT Conformational Search failed for ";
255 +
"_" + runLabel + idm +
".000", csLogFile,
256 runLabel +
"PSSROT job");
263 molName +
"_"+ runLabel + idm, csLogFile,
264 " Final Function Value and Deformation");
269 String newTnkICLog = workDir +
FSEP + molName +
"_"+runLabel + idm
271 String ocsID =
"" + taskId;
272 String ocsCmd = xyzintPathName +
" " + ocsIntfile +
" "
274 +
" > " + newTnkICLog;
275 logger.log(Level.INFO,
"CMD: " + ocsCmd+
" TskID: "+ocsID);
282 String msg =
"XYZINT (post conf.search) failed for " + molName;
294 String newTnkIC = workDir +
FSEP + molName +
"_" + runLabel + idm
297 "convert xyz to int for " + runLabel +
"job");
301 ArrayList<TinkerAtom> lstAtoms = tmpTmol.
getAtoms();
302 for (
int i=0; i<lstAtoms.size(); i++)
307 chemObj.updateXYZFromINT();
327 ArrayList<String> txtLines =
new ArrayList<String>();
337 String[] wFrstLine = txtLines.get(0).trim().split(
"\\s+");
338 int numAtms = Integer.parseInt(wFrstLine[0]);
341 if (numAtms+1 == txtLines.size())
346 StringBuilder sb =
new StringBuilder(512);
347 sb.append(txtLines.get(0));
349 for (
int i=1; i<txtLines.size(); i++)
351 String line = txtLines.get(i).trim();
353 if (line ==
"" || line ==
null)
356 String[] wLine = line.split(
"\\s+");
357 int atmNum = Integer.parseInt(wLine[0]);
360 sb.append(
NL).append(txtLines.get(i));
364 sb.append(
" ").append(txtLines.get(i));
General set of constants used in DENOPTIM.
static final String EOL
new line character
static final String MOLERRORTAG
SDF tag containing errors during execution of molecule specific tasks.
static void deleteFilesContaining(String path, String pattern)
Delete all files with pathname containing a given string.
Based on the code from ffx.kenai.com Michael J.
void setDistAngle(double[] distAngles)
Exceptions resulting from a failure of Tinker.
ArrayList< TinkerAtom > getAtoms()
TinkerAtom getAtom(int pos)
Returns the atom which has the XYZ index set to pos.
Toolbox of utilities for Tinker style molecular representation.
static String getNameLastCycleFile(String workDir, String fname, String tinkerLog, String pattern)
Identifies how many iteration Tinker has done by looking into the log file, searching for a given pat...
static void writeIC(String filename, TinkerMolecule tmol)
Write Tinker INT file.
static TinkerMolecule readTinkerIC(String filename)
Reads a Tinker INT file.
static void ensureOutputExistsOrRelayError(String outputPathName, String logPathName, String taskName)
Check for the existence of an output file for a Tinker job and, if the output file is not found,...
Utility methods for input/output.
static ArrayList< String > readList(String fileName)
Read list of data as text.
static void writeData(String fileName, String data, boolean append)
Write text-like data file.
Collector of molecular information, related to a single chemical object, that is deployed within the ...
int getExitCode()
Get the exit code returned by the sub-process.
String getErrorOutput()
Get the content of the error output for the process.
void runProcessInBASH()
Run the process associated with the command from BASH http://www.javaworld.com/javaworld/jw-12-2000/j...
This class is the equivalent of the Pair data structure used in C++ Although AbstractMap....