What's going wrong?
Reactant Ne (here called Species 4) throws errors no matter how it's involved in rate laws. Included an image with debug output. The problem is sympy thinks "Ne" is the "not equals" operand, and doesn't understand to parse it as a regular variable instead of as a type. Very glad for the debug output message or else this would've been a nightmare to diagnose!
Steps to Reproduce
No response
Desired Behavior
No response
Additional
This is fixable if we skip over certain names in store.tsx. When creating a node and generating its ID, run a function to check if the name ID is valid for SymPy. Currently, that conversion happens in src\react-app\App.tsx in AddSpeciesBox():
// Handle adding a node
const onAddNode = (type: 'molecule' | 'enzyme') => {
const id = 'N' + numberToLetters(nextId++);
const label = 'Species ' + String(nextId - 1);
const color = type === 'molecule' ? NODE_COLORS[0] : NODE_COLORS[1];
const screenCenter = screenToFlowPosition({ x: window.innerWidth / 2, y: window.innerHeight / 2}); // Center of the screen
// We got screen center, now we need to offset, otherwise top left corner of node would be in center.
const position = { x: screenCenter.x - 80, y: screenCenter.y - 50 }
addNode(id, label, color, type, position);
}
that const id = 'N' + numberToLetters(nextId++); is the problematic line.
Suggested fix:
- Start by moving nextID to
src\react-app\stores\store.ts, alongside incrementID, and createNodeID functions.
incrementID just increases the store's nextId plus one.
createNodeID would pretty much do the same thing as the problematic line, but it would ALSO check against a list of known "problematic" words, like ['Ne', 'Null', 'None'] (though we would never get the words Null or None as we only generate node ids with letters a-j.
- While the current id is in that word of known problematic words, increase the ID by one.
Don't worry on making the list of problematic words super extensive, we can expand on this later down the road!
We need to somehow find a list of all forbidden variable names in SymPy.
What's going wrong?
Reactant
Ne(here called Species 4) throws errors no matter how it's involved in rate laws. Included an image with debug output. The problem is sympy thinks "Ne" is the "not equals" operand, and doesn't understand to parse it as a regular variable instead of as a type. Very glad for the debug output message or else this would've been a nightmare to diagnose!Steps to Reproduce
No response
Desired Behavior
No response
Additional
This is fixable if we skip over certain names in
store.tsx. When creating a node and generating its ID, run a function to check if the name ID is valid for SymPy. Currently, that conversion happens insrc\react-app\App.tsxinAddSpeciesBox():that
const id = 'N' + numberToLetters(nextId++);is the problematic line.Suggested fix:
src\react-app\stores\store.ts, alongsideincrementID, andcreateNodeIDfunctions.incrementIDjust increases the store's nextId plus one.createNodeIDwould pretty much do the same thing as the problematic line, but it would ALSO check against a list of known "problematic" words, like['Ne', 'Null', 'None'](though we would never get the words Null or None as we only generate node ids with letters a-j.Don't worry on making the list of problematic words super extensive, we can expand on this later down the road!
We need to somehow find a list of all forbidden variable names in SymPy.