Skip to content

MCR-ALS with kinetic constraints with "A -> B" reaction #722

Answered by atravert
liuchzzyy asked this question in Q&A
Discussion options

You must be logged in to vote

Hi Cheng,

here are the reasons of the error:
1/ reactions should be a list, a tuple or a dict, but ("A -> B") is a string so, the MassActionKinetics instance contains 0 reaction and so expects 0 rate constant
2/ arrhenius (your k0 variable) is a 1D array of size 2, hence you provide 2 rate constants.

The following script should work:

import numpy as np
import spectrochempy as scp

# kinetic model 
reactions = ("A -> B",)  # note the coma: this is now a tuple of size 1    
species_concentrations = {"A": 0.69, "B": 0.31}
k0 = np.array([0.5])  # as we have a single reaction, we must use a single rate constant. 
kin = scp.ActionMassKinetics(reactions, species_concentrations, k0)

# integrate …

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@atravert
Comment options

@liuchzzyy
Comment options

Answer selected by liuchzzyy
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants