@@ -1201,12 +1201,14 @@ public void gatherIssues(IssueContext issueContext, List<Issue> issueList, React
12011201 if (scCandidate == null || scCandidate .getSpeciesPattern () == null ) {
12021202 continue ;
12031203 }
1204+ // we may have just one spCandidate wif the reaction is A + A -> A.A
12041205 SpeciesPattern spCandidate = scCandidate .getSpeciesPattern ();
12051206 MolecularTypePattern mtpCandidate = spCandidate .getMolecularTypePatterns ().get (0 );
12061207 MolecularType mtCandidate = mtpCandidate .getMolecularType ();
12071208 if (mtOursOne == mtCandidate ) {
12081209 siteAttributesMapOne = scs .getSiteAttributesMap ();
1209- } else if (mtOursTwo == mtCandidate ) {
1210+ }
1211+ if (mtOursTwo == mtCandidate ) {
12101212 siteAttributesMapTwo = scs .getSiteAttributesMap ();
12111213 }
12121214 }
@@ -1225,13 +1227,14 @@ public void gatherIssues(IssueContext issueContext, List<Issue> issueList, React
12251227 }
12261228 }
12271229 //
1228- // TODO: check logic here, sometimes siteAttributesMapTwo is null (issue #977)
1229- // temp fix, we check for non-null siteAttributesMapTwo
1230- // hard to catch, it may be that the reactant or the product end up in an inconsistent state
1231- // after using the reaction visual editor in the physiology (the state of a bonding site is possibly inconsistent)
1232- //
1233- if (sasOne != null && sasTwo != null && siteAttributesMapTwo != null ) {
1234-
1230+ // with previous logic, siteAttributesMapTwo could have been null (issue #977)
1231+ // happened when the reaction was between 2 molecules of the same type A + A -> A.A
1232+ // the temp fixwas: we check for non-null siteAttributesMapTwo
1233+ // as from feb 24, 2025 this was fixed and siteAttributesMapTwo should never be null
1234+ if (siteAttributesMapTwo == null ) {
1235+ throw new RuntimeException ("Unexpected null value for siteAttributesMapTwo" );
1236+ }
1237+ if (sasOne != null && sasTwo != null ) {
12351238 for (Map .Entry <MolecularComponentPattern , SiteAttributesSpec > entry : siteAttributesMapTwo .entrySet ()) {
12361239 MolecularComponentPattern mcpCandidate = entry .getKey ();
12371240 if (MolecularComponentPattern .BondType .None != mcpCandidate .getBondType ()) {
@@ -1250,12 +1253,12 @@ public void gatherIssues(IssueContext issueContext, List<Issue> issueList, React
12501253 issueList .add (new Issue (r , issueContext , IssueCategory .Identifiers , msg , tip , Issue .Severity .ERROR ));
12511254 return ;
12521255 }
1253- // if(checkOnRate(sasOne, sasTwo) == false) { // rate doesn't check as acceptable
1254- // String msg = "The simulation Kon is too large (I .e. exceeds the diffusion limited rate) for this reaction.";
1255- // String tip = "Please consider reducing Kon or increasing the Radius or D of the participating Site Types.";
1256- // issueList.add(new Issue(r, issueContext, IssueCategory.Identifiers, msg, tip, Issue.Severity.ERROR ));
1257- // return;
1258- // }
1256+ if (checkOnRate (sasOne , sasTwo ) == false ) { // rate doesn't check as acceptable
1257+ String msg = "The forward rate Kf is too large (i .e. exceeds the diffusion limited rate) for this reaction rule ." ;
1258+ String tip = "Please consider reducing Kon or increasing the Radius or D of the participating Site Types." ;
1259+ issueList .add (new Issue (r , issueContext , IssueCategory .Identifiers , msg , tip , Issue .Severity .WARNING ));
1260+ return ;
1261+ }
12591262 }
12601263 // binding reactions must be reversible
12611264 if (!reactionRule .isReversible ()) {
@@ -1321,6 +1324,11 @@ public void gatherIssues(IssueContext issueContext, List<Issue> issueList, React
13211324 */
13221325 public boolean checkOnRate (SiteAttributesSpec sasOne , SiteAttributesSpec sasTwo ) {
13231326
1327+ // set of acceptable numbers (marginally) for A + A -> A.A are:
1328+ // Kon = 40 s-1uM-1
1329+ // site radius 1nm
1330+ // site diffusion rate 1 um2s-1
1331+
13241332 double R = sasOne .computeReactionRadius () + sasTwo .computeReactionRadius (); // nm
13251333 double D = sasOne .getDiffusionRate () + sasTwo .getDiffusionRate ();
13261334
0 commit comments