Skip to content

Commit

Permalink
Michael Tutorials bug, race condition trap
Browse files Browse the repository at this point in the history
  • Loading branch information
danv61 committed Sep 30, 2024
1 parent c6d5501 commit a5c03be
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -237,19 +237,19 @@ public void readVCML(CommentStringTokenizer tokens) throws DataAccessException {
observableComputationOff = Boolean.parseBoolean(token);
} else if(token.equalsIgnoreCase(VCML.NFSimSimulationOptions_moleculeDistance)) {
token = tokens.nextToken();
moleculeDistance = new Integer(token);
moleculeDistance = Integer.parseInt(token);
} else if(token.equalsIgnoreCase(VCML.NFSimSimulationOptions_aggregateBookkeeping)) {
token = tokens.nextToken();
aggregateBookkeeping = Boolean.parseBoolean(token);
} else if(token.equalsIgnoreCase(VCML.NFSimSimulationOptions_maxMoleculesPerType)) {
token = tokens.nextToken();
maxMoleculesPerType = new Integer(token);
maxMoleculesPerType = Integer.parseInt(token);
} else if(token.equalsIgnoreCase(VCML.NFSimSimulationOptions_equilibrateTime)) {
token = tokens.nextToken();
equilibrateTime = new Integer(token);
equilibrateTime = Integer.parseInt(token);
} else if(token.equalsIgnoreCase(VCML.NFSimSimulationOptions_randomSeed)) {
token = tokens.nextToken();
randomSeed = new Integer(token);
randomSeed = Integer.parseInt(token);
} else if(token.equalsIgnoreCase(VCML.NFSimSimulationOptions_preventIntraBonds)) {
token = tokens.nextToken();
preventIntraBonds = Boolean.parseBoolean(token);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,8 @@ private void resetSolverTaskDescriptionIfNecessary(){
}
}
try {
setSolverDescription(SolverDescription.getDefaultSolverDescription(md));
SolverDescription sd = SolverDescription.getDefaultSolverDescription(md);
setSolverDescription(sd);
} catch(PropertyVetoException e){
throw new RuntimeException("failed to set SolverDescription for simulation " + getSimulation().getName(), e);
}
Expand Down
10 changes: 10 additions & 0 deletions vcell-core/src/main/java/cbit/vcell/xml/XmlReader.java
Original file line number Diff line number Diff line change
Expand Up @@ -4351,6 +4351,16 @@ private MembraneSubDomain getMembraneSubDomain(Element param, MathDescription ma
}
}

iterator = param.getChildren(XMLTags.LangevinParticleJumpProcessTag, vcNamespace).iterator();
while (iterator.hasNext()) {
Element tempelement = (Element) iterator.next();
try {
subDomain.addParticleJumpProcess(getParticleJumpProcess(tempelement, mathDesc));
} catch(MathException e){
throw new XmlParseException("A MathException was fired when adding a jump process to the MembraneSubDomain " + name, e);
}
}

iterator = param.getChildren(XMLTags.ParticlePropertiesTag, vcNamespace).iterator();
while (iterator.hasNext()) {
Element tempelement = (Element) iterator.next();
Expand Down
13 changes: 8 additions & 5 deletions vcell-core/src/main/java/org/vcell/model/ssld/SsldUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -578,7 +578,10 @@ public Mapping importPhysiologyFromSsld(SsldModel ssldModel) throws Exception {
m.put(ssldType, mc);
mt.addMolecularComponent(mc);
}
// TODO: if membrane molecule, anchor it to membrane
if(ssldMolecule.hasAnchorType()) { // if membrane molecule, anchor it to membrane
mt.addAnchor(membr);
mt.setAnchorAll(false);
}
m.put(ssldMolecule, mt);
model.getRbmModelContainer().addMolecularType(mt, false);
}
Expand Down Expand Up @@ -731,7 +734,7 @@ public Mapping importPhysiologyFromSsld(SsldModel ssldModel) throws Exception {
Structure structure = model.getStructure(location);

double ssldKf = ssldReaction.getRate();
Expression kf = new Expression(ssldKf);
Expression kf = new Expression(ssldKf); // the unit is s-1
ReactionRule reactionRule = new ReactionRule(model, ssldReaction.getName(), structure, reversible);
RbmKineticLaw.RateLawType rateLawType = RbmKineticLaw.RateLawType.MassAction;
reactionRule.setKineticLaw(new RbmKineticLaw(reactionRule, rateLawType));
Expand Down Expand Up @@ -766,7 +769,7 @@ public Mapping importPhysiologyFromSsld(SsldModel ssldModel) throws Exception {
Molecule ssldReactantTwo = ssldReaction.getMolecule(1);
String locationOne = ssldReactantOne.getLocation();
String locationTwo = ssldReactantTwo.getLocation();
Structure structure;
Structure structure; // if one reactant is on the membrane, the reaction's structure is the membrane as well
if(locationOne.contentEquals(SystemGeometry.MEMBRANE) || locationTwo.contentEquals(SystemGeometry.MEMBRANE)) {
// reaction is on the Membrane if at least one reactant is on the Membrane, the product stay on the membrane
// actually the membrane molecule must be anchored to the membrane
Expand All @@ -777,9 +780,9 @@ public Mapping importPhysiologyFromSsld(SsldModel ssldModel) throws Exception {
}

double ssldKf = ssldReaction.getkon();
Expression kf = new Expression(ssldKf);
Expression kf = new Expression(ssldKf); // unit is s-1.uM-1
double ssldKr = ssldReaction.getkoff();
Expression kr = new Expression(ssldKr);
Expression kr = new Expression(ssldKr); // unit is s-1
ReactionRule reactionRule = new ReactionRule(model, ssldReaction.getName(), structure, reversible);
RbmKineticLaw.RateLawType rateLawType = RbmKineticLaw.RateLawType.MassAction;
reactionRule.setKineticLaw(new RbmKineticLaw(reactionRule, rateLawType));
Expand Down

0 comments on commit a5c03be

Please sign in to comment.