### How can I restart a simulation from the last time step ?

137
views
0
4 months ago by
Is there a way to write a restart file so that the next simulation starts from the last time step. As for example the total MCS that I have to run is 24000. However, with the resource allocation, I can only run approximately 5000 steps continuously. How can I write a restart file so I can start from where I last ended the simulation. What needs to be changed in the number of steps ?

EDIT: How would I do it without the GUI just through the terminal? I was able to write restart file but am not sure how to specify to read from that particular directory when restarting the next stage of simulation. More specifically ,

./runScript.sh  -i  < input.cc3d> -o  < Output directory >   ...... < restart directory > ?
Community: CompuCell3D

3
3 months ago by
Have you tried following the manual?

If you want to restart it make sure that you remove serialization line from the .cc3d file - you can do it as shown in the manual or simply edit .ccd file so that

<Simulation version="3.6.1">
<XMLScript Type="XMLScript">Simulation/cellsort_2D.xml</XMLScript>
<SerializeSimulation AllowMultipleRestartDirectories="False" FileFormat="text" OutputFrequency="100"/>
<RestartSimulation RestartDirectory="restart"/>
</Simulation>​

goes to
<Simulation version="3.6.1">
<XMLScript Type="XMLScript">Simulation/cellsort_2D.xml</XMLScript>
<RestartSimulation RestartDirectory="restart"/>
</Simulation>​
when you remove the serialization line.

And if you want to run from command line you type

./runScript.command -i /Users/m/CC3DProjects/restart_01600/cellsort_2D.cc3d --noOutput

See attached file. Unpack it and change /Users/m/CC3DProjects/restart_01600/cellsort_2D.cc3d to the path where you unpacked the attached file. It has complete restart snapshot and it runs both from GUI and command line

File attached: restart_01600.zip (14.76 KB)

Thank you for the detailed description.
written 3 months ago by Mahua Roy
0
14 days ago by
File attached: Run2.zip (68.93 KB)

There has been a constant error with the restart file being not found even though it is present there. I looked at the way the serializer is specified in the restart_01600 and it is the same in Run2. I am not sure why I am still getting the same error. Any help from your side would be very helpful.

Thanks and regards,
Mahua

0
14 days ago by
What error are you getting? Could you post it here?

Your restart folder is empty. But I also noticed that you are not using scipy in your simulation but still importing it. On my machine it caused problems so I commented out any references to scipy
0
13 days ago by
I apologise for the empty file. Please find the attached restart file
File attached: restart_10000.zip (1.49 MB)

The error is attached here as well. It complains of the file not being there, when it is present

[Error: IOError: loadSBMLError Wrong constructed path: RoadRunnerPy could not find /Volumes/CompuCell/Pancreatic-cancer-CC3D/Tumor_growth_simulation2/Run1/Result_atpD_032/restart_10000/ in the filesystem
Traceback (most recent call last):
Line: 351 Col: 0 execfile(CompuCellSetup.simulationPaths.simulationPythonScriptName)
execfile(CompuCellSetup.simulationPaths.simulationPythonScriptName)
File: /Volumes/CompuCell/Pancreatic-cancer-CC3D/Tumor_growth_simulation2/Run1/Result_atpD_032/restart_10000/Simulation/TumorGrowth.py
Line: 1980 Col: 0 return mainLoopNewPlayer(sim, simthread, steppableRegistry, _screenUpdateFrequency)
Line: 644 Col: 0 sbmlSolver.loadSBML(_externalPath=self.sim.getBasePath()) # this call fully initializes SBML Solver by loading sbmlMode ( relative path stored in sbmlSolver.path and root dir is passed using self.sim.getBasePath())
sbmlSolver.loadSBML(_externalPath=self.sim.getBasePath()) # this call fully initializes SBML Solver by loading sbmlMode ( relative path stored in sbmlSolver.path and root dir is passed using self.sim.getBasePath())
Line: 109 Col: 0 'loadSBMLError Wrong constructed path: RoadRunnerPy could not find ' + self.absPath + ' in the filesystem')
'loadSBMLError Wrong constructed path: RoadRunnerPy could not find ' + self.absPath + ' in the filesystem')]

0
12 days ago by
I saw that too. and in this case it cannot find your sbml model mile (I believe in your case it might have xml extension). The serializer does not copy the sbml to the restart directory so you need to do it by hand. Simply place the sbml file in one of the restart folders you are attempting to run (in the same hierarchical location as in the original simulation i.e. inside Simulation subfolder)

Let me know if this works
0
12 days ago by
I tried copying it all locations but still the error remains the same.
'loadSBMLError Wrong constructed path: RoadRunnerPy could not find ' + self.absPath + ' in the filesystem')

I never received the error during the initial simulation.
0
10 days ago by
so it looks like a bug. I will rerun some other simulations with SBML serializations and see what's going on. Essentially many cells that have SBML solver attached are missing the path to the sbml model. This is strange. Maybe those ar ethe new cells that got created . I will need to check that
0
10 days ago by
BTW is there any chance you could try the same with CC3D 3.7.7. I know we have fixed few bugs related to copying SBML solvers during Mitosis and I wonder if this is one of those bugs that we are seeing now
0
9 days ago by
Thanks so much for looking into it. I really appreciate your help. I tried with 3.7.7 version as you suggested. However, it seems to be the same error. I paste it below :

**********

File "/staging/mr2/mahuaroy/CC3D_3.7.7_RHEL/player5/CompuCellPythonSimulationCML.py", line 363, in <module>

execfile(CompuCellSetup.simulationPaths.simulationPythonScriptName)

File "/staging/mr2/mahuaroy/Tumor_growth_simulation2/test/restart_10000/Simulation/TumorGrowth.py", line 83, in <module>

File "/staging/mr2/mahuaroy/CC3D_3.7.7_RHEL/pythonSetupScripts/CompuCellSetup.py", line 2072, in mainLoop

File "/staging/mr2/mahuaroy/CC3D_3.7.7_RHEL/pythonSetupScripts/CompuCellSetup.py", line 1860, in mainLoopCML

File "/staging/mr2/mahuaroy/CC3D_3.7.7_RHEL/pythonSetupScripts/RestartManager.py", line 340, in loadRestartFiles

File "/staging/mr2/mahuaroy/CC3D_3.7.7_RHEL/pythonSetupScripts/RestartManager.py", line 644, in loadSBMLSolvers

sbmlSolver.loadSBML(_externalPath=self.sim.getBasePath()) # this call fully initializes SBML Solver by loading sbmlMode ( relative path stored in sbmlSolver.path and root dir is passed using self.sim.getBasePath())

'loadSBMLError Wrong constructed path: RoadRunnerPy could not find ' + self.absPath + ' in the filesystem')

IOError: loadSBMLError Wrong constructed path: RoadRunnerPy could not find /staging/mr2/mahuaroy/Tumor_growth_simulation2/test/restart_10000/ in the filesystem

/staging/mr2/mahuaroy/CC3D_3.7.7_RHEL/runScript.sh: line 39: 49004 Segmentation fault      ${PYTHON_EXEC}${PREFIX_CC3D}/player5/CompuCellPythonSimulationCML.py $* --currentDir=${current_directory}

0
9 days ago by
I placed the SBML (xml) file in the same location as specified in the Steppables file - in the Simulation folder.
0
5 days ago by
The problem was not in the restart function but in the copySBML's function that you used in the Mitosis Steppeble (your Mitosis code was correct BTW). I fixed that along with addSBMLtoCell function and now the serialization works.

Few things though:

1. The way you initialized FPP links is not entirely correct because you end up with infinity values for lambda D after few very few MCS - you keep multiplying previous value of lambdaD by 20 each MCS. As you can tell this will led to inf values - I fixed it see lines 125-130 of your Steppables file (here is your new simulation File attached: TumorGrowth_restart.tar.gz (32.97 KB))

2. The restart file after 1000 MCS is here File attached: TumorGrowth_restart_1000.tar.gz (1.11 MB)

3. Finally to get your code working you need to patch the installation of CD3D . All you need to do is to copy the attached SBMLHelper.py (File attached: SBMLSolverHelper.py (28.46 KB)

) to <your cc3d installation directory>/pythonSetupScripts , replacing old version of SBMLHelper.py

We will be releasing new version of CC3D soon and this bug fix will be included but for now you need to do this manual step.

Thanks for reporting this bug. It helped us to improve CC3D

Let us know if you have any questions
0
4 days ago by
Thank so much for your time to look into the script and fix the issue. I copied the SBMLSolverHelper.py into the installation directory. Currently the restart files work. I will run on the Linux version of the CompuCell and will update you if there are any issues.

Thanks so much again.