Search in sources :

Example 16 with OutputTimeSpec

use of cbit.vcell.solver.OutputTimeSpec in project vcell by virtualcell.

the class RuleBasedTest method checkNonspatialStochasticSimContext.

private static void checkNonspatialStochasticSimContext(SimulationContext srcSimContext, File baseDirectory, int numTrials) throws Exception {
    if (!srcSimContext.getApplicationType().equals(Application.NETWORK_STOCHASTIC) || srcSimContext.getGeometry().getDimension() != 0) {
        throw new RuntimeException("simContext is of type " + srcSimContext.getApplicationType() + " and geometry dimension of " + srcSimContext.getGeometry().getDimension() + ", expecting nonspatial stochastic");
    }
    BioModel origBioModel = srcSimContext.getBioModel();
    BioModel bioModel = XmlHelper.XMLToBioModel(new XMLSource(XmlHelper.bioModelToXML(origBioModel)));
    bioModel.refreshDependencies();
    // create ODE and RuleBased
    SimulationContext newODEApp = SimulationContext.copySimulationContext(srcSimContext, "aUniqueNewODEApp", false, Application.NETWORK_DETERMINISTIC);
    SimulationContext newRuleBasedApp = SimulationContext.copySimulationContext(srcSimContext, "aUniqueNewRuleBasedApp", false, Application.RULE_BASED_STOCHASTIC);
    newODEApp.setBioModel(bioModel);
    newRuleBasedApp.setBioModel(bioModel);
    ArrayList<AnnotatedFunction> outputFunctionsList = srcSimContext.getOutputFunctionContext().getOutputFunctionsList();
    // OutputContext outputContext = new OutputContext(outputFunctionsList.toArray(new AnnotatedFunction[outputFunctionsList.size()]));
    newODEApp.getOutputFunctionContext().setOutputFunctions(outputFunctionsList);
    newRuleBasedApp.getOutputFunctionContext().setOutputFunctions(outputFunctionsList);
    NetworkGenerationRequirements networkGenerationRequirements = NetworkGenerationRequirements.AllowTruncatedStandardTimeout;
    bioModel.addSimulationContext(newODEApp);
    newODEApp.refreshMathDescription(new MathMappingCallbackTaskAdapter(null), networkGenerationRequirements);
    bioModel.addSimulationContext(newRuleBasedApp);
    newRuleBasedApp.refreshMathDescription(new MathMappingCallbackTaskAdapter(null), networkGenerationRequirements);
    srcSimContext.refreshMathDescription(new MathMappingCallbackTaskAdapter(null), networkGenerationRequirements);
    // Create non-spatialStoch, ODE and RuleBased sims
    Simulation nonspatialStochAppNewSim = srcSimContext.addNewSimulation(STOCH_SIM_NAME, /*SimulationOwner.DEFAULT_SIM_NAME_PREFIX*/
    new MathMappingCallbackTaskAdapter(null), networkGenerationRequirements);
    Simulation newODEAppNewSim = newODEApp.addNewSimulation(ODE_SIM_NAME, new MathMappingCallbackTaskAdapter(null), networkGenerationRequirements);
    Simulation newRuleBasedAppNewSim = newRuleBasedApp.addNewSimulation(NFS_SIM_NAME, new MathMappingCallbackTaskAdapter(null), networkGenerationRequirements);
    nonspatialStochAppNewSim.setSimulationOwner(srcSimContext);
    newODEAppNewSim.setSimulationOwner(newODEApp);
    newRuleBasedAppNewSim.setSimulationOwner(newRuleBasedApp);
    try {
        bioModel.getModel().getSpeciesContexts();
        ArrayList<String> varNameList = new ArrayList<String>();
        for (SpeciesContextSpec scs : srcSimContext.getReactionContext().getSpeciesContextSpecs()) {
            varNameList.add(scs.getSpeciesContext().getName());
        }
        String[] varNames = varNameList.toArray(new String[0]);
        OutputTimeSpec outputTimeSpec = nonspatialStochAppNewSim.getSolverTaskDescription().getOutputTimeSpec();
        ArrayList<Double> sampleTimeList = new ArrayList<Double>();
        if (outputTimeSpec instanceof UniformOutputTimeSpec) {
            double endingTime = nonspatialStochAppNewSim.getSolverTaskDescription().getTimeBounds().getEndingTime();
            double dT = ((UniformOutputTimeSpec) outputTimeSpec).getOutputTimeStep();
            int currTimeIndex = 0;
            while (currTimeIndex * dT <= (endingTime + 1e-8)) {
                sampleTimeList.add(currTimeIndex * dT);
                currTimeIndex++;
            }
        }
        double[] sampleTimes = new double[sampleTimeList.size()];
        for (int i = 0; i < sampleTimes.length; i++) {
            sampleTimes[i] = sampleTimeList.get(i);
        }
        TimeSeriesMultitrialData sampleDataStoch1 = new TimeSeriesMultitrialData("stochastic1", varNames, sampleTimes, numTrials);
        TimeSeriesMultitrialData sampleDataStoch2 = new TimeSeriesMultitrialData("stochastic2", varNames, sampleTimes, numTrials);
        TimeSeriesMultitrialData sampleDataDeterministic = new TimeSeriesMultitrialData("determinstic", varNames, sampleTimes, 1);
        runsolver(nonspatialStochAppNewSim, baseDirectory, numTrials, sampleDataStoch1);
        runsolver(newODEAppNewSim, baseDirectory, 1, sampleDataDeterministic);
        runsolver(newRuleBasedAppNewSim, baseDirectory, numTrials, sampleDataStoch2);
        writeVarDiffData(baseDirectory, sampleDataStoch1, sampleDataStoch2);
        writeKolmogorovSmirnovTest(baseDirectory, sampleDataStoch1, sampleDataStoch2);
        writeChiSquareTest(baseDirectory, sampleDataStoch1, sampleDataStoch2);
        writeData(baseDirectory, sampleDataStoch1);
        writeData(baseDirectory, sampleDataStoch2);
        writeData(baseDirectory, sampleDataDeterministic);
    } finally {
        srcSimContext.removeSimulation(nonspatialStochAppNewSim);
        newODEApp.removeSimulation(newODEAppNewSim);
        newRuleBasedApp.removeSimulation(newRuleBasedAppNewSim);
    }
}
Also used : MathMappingCallbackTaskAdapter(cbit.vcell.mapping.MathMappingCallbackTaskAdapter) UniformOutputTimeSpec(cbit.vcell.solver.UniformOutputTimeSpec) ArrayList(java.util.ArrayList) SimulationContext(cbit.vcell.mapping.SimulationContext) SpeciesContextSpec(cbit.vcell.mapping.SpeciesContextSpec) UniformOutputTimeSpec(cbit.vcell.solver.UniformOutputTimeSpec) OutputTimeSpec(cbit.vcell.solver.OutputTimeSpec) TempSimulation(cbit.vcell.solver.TempSimulation) Simulation(cbit.vcell.solver.Simulation) BioModel(cbit.vcell.biomodel.BioModel) NetworkGenerationRequirements(cbit.vcell.mapping.SimulationContext.NetworkGenerationRequirements) XMLSource(cbit.vcell.xml.XMLSource) AnnotatedFunction(cbit.vcell.solver.AnnotatedFunction)

Example 17 with OutputTimeSpec

use of cbit.vcell.solver.OutputTimeSpec in project vcell by virtualcell.

the class SimulationListPanel method initConnections.

/**
 * Initializes connections
 * @exception java.lang.Exception The exception description.
 */
/* WARNING: THIS METHOD WILL BE REGENERATED. */
private void initConnections() throws java.lang.Exception {
    // user code begin {1}
    // user code end
    getNewButton().addActionListener(ivjEventHandler);
    getEditButton().addActionListener(ivjEventHandler);
    getDeleteButton().addActionListener(ivjEventHandler);
    getRunButton().addActionListener(ivjEventHandler);
    // getPythonResultsButton().addActionListener(ivjEventHandler);
    getNativeResultsButton().addActionListener(ivjEventHandler);
    getMoreActionsButton().addActionListener(ivjEventHandler);
    getScrollPaneTable().addPropertyChangeListener(ivjEventHandler);
    getOutputFunctionsPanel().addPropertyChangeListener(ivjEventHandler);
    getScrollPaneTable().getSelectionModel().addListSelectionListener(ivjEventHandler);
    DefaultScrollTableCellRenderer renderer = new DefaultScrollTableCellRenderer() {

        @Override
        public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
            super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
            if (value instanceof OutputTimeSpec) {
                SimulationWorkspace sw = getSimulationWorkspace();
                SimulationOwner so = sw.getSimulationOwner();
                UnitInfo unitInfo = so.getUnitInfo();
                Objects.requireNonNull(unitInfo);
                OutputTimeSpec ots = (OutputTimeSpec) value;
                String text = ots.describe(unitInfo);
                setText(text);
            } else if (value instanceof Double) {
                setText(value + "");
            }
            boolean bFinitVolumeRerun = false;
            if (value instanceof SolverDescription) {
                SolverDescription solverDescription = (SolverDescription) value;
                try {
                    if (FINITEVOLUME_CUTTOFF != null && solverDescription.equals(SolverDescription.FiniteVolume)) /*Compiled Solver*/
                    {
                        SimulationStatus simStatus = getSimulationWorkspace().getSimulationStatus(getSimulationListTableModel1().getValueAt(row));
                        if (simStatus.getHasData()) {
                            int statusIndex = 0;
                            while (simStatus.getJobStatus(statusIndex) != null) {
                                if (simStatus.getJobStatus(statusIndex).getEndDate().compareTo(FINITEVOLUME_CUTTOFF) > 0) {
                                    bFinitVolumeRerun = true;
                                    break;
                                }
                                statusIndex++;
                            }
                        }
                    }
                } catch (Exception e) {
                    // ignore, let table cell render anyway
                    e.printStackTrace();
                }
                setText(solverDescription.getShortDisplayLabel());
                setToolTipText(solverDescription.getDisplayLabel());
            } else {
                setToolTipText(getText());
            }
            if (bFinitVolumeRerun) {
                setText(getText() + (bFinitVolumeRerun ? "(*)" : ""));
                setToolTipText(getToolTipText() + (bFinitVolumeRerun ? " (data regenerated using FiniteVolumeStandalone)" : ""));
            }
            return this;
        }
    };
    getScrollPaneTable().setDefaultRenderer(OutputTimeSpec.class, renderer);
    getScrollPaneTable().setDefaultRenderer(Double.class, renderer);
    getScrollPaneTable().setDefaultRenderer(String.class, renderer);
    getScrollPaneTable().setDefaultRenderer(SolverDescription.class, renderer);
    getScrollPaneTable().setDefaultEditor(OutputTimeSpec.class, new DefaultCellEditor(new JTextField()));
    getScrollPaneTable().setDefaultRenderer(SimulationStatus.class, new DefaultScrollTableCellRenderer() {

        @Override
        public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
            Object obj = getSimulationStatusDisplay(row);
            if (obj instanceof JProgressBar) {
                return (JProgressBar) obj;
            }
            super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
            if (value instanceof SimulationStatus) {
                setText(obj.toString());
                String details = ((SimulationStatus) value).getDetails();
                setToolTipText(details);
            }
            return this;
        }
    });
}
Also used : SolverDescription(cbit.vcell.solver.SolverDescription) JProgressBar(javax.swing.JProgressBar) JTextField(javax.swing.JTextField) PropertyVetoException(java.beans.PropertyVetoException) IOException(java.io.IOException) DefaultCellEditor(javax.swing.DefaultCellEditor) SimulationOwner(cbit.vcell.solver.SimulationOwner) UnitInfo(cbit.vcell.solver.SimulationOwner.UnitInfo) OutputTimeSpec(cbit.vcell.solver.OutputTimeSpec) SimulationStatus(cbit.vcell.server.SimulationStatus) JTable(javax.swing.JTable) DefaultScrollTableCellRenderer(org.vcell.util.gui.DefaultScrollTableCellRenderer) Component(java.awt.Component)

Example 18 with OutputTimeSpec

use of cbit.vcell.solver.OutputTimeSpec in project vcell by virtualcell.

the class SimulationListTableModel method setValueAt.

/**
 * Insert the method's description here.
 * Creation date: (7/12/2004 2:01:23 PM)
 * @param aValue java.lang.Object
 * @param rowIndex int
 * @param columnIndex int
 */
public void setValueAt(Object aValue, int rowIndex, int columnIndex) {
    Simulation simulation = getValueAt(rowIndex);
    try {
        switch(columnIndex) {
            case COLUMN_NAME:
                if (aValue instanceof String) {
                    String newName = (String) aValue;
                    if (!simulation.getName().equals(newName)) {
                        simulation.setName(newName);
                    }
                }
                break;
            case COLUMN_ENDTIME:
                if (aValue instanceof Double) {
                    SolverTaskDescription solverTaskDescription = simulation.getSolverTaskDescription();
                    double newEndTime = (Double) aValue;
                    if (newEndTime != solverTaskDescription.getTimeBounds().getEndingTime()) {
                        ClientTaskManager.changeEndTime(ownerTable, solverTaskDescription, newEndTime);
                        simulation.setIsDirty(true);
                    }
                }
                break;
            case COLUMN_OUTPUT:
                if (aValue instanceof String) {
                    SolverTaskDescription solverTaskDescription = simulation.getSolverTaskDescription();
                    OutputTimeSpec ots = solverTaskDescription.getOutputTimeSpec();
                    OutputTimeSpec newOts = null;
                    if (ots instanceof DefaultOutputTimeSpec) {
                        int newValue = Integer.parseInt((String) aValue);
                        newOts = new DefaultOutputTimeSpec(newValue, ((DefaultOutputTimeSpec) ots).getKeepAtMost());
                    } else if (ots instanceof UniformOutputTimeSpec) {
                        try {
                            boolean bValid = true;
                            double outputTime = Double.parseDouble((String) aValue);
                            if (solverTaskDescription.getOutputTimeSpec().isUniform()) {
                                if (solverTaskDescription.getSolverDescription().hasVariableTimestep()) {
                                    newOts = new UniformOutputTimeSpec(outputTime);
                                } else {
                                    double timeStep = solverTaskDescription.getTimeStep().getDefaultTimeStep();
                                    double suggestedInterval = outputTime;
                                    if (outputTime < timeStep) {
                                        suggestedInterval = timeStep;
                                        bValid = false;
                                    } else {
                                        if (!BeanUtils.isIntegerMultiple(outputTime, timeStep)) {
                                            double n = outputTime / timeStep;
                                            int intn = (int) Math.round(n);
                                            suggestedInterval = (intn * timeStep);
                                            if (suggestedInterval != outputTime) {
                                                bValid = false;
                                            }
                                        }
                                    }
                                    if (bValid) {
                                        newOts = new UniformOutputTimeSpec(outputTime);
                                    } else {
                                        String ret = PopupGenerator.showWarningDialog(ownerTable, "Output Interval", "Output Interval must " + "be integer multiple of time step.\n\nChange Output Interval to " + suggestedInterval + "?", new String[] { UserMessage.OPTION_YES, UserMessage.OPTION_NO }, UserMessage.OPTION_YES);
                                        if (ret.equals(UserMessage.OPTION_YES)) {
                                            newOts = new UniformOutputTimeSpec(suggestedInterval);
                                        }
                                    }
                                }
                            }
                        } catch (NumberFormatException ex) {
                            DialogUtils.showErrorDialog(ownerTable, "Wrong number format " + ex.getMessage().toLowerCase());
                        }
                    } else if (ots instanceof ExplicitOutputTimeSpec) {
                        newOts = ExplicitOutputTimeSpec.fromString((String) aValue);
                    }
                    if (newOts != null && !newOts.compareEqual(ots)) {
                        solverTaskDescription.setOutputTimeSpec(newOts);
                        simulation.setIsDirty(true);
                    }
                }
                break;
        }
    } catch (Exception ex) {
        ex.printStackTrace(System.out);
        PopupGenerator.showErrorDialog(ownerTable, ex.getMessage());
    }
}
Also used : ExplicitOutputTimeSpec(cbit.vcell.solver.ExplicitOutputTimeSpec) DefaultOutputTimeSpec(cbit.vcell.solver.DefaultOutputTimeSpec) UniformOutputTimeSpec(cbit.vcell.solver.UniformOutputTimeSpec) OutputTimeSpec(cbit.vcell.solver.OutputTimeSpec) ExplicitOutputTimeSpec(cbit.vcell.solver.ExplicitOutputTimeSpec) Simulation(cbit.vcell.solver.Simulation) UniformOutputTimeSpec(cbit.vcell.solver.UniformOutputTimeSpec) SolverTaskDescription(cbit.vcell.solver.SolverTaskDescription) DefaultOutputTimeSpec(cbit.vcell.solver.DefaultOutputTimeSpec)

Example 19 with OutputTimeSpec

use of cbit.vcell.solver.OutputTimeSpec in project vcell by virtualcell.

the class OdeFileWriter method write.

/**
 * Insert the method's description here.
 * Creation date: (3/8/00 10:31:52 PM)
 */
public void write(String[] parameterNames) throws Exception {
    createStateVariables();
    createSymbolTable();
    Simulation simulation = simTask.getSimulation();
    if (simulation.getSolverTaskDescription().getUseSymbolicJacobian()) {
        throw new RuntimeException("symbolic jacobian option not yet supported in interpreted Stiff solver");
    }
    writeJMSParamters();
    SolverTaskDescription solverTaskDescription = simulation.getSolverTaskDescription();
    TimeBounds timeBounds = solverTaskDescription.getTimeBounds();
    ErrorTolerance errorTolerance = solverTaskDescription.getErrorTolerance();
    printWriter.println("SOLVER " + getSolverName());
    printWriter.println("STARTING_TIME " + timeBounds.getStartingTime());
    printWriter.println("ENDING_TIME " + timeBounds.getEndingTime());
    printWriter.println("RELATIVE_TOLERANCE " + errorTolerance.getRelativeErrorTolerance());
    printWriter.println("ABSOLUTE_TOLERANCE " + errorTolerance.getAbsoluteErrorTolerance());
    printWriter.println("MAX_TIME_STEP " + simulation.getSolverTaskDescription().getTimeStep().getMaximumTimeStep());
    OutputTimeSpec ots = simulation.getSolverTaskDescription().getOutputTimeSpec();
    if (ots.isDefault()) {
        printWriter.println("KEEP_EVERY " + ((DefaultOutputTimeSpec) ots).getKeepEvery());
    } else if (ots.isUniform()) {
        printWriter.println("OUTPUT_TIME_STEP " + ((UniformOutputTimeSpec) ots).getOutputTimeStep());
    } else if (ots.isExplicit()) {
        printWriter.println("OUTPUT_TIMES " + ((ExplicitOutputTimeSpec) ots).getNumTimePoints());
        printWriter.println(((ExplicitOutputTimeSpec) ots).toSpaceSeperatedMultiLinesOfString());
    }
    if (parameterNames != null && parameterNames.length != 0) {
        printWriter.println("NUM_PARAMETERS " + parameterNames.length);
        for (int i = 0; i < parameterNames.length; i++) {
            printWriter.println(parameterNames[i]);
        }
    }
    HashMap<Discontinuity, String> discontinuityNameMap = new HashMap<Discontinuity, String>();
    String eventString = null;
    if (simulation.getMathDescription().hasEvents()) {
        eventString = writeEvents(discontinuityNameMap);
    }
    String equationString = writeEquations(discontinuityNameMap);
    if (discontinuityNameMap.size() > 0) {
        printWriter.println("DISCONTINUITIES " + discontinuityNameMap.size());
        for (Discontinuity od : discontinuityNameMap.keySet()) {
            printWriter.println(discontinuityNameMap.get(od) + " " + od.getDiscontinuityExp().flatten().infix() + "; " + od.getRootFindingExp().flatten().infix() + ";");
        }
    }
    if (eventString != null) {
        printWriter.print(eventString);
    }
    printWriter.println("NUM_EQUATIONS " + getStateVariableCount());
    printWriter.println(equationString);
}
Also used : Discontinuity(cbit.vcell.parser.Discontinuity) HashMap(java.util.HashMap) TimeBounds(cbit.vcell.solver.TimeBounds) DefaultOutputTimeSpec(cbit.vcell.solver.DefaultOutputTimeSpec) UniformOutputTimeSpec(cbit.vcell.solver.UniformOutputTimeSpec) ExplicitOutputTimeSpec(cbit.vcell.solver.ExplicitOutputTimeSpec) OutputTimeSpec(cbit.vcell.solver.OutputTimeSpec) ExplicitOutputTimeSpec(cbit.vcell.solver.ExplicitOutputTimeSpec) Simulation(cbit.vcell.solver.Simulation) ErrorTolerance(cbit.vcell.solver.ErrorTolerance) SolverTaskDescription(cbit.vcell.solver.SolverTaskDescription) DefaultOutputTimeSpec(cbit.vcell.solver.DefaultOutputTimeSpec)

Example 20 with OutputTimeSpec

use of cbit.vcell.solver.OutputTimeSpec in project vcell by virtualcell.

the class NFSimSolver method getMathExecutableCommand.

@Override
protected String[] getMathExecutableCommand() {
    String executableName = null;
    try {
        executableName = SolverUtilities.getExes(SolverDescription.NFSim)[0].getAbsolutePath();
    } catch (IOException e) {
        throw new RuntimeException("failed to get executable for solver " + SolverDescription.NFSim.getDisplayLabel() + ": " + e.getMessage(), e);
    }
    String inputFilename = getInputFilename();
    String outputFilename = getOutputFilename();
    String speciesOutputFilename = getSpeciesOutputFilename();
    NFsimSimulationOptions nfsso = simTask.getSimulation().getSolverTaskDescription().getNFSimSimulationOptions();
    ArrayList<String> adv = new ArrayList<String>();
    boolean observableComputationOff = nfsso.getObservableComputationOff();
    if (observableComputationOff == true) {
        // false is by default, no need to specify
        adv.add("-notf");
    }
    Integer moleculeDistance = nfsso.getMoleculeDistance();
    if (moleculeDistance != null) {
        adv.add("-utl");
        adv.add(moleculeDistance + "");
    }
    boolean aggregateBookkeeping = nfsso.getAggregateBookkeeping();
    if (aggregateBookkeeping == true || simTask.getSimulation().getMathDescription().hasSpeciesObservable()) {
        // false is by default, no need to specify
        adv.add("-cb");
    }
    Integer maxMoleculesPerType = nfsso.getMaxMoleculesPerType();
    if (maxMoleculesPerType != null) {
        adv.add("-gml");
        adv.add(maxMoleculesPerType + "");
    }
    Integer equilibrateTime = nfsso.getEquilibrateTime();
    if (equilibrateTime != null) {
        adv.add("-eq");
        adv.add(equilibrateTime + "");
    }
    boolean preventIntraBonds = nfsso.getPreventIntraBonds();
    if (preventIntraBonds == true) {
        // false is by default, no need to specify
        adv.add("-bscb");
    }
    TimeBounds tb = getSimulationJob().getSimulation().getSolverTaskDescription().getTimeBounds();
    double dtime = tb.getEndingTime() - tb.getStartingTime();
    String timeSpecOption1 = "-oSteps";
    String timeSpecOption2 = "10";
    OutputTimeSpec outputTimeSpec = getSimulationJob().getSimulation().getSolverTaskDescription().getOutputTimeSpec();
    if (outputTimeSpec instanceof DefaultOutputTimeSpec) {
        DefaultOutputTimeSpec dots = (DefaultOutputTimeSpec) outputTimeSpec;
        int steps = dots.getKeepAtMost();
        timeSpecOption1 = "-oSteps";
        timeSpecOption2 = Integer.toString(steps);
    } else if (outputTimeSpec instanceof UniformOutputTimeSpec) {
        UniformOutputTimeSpec dots = (UniformOutputTimeSpec) outputTimeSpec;
        double steps = dtime / dots.getOutputTimeStep();
        timeSpecOption1 = "-oSteps";
        int stepsi = (int) Math.round(steps);
        timeSpecOption2 = Integer.toString(stepsi);
    } else {
        throw new RuntimeException("Unsupported output time spec class");
    }
    String[] baseCommands = { "-xml", inputFilename, "-o", outputFilename, "-sim", Double.toString(dtime), "-ss", speciesOutputFilename };
    ArrayList<String> cmds = new ArrayList<String>();
    cmds.add(executableName);
    Integer seed = nfsso.getRandomSeed();
    if (seed != null) {
        cmds.add("-seed");
        cmds.add(seed.toString());
    } else {
        long randomSeed = System.currentTimeMillis();
        randomSeed = randomSeed + simTask.getSimulationJob().getJobIndex();
        // multiply with a large prime number to spread numbers that are too close and in sequence
        randomSeed = randomSeed * 89611;
        Integer rs = (int) randomSeed;
        String str = rs.toString();
        if (str.startsWith("-")) {
            // NFSim wants a positive integer, for anything else is initializing with 0
            str = str.substring(1);
        }
        cmds.add("-seed");
        cmds.add(str);
    // PrintWriter writer;
    // try {
    // writer = new PrintWriter("c:\\TEMP\\aaa\\" + randomSeed + ".txt", "UTF-8");
    // writer.println(str);
    // writer.close();
    // } catch (FileNotFoundException | UnsupportedEncodingException e) {
    // // Auto-generated catch block
    // e.printStackTrace();
    // }
    }
    cmds.add("-vcell");
    cmds.addAll(new ArrayList<String>(Arrays.asList(baseCommands)));
    cmds.add(timeSpecOption1);
    cmds.add(timeSpecOption2);
    cmds.addAll(adv);
    if (bMessaging) {
        cmds.add("-v");
    }
    return cmds.toArray(new String[cmds.size()]);
}
Also used : NFsimSimulationOptions(cbit.vcell.solver.NFsimSimulationOptions) UniformOutputTimeSpec(cbit.vcell.solver.UniformOutputTimeSpec) ArrayList(java.util.ArrayList) IOException(java.io.IOException) TimeBounds(cbit.vcell.solver.TimeBounds) DefaultOutputTimeSpec(cbit.vcell.solver.DefaultOutputTimeSpec) UniformOutputTimeSpec(cbit.vcell.solver.UniformOutputTimeSpec) OutputTimeSpec(cbit.vcell.solver.OutputTimeSpec) DefaultOutputTimeSpec(cbit.vcell.solver.DefaultOutputTimeSpec)

Aggregations

OutputTimeSpec (cbit.vcell.solver.OutputTimeSpec)21 UniformOutputTimeSpec (cbit.vcell.solver.UniformOutputTimeSpec)18 DefaultOutputTimeSpec (cbit.vcell.solver.DefaultOutputTimeSpec)13 Simulation (cbit.vcell.solver.Simulation)9 ExplicitOutputTimeSpec (cbit.vcell.solver.ExplicitOutputTimeSpec)7 SolverTaskDescription (cbit.vcell.solver.SolverTaskDescription)7 TimeBounds (cbit.vcell.solver.TimeBounds)6 BioModel (cbit.vcell.biomodel.BioModel)5 SimulationContext (cbit.vcell.mapping.SimulationContext)5 PropertyVetoException (java.beans.PropertyVetoException)5 ArrayList (java.util.ArrayList)5 SpeciesContextSpec (cbit.vcell.mapping.SpeciesContextSpec)4 ExpressionException (cbit.vcell.parser.ExpressionException)4 SolverDescription (cbit.vcell.solver.SolverDescription)4 File (java.io.File)4 IOException (java.io.IOException)4 MathMappingCallbackTaskAdapter (cbit.vcell.mapping.MathMappingCallbackTaskAdapter)3 MathDescription (cbit.vcell.math.MathDescription)3 SubDomain (cbit.vcell.math.SubDomain)3 Expression (cbit.vcell.parser.Expression)3