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

Commit 4b4384a

Browse files
committed
Write the chemkin files less often.
Now written only once per iteration, instead of once for each reaction system. To preserve the previous behaviour (the over-writing meant only the last reaction system was saved) it now saves only the last reaction system. I have also moved where this happens, to be just after the printModelSize() call, because writing the chemkin files now has the side-effect of reporting their size, and it looks nicer in the log file if this occurs straight after printModelSize().
1 parent 2781618 commit 4b4384a

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

source/RMG/jing/rxnSys/ReactionModelGenerator.java

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1376,16 +1376,19 @@ public void modelGeneration() {
13761376
}
13771377

13781378
printModelSize();
1379+
1380+
// Write Chemkin input file only for the LAST reaction system (preserving old behaviour from when it used to be overwritten N times).
1381+
Chemkin.writeChemkinInputFile((ReactionSystem)reactionSystemList.getLast());
1382+
13791383
Logger.info(String.format("Running time: %.3f min", + (System.currentTimeMillis()-Global.tAtInitialization)/1000./60.));
13801384
printMemoryUsed();
1381-
1385+
13821386
//10/24/07 gmagoon: note: each element of for loop could be done in parallel if desired; some modifications would be needed
13831387
for (Integer i = 0; i<reactionSystemList.size();i++) {
13841388
ReactionSystem rs = (ReactionSystem)reactionSystemList.get(i);
13851389
ReactionTime begin = (ReactionTime)beginList.get(i);
13861390
ReactionTime end = (ReactionTime)endList.get(i);
13871391
endList.set(i,rs.solveReactionSystem(begin, end, true, true, true, iterationNumber-1));
1388-
Chemkin.writeChemkinInputFile(rs);
13891392
boolean terminated = rs.isReactionTerminated();
13901393
terminatedList.add(terminated);
13911394
if(!terminated)
@@ -1462,9 +1465,13 @@ public void modelGeneration() {
14621465
rs.initializePDepNetwork();
14631466
}
14641467
//reactionSystem.initializePDepNetwork();
1465-
}
1468+
}
14661469

14671470
printModelSize();
1471+
1472+
// Write Chemkin input file only for the LAST reaction system (preserving old behaviour from when it used to be overwritten N times).
1473+
Chemkin.writeChemkinInputFile((ReactionSystem)reactionSystemList.getLast());
1474+
14681475
Logger.info(String.format("Running time: %.3f min", + (System.currentTimeMillis()-Global.tAtInitialization)/1000./60.));
14691476
printMemoryUsed();
14701477

@@ -1524,12 +1531,7 @@ public void modelGeneration() {
15241531
solverMin = solverMin + (System.currentTimeMillis()-startTime)/1000/60;
15251532

15261533
startTime = System.currentTimeMillis();
1527-
for (Integer i = 0; i<reactionSystemList.size();i++) {
1528-
// we over-write the chemkin file each time, so only the LAST reaction system is saved
1529-
// i.e. if you are using RATE for pdep, only the LAST pressure is used.
1530-
ReactionSystem rs = (ReactionSystem)reactionSystemList.get(i);
1531-
Chemkin.writeChemkinInputFile(rs);
1532-
}
1534+
15331535
//9/1/09 gmagoon: if we are using QM, output a file with the CHEMKIN name, the RMG name, the (modified) InChI, and the (modified) InChIKey
15341536
if (ChemGraph.useQM){
15351537
writeInChIs(getReactionModel());

0 commit comments

Comments
 (0)