|
2 | 2 | "cells": [
|
3 | 3 | {
|
4 | 4 | "cell_type": "code",
|
5 |
| - "execution_count": null, |
| 5 | + "execution_count": 1, |
6 | 6 | "metadata": {
|
7 | 7 | "init_cell": true
|
8 | 8 | },
|
9 |
| - "outputs": [], |
| 9 | + "outputs": [ |
| 10 | + { |
| 11 | + "name": "stdout", |
| 12 | + "output_type": "stream", |
| 13 | + "text": [ |
| 14 | + "0.1.6\n" |
| 15 | + ] |
| 16 | + } |
| 17 | + ], |
10 | 18 | "source": [
|
11 | 19 | "import numpy as np \n",
|
12 | 20 | "import pandas as pd\n",
|
|
93 | 101 | "# Object Types"
|
94 | 102 | ]
|
95 | 103 | },
|
| 104 | + { |
| 105 | + "cell_type": "code", |
| 106 | + "execution_count": null, |
| 107 | + "metadata": { |
| 108 | + "collapsed": true |
| 109 | + }, |
| 110 | + "outputs": [], |
| 111 | + "source": [] |
| 112 | + }, |
96 | 113 | {
|
97 | 114 | "cell_type": "code",
|
98 | 115 | "execution_count": null,
|
|
108 | 125 | " 'otype':['pandas3js.models.'+options['Object']],\n",
|
109 | 126 | " 'position':[(options['x'],0,0)],\n",
|
110 | 127 | " 'visible':[options['Visible']]})\n",
|
| 128 | + " if 'Icosahedron' in options['Object']:\n", |
| 129 | + " df['detail'] = 1\n", |
111 | 130 | " if 'Triclinic' in options['Object']:\n",
|
112 | 131 | " pjs.utils.tuple_to_df(df,'b',(0.5,1,0))\n",
|
113 | 132 | " pjs.utils.tuple_to_df(df,'c',(0,.5,1))\n",
|
|
166 | 185 | " for q in cdata['charge']]\n",
|
167 | 186 | " geometry.change_by_df(df,otype_column='otype')\n",
|
168 | 187 | "\n",
|
169 |
| - "gui, gcollect, opts = pjs.views.create_gui(geometry,callback,\n", |
| 188 | + "gui, gcollect, opts = pjs.views.create_gui(callback=callback,\n", |
170 | 189 | " height=200,width=200,camera_position=[.5,0,-4],\n",
|
171 | 190 | " show_object_info=True,otype_column='otype',\n",
|
172 | 191 | " opts_choice={'Color':['c1','c2']},\n",
|
|
220 | 239 | "outputs": [],
|
221 | 240 | "source": [
|
222 | 241 | "# pip install jsonextended\n",
|
223 |
| - "import jsonextended as ejson\n", |
224 |
| - "import urllib #urllib2 for python3\n", |
225 |
| - "f = urllib.urlopen(\n", |
226 |
| - " 'https://raw.githubusercontent.com/chrisjsewell'\n", |
227 |
| - " '/jsonextended/master/jsonextended/parsers/crystal_test.data')\n", |
228 |
| - "parser = ejson.parsers.CrystalDFTParser()\n", |
229 |
| - "parser.read_file(f)\n", |
230 |
| - "f.close()\n", |
231 |
| - "\n", |
232 |
| - "data = ejson.dict_combine_lists(parser.data,['id','x/a','y/b','z/c','atomic_number'],'ixyzn')\n", |
| 242 | + "from jsonextended import edict, utils, _example_data_folder\n", |
| 243 | + "from jsonextended.complex_parsers import crystal_dft" |
| 244 | + ] |
| 245 | + }, |
| 246 | + { |
| 247 | + "cell_type": "code", |
| 248 | + "execution_count": null, |
| 249 | + "metadata": {}, |
| 250 | + "outputs": [], |
| 251 | + "source": [ |
| 252 | + "datapath = utils.get_data_path('data.crystal.out',_example_data_folder)\n", |
| 253 | + "parser = crystal_dft.CrystalDFTParser()\n", |
| 254 | + "data = parser.read_file(datapath)" |
| 255 | + ] |
| 256 | + }, |
| 257 | + { |
| 258 | + "cell_type": "code", |
| 259 | + "execution_count": null, |
| 260 | + "metadata": {}, |
| 261 | + "outputs": [], |
| 262 | + "source": [ |
| 263 | + "data = edict.combine_lists(data,['id','x/a','y/b','z/c','atomic_number'],'ixyzn')\n", |
233 | 264 | "geometry = pjs.models.GeometricCollection()\n",
|
234 | 265 | "\n",
|
235 | 266 | "# create bounding box\n",
|
|
242 | 273 | "# create atoms\n",
|
243 | 274 | "for d in data['initial']['primitive']['geometry']['ixyzn'].values():\n",
|
244 | 275 | " x,y,z = d['x/a']*a_vec+d['y/b']*b_vec+d['z/c']*c_vec\n",
|
245 |
| - " atom = pjs.models.Sphere(id=d['id'],position=(x,y,z))\n", |
| 276 | + " #atom = pjs.models.Sphere(id=d['id'],position=(x,y,z))\n", |
| 277 | + " atom = pjs.models.Icosahedron(id=d['id'],position=(x,y,z),detail=1)\n", |
246 | 278 | " atom.color = atom.label_color = pjs.atom.map_atoms(d['atomic_number'],'color')\n",
|
247 | 279 | " atom.radius = pjs.atom.map_atoms(d['atomic_number'],'RCov')\n",
|
248 | 280 | " atom.label = pjs.atom.map_atoms(d['atomic_number'],'Symbol')\n",
|
|
278 | 310 | "metadata": {
|
279 | 311 | "hide_input": false,
|
280 | 312 | "kernelspec": {
|
281 |
| - "display_name": "Python 2", |
| 313 | + "display_name": "Python 3", |
282 | 314 | "language": "python",
|
283 |
| - "name": "python2" |
| 315 | + "name": "python3" |
284 | 316 | },
|
285 | 317 | "language_info": {
|
286 | 318 | "codemirror_mode": {
|
287 | 319 | "name": "ipython",
|
288 |
| - "version": 2 |
| 320 | + "version": 3 |
289 | 321 | },
|
290 | 322 | "file_extension": ".py",
|
291 | 323 | "mimetype": "text/x-python",
|
292 | 324 | "name": "python",
|
293 | 325 | "nbconvert_exporter": "python",
|
294 |
| - "pygments_lexer": "ipython2", |
295 |
| - "version": "2.7.13" |
| 326 | + "pygments_lexer": "ipython3", |
| 327 | + "version": "3.6.1" |
296 | 328 | },
|
297 | 329 | "nav_menu": {},
|
298 | 330 | "toc": {
|
| 331 | + "colors": { |
| 332 | + "hover_highlight": "#DAA520", |
| 333 | + "navigate_num": "#000000", |
| 334 | + "navigate_text": "#333333", |
| 335 | + "running_highlight": "#FF0000", |
| 336 | + "selected_highlight": "#FFD700", |
| 337 | + "sidebar_border": "#EEEEEE", |
| 338 | + "wrapper_background": "#FFFFFF" |
| 339 | + }, |
| 340 | + "moveMenuLeft": true, |
| 341 | + "nav_menu": { |
| 342 | + "height": "105px", |
| 343 | + "width": "252px" |
| 344 | + }, |
299 | 345 | "navigate_menu": true,
|
300 | 346 | "number_sections": true,
|
301 | 347 | "sideBar": true,
|
302 | 348 | "threshold": 4,
|
303 | 349 | "toc_cell": false,
|
304 | 350 | "toc_section_display": "block",
|
305 |
| - "toc_window_display": false |
| 351 | + "toc_window_display": false, |
| 352 | + "widenNotebook": false |
306 | 353 | }
|
307 | 354 | },
|
308 | 355 | "nbformat": 4,
|
|
0 commit comments