Skip to content

Commit

Permalink
Fixed small camera issues
Browse files Browse the repository at this point in the history
  • Loading branch information
gabrielelanaro committed Jan 14, 2015
1 parent ebdd71d commit 5ecf853
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 33 deletions.
2 changes: 1 addition & 1 deletion chemview/static/chemview.js
Expand Up @@ -24,7 +24,7 @@ var MolecularViewer = function ($el) {
};

this.camera_z = -150;
this.perspectiveCamera = new THREE.PerspectiveCamera(20, this.container.whratio, 1, 800);
this.perspectiveCamera = new THREE.PerspectiveCamera(20, this.container.whratio, 0.1, 800);
this.perspectiveCamera.position.set(0, 0, this.camera_z);
this.perspectiveCamera.lookAt(new THREE.Vector3(0, 0, 0));
this.orthographicCamera = new THREE.OrthographicCamera();
Expand Down
4 changes: 2 additions & 2 deletions chemview/viewer.py
Expand Up @@ -209,8 +209,8 @@ def add_isosurface(self, function, isolevel=0.3, resolution=32, style="wireframe

# We want to make a container that contains the whole molecule
# and surface
area_min = self.coordinates.min(axis=0) - 0.5
area_max = self.coordinates.max(axis=0) + 0.5
area_min = self.coordinates.min(axis=0) - 0.2
area_max = self.coordinates.max(axis=0) + 0.2

x = np.linspace(area_min[0], area_max[0], resolution)
y = np.linspace(area_min[1], area_max[1], resolution)
Expand Down
44 changes: 14 additions & 30 deletions examples/Molecular Orbitals.ipynb
@@ -1,7 +1,7 @@
{
"metadata": {
"name": "",
"signature": "sha256:8483459a9ad54c353d4cb9e80ce1d7e6a42e047f8a9dd50e3d8d016faeac74c6"
"signature": "sha256:5df287995a349ef3d453e1c65f19922c3b08ea8990cfa09a31fac543006d6739"
},
"nbformat": 3,
"nbformat_minor": 0,
Expand All @@ -25,15 +25,6 @@
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stderr",
"text": [
"/home/gabriele/miniconda/envs/test_install/lib/python3.4/site-packages/numba/tests/__init__.py:393: UserWarning: Failed to enable faulthandler due to:\n",
"IOStream has no fileno.\n",
" warnings.warn(msg.format(err=e))\n"
]
},
{
"javascript": [
"$(\"head\").append($(\"<link/>\").attr({\n",
Expand Down Expand Up @@ -83,7 +74,7 @@
"metadata": {},
"output_type": "display_data",
"text": [
"<IPython.core.display.Javascript at 0x7f7affc65080>"
"<IPython.core.display.Javascript at 0x7f196158f1d0>"
]
},
{
Expand Down Expand Up @@ -373,7 +364,7 @@
"metadata": {},
"output_type": "display_data",
"text": [
"<IPython.core.display.Javascript at 0x7f7ae04414e0>"
"<IPython.core.display.Javascript at 0x7f1945ce1510>"
]
},
{
Expand Down Expand Up @@ -520,7 +511,7 @@
"metadata": {},
"output_type": "display_data",
"text": [
"<IPython.core.display.Javascript at 0x7f7ae043feb8>"
"<IPython.core.display.Javascript at 0x7f1945d18510>"
]
}
],
Expand All @@ -536,21 +527,13 @@
"\n",
"mo_coefficients = df.read('mocoeffs')\n",
"gbasis = df.read('gbasis')\n",
"molecule = df.read('molecule')"
"molecule = df.read('molecule')\n",
"molecule.guess_bonds()"
],
"language": "python",
"metadata": {},
"outputs": [
{
"ename": "SyntaxError",
"evalue": "invalid syntax (__init__.py, line 15)",
"output_type": "pyerr",
"traceback": [
"\u001b[1;36m File \u001b[1;32m\"/home/gabriele/miniconda/envs/test_install/lib/python3.4/site-packages/chemlab/__init__.py\"\u001b[1;36m, line \u001b[1;32m15\u001b[0m\n\u001b[1;33m except ValueError, e:\u001b[0m\n\u001b[1;37m ^\u001b[0m\n\u001b[1;31mSyntaxError\u001b[0m\u001b[1;31m:\u001b[0m invalid syntax\n"
]
}
],
"prompt_number": 2
"outputs": [],
"prompt_number": 7
},
{
"cell_type": "code",
Expand All @@ -560,17 +543,18 @@
"\n",
"f = molecular_orbital(molecule.r_array, mo_coefficients[0][-1], gbasis)\n",
"\n",
"mv = MolecularViewer(molecule.r_array, {'atom_types': molecule.type_array})\n",
"mv.ball_and_sticks()\n",
"mv.add_isosurface(f, isolevel=0.3, style='wireframe', color=0xff0000)\n",
"mv.add_isosurface(f, isolevel=-0.3, style='wireframe', color=0x0000ff)\n",
"mv = MolecularViewer(molecule.r_array, {'atom_types': molecule.type_array,\n",
" 'bonds': molecule.bonds})\n",
"mv.wireframe()\n",
"mv.add_isosurface(f, isolevel=0.3, color=0xff0000)\n",
"mv.add_isosurface(f, isolevel=-0.3, color=0x0000ff)\n",
"\n",
"mv"
],
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": 4
"prompt_number": 14
},
{
"cell_type": "code",
Expand Down

0 comments on commit 5ecf853

Please sign in to comment.