Permalink
Browse files

Improve docs a little.

  • Loading branch information...
1 parent fbfa3af commit 22613a39c37e93250666a138a421d9ef1fd78feb @shyuep shyuep committed Feb 9, 2014
Showing with 41 additions and 26 deletions.
  1. +13 −11 docs/_static/Basic functionality.html
  2. +12 −4 docs/index.rst
  3. +3 −0 docs/installation.rst
  4. +13 −11 examples/Basic functionality.ipynb
@@ -1745,7 +1745,7 @@ <h2 id="Basic-Element,-Specie-and-Composition-objects">Basic Element, Specie and
<pre>
Atomic mass of Si is 28.0855 amu
Si has a melting point of 1687 K
-Ionic radii for Si: {4: 0.54 pm}
+Ionic radii for Si: {4: 0.54}
</pre>
</div>
@@ -1777,7 +1777,7 @@ <h2 id="Basic-Element,-Specie-and-Composition-objects">Basic Element, Specie and
<div class="hbox output_area"><div class="prompt"></div>
<div class="box-flex1 output_subarea output_stream output_stdout">
<pre>
-Atomic mass of Si in kg: 4.66370658657455e-26 kg
+Atomic mass of Si in kg: 4.66370658657e-26 kg
</pre>
</div>
@@ -1812,7 +1812,7 @@ <h2 id="Basic-Element,-Specie-and-Composition-objects">Basic Element, Specie and
<div class="box-flex1 output_subarea output_stream output_stdout">
<pre>
55.845 amu
-0.92 pm
+0.92 ang
</pre>
</div>
@@ -1851,7 +1851,7 @@ <h2 id="Basic-Element,-Specie-and-Composition-objects">Basic Element, Specie and
Weight of Fe2O3 is 159.6882 amu
Amount of Fe in Fe2O3 is 2.0
Atomic fraction of Fe is 0.4
-Weight fraction of Fe is 0.699425505453753
+Weight fraction of Fe is 0.699425505454
</pre>
</div>
@@ -1935,7 +1935,7 @@ <h2 id="Lattice-&amp;-Structure-objects">Lattice &amp; Structure objects<a class
</div>
<div class="text_cell_render border-box-sizing rendered_html">
-<p>The Structure object contains many useful manipulation functions. Some examples are given below. Please note that there is an immutable version of Structure known as IStructure, for the use case where you really need to enforce that the structure does not change. Conversion between these forms of Structure can be performed using from_sites().</p>
+<p>The Structure object contains many useful manipulation functions. Since Structure is essentially a list, it contains a simple pythonic API for manipulation its sites. Some examples are given below. Please note that there is an immutable version of Structure known as IStructure, for the use case where you really need to enforce that the structure does not change. Conversion between these forms of Structure can be performed using from_sites().</p>
</div>
<div class="cell border-box-sizing code_cell vbox">
<div class="input hbox">
@@ -1944,8 +1944,10 @@ <h2 id="Lattice-&amp;-Structure-objects">Lattice &amp; Structure objects<a class
</div>
<div class="input_area box-flex1">
<div class="highlight"><pre><span class="n">structure</span><span class="o">.</span><span class="n">make_supercell</span><span class="p">([</span><span class="mi">2</span><span class="p">,</span> <span class="mi">2</span><span class="p">,</span> <span class="mi">1</span><span class="p">])</span> <span class="c">#Make a 3 x 2 x 1 supercell of the structure</span>
-<span class="n">structure</span><span class="o">.</span><span class="n">remove</span><span class="p">(</span><span class="mi">0</span><span class="p">)</span> <span class="c">#Remove the first site</span>
+<span class="k">del</span> <span class="n">structure</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="c">#Remove the first site</span>
<span class="n">structure</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="s">&quot;Na&quot;</span><span class="p">,</span> <span class="p">[</span><span class="mi">0</span><span class="p">,</span><span class="mi">0</span><span class="p">,</span><span class="mi">0</span><span class="p">])</span> <span class="c">#Append a Na atom.</span>
+<span class="n">structure</span><span class="p">[</span><span class="o">-</span><span class="mi">1</span><span class="p">]</span> <span class="o">=</span> <span class="s">&quot;Li&quot;</span> <span class="c">#Change the last added atom to Li.</span>
+<span class="n">structure</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">=</span> <span class="s">&quot;Cs&quot;</span><span class="p">,</span> <span class="p">[</span><span class="mf">0.01</span><span class="p">,</span> <span class="mf">0.5</span><span class="p">,</span> <span class="mi">0</span><span class="p">]</span> <span class="c">#Shift the first atom by 0.01 in fractional coordinates in the x-direction.</span>
<span class="n">immutable_structure</span> <span class="o">=</span> <span class="n">mg</span><span class="o">.</span><span class="n">IStructure</span><span class="o">.</span><span class="n">from_sites</span><span class="p">(</span><span class="n">structure</span><span class="p">)</span> <span class="c">#Create an immutable structure (cannot be modified).</span>
<span class="k">print</span> <span class="n">immutable_structure</span>
</pre></div>
@@ -1960,19 +1962,19 @@ <h2 id="Lattice-&amp;-Structure-objects">Lattice &amp; Structure objects<a class
<div class="hbox output_area"><div class="prompt"></div>
<div class="box-flex1 output_subarea output_stream output_stdout">
<pre>
-Structure Summary (Cs3 Na1 Cl4)
-Reduced Formula: Cs3NaCl4
+Structure Summary (Cs3 Li1 Cl4)
+Reduced Formula: Cs3LiCl4
abc : 8.400000 8.400000 4.200000
angles: 90.000000 90.000000 90.000000
Sites (8)
-1 Cs 0.000000 0.500000 0.000000
+1 Cs 0.010000 0.500000 0.000000
2 Cs 0.500000 0.000000 0.000000
3 Cs 0.500000 0.500000 0.000000
4 Cl 0.250000 0.250000 0.500000
5 Cl 0.250000 0.750000 0.500000
6 Cl 0.750000 0.250000 0.500000
7 Cl 0.750000 0.750000 0.500000
-8 Na 0.000000 0.000000 0.000000
+8 Li 0.000000 0.000000 0.000000
</pre>
</div>
@@ -2011,7 +2013,7 @@ <h2 id="Basic-analyses">Basic analyses<a class="anchor-link" href="#Basic-analys
<div class="hbox output_area"><div class="prompt"></div>
<div class="box-flex1 output_subarea output_stream output_stdout">
<pre>
-The spacegroup is P4/mmm
+The spacegroup is P2mm
</pre>
</div>
View
@@ -122,10 +122,18 @@ to be installed for matplotlib.
Stable version
--------------
-.. note:: Install numpy first.
-
- You may need to install numpy before installing pymatgen as numpy's
- distutils is needed to compile the spglib and pyhull dependencies.
+.. note:: Preparation
+
+ Before installing pymatgen, you may need to first install a few critical
+ dependencies manually.
+
+ 1. Numpy's distutils is needed to compile the spglib and pyhull
+ dependencies. This should be the first thing you install.
+ 2. Pyhull and PyCifRW. The recent versions of pip does not allow the
+ installation of externally hosted files. Furthermore,
+ there are some issues with easy_install for these extensions. Install
+ both these dependencies manually using "pip install <package>
+ --allow-external <package> --allow-unverified <package>".
The version at the Python Package Index (PyPI) is always the latest stable
release that will be hopefully, be relatively bug-free. The easiest way to
@@ -13,6 +13,9 @@ be available on `PyPI <http://pypi.python.org>`_.
4. PyCifRW 3.3+: For reading and writing Crystallographic Information Format
(CIF) files.
5. requests 1.0+: For the high-level interface to the Materials API.
+6. monty 0.1.1+: For some common complementary functions,
+ design patterns (e.g., singleton) and decorators to the Python
+ standard library.
Optional dependencies
---------------------
@@ -68,7 +68,7 @@
"text": [
"Atomic mass of Si is 28.0855 amu\n",
"Si has a melting point of 1687 K\n",
- "Ionic radii for Si: {4: 0.54 pm}\n"
+ "Ionic radii for Si: {4: 0.54}\n"
]
}
],
@@ -94,7 +94,7 @@
"output_type": "stream",
"stream": "stdout",
"text": [
- "Atomic mass of Si in kg: 4.66370658657455e-26 kg\n"
+ "Atomic mass of Si in kg: 4.66370658657e-26 kg\n"
]
}
],
@@ -123,7 +123,7 @@
"stream": "stdout",
"text": [
"55.845 amu\n",
- "0.92 pm\n"
+ "0.92 ang\n"
]
}
],
@@ -156,7 +156,7 @@
"Weight of Fe2O3 is 159.6882 amu\n",
"Amount of Fe in Fe2O3 is 2.0\n",
"Atomic fraction of Fe is 0.4\n",
- "Weight fraction of Fe is 0.699425505453753 \n"
+ "Weight fraction of Fe is 0.699425505454 \n"
]
}
],
@@ -231,16 +231,18 @@
"cell_type": "markdown",
"metadata": {},
"source": [
- "The Structure object contains many useful manipulation functions. Some examples are given below. Please note that there is an immutable version of Structure known as IStructure, for the use case where you really need to enforce that the structure does not change. Conversion between these forms of Structure can be performed using from_sites()."
+ "The Structure object contains many useful manipulation functions. Since Structure is essentially a list, it contains a simple pythonic API for manipulation its sites. Some examples are given below. Please note that there is an immutable version of Structure known as IStructure, for the use case where you really need to enforce that the structure does not change. Conversion between these forms of Structure can be performed using from_sites()."
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"structure.make_supercell([2, 2, 1]) #Make a 3 x 2 x 1 supercell of the structure\n",
- "structure.remove(0) #Remove the first site\n",
+ "del structure[0] #Remove the first site\n",
"structure.append(\"Na\", [0,0,0]) #Append a Na atom.\n",
+ "structure[-1] = \"Li\" #Change the last added atom to Li.\n",
+ "structure[0] = \"Cs\", [0.01, 0.5, 0] #Shift the first atom by 0.01 in fractional coordinates in the x-direction.\n",
"immutable_structure = mg.IStructure.from_sites(structure) #Create an immutable structure (cannot be modified).\n",
"print immutable_structure"
],
@@ -251,19 +253,19 @@
"output_type": "stream",
"stream": "stdout",
"text": [
- "Structure Summary (Cs3 Na1 Cl4)\n",
- "Reduced Formula: Cs3NaCl4\n",
+ "Structure Summary (Cs3 Li1 Cl4)\n",
+ "Reduced Formula: Cs3LiCl4\n",
"abc : 8.400000 8.400000 4.200000\n",
"angles: 90.000000 90.000000 90.000000\n",
"Sites (8)\n",
- "1 Cs 0.000000 0.500000 0.000000\n",
+ "1 Cs 0.010000 0.500000 0.000000\n",
"2 Cs 0.500000 0.000000 0.000000\n",
"3 Cs 0.500000 0.500000 0.000000\n",
"4 Cl 0.250000 0.250000 0.500000\n",
"5 Cl 0.250000 0.750000 0.500000\n",
"6 Cl 0.750000 0.250000 0.500000\n",
"7 Cl 0.750000 0.750000 0.500000\n",
- "8 Na 0.000000 0.000000 0.000000\n"
+ "8 Li 0.000000 0.000000 0.000000\n"
]
}
],
@@ -300,7 +302,7 @@
"output_type": "stream",
"stream": "stdout",
"text": [
- "The spacegroup is P4/mmm\n"
+ "The spacegroup is P2mm\n"
]
}
],

0 comments on commit 22613a3

Please sign in to comment.