-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
209 lines (200 loc) · 9.75 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" type="text/css" href="lib/styles.css">
<link rel="stylesheet" href="css/skel.css" />
<link rel="stylesheet" href="css/style.css" />
<link rel="stylesheet" href="css/style-desktop.css" />
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
<title>Visualizing Molecular Dynamics Simulation</title>
<body style="overflow-x: scroll">
<div align="center">
<h3>Exploratory Data Analysis Tool for Molecular Simulation Data</h3>
<p>Start by choosing 3 same variables, 2 same and 1 different or 3 different variables. Interact with the 2D plot below.
Distance between dots represent the similarity of the selected variables at different times. Time is indicated by colors, see legend. Open filtering options to
select the range of data that you are interested in. Click and drag your mouse around points to select them and write the structure of physical data associated with it.
Click on a dot to see the 3D structure of the simulation at the time represented by the dot. Sample simulation data is loaded here, as described in the readme.md</p>
<div style="width:100%;">
<div style="margin-left:10px; width:250px">
<label>Show/Hide Plotting Options</label>
<input type="checkbox" name="plotting" id="plotting" onchange="showDiv()">
</div>
<div id="plot_options" >
<select name="plot_list1" id="plot_list1" onchange="updateData()">
<option value="0">Select 1st Variable</option>
</select>
<select name="plot_list2" id="plot_list2" onchange="updateData()">
<option value="0">Select 2nd Variable</option>
</select>
<select name="plot_list3" id="plot_list3" onchange="updateData()">
<option value="0">Select 3rd Variable</option>
</select>
</div>
</div>
<div style="width:100%; float:left">
<label>Show/Hide Filter Options</label>
<input type="checkbox" name="filtershow" id="filtershow" onchange="showDiv()" unchecked>
<div id="filters">
<button class="button" type="button" id="filterbutton">Submit Filter Options</button>
<button class="button" type="button" id="clearfilter" onclick="removeFilters()">Clear Filters</button>
</div>
<div >
<label>Show/Hide 3D Diagram</label>
<input type="checkbox" name="3D" id="3D" value="1" checked onchange="showfigure()">
</div>
<div>
<label>Colors</label>
<select name="element_color" id="element_color">
<option value="o">Select an Element</option>
</select>
<select name="color_list" id="color_list" onchange="recolor()">
<option value="128,0,0">Maroon</option>
<option value="255,0,0">Red</option>
<option value="255,165,0">Orange</option>
<option value="255,255,0">Yellow</option>
<option value="128,128,0">Olive</option>
<option value="0,128,0">Green</option>
<option value="128,0,128">Purple</option>
<option value="255,0,255">Fuschia</option>
<option value="0,255,0">Lime</option>
<option value="0,128,128">Teal</option>
<option value="0,255,255">Aqua</option>
<option value="0,0,255">Blue</option>
<option value="0,0,128">Navy</option>
<option value="0,0,0">Black</option>
<option value="128,128,128">Gray</option>
<option value="192,192,192">Silver</option>
<option value="255,255,255">White</option>
</select>
</div>
<div >
<button class="button" type="button" id="clear">Clear Selection</button>
<button class="button" type="button" id="writedata">Write Selection to File</button>
<button class="button" type="button" id="writeframe">Export Selected Frames to File</button>
</div>
<div style="width: 100%;">
<div><img src="lib/legend.png" style="margin-left:-195px;width:100px;height:200px;position:absolute;"></div>
<div id="wrap" style="width: 500px; float: left; margin-left:0px;"></div>
<div id="container" style="margin-left: 520px; background-color:#bfcfec;width:500px;" ></div>
</div>
<div id="footer">Loading</div>
</div>
<script src="lib/d3.min.js"></script>
<script src="lib/numeric-1.2.6.min.js"></script>
<script src="lib/utils.js"></script>
<script src="lib/three.js"></script>
<script src="lib/fisheye.js"></script>
<script src="lib/TrackballControls.js"></script>
<script src="lib/CSS3DRenderer.js"></script>
<script src="lib/PDBLoader.js"></script>
<script src="lib/FileSaver.min.js"></script>
<script src="lib/jquery.js"></script>
<script>
document.getElementById('plotting').checked = true;
var frames ={};
var filename ="COLVAR.csv";
var t0=1,t1=30;
var scope = this;
var loader = new THREE.XHRLoader( scope.manager );
var state = []; // Default only first variable selected
var CSVdata=[];
var CSVranges = [];
loader.load( filename, function ( text ) {
var top = text.split( "\n" )[0].split(",");
state = Array.apply(null, Array(top.length)).map(Number.prototype.valueOf,0);
makeOptions("plot_list1");
makeOptions("plot_list2");
makeOptions("plot_list3");
function makeOptions(listname) {
var select = document.getElementById(listname);
for (i=0;i<top.length;i++) {
var el = document.createElement("option");
el.textContent=top[i];
el.value= i;
select.appendChild(el);
}}
text=text.trim().split("\n");
var data=[],yo=[];
for (i=1;i<text.length;i++) {
data=text[i].split(",")
yo=[];
for (k=0;k<data.length;k++) {
if (data[k] !== undefined)
{ yo.push(Number(data[k]))}
}
yo.push(i-1);
CSVdata.push(yo);
}
state[0] =1;
getglobalranges();
makefilters()
plotd3(MDScalculate(CSVdata));
});
var headlen = document.getElementById("plot_list1");
var len = headlen.options.length;
function getglobalranges() {
for (i=0;i<CSVdata[0].length;i++){ // for all columns, even the first time column
var min = Infinity;
var max = -Infinity;
for (j=0;j<CSVdata.length;j++) {
min = Math.min(min,CSVdata[j][i]);
max = Math.max(max,CSVdata[j][i]);
}
CSVranges.push([min,max,Math.abs(max-min)]);
}
}
function makefilters() {
var select=document.getElementById("plot_list1")
for (i=1;i<select.options.length;i++) {
var p= document.createElement("p");
var inp = document.createElement("input");
var text =select.options[i].textContent;
inp.type="number"; inp.id=text+'min';
inp.min=String(CSVranges[i-1][0]);inp.max=String(CSVranges[i-1][1]);inp.step="100";inp.value=String(CSVranges[i-1][0]);
var ilabel = document.createElement("label");
ilabel.innerHTML=text+' min';
ilabel.setAttribute("for",inp);
filters.appendChild(p);
filters.appendChild(ilabel);
filters.appendChild(inp);
var inp = document.createElement("input");
inp.type="number"; inp.id=text+"max";
inp.min=String(CSVranges[i-1][0]);inp.max=String(CSVranges[i-1][1]);inp.step="100";inp.value=String(CSVranges[i-1][1]);
var ilabel = document.createElement("label");
ilabel.innerHTML=text+" max";
ilabel.setAttribute("for",inp);
filters.appendChild(ilabel);
filters.appendChild(inp);
}
}
d3.select("#filterbutton").on("click", function() {
d3.select("svg").remove();
plotd3(MDScalculate(CSVdata));
});
showDiv()
var camera, scene, renderer;
var controls;
var root;
var objects = [];
var tmpVec1 = new THREE.Vector3();
var tmpVec2 = new THREE.Vector3();
var tmpVec3 = new THREE.Vector3();
var tmpVec4 = new THREE.Vector3();
var atomlist ={};
var visualizationType = 0; // shows atoms only
var framenum=1;
var loader = {};
var trajectory="lib/trajout.gro"
var atomcount=0;
var show3D = true;
var xbox =0,ybox=0,zbox=0;
var colorSpriteMap = {};
var baseSprite = {};
var CPK = { "h": [ 255,255,255 ], "c": [ 0,0,0 ], "n": [ 0,0,255 ], "o": [ 255,0,0 ], "s": [ 0,128,128 ] };
var CPKsize = { "h": 1, "c": 1.5, "n": 1.3, "o": 1.3 };
init(framenum);
animate();
</script>
</body>
</html>