Skip to content

Instantly share code, notes, and snippets.

@knowuh
Forked from stepheneb/gist:4694048
Last active December 12, 2015 01:49
Show Gist options
  • Save knowuh/4694067 to your computer and use it in GitHub Desktop.
Save knowuh/4694067 to your computer and use it in GitHub Desktop.
{
"title": "What is Pressure?",
"publicationStatus": "public",
"subtitle": "Explore how gas exerts pressure on the sides of a container.",
"about": "[\"Gases have no definite shape or volume. When they are constrained to a container, we can measure the pressure they exert on the container walls.\", \"The model shows the inside (yellow atoms) and outside (pink atoms) of a balloon. The green barrier represents the wall of the balloon.\", \"Add atoms to the balloon (the number of atoms in the balloon is shown on the slider). What happens to the balloon wall when atoms are added?\"]",
"components": [
{
"type": "checkbox",
"id": "show-velocity",
"text": "Show Velocity",
"property": "showVelocityVectors"
},
{
"type": "button",
"id": "add-atom",
"text": "Add an Atom to the Balloon",
"action": [
"var elemNum = 3;",
"var obsX = getObstacleProperties(0).x;",
"var atomSigma = getElementProperties(elemNum).sigma;",
"var avgVx = 0;",
"var avgVy = 0;",
"var atomNum = getNumberOfAtoms();",
"for (var i = 0; i < atomNum; i++) {",
" avgVx += Math.abs(getAtomProperties(i).vx);",
" avgVy += Math.abs(getAtomProperties(i).vy);",
"}",
"avgVx /= atomNum;",
"avgVy /= atomNum;",
"addAtom({ element: elemNum, x: (obsX - atomSigma) * Math.random() , y: get('height') * Math.random(), vx: avgVx, vy: avgVy});"
]
},
{
"type": "button",
"id": "remove-atom",
"text": "Remove an Atom From the Balloon",
"action": [
"var atomNum = getNumberOfAtoms();",
"var obsx = getObstacleProperties(0).x;",
"if (atomNum > 0) {",
" for (var i = 0; i < atomNum; i++) {",
" if (getAtomProperties(i).x < obsx) {",
" removeAtom(i);",
" break;",
" }",
" }",
"}"
]
}
],
"layout": {
"bottom": [
[
"add-atom",
"remove-atom",
"show-velocity"
]
]
},
"models": [
{
"id": "page2$0",
"viewOptions": {
"backgroundColor": "rgba(238,238,238,255)",
"showClock": true,
"keShading": false,
"chargeShading": false,
"useThreeLetterCode": true,
"aminoAcidColorScheme": "hydrophobicity",
"showChargeSymbols": true,
"showVDWLines": false,
"VDWLinesCutoff": "medium",
"showVelocityVectors": false,
"showForceVectors": false,
"showAtomTrace": false,
"images": [],
"imageMapping": {},
"textBoxes": [],
"fitToParent": false,
"xlabel": false,
"ylabel": false,
"xunits": false,
"yunits": false,
"controlButtons": "play",
"gridLines": false,
"atomNumbers": false,
"enableAtomTooltips": false,
"enableKeyboardHandlers": true,
"atomTraceColor": "#6913c5",
"velocityVectors": {
"color": "#000",
"width": 0.01,
"length": 2
},
"forceVectors": {
"color": "#169C30",
"width": 0.01,
"length": 2
}
},
"type": "md2d",
"url": "http://localhost:3000/models/md2ds/page2$0.json"
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment