Skip to content

Commit

Permalink
added test for gibson solver
Browse files Browse the repository at this point in the history
  • Loading branch information
jcschaff committed Aug 21, 2024
1 parent e7e29ba commit 0b91c0a
Show file tree
Hide file tree
Showing 3 changed files with 315 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public static void setProperties() throws MalformedURLException
System.setProperty(PropertyLoader.simulationPreprocessor, "JavaPreprocessor64");
}

public String createScriptForNativeSolvers(String simTaskResourcePath, String solverExeName, String inputFileSuffix, String outputFileSuffix, String JOB_NAME) throws IOException, XmlParseException, ExpressionException {
public String createScriptForNativeSolvers(String simTaskResourcePath, String solverExeName, String subcommand, String inputFileSuffix, String outputFileSuffix, String JOB_NAME) throws IOException, XmlParseException, ExpressionException {

SimulationTask simTask = XmlHelper.XMLToSimTask(readTextFileFromResource(simTaskResourcePath));
KeyValue simKey = simTask.getSimKey();
Expand Down Expand Up @@ -94,9 +94,14 @@ public String createScriptForNativeSolvers(String simTaskResourcePath, String so
String outputFilePath = "/share/apps/vcell3/users/schaff/SimID_"+simKey+"_0_."+outputFileSuffix;
final ExecutableCommand solverCmd;
if (outputFileSuffix == null) {
new ExecutableCommand(libraryPath, new String[0]);
solverCmd = new ExecutableCommand(libraryPath, command, inputFilePath, "-tid", "0");
} else {
solverCmd = new ExecutableCommand(libraryPath, command, inputFilePath, outputFilePath, "-tid", "0");
if (subcommand != null) {
solverCmd = new ExecutableCommand(libraryPath, command, subcommand, inputFilePath, outputFilePath, "-tid", "0");
} else {
solverCmd = new ExecutableCommand(libraryPath, command, inputFilePath, outputFilePath, "-tid", "0");
}
}

// postprocessor
Expand Down Expand Up @@ -173,7 +178,7 @@ public String createScriptForJavaSolvers(String simTaskResourcePath, String JOB_
public void testSimJobScriptFiniteVolume() throws IOException, XmlParseException, ExpressionException {
String simTaskResourcePath = "slurm_fixtures/finite_volume/SimID_274514696_0__0.simtask.xml";
String JOB_NAME = "V_REL_274514696_0_0";
String slurmScript = createScriptForNativeSolvers(simTaskResourcePath, "FiniteVolume_x64", "fvinput", null, JOB_NAME);
String slurmScript = createScriptForNativeSolvers(simTaskResourcePath, "FiniteVolume_x64", null,"fvinput", null, JOB_NAME);
String expectedSlurmScript = readTextFileFromResource("slurm_fixtures/finite_volume/V_REL_274514696_0_0.slurm.sub");
Assertions.assertEquals(expectedSlurmScript, slurmScript);
}
Expand All @@ -182,7 +187,7 @@ public void testSimJobScriptFiniteVolume() throws IOException, XmlParseException
public void testSimJobScriptSmoldyn() throws IOException, XmlParseException, ExpressionException {
String simTaskResourcePath = "slurm_fixtures/smoldyn/SimID_274630052_0__0.simtask.xml";
String JOB_NAME = "V_REL_274630052_0_0";
String slurmScript = createScriptForNativeSolvers(simTaskResourcePath, "smoldyn_x64", "smoldynInput", null, JOB_NAME);
String slurmScript = createScriptForNativeSolvers(simTaskResourcePath, "smoldyn_x64", null, "smoldynInput", null, JOB_NAME);
String expectedSlurmScript = readTextFileFromResource("slurm_fixtures/smoldyn/V_REL_274630052_0_0.slurm.sub");
Assertions.assertEquals(expectedSlurmScript, slurmScript);
}
Expand All @@ -191,11 +196,20 @@ public void testSimJobScriptSmoldyn() throws IOException, XmlParseException, Exp
public void testSimJobScriptCVODE() throws IOException, XmlParseException, ExpressionException {
String simTaskResourcePath = "slurm_fixtures/cvode/SimID_274630682_0__0.simtask.xml";
String JOB_NAME = "V_REL_274630682_0_0";
String slurmScript = createScriptForNativeSolvers(simTaskResourcePath, "SundialsSolverStandalone_x64", "cvodeInput", "ida", JOB_NAME);
String slurmScript = createScriptForNativeSolvers(simTaskResourcePath, "SundialsSolverStandalone_x64", null, "cvodeInput", "ida", JOB_NAME);
String expectedSlurmScript = readTextFileFromResource("slurm_fixtures/cvode/V_REL_274630682_0_0.slurm.sub");
Assertions.assertEquals(expectedSlurmScript, slurmScript);
}

@Test
public void testSimJobScriptGibson() throws IOException, XmlParseException, ExpressionException {
String simTaskResourcePath = "slurm_fixtures/gibson/SimID_274635122_0__0.simtask.xml";
String JOB_NAME = "V_REL_274635122_0_0";
String slurmScript = createScriptForNativeSolvers(simTaskResourcePath, "VCellStoch_x64", "gibson", "stochInput", "ida", JOB_NAME);
String expectedSlurmScript = readTextFileFromResource("slurm_fixtures/gibson/V_REL_274635122_0_0.slurm.sub");
Assertions.assertEquals(expectedSlurmScript, slurmScript);
}

@Test
public void testSimJobScriptRK45() throws IOException, XmlParseException, ExpressionException {
String simTaskResourcePath = "slurm_fixtures/runge_kutta_fehlberg/SimID_274631114_0__0.simtask.xml";
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
<SimulationTask xmlns="http://sourceforge.net/projects/vcell/vcml" TaskId="0" JobIndex="0" isPowerUser="false">
<MathDescription Name="Copy of 3D pde_generated">
<Annotation>cloned from 'Copy of 3D pde_generated' owned by user frm
cloned from 'Copy of 3D pde_generated' owned by user anu
cloned from 'Copy of 3D pde_generated' owned by user schaff
cloned from 'Copy of 3D pde_generated' owned by user les</Annotation>
<Constant Name="_F_">96485.3321</Constant>
<Constant Name="_F_nmol_">9.64853321E-5</Constant>
<Constant Name="_N_pmol_">6.02214179E11</Constant>
<Constant Name="_PI_">3.141592653589793</Constant>
<Constant Name="_R_">8314.46261815</Constant>
<Constant Name="_T_">300.0</Constant>
<Constant Name="C_cyt_Count_initCount">0.0</Constant>
<Constant Name="Kf">2.0</Constant>
<Constant Name="kfl">2.0</Constant>
<Constant Name="KMOLE">0.001660538783162726</Constant>
<Constant Name="Kr">1000.0</Constant>
<Constant Name="netValence">1.0</Constant>
<Constant Name="Ran_cyt_Count_initCount">0.0</Constant>
<Constant Name="RanC_cyt_Count_initCount">0.0</Constant>
<Constant Name="RanC_nuc_Count_initCount">100.0</Constant>
<Constant Name="s2_Count_initCount">0.0</Constant>
<Constant Name="Size_cyt">14891.899581611733</Constant>
<Constant Name="Size_EC">124712.10435961554</Constant>
<Constant Name="Size_nm">1406.7733692487282</Constant>
<Constant Name="Size_nuc">3697.013658772733</Constant>
<Constant Name="Size_pm">4738.640600365477</Constant>
<Constant Name="UnitFactor_molecules_uM_neg_1_um_neg_3">(1.0 * pow(KMOLE, - 1.0))</Constant>
<Constant Name="UnitFactor_uM_um3_molecules_neg_1">(1.0 * pow(KMOLE,1.0))</Constant>
<Constant Name="Voltage_nm">0.0</Constant>
<Constant Name="Voltage_pm">0.0</Constant>
<StochasticVolumeVariable Name="C_cyt_Count" />
<StochasticVolumeVariable Name="Ran_cyt_Count" />
<StochasticVolumeVariable Name="RanC_cyt_Count" />
<StochasticVolumeVariable Name="RanC_nuc_Count" />
<StochasticVolumeVariable Name="s2_Count" />
<Function Name="C_cyt" Domain="Compartment">((C_cyt_Count * UnitFactor_uM_um3_molecules_neg_1) / Size_cyt)</Function>
<Function Name="J_flux0" Domain="Compartment">(kfl * (RanC_cyt - RanC_nuc))</Function>
<Function Name="J_r0" Domain="Compartment">((Kf * RanC_cyt) - ((Kr * Ran_cyt) * C_cyt))</Function>
<Function Name="P_flux0_probabilityRate" Domain="Compartment">(UnitFactor_molecules_uM_neg_1_um_neg_3 * kfl * Size_nm * RanC_cyt)</Function>
<Function Name="P_flux0_reverse_probabilityRate" Domain="Compartment">(kfl * UnitFactor_molecules_uM_neg_1_um_neg_3 * Size_nm * RanC_nuc)</Function>
<Function Name="P_r0_probabilityRate" Domain="Compartment">(Kf * RanC_cyt_Count * UnitFactor_molecules_uM_neg_1_um_neg_3 * UnitFactor_uM_um3_molecules_neg_1)</Function>
<Function Name="P_r0_reverse_probabilityRate" Domain="Compartment">(Kr * Ran_cyt_Count * C_cyt_Count * UnitFactor_molecules_uM_neg_1_um_neg_3 * UnitFactor_uM_um3_molecules_neg_1 * UnitFactor_uM_um3_molecules_neg_1 / Size_cyt)</Function>
<Function Name="Ran_cyt" Domain="Compartment">((Ran_cyt_Count * UnitFactor_uM_um3_molecules_neg_1) / Size_cyt)</Function>
<Function Name="RanC_cyt" Domain="Compartment">((RanC_cyt_Count * UnitFactor_uM_um3_molecules_neg_1) / Size_cyt)</Function>
<Function Name="RanC_nuc" Domain="Compartment">((RanC_nuc_Count * UnitFactor_uM_um3_molecules_neg_1) / Size_nuc)</Function>
<Function Name="s2" Domain="Compartment">(s2_Count / Size_pm)</Function>
<CompartmentSubDomain Name="Compartment">
<BoundaryType Boundary="Xm" Type="Value" />
<BoundaryType Boundary="Xp" Type="Value" />
<BoundaryType Boundary="Ym" Type="Value" />
<BoundaryType Boundary="Yp" Type="Value" />
<BoundaryType Boundary="Zm" Type="Value" />
<BoundaryType Boundary="Zp" Type="Value" />
<VariableInitialCount Name="RanC_cyt_Count">RanC_cyt_Count_initCount</VariableInitialCount>
<VariableInitialCount Name="Ran_cyt_Count">Ran_cyt_Count_initCount</VariableInitialCount>
<VariableInitialCount Name="C_cyt_Count">C_cyt_Count_initCount</VariableInitialCount>
<VariableInitialCount Name="RanC_nuc_Count">RanC_nuc_Count_initCount</VariableInitialCount>
<VariableInitialCount Name="s2_Count">s2_Count_initCount</VariableInitialCount>
<JumpProcess Name="r0">
<ProbabilityRate>P_r0_probabilityRate</ProbabilityRate>
<Effect VarName="RanC_cyt_Count" Operation="inc">-1.0</Effect>
<Effect VarName="Ran_cyt_Count" Operation="inc">1.0</Effect>
<Effect VarName="C_cyt_Count" Operation="inc">1.0</Effect>
</JumpProcess>
<JumpProcess Name="r0_reverse">
<ProbabilityRate>P_r0_reverse_probabilityRate</ProbabilityRate>
<Effect VarName="RanC_cyt_Count" Operation="inc">1.0</Effect>
<Effect VarName="Ran_cyt_Count" Operation="inc">-1.0</Effect>
<Effect VarName="C_cyt_Count" Operation="inc">-1.0</Effect>
</JumpProcess>
<JumpProcess Name="flux0">
<ProbabilityRate>P_flux0_probabilityRate</ProbabilityRate>
<Effect VarName="RanC_cyt_Count" Operation="inc">-1.0</Effect>
<Effect VarName="RanC_nuc_Count" Operation="inc">1.0</Effect>
</JumpProcess>
<JumpProcess Name="flux0_reverse">
<ProbabilityRate>P_flux0_reverse_probabilityRate</ProbabilityRate>
<Effect VarName="RanC_cyt_Count" Operation="inc">1.0</Effect>
<Effect VarName="RanC_nuc_Count" Operation="inc">-1.0</Effect>
</JumpProcess>
</CompartmentSubDomain>
<Version Name="Copy of 3D pde_generated" KeyValue="252546354" BranchId="84086541" Archived="0" Date="08-Feb-2023 01:54:34" FromVersionable="false">
<Owner Name="schaff" Identifier="17" />
<GroupAccess Type="1" />
<Annotation>cloned from 'Copy of 3D pde_generated' owned by user frm
cloned from 'Copy of 3D pde_generated' owned by user anu
cloned from 'Copy of 3D pde_generated' owned by user schaff
cloned from 'Copy of 3D pde_generated' owned by user les</Annotation>
</Version>
</MathDescription>
<Simulation Name="Copy of Gibson">
<Annotation>cloned from 'Copy of Gibson' owned by user frm
cloned from 'Gibson' owned by user anu
cloned from 'Gibson' owned by user schaff
cloned from 'Simulation0' owned by user les</Annotation>
<SolverTaskDescription TaskType="Unsteady" UseSymbolicJacobian="false" Solver="Gibson (Next Reaction Stochastic Method)">
<TimeBound StartTime="0.0" EndTime="10.0" />
<TimeStep DefaultTime="0.1" MinTime="1.0E-8" MaxTime="1.0" />
<ErrorTolerance Absolut="1.0E-9" Relative="1.0E-9" />
<StochSimOptions UseCustomSeed="false" NumberOfTrial="1" Histogram="false" />
<OutputOptions OutputTimeStep="0.1" />
<NumberProcessors>1</NumberProcessors>
</SolverTaskDescription>
<MathOverrides />
<Version Name="Copy of Gibson" KeyValue="274635122" BranchId="274635123" Archived="0" Date="21-Aug-2024 22:12:11" FromVersionable="false">
<Owner Name="schaff" Identifier="17" />
<GroupAccess Type="1" />
<Annotation>cloned from 'Copy of Gibson' owned by user frm
cloned from 'Gibson' owned by user anu
cloned from 'Gibson' owned by user schaff
cloned from 'Simulation0' owned by user les</Annotation>
</Version>
</Simulation>
<Geometry Name="nonspatial1435481798" Dimension="0">
<Annotation>cloned from 'nonspatial1435481798' owned by user frm
cloned from 'nonspatial660203233' owned by user anu
cloned from 'nonspatial637508148' owned by user schaff
cloned from 'nonspatial608887770' owned by user les</Annotation>
<Extent X="10.0" Y="10.0" Z="10.0" />
<Origin X="0.0" Y="0.0" Z="0.0" />
<SubVolume Name="Compartment" Handle="0" Type="Compartmental" KeyValue="252545856" />
<Version Name="nonspatial1435481798" KeyValue="252545853" BranchId="84086514" Archived="0" Date="08-Feb-2023 01:53:13" FromVersionable="false">
<Owner Name="schaff" Identifier="17" />
<GroupAccess Type="1" />
<Annotation>cloned from 'nonspatial1435481798' owned by user frm
cloned from 'nonspatial660203233' owned by user anu
cloned from 'nonspatial637508148' owned by user schaff
cloned from 'nonspatial608887770' owned by user les</Annotation>
</Version>
</Geometry>
</SimulationTask>
Loading

0 comments on commit 0b91c0a

Please sign in to comment.