-
Notifications
You must be signed in to change notification settings - Fork 28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comparing potential energy of bond #42
Comparing potential energy of bond #42
Conversation
…//github.com/rishiloyola/lab-interactives-site into comparing-dipole-dipole-to-london-dispersion
Here's some feedback on the coding:
Sam may have some other suggestions. |
"set('countPotential', 5+3*Math.pow(distance,0.5));", | ||
"});", | ||
"});" | ||
], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All scripts should be indented as if they were being written in a regular editor. You can see this, for example with the onLoad scripts in your mixing-liquids interactive. It makes it much easier to read.
Honestly, unless a feature such as the ability to use scripts from external files that I suggested a few weeks ago gets implemented, there isn't really a practical way to "share" code between models. The one way to do this would be to have a single model, instead of four different models. We have a number of models like this, for example "non-bonding" allows a user to change the elements, and it simply updates the atom properties. It's hard for me to judge at this point whether it would be worth re-writing this interactive to use one single model. |
It looks like parameters are shared between models, so I was wondering if code to calculate might be tied to a model parameter. In each model there could be something like
in the onLoad function. Then that function could update some parameter (ex. updatePEFlag) that has an "onChange" attribute which contains the code for calculating the PE. @sfentress Do you think something like that would work? |
[#95366760]
[#95366760]
I did necessary changes in coding. You can now review it. |
[#95366760]
[#95366760]
[#95366760]
[#95366760]
[#95366760]
[#95366760]
[#95366760]
The behavior of the interactive seems pretty good now. I'm going to ask the Interactions team for feedback. However, I am noticing that the longer it runs the slower the dragging behavior is. (Or perhaps the more I drag the slower it gets.) I think this is because you have embedded a callEvery inside of an onDrag. Try removing the callEvery call. (This will also fix an indentation problem you have, as the callEvery function and its contents should be indented to show it is contained within the onDrag). |
[#95366760]
[#95366760]
[#95366760]
[#95366760]
[#95366760]
[#95366760]
[#95366760]
[##95366760]
I made some additional whitespace changes. @rishiloyola please take a look for future interactives. |
…e-to-london-dispersion Comparing potential energy of bond [##95366760]
No description provided.