Skip to content
This repository was archived by the owner on Jun 7, 2024. It is now read-only.

Commit c56ff8d

Browse files
committed
get and close other streams in InChI and QMTP processes
trying to address issue #141
1 parent 8a57edc commit c56ff8d

File tree

2 files changed

+33
-0
lines changed

2 files changed

+33
-0
lines changed

source/RMG/jing/chem/QMTP.java

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -463,6 +463,8 @@ public molFile embed3D(molFile twoDmolFile, int numConfAttempts){
463463
System.out.println("RDKit received error (see above) on " + twoDmolFile.getName()+". File was probably not written.");
464464
}
465465
int exitValue = pythonProc.waitFor();
466+
pythonProc.getInputStream().close();
467+
pythonProc.getOutputStream().close();
466468
br.close();
467469
isr.close();
468470
is.close();
@@ -614,6 +616,8 @@ public int createGaussianPM3Input(String name, String directory, molFile p_molfi
614616
//do nothing
615617
}
616618
int exitValue = babelProc.waitFor();
619+
babelProc.getErrorStream().close();
620+
babelProc.getOutputStream().close();
617621
br.close();
618622
isr.close();
619623
is.close();
@@ -718,6 +722,8 @@ public int createMM4Input(String name, String directory, molFile p_molfile, int
718722
//do nothing
719723
}
720724
int exitValue = molecoorProc.waitFor();
725+
molecoorProc.getErrorStream().close();
726+
molecoorProc.getOutputStream().close();
721727
br.close();
722728
isr.close();
723729
is.close();
@@ -1000,6 +1006,8 @@ else if(attemptNumber%scriptAttempts==0){//used for troublesome HGRZRPHFLAXXBT-U
10001006
//do nothing
10011007
}
10021008
int exitValue = babelProc.waitFor();
1009+
babelProc.getErrorStream().close();
1010+
babelProc.getOutputStream().close();
10031011
br.close();
10041012
isr.close();
10051013
is.close();
@@ -1046,6 +1054,8 @@ public int runGaussian(String name, String directory){
10461054
System.out.println("Gaussian process received error (see above) on " + name);
10471055
}
10481056
int exitValue = gaussianProc.waitFor();
1057+
gaussianProc.getInputStream().close();
1058+
gaussianProc.getOutputStream().close();
10491059
br.close();
10501060
isr.close();
10511061
is.close();
@@ -1142,6 +1152,8 @@ public int runMM4(String name, String directory){
11421152

11431153

11441154
int exitValue = mm4Proc.waitFor();
1155+
mm4Proc.getErrorStream().close();
1156+
mm4Proc.getOutputStream().close();
11451157
br.close();
11461158
isr.close();
11471159
is.close();
@@ -1241,6 +1253,8 @@ public void runMM4Rotor(String name, String directory, int rotors){
12411253

12421254

12431255
int exitValue = mm4Proc.waitFor();
1256+
mm4Proc.getErrorStream().close();
1257+
mm4Proc.getOutputStream().close();
12441258
br.close();
12451259
isr.close();
12461260
is.close();
@@ -1283,6 +1297,8 @@ public int runMOPAC(String name, String directory){
12831297
System.out.println("MOPAC process received error (see above) on " + name);
12841298
}
12851299
int exitValue = mopacProc.waitFor();
1300+
mopacProc.getInputStream().close();
1301+
mopacProc.getOutputStream().close();
12861302
br.close();
12871303
isr.close();
12881304
is.close();
@@ -1596,6 +1612,8 @@ public QMData performCanThermCalcs(String name, String directory, ChemGraph p_ch
15961612
}
15971613

15981614
int exitValue = canProc.waitFor();
1615+
canProc.getErrorStream().close();
1616+
canProc.getOutputStream().close();
15991617
br.close();
16001618
isr.close();
16011619
is.close();
@@ -1785,6 +1803,8 @@ public ThermoData getPM3MM4ThermoDataUsingCCLib(String name, String directory, C
17851803
//do nothing (there shouldn't be any more information, but this is included to get all the output)
17861804
}
17871805
int exitValue = cclibProc.waitFor();
1806+
cclibProc.getErrorStream().close();
1807+
cclibProc.getOutputStream().close();
17881808
br.close();
17891809
isr.close();
17901810
is.close();
@@ -1995,6 +2015,8 @@ else if (attemptNumber==4){
19952015
}
19962016
}
19972017
int exitValue = symmProc.waitFor();
2018+
symmProc.getErrorStream().close();
2019+
symmProc.getOutputStream().close();
19982020
br.close();
19992021
isr.close();
20002022
is.close();
@@ -2730,6 +2752,8 @@ public QMData getQMDataWithCClib(String name, String directory, ChemGraph p_chem
27302752
//do nothing (there shouldn't be any more information, but this is included to get all the output)
27312753
}
27322754
int exitValue = cclibProc.waitFor();
2755+
cclibProc.getErrorStream().close();
2756+
cclibProc.getOutputStream().close();
27332757
br.close();
27342758
isr.close();
27352759
is.close();

source/RMG/jing/chem/Species.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1214,6 +1214,7 @@ public String toStringWithoutH(int i) {
12141214
BufferedReader stderr = new BufferedReader(new InputStreamReader(InChI.getErrorStream()));
12151215

12161216
// Clean up i/o streams
1217+
InChI.getOutputStream().close();
12171218
stdout.close();
12181219
stderr.close();
12191220

@@ -1233,6 +1234,7 @@ else if (getOs().toLowerCase().contains("linux")){
12331234
exitValue = InChI.waitFor();
12341235

12351236
// Clean up i/o streams
1237+
InChI.getOutputStream().close();
12361238
stdout.close();
12371239
stderr.close();
12381240

@@ -1251,6 +1253,7 @@ else if (getOs().toLowerCase().contains("mac")){
12511253
exitValue = InChI.waitFor();
12521254

12531255
// Clean up i/o streams
1256+
InChI.getOutputStream().close();
12541257
stdout.close();
12551258
stderr.close();
12561259
}
@@ -1548,6 +1551,7 @@ public static void inchi2mol(String p_inchi) {
15481551
BufferedReader stdout = new BufferedReader(new InputStreamReader(InChI.getInputStream()));
15491552
BufferedReader stderr = new BufferedReader(new InputStreamReader(InChI.getErrorStream()));
15501553
// Clean up i/o streams
1554+
InChI.getOutputStream().close();
15511555
stdout.close();
15521556
stderr.close();
15531557
exitValue = InChI.waitFor();
@@ -1557,6 +1561,7 @@ public static void inchi2mol(String p_inchi) {
15571561
stdout = new BufferedReader(new InputStreamReader(InChI.getInputStream()));
15581562
stderr = new BufferedReader(new InputStreamReader(InChI.getErrorStream()));
15591563
// Clean up i/o streams
1564+
InChI.getOutputStream().close();
15601565
stdout.close();
15611566
stderr.close();
15621567
exitValue = InChI.waitFor();
@@ -1585,6 +1590,7 @@ public static void inchi2mol(String p_inchi) {
15851590
BufferedReader stderr = new BufferedReader(new InputStreamReader(InChI.getErrorStream()));
15861591
exitValue = InChI.waitFor();
15871592
// Clean up i/o streams
1593+
InChI.getOutputStream().close();
15881594
stdout.close();
15891595
stderr.close();
15901596

@@ -1594,6 +1600,7 @@ public static void inchi2mol(String p_inchi) {
15941600
stderr = new BufferedReader(new InputStreamReader(InChI.getErrorStream()));
15951601
exitValue = InChI.waitFor();
15961602
// Clean up i/o streams
1603+
InChI.getOutputStream().close();
15971604
stdout.close();
15981605
stderr.close();
15991606
}
@@ -1621,6 +1628,7 @@ public static void inchi2mol(String p_inchi) {
16211628
BufferedReader stderr = new BufferedReader(new InputStreamReader(InChI.getErrorStream()));
16221629
exitValue = InChI.waitFor();
16231630
// Clean up i/o streams
1631+
InChI.getOutputStream().close();
16241632
stdout.close();
16251633
stderr.close();
16261634

@@ -1630,6 +1638,7 @@ public static void inchi2mol(String p_inchi) {
16301638
stderr = new BufferedReader(new InputStreamReader(InChI.getErrorStream()));
16311639
exitValue = InChI.waitFor();
16321640
// Clean up i/o streams
1641+
InChI.getOutputStream().close();
16331642
stdout.close();
16341643
stderr.close();
16351644
}

0 commit comments

Comments
 (0)