ckwatson / kernel

Does the math.
GNU General Public License v3.0
0 stars 0 forks source link

True model concentration profile is truncated but not user model profile #2

Closed ngraymon closed 8 years ago

ngraymon commented 8 years ago

Creating a new puzzle H2 <-> H + H K2 <-> K + K H + K <-> HK

With the following energies H2 - 0.0 H - 203300.0 K2 - 0.0 K 120000.0 HK 15000.0

Using the following plotting values H2 <-> H + H K2 <-> K + K H + K <-> HK H2 + K2 <-> HK + HK

K2 = 35 mol 273.15K H2 = 50 mol 273.15K

We can see that the user model profile extends far beyond the true model profile: plot_capture.pdf

The resolution on the plots suffer and makes it harder to evaluate the accuracy of a simulation because the concentration profiles for the user/true model are not of the same length.

Also I was able to use a elementary reaction in the user model that wasn't present in the true model. Is this SOP? I thought the user was restricted to only using elementary reactions from the true model?

tslmy commented 8 years ago

We can see that the user model profile extends far beyond the true model profile...

This is because the User Model Profiles took much longer to stabilize than the True Model Profile. The program cuts these two sets of Model Profiles separately, without regards of how the other is cut. I added some code in the plotter.py so that it will cut the longer curves to fit the length of the shorter ones. I didn't implement the code this way before because it may cause the curves of the slower-stabilized Model Profile to be truncated right at some characteristic region. Since now it looks that coherence in length is more important, we may as well do it.

I was able to use a elementary reaction in the user model that wasn't present in the true model...

Yes, it was on purpose. I think the user should be allowed to input whatever he/she thinks is right. The user is already well-directed with our fixed list of available species and mass balance checker. Therefore, if the user is provided extra hints like "hey this elem. rxn. does not exist in the correct solution ;)", the puzzles might be too easy to solve: by iterating all possible elem. rxn.s that does not result in a red-background label, one can figure out the correct solution even before hitting the plot button.

This is just my opinion. How do you think about this?

ngraymon commented 8 years ago

Ah, some very good points!

This is because the User Model Profiles took much longer to stabilize than the True Model Profile.

If I understand correctly: The True Model reached a stable Keq faster than the User Model and therefore the integrator ceased operation.

The goal is to make the evaluation of the reaction profile easier for the user. Under the assumption that equivalently long reaction profiles are the optimal case for evaluation, it seems to me there are two possible options:

  1. We truncate the User Model profile to match the True Model profile. The disadvantage of this option, as you pointed out, is data loss:

    it may cause the curves of the slower-stabilized Model Profile to be truncated right at some characteristic region.

  2. We extend the True Model to match the length of the User Model profile A very simple implementation would be to replicate the final concentration values of the True Model profile. Fancier methods might involve taking the final concentration values and adding a small amount of error to them (<1%) to simulate small perturbations that are expected in the plateau.

What do you think about method 2? My proposed change: We replace lines 74-76 With

if(true_data.shape[1] < user_data.shape[1]):                    # if the trueDataSet is shorter, extend it to match the length of the userDataSet
    length_difference = user_data.shape[1] - true_data.shape[1]
    true_data = np.append(true_data, np.repeat(true_data[:,-1].reshape((6,1)), length_difference, axis=1), axis=1)
elif(true_data.shape[1] > user_data.shape[1]):
    true_data = true_data[:,:user_data.shape[1]]                # if the trueDataSet is longer, truncate it to match the length of the userDataSet 

In terms of the elementary reaction: I confused the ability to create an elementary reaction that was not in the True Model with the restriction on reagents and their pre-equilibration reactions. You are correct, I agree with your assessment.

tslmy commented 8 years ago

Agreed.

Yours, Mingyang Li

On September 20, 2016 at 6:58:40 AM, Neil (notifications@github.commailto:notifications@github.com) wrote:

  1. We extend the True Model to match the length of the User Model profile A very simple implementation would be to replicate the final concentration values of the True Model profile. Fancier methods might involve taking the final concentration values and adding a small amount of error to them (<1%) to simulate small perturbations that are expected in the plateau.