diff --git a/vcell-core/src/main/java/org/vcell/solver/langevin/LangevinLngvWriter.java b/vcell-core/src/main/java/org/vcell/solver/langevin/LangevinLngvWriter.java index a127b75eeb..49366ffb73 100644 --- a/vcell-core/src/main/java/org/vcell/solver/langevin/LangevinLngvWriter.java +++ b/vcell-core/src/main/java/org/vcell/solver/langevin/LangevinLngvWriter.java @@ -1,5 +1,6 @@ package org.vcell.solver.langevin; +import java.math.BigInteger; import java.util.*; import cbit.vcell.geometry.AnalyticSubVolume; @@ -73,6 +74,7 @@ public class LangevinLngvWriter { public final static String SYSTEM_ANNOTATION = "SYSTEM ANNOTATIONS"; public final static String MOLECULE_ANNOTATIONS = "MOLECULE ANNOTATIONS"; public final static String REACTION_ANNOTATIONS = "REACTION ANNOTATIONS"; + public final static String SIMULATION_OPTIONS = "SIMULATION OPTIONS"; public final static String DEFAULT_FOLDER = "Default Folder"; private String systemName; // The system name (same as the file name, usually) @@ -244,11 +246,16 @@ public static String writeLangevinLngv(Simulation simulation, long randomSeed) t // writeReactionAnnotations(sb); sb.append("\n"); - /* - TODO: The following are being produced when the simulation is created, and are being updated as simulations run (I think) - from C:\TEMP\springsalad-new\spring3reactions\spring3reactions_SIMULATIONS\Simulation0_SIM_FOLDER\Simulation0_SIM.txt - *** SIMULATION STATE *** + /* ****** WRITE THE SIMULATION OPTIONS *********************/ + sb.append("*** " + SIMULATION_OPTIONS + " ***"); + sb.append("\n"); + sb.append("\n"); + writeSimulationOptions(simulation, sb); + sb.append("\n"); + +/* + // TODO: SIMULATION STATE produced by the solver, will be used in ClusterAnalyzer to postprocess run results Runs: 6 Parallel: true @@ -258,6 +265,9 @@ public static String writeLangevinLngv(Simulation simulation, long randomSeed) t HasResults: false RunOnCluster: false + TODO: The following are being produced when the simulation is created, and are being updated as simulations run (I think) + from C:\TEMP\springsalad-new\spring3reactions\spring3reactions_SIMULATIONS\Simulation0_SIM_FOLDER\Simulation0_SIM.txt + *** PROCESSOR FILES *** MoleculeAverages: 'null' @@ -959,6 +969,41 @@ private static void writeSpeciesInfo(StringBuilder sb) { return; } + /* + * We provide the SIMULATION OPTIONS block as part of the input to the solver + * The only important field really is the RandomSeed, which is optional, the rest are not needed by the + * current solver implementation + * + * There is a related SIMULATION STATE block which is generated by the solver when it finishes running + * Then the SpringSaLaD client is parsing it and will use the Runs field in the ClusterAnalyzer module + * for analyzing the results (of one or multiple runs). We'll probably do something similar server-side in + * the postprocessing module + */ + public static void writeSimulationOptions(Simulation simulation, StringBuilder sb) { + SolverTaskDescription std = simulation.getSolverTaskDescription(); + LangevinSimulationOptions lso = std.getLangevinSimulationOptions(); + + int numTrials = std.getNumTrials(); + BigInteger randomSeed = lso.getRandomSeed(); + int simultaneousRuns = lso.getNumOfParallelLocalRuns(); + + // TODO: do not delete this, until we decide on how much info the solver needs + // These are not needed but may be nice to have in the future, makes the solver instance more aware +// sb.append("Runs: " + numTrials); // the SpringSaLaD client parser expects this to be the first line in block +// sb.append("\n"); +// sb.append("Parallel: " + (simultaneousRuns == 1 ? "true" : "false")); +// sb.append("\n"); +// sb.append("SimultaneousRuns: " + simultaneousRuns); // this is always 1 on local and quota dependent on server +// sb.append("\n"); + + // if we don't specify a random seed the solver will do its thing like in the past (use system time in ms) + if(randomSeed != null) { + sb.append("RandomSeed: " + randomSeed); + sb.append("\n"); + } + + } + public static void writeSpatialInformation(GeometrySpec geometrySpec, Simulation simulation, StringBuilder sb) { // SpringSaLaD exporting the time information if (geometrySpec.getDimension() != 3) { throw new RuntimeException("SpringSaLaD requires 3D geometry");