From 9096cea3986191395215597d217a5c3b0f782e41 Mon Sep 17 00:00:00 2001 From: Co Quach Date: Fri, 8 Mar 2024 08:02:34 -0600 Subject: [PATCH 01/12] attempt to fix docs build --- docs/docs-env.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/docs-env.yml b/docs/docs-env.yml index 3068f652f..0821253c4 100644 --- a/docs/docs-env.yml +++ b/docs/docs-env.yml @@ -3,7 +3,8 @@ channels: - jaimergp/label/unsupported-cudatoolkit-shim - conda-forge dependencies: - - python>=3.8 + - importlib_resources + - python>=3.11 - pip - pip: - boltons From 37466da75f593b2270ed7fa7b64e3435a0568cce Mon Sep 17 00:00:00 2001 From: Co Quach Date: Fri, 8 Mar 2024 08:18:39 -0600 Subject: [PATCH 02/12] check if the issue is what we think it is --- docs/docs-env.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/docs/docs-env.yml b/docs/docs-env.yml index 0821253c4..64570f33a 100644 --- a/docs/docs-env.yml +++ b/docs/docs-env.yml @@ -3,7 +3,6 @@ channels: - jaimergp/label/unsupported-cudatoolkit-shim - conda-forge dependencies: - - importlib_resources - python>=3.11 - pip - pip: From 43419dd6475e3b0de92bd6a92a8eb9a768f7d28b Mon Sep 17 00:00:00 2001 From: Co Quach Date: Fri, 8 Mar 2024 12:17:47 -0600 Subject: [PATCH 03/12] add back importlib_resources --- docs/docs-env.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/docs-env.yml b/docs/docs-env.yml index 64570f33a..0821253c4 100644 --- a/docs/docs-env.yml +++ b/docs/docs-env.yml @@ -3,6 +3,7 @@ channels: - jaimergp/label/unsupported-cudatoolkit-shim - conda-forge dependencies: + - importlib_resources - python>=3.11 - pip - pip: From 2da8f1b506dc064bd3349b323d70abce2dcd9213 Mon Sep 17 00:00:00 2001 From: Co Quach Date: Fri, 8 Mar 2024 12:21:37 -0600 Subject: [PATCH 04/12] update python version --- docs/conf.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/conf.py b/docs/conf.py index 8ad87a4cf..d04b1b0e4 100755 --- a/docs/conf.py +++ b/docs/conf.py @@ -131,10 +131,10 @@ numpydoc_show_class_members = False numpydoc_show_inherited_class_members = False -_python_doc_base = "https://docs.python.org/3.9" +_python_doc_base = "https://docs.python.org/3.11" intersphinx_mapping = { - "python": ("https://docs.python.org/3.9", None), + "python": ("https://docs.python.org/3.11", None), "numpy": ("https://numpy.org/doc/stable", None), "scipy": ("https://docs.scipy.org/doc/scipy/reference", None), "scikit-learn": ("https://scikit-learn.org/stable", None), From ee02b578b524b03dd8439f13b607be89234dd208 Mon Sep 17 00:00:00 2001 From: Co Quach Date: Fri, 8 Mar 2024 13:33:34 -0600 Subject: [PATCH 05/12] change latex source file --- docs/conf.py | 2 +- docs/docs-env.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/conf.py b/docs/conf.py index d04b1b0e4..b5dc288a2 100755 --- a/docs/conf.py +++ b/docs/conf.py @@ -332,7 +332,7 @@ """, } -latex_master_doc = "indexlatex" +latex_master_doc = "index" # Grouping the document tree into LaTeX files. List of tuples # (source start file, target name, title, diff --git a/docs/docs-env.yml b/docs/docs-env.yml index 0821253c4..5584f41e2 100644 --- a/docs/docs-env.yml +++ b/docs/docs-env.yml @@ -4,7 +4,7 @@ channels: - conda-forge dependencies: - importlib_resources - - python>=3.11 + - python=3.10 - pip - pip: - boltons From 85d93c59818f46440b545e49c8b85ba00203053e Mon Sep 17 00:00:00 2001 From: Co Quach Date: Fri, 8 Mar 2024 13:42:18 -0600 Subject: [PATCH 06/12] up python version in docs --- docs/docs-env.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/docs-env.yml b/docs/docs-env.yml index 5584f41e2..3f4897af5 100644 --- a/docs/docs-env.yml +++ b/docs/docs-env.yml @@ -4,7 +4,7 @@ channels: - conda-forge dependencies: - importlib_resources - - python=3.10 + - python=3.11 - pip - pip: - boltons From a71644f59b4a8ab92c41fdb013428defebf9e461 Mon Sep 17 00:00:00 2001 From: Co Quach Date: Fri, 8 Mar 2024 14:25:30 -0600 Subject: [PATCH 07/12] try to update entry point syntax --- mbuild/recipes/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mbuild/recipes/__init__.py b/mbuild/recipes/__init__.py index e5970a0d1..fc54d51ff 100644 --- a/mbuild/recipes/__init__.py +++ b/mbuild/recipes/__init__.py @@ -10,7 +10,7 @@ class Recipes(object): recipes = Recipes() from importlib import metadata -entry_points = metadata.entry_points()["mbuild.plugins"] +entry_points = metadata.entry_points().select(group="mbuild.plugins") available_methods = [] for entry_point in entry_points: From 99adf973fc7cdd64aeffdfdb14823521dd6d8acb Mon Sep 17 00:00:00 2001 From: Co Quach Date: Fri, 8 Mar 2024 14:46:43 -0600 Subject: [PATCH 08/12] check python version for appropriate entry point syntax --- mbuild/recipes/__init__.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/mbuild/recipes/__init__.py b/mbuild/recipes/__init__.py index fc54d51ff..20072f03b 100644 --- a/mbuild/recipes/__init__.py +++ b/mbuild/recipes/__init__.py @@ -1,5 +1,7 @@ """Entrypoints for mBuild recipe plugins.""" +import sys + class Recipes(object): """mBuild recipe object.""" @@ -10,8 +12,12 @@ class Recipes(object): recipes = Recipes() from importlib import metadata -entry_points = metadata.entry_points().select(group="mbuild.plugins") +if sys.version_info.minor >= 10: + entry_points = metadata.entry_points().select(group="mbuild.plugins") +else: + entry_points = metadata.entry_points()["mbuild.plugins"] available_methods = [] for entry_point in entry_points: setattr(recipes, entry_point.name, entry_point.load()) +e From ce1b9682df28195380766f1328f5de602bcd02ac Mon Sep 17 00:00:00 2001 From: Co Quach Date: Fri, 8 Mar 2024 14:54:56 -0600 Subject: [PATCH 09/12] fix typo --- mbuild/recipes/__init__.py | 1 - 1 file changed, 1 deletion(-) diff --git a/mbuild/recipes/__init__.py b/mbuild/recipes/__init__.py index 20072f03b..e5caecc5e 100644 --- a/mbuild/recipes/__init__.py +++ b/mbuild/recipes/__init__.py @@ -20,4 +20,3 @@ class Recipes(object): available_methods = [] for entry_point in entry_points: setattr(recipes, entry_point.name, entry_point.load()) -e From 7e6c9633d4d4ea6e92e5a318cefc04d944f970a2 Mon Sep 17 00:00:00 2001 From: Co Quach Date: Fri, 8 Mar 2024 15:33:30 -0600 Subject: [PATCH 10/12] chagne ipython3 to just ipython in rst --- .../quick_start/Box_example.rst | 6 ++--- .../quick_start/fill_box_example.rst | 12 ++++----- .../quick_start/load_files.rst | 8 +++--- .../quick_start/polymer_example.rst | 6 ++--- .../tutorials/tutorial_ethane.rst | 24 ++++++++--------- .../tutorials/tutorial_lattice.rst | 26 +++++++++---------- .../tutorials/tutorial_methane.rst | 12 ++++----- .../tutorials/tutorial_monolayer.rst | 16 ++++++------ .../tutorials/tutorial_polymers.rst | 22 ++++++++-------- .../tutorials/tutorial_simple_LJ.rst | 18 ++++++------- 10 files changed, 75 insertions(+), 75 deletions(-) diff --git a/docs/getting_started/quick_start/Box_example.rst b/docs/getting_started/quick_start/Box_example.rst index b8cff8e22..7a0157bdc 100644 --- a/docs/getting_started/quick_start/Box_example.rst +++ b/docs/getting_started/quick_start/Box_example.rst @@ -4,7 +4,7 @@ Box Import the required mbuild package. -.. code:: ipython3 +.. code:: ipython import mbuild as mb @@ -18,7 +18,7 @@ Build an empty orthogonal **mBuild** Box (i.e., the angle in degrees are 𝛼 = Note: if the angles are not specified, the system will default to an orthogonal box (i.e., the angle in degrees are 𝛼 = 90, 𝛽 = 90, 𝛾 = 90). -.. code:: ipython3 +.. code:: ipython empty_box = mb.Box(lengths=[4.0, 4.0, 4.0], angles=[90, 90, 90]) @@ -28,6 +28,6 @@ Non-Orthogonal Box Build an empty non-orthogonal **mBuild** Box (i.e., the angle in degrees are 𝛼 = 90, 𝛽 = 90, 𝛾 = 120) measuring 4.0 nm in the x and y-dimensions, and 5.0 nm in the z-dimension. -.. code:: ipython3 +.. code:: ipython empty_box = mb.Box(lengths=[4.0, 4.0, 5.0], angles=[90, 90, 120]) diff --git a/docs/getting_started/quick_start/fill_box_example.rst b/docs/getting_started/quick_start/fill_box_example.rst index 992e5053d..d44ef3f86 100644 --- a/docs/getting_started/quick_start/fill_box_example.rst +++ b/docs/getting_started/quick_start/fill_box_example.rst @@ -12,7 +12,7 @@ All-Atom (AA) Hexane and Ethanol System Import the required mbuild package. -.. code:: ipython3 +.. code:: ipython import mbuild as mb @@ -26,7 +26,7 @@ Lastly, the hexane and ethanol molecule's configuration will be energy minimized .. note:: The energy minimize step requires the `foyer `_ package. -.. code:: ipython3 +.. code:: ipython hexane = mb.load('CCCCCC', smiles=True) hexane.name = 'HEX' @@ -39,7 +39,7 @@ Lastly, the hexane and ethanol molecule's configuration will be energy minimized The liquid box is built to a density of 680 kg/m\ :sup:`3`, with a 50/50 mol ratio of hexane and ethanol, and will be in an orthogonal box measuring 5.0 nm in the x, y, and z-dimensions. -.. code:: ipython3 +.. code:: ipython box_liq = mb.fill_box(compound= [hexane, ethanol], density=680, @@ -58,7 +58,7 @@ United Atom (UA) Methane System Import the required mbuild package. -.. code:: ipython3 +.. code:: ipython import mbuild as mb @@ -67,7 +67,7 @@ Construct a pseudo-monatomic molecule (united atom (UA) methane), for use with t `TraPPE `_ FF. The UA methane, bead type `"_CH4"`, will be built as a child (``mbuild.Compound.children``), so the parent (``mbuild.Compound``) will allow a user-selected residue name (``mbuild.Compound.name``). If the methane is built using ``methane = mb.Compound(name="_CH4")``, then the user must keep the residue name `"_CH4"` or `foyer `_ will not recognize the bead type when using the standard TraPPE force field XML file. -.. code:: ipython3 +.. code:: ipython methane = mb.Compound(name="MET") methane_child_bead = mb.Compound(name="_CH4") @@ -79,7 +79,7 @@ allow a user-selected residue name (``mbuild.Compound.name``). If the methane is The orthogonal liquid box contains 1230 methane molecules and measures 4.5 nm in all the x, y, and z-dimensions. -.. code:: ipython3 +.. code:: ipython box_liq = mb.fill_box(compound=methane, n_compounds=1230, diff --git a/docs/getting_started/quick_start/load_files.rst b/docs/getting_started/quick_start/load_files.rst index 0c9af1019..afd07452f 100644 --- a/docs/getting_started/quick_start/load_files.rst +++ b/docs/getting_started/quick_start/load_files.rst @@ -11,14 +11,14 @@ Create an ``mbuild.Compound`` (i.e., the "pentane" variable) by loading a molecu Import the required mbuild packages. -.. code:: ipython3 +.. code:: ipython import mbuild as mb Load the "pentane.mol2" file from its directory. -.. code:: ipython3 +.. code:: ipython pentane = mb.load("path_to_mol2_file/pentane.mol2") @@ -31,7 +31,7 @@ Build an ``mbuild.Compound`` (i.e., the "ETV_triclinic" variable) by loading a ` Import the required mbuild packages. -.. code:: ipython3 +.. code:: ipython import mbuild as mb from mbuild.lattice import load_cif @@ -40,7 +40,7 @@ Import the required mbuild packages. The `CIF `_ file is loaded using the ``load_cif`` function. Next, three (3) cell units shall be built for all the x, y, and z-dimensions with the populate function. Finally, the `CIF `_'s residues are named 'ETV'. -.. code:: ipython3 +.. code:: ipython lattice_cif_ETV_triclinic = load_cif("path_to_cif_file/ETV_triclinic.cif") ETV_triclinic = lattice_cif_ETV_triclinic.populate(x=3, y=3, z=3) diff --git a/docs/getting_started/quick_start/polymer_example.rst b/docs/getting_started/quick_start/polymer_example.rst index ac567bfc9..02c73d7c6 100644 --- a/docs/getting_started/quick_start/polymer_example.rst +++ b/docs/getting_started/quick_start/polymer_example.rst @@ -6,7 +6,7 @@ Use two (2) different monomer units, A and B, to construct a polymer, capping it Import the required mbuild packages. -.. code:: ipython3 +.. code:: ipython import mbuild as mb from mbuild.lib.recipes.polymer import Polymer @@ -20,7 +20,7 @@ Set the `chain` as a ``Polymer`` class, adding `comp_1` and `comp_2` as the mono Setting the indices identifies which atoms will be removed and have ports created in their place. -.. code:: ipython3 +.. code:: ipython comp_1 = mb.load('CC', smiles=True) # mBuild compound of the monomer unit comp_2 = mb.load('COC', smiles=True) # mBuild compound of the monomer unit @@ -40,7 +40,7 @@ Select the carboxylic acid and amine end groups that we want to use for the head Then, build the polymer with three (3) iterations of the AB sequence, and the selected head and tail end groups. -.. code:: ipython3 +.. code:: ipython chain.add_end_groups(mb.load('C(=O)O',smiles=True), index=3, diff --git a/docs/getting_started/tutorials/tutorial_ethane.rst b/docs/getting_started/tutorials/tutorial_ethane.rst index 48c2999b3..a3b6293ec 100644 --- a/docs/getting_started/tutorials/tutorial_ethane.rst +++ b/docs/getting_started/tutorials/tutorial_ethane.rst @@ -9,7 +9,7 @@ transforms. First, we need to import the mbuild package: -.. code:: ipython3 +.. code:: ipython import mbuild as mb @@ -23,7 +23,7 @@ connectivity information). Let’s start by reading a methyl group from a ``.pdb`` file: -.. code:: ipython3 +.. code:: ipython import mbuild as mb @@ -34,7 +34,7 @@ Let’s start by reading a methyl group from a ``.pdb`` file: Now let’s use our first coordinate transform to center the methyl at its carbon atom: -.. code:: ipython3 +.. code:: ipython import mbuild as mb @@ -49,7 +49,7 @@ typically points to a particle that the ``Port`` should be associated with. In our methyl group, the ``Port`` should be anchored to the carbon atom so that we can now form bonds to this carbon: -.. code:: ipython3 +.. code:: ipython import mbuild as mb @@ -66,14 +66,14 @@ By default, ``Ports`` are never output from the mBuild structure. However, it can be useful to look at a molecule with the ``Ports`` to check your work as you go: -.. code:: ipython3 +.. code:: ipython ch3.visualize(show_ports=True) Now we wrap the methyl group into a python class, so that we can reuse it as a component to build more complex molecules later. -.. code:: ipython3 +.. code:: ipython import mbuild as mb @@ -111,7 +111,7 @@ automatically chosen. Now the fun part: stick ’em together to create an ethane: -.. code:: ipython3 +.. code:: ipython ethane = mb.Compound() @@ -126,18 +126,18 @@ rotates and translates it such that two other ``Compounds`` overlap. Typically, as in this case, those two other ``Compounds`` are ``Ports`` - in our case, ``methyl1['up']`` and ``methyl2['up']``. -.. code:: ipython3 +.. code:: ipython ethane.visualize() -.. code:: ipython3 +.. code:: ipython ethane.visualize(show_ports=True) Similarly, if we want to make ethane a reusable component, we need to wrap it into a python class. -.. code:: ipython3 +.. code:: ipython import mbuild as mb @@ -151,12 +151,12 @@ wrap it into a python class. from_positions=self['methyl_1']['up'], to_positions=self['methyl_2']['up']) -.. code:: ipython3 +.. code:: ipython ethane = Ethane() ethane.visualize() -.. code:: ipython3 +.. code:: ipython # Save to .mol2 ethane.save('ethane.mol2', overwrite=True) diff --git a/docs/getting_started/tutorials/tutorial_lattice.rst b/docs/getting_started/tutorials/tutorial_lattice.rst index 2deba6ccc..1b7bf8510 100644 --- a/docs/getting_started/tutorials/tutorial_lattice.rst +++ b/docs/getting_started/tutorials/tutorial_lattice.rst @@ -58,7 +58,7 @@ desired crystal structures. To begin, we will call the python ``help()`` method to observe the parameters and attributes of the ``Lattice`` class. -.. code:: ipython3 +.. code:: ipython import mbuild help(mbuild.Lattice) @@ -79,7 +79,7 @@ ever get stuck, remember to use the python built-in ``help()`` method! For Example: - .. code:: ipython3 + .. code:: ipython lattice_spacing = [0.5, 0.5, 0.5] @@ -100,7 +100,7 @@ ever get stuck, remember to use the python built-in ``help()`` method! For example: Cubic Cell - .. code:: ipython3 + .. code:: ipython lattice_vectors = [[1, 0, 0], [0, 1, 0], [0, 0, 1]] @@ -112,7 +112,7 @@ ever get stuck, remember to use the python built-in ``help()`` method! For example: Cubic Cell - .. code:: ipython3 + .. code:: ipython angles = [90, 90, 90] @@ -140,7 +140,7 @@ ever get stuck, remember to use the python built-in ``help()`` method! For Example: FCC All Unique - .. code:: ipython3 + .. code:: ipython lattice_points = {'A' : [[0, 0, 0]], 'B' : [[0.5, 0.5, 0]], @@ -150,7 +150,7 @@ ever get stuck, remember to use the python built-in ``help()`` method! For Example: FCC All Same - .. code:: ipython3 + .. code:: ipython lattice_points = {'A' : [[0, 0, 0], [0.5, 0.5, 0], [0.5, 0, 0.5], [0, 0.5, 0.5]] } @@ -179,7 +179,7 @@ replications in the x, y, and z directions. For Example: FCC All Unique - .. code:: ipython3 + .. code:: ipython lattice_points = {'A' : [[0, 0, 0]], 'B' : [[0.5, 0.5, 0]], @@ -197,7 +197,7 @@ replications in the x, y, and z directions. For Example: FCC All Same - .. code:: ipython3 + .. code:: ipython lattice_points = {'A' : [[0, 0, 0], [0.5, 0.5, 0], [0.5, 0, 0.5], [0, 0.5, 0.5]] } @@ -217,7 +217,7 @@ Simple Cubic (SC) - Polonium -.. code:: ipython3 +.. code:: ipython import mbuild as mb import numpy as np @@ -250,7 +250,7 @@ Body-centered Cubic (BCC) - CsCl -.. code:: ipython3 +.. code:: ipython import mbuild as mb import numpy as np @@ -285,7 +285,7 @@ Face-centered Cubic (FCC) - Cu -.. code:: ipython3 +.. code:: ipython import mbuild as mb import numpy as np @@ -318,7 +318,7 @@ Diamond (Cubic) - Si -.. code:: ipython3 +.. code:: ipython import mbuild as mb import numpy as np @@ -352,7 +352,7 @@ Graphene (2D) - C -.. code:: ipython3 +.. code:: ipython import mbuild as mb import numpy as np diff --git a/docs/getting_started/tutorials/tutorial_methane.rst b/docs/getting_started/tutorials/tutorial_methane.rst index 632ba0401..0ae129b43 100644 --- a/docs/getting_started/tutorials/tutorial_methane.rst +++ b/docs/getting_started/tutorials/tutorial_methane.rst @@ -7,7 +7,7 @@ The primary building block in mBuild is a ``Compound``. Anything you construct will inherit from this class. Let’s start with some basic imports and initialization: -.. code:: ipython3 +.. code:: ipython import mbuild as mb @@ -21,7 +21,7 @@ hierarchy are referred to as ``Particles``. Note however, that this is purely semantic in mBuild to help clearly designate the bottom of a hierarchy. -.. code:: ipython3 +.. code:: ipython import mbuild as mb @@ -56,7 +56,7 @@ hydrogen. Note that for typical use cases, you will almost never have to explicitly define a bond when using mBuild - this is just to show you what’s going on under the hood: -.. code:: ipython3 +.. code:: ipython import mbuild as mb @@ -78,7 +78,7 @@ fancy label, it’s also referenceable via ``self['HC'][0]``. Alright now that we’ve got the basics, let’s finish building our ``Methane`` and take a look at it: -.. code:: ipython3 +.. code:: ipython import mbuild as mb @@ -101,12 +101,12 @@ Alright now that we’ve got the basics, let’s finish building our self.add_bond((self[0], self['HC'][2])) self.add_bond((self[0], self['HC'][3])) -.. code:: ipython3 +.. code:: ipython methane = Methane() methane.visualize() -.. code:: ipython3 +.. code:: ipython # Save to .mol2 methane.save('methane.mol2',overwrite=True) diff --git a/docs/getting_started/tutorials/tutorial_monolayer.rst b/docs/getting_started/tutorials/tutorial_monolayer.rst index 0538a7b23..11c9eb5c7 100644 --- a/docs/getting_started/tutorials/tutorial_monolayer.rst +++ b/docs/getting_started/tutorials/tutorial_monolayer.rst @@ -28,7 +28,7 @@ consistent! The more components we collect in our library with the same labeling conventions, the easier it becomes to build ever more complex structures. -.. code:: ipython3 +.. code:: ipython import mbuild as mb @@ -50,13 +50,13 @@ structures. # Hoist silane port to AlkylSilane level. self.add(silane['down'], 'down', containment=False) -.. code:: ipython3 +.. code:: ipython AlkylSilane(5).visualize() Now let’s create a substrate to which we can later attach our monomers: -.. code:: ipython3 +.. code:: ipython import mbuild as mb from mbuild.lib.surfaces import Betacristobalite @@ -72,7 +72,7 @@ library. The ``TiledCompound`` tool allows you replicate any Next, let’s create our monomer and a hydrogen atom that we’ll place on unoccupied surface sites: -.. code:: ipython3 +.. code:: ipython from mbuild.lib.atoms import H alkylsilane = AlkylSilane(chain_length=10) @@ -87,7 +87,7 @@ figures out what the closest ports are to the pattern points and then attaches copies of the guest onto the binding sites identified by the pattern: -.. code:: ipython3 +.. code:: ipython pattern = mb.Grid2DPattern(8, 8) # Evenly spaced, 2D grid of points. @@ -98,12 +98,12 @@ Also note the ``backfill`` optional argument which allows you to place a different compound on any unused ports. In this case we want to backfill with hydrogen atoms on every port without a chain. -.. code:: ipython3 +.. code:: ipython monolayer = mb.Compound([tiled_surface, chains, hydrogens]) monolayer.visualize() # Warning: may be slow in IPython notebooks -.. code:: ipython3 +.. code:: ipython # Save as .mol2 file monolayer.save('monolayer.mol2', overwrite=True) @@ -111,7 +111,7 @@ with hydrogen atoms on every port without a chain. ``lib.recipes.monolayer.py`` wraps many these functions into a simple, general class for generating the monolayers, as shown below: -.. code:: ipython3 +.. code:: ipython from mbuild.lib.recipes import Monolayer diff --git a/docs/getting_started/tutorials/tutorial_polymers.rst b/docs/getting_started/tutorials/tutorial_polymers.rst index 179c5c530..7e9069ab4 100644 --- a/docs/getting_started/tutorials/tutorial_polymers.rst +++ b/docs/getting_started/tutorials/tutorial_polymers.rst @@ -17,7 +17,7 @@ importing the coordinates from a pdb file, as in the previous example, we will instead explicitly define them in the class. Recall that distance units are nm in mBuild. -.. code:: ipython3 +.. code:: ipython import mbuild as mb @@ -60,7 +60,7 @@ given in radians. Similarly, the ports should be rotated around the x-axis by the same amount so that atoms can be added in a realistic orientation. -.. code:: ipython3 +.. code:: ipython import numpy as np import mbuild as mb @@ -108,7 +108,7 @@ make a copy. The ``force_overlap()`` function is used to connect the ``'up'`` port from ``current_monomer`` to the ``'down'`` port of ``last_mononer``. -.. code:: ipython3 +.. code:: ipython class AlkanePolymer(mb.Compound): def __init__(self): @@ -135,7 +135,7 @@ We can also add a variable ``chain_length`` both to the for loop and ``init`` that will allow the length of the polymer to be adjusted when the class is instantiated. -.. code:: ipython3 +.. code:: ipython import numpy as np import mbuild as mb @@ -182,7 +182,7 @@ the class is instantiated. self.add(current_monomer) last_monomer=current_monomer -.. code:: ipython3 +.. code:: ipython polymer = AlkanePolymer(chain_length=10) polymer.visualize(show_ports=True) @@ -211,7 +211,7 @@ A simple hexane molecule is built using ``mBuild``'s packaged polymer builder. This is done by loading a methane molecule via a SMILES string. The indices are explicitly selected, so the molecule builds out in the proper directions and does not overlap. -.. code:: ipython3 +.. code:: ipython import mbuild as mb from mbuild.lib.recipes.polymer import Polymer @@ -235,7 +235,7 @@ The end groups are added via the ``add_end_groups`` attribute, specifying the at the location of each end group (``label``), and if the tail end group is duplicated to the head of the polymer (``duplicate``). The indices are explicitly selected, so the molecule builds out in the proper directions and does not overlap. -.. code:: ipython3 +.. code:: ipython from mbuild.lib.recipes.polymer import Polymer import mbuild as mb @@ -275,7 +275,7 @@ constructed above and translating and/or rotating the alkanes in space. ``mBuild`` provides many routines that can be used to create different patterns, to which the polymers can be shifted. -.. code:: ipython3 +.. code:: ipython comp = mb.load('C', smiles=True) # mBuild compound of the monomer unit polymer = Polymer() @@ -311,7 +311,7 @@ patterns, to which the polymers can be shifted. Other patterns can be used, e.g., the ``Grid3DPattern``. We can also use the rotation commands to randomize the orientation. -.. code:: ipython3 +.. code:: ipython import random @@ -344,7 +344,7 @@ the rotation commands to randomize the orientation. ``mBuild`` also provides an interface to ``PACKMOL``, allowing the creation of a randomized configuration. -.. code:: ipython3 +.. code:: ipython comp = mb.load('C', smiles=True) # mBuild compound of the monomer unit polymer = Polymer() @@ -373,7 +373,7 @@ amount of perturbation. Note that large values of ``delta`` may result in the chain overlapping itself, as ``mBuild`` does not currently include routines to exclude such overlaps. -.. code:: ipython3 +.. code:: ipython import mbuild as mb diff --git a/docs/getting_started/tutorials/tutorial_simple_LJ.rst b/docs/getting_started/tutorials/tutorial_simple_LJ.rst index 0afb4f5d1..812085bd2 100644 --- a/docs/getting_started/tutorials/tutorial_simple_LJ.rst +++ b/docs/getting_started/tutorials/tutorial_simple_LJ.rst @@ -12,7 +12,7 @@ Note, the color and radius associated with a Particle name can be set and passed to the visualize command. Colors are passed in hex format (see http://www.color-hex.com/color/bfbfbf). -.. code:: ipython3 +.. code:: ipython import mbuild as mb @@ -63,7 +63,7 @@ translating to the specified location. Since the lj_proto particle in this example starts at the origin, these two commands produce identical behavior. -.. code:: ipython3 +.. code:: ipython import mbuild as mb @@ -91,7 +91,7 @@ in pattern, cloning, translating, and adding to the system. Note, because Grid3DPattern defines points between 0 and 1, they must be scaled based on the desired system size, i.e., pattern.scale(2). -.. code:: ipython3 +.. code:: ipython import mbuild as mb @@ -115,7 +115,7 @@ Larger systems can therefore be easily generated by toggling the values given to Grid3DPattern. Other patterns can also be generated using the same basic code, such as a 2D grid pattern: -.. code:: ipython3 +.. code:: ipython import mbuild as mb @@ -142,7 +142,7 @@ Note to show both simultaneously, we shift the x-coordinate of Particles in the sphere by -1 (i.e., pos[0]-=1.0) and +1 for the disk (i.e, pos[0]+=1.0). -.. code:: ipython3 +.. code:: ipython import mbuild as mb @@ -177,7 +177,7 @@ corresponds to the sphere (class SphereLJ), and one that corresponds to the disk (class DiskLJ), and then instantiate and shift each of these individually in the MonoLJ component. -.. code:: ipython3 +.. code:: ipython import mbuild as mb @@ -229,7 +229,7 @@ Again, since mBuild is hierarchical, the pattern functions can be used to generate large systems of any arbitary component. For example, we can replicate the SphereLJ component on a regular array. -.. code:: ipython3 +.. code:: ipython import mbuild as mb @@ -270,7 +270,7 @@ command allows a compound to be rotated, in place, about a specific axis (i.e., it considers the origin for the rotation to lie at the compound’s center of mass). -.. code:: ipython3 +.. code:: ipython import mbuild as mb import random @@ -319,7 +319,7 @@ Configurations can be dumped to file using the save command; this takes advantage of MDTraj and supports a range of file formats (see http://MDTraj.org). -.. code:: ipython3 +.. code:: ipython #save as xyz file monoLJ.save('output.xyz') From 40ffe97fa8c3e34873e4be2b4e5f063b4282d1dc Mon Sep 17 00:00:00 2001 From: Co Quach Date: Fri, 8 Mar 2024 15:46:51 -0600 Subject: [PATCH 11/12] Revert "chagne ipython3 to just ipython in rst" This reverts commit 7e6c9633d4d4ea6e92e5a318cefc04d944f970a2. --- .../quick_start/Box_example.rst | 6 ++--- .../quick_start/fill_box_example.rst | 12 ++++----- .../quick_start/load_files.rst | 8 +++--- .../quick_start/polymer_example.rst | 6 ++--- .../tutorials/tutorial_ethane.rst | 24 ++++++++--------- .../tutorials/tutorial_lattice.rst | 26 +++++++++---------- .../tutorials/tutorial_methane.rst | 12 ++++----- .../tutorials/tutorial_monolayer.rst | 16 ++++++------ .../tutorials/tutorial_polymers.rst | 22 ++++++++-------- .../tutorials/tutorial_simple_LJ.rst | 18 ++++++------- 10 files changed, 75 insertions(+), 75 deletions(-) diff --git a/docs/getting_started/quick_start/Box_example.rst b/docs/getting_started/quick_start/Box_example.rst index 7a0157bdc..b8cff8e22 100644 --- a/docs/getting_started/quick_start/Box_example.rst +++ b/docs/getting_started/quick_start/Box_example.rst @@ -4,7 +4,7 @@ Box Import the required mbuild package. -.. code:: ipython +.. code:: ipython3 import mbuild as mb @@ -18,7 +18,7 @@ Build an empty orthogonal **mBuild** Box (i.e., the angle in degrees are 𝛼 = Note: if the angles are not specified, the system will default to an orthogonal box (i.e., the angle in degrees are 𝛼 = 90, 𝛽 = 90, 𝛾 = 90). -.. code:: ipython +.. code:: ipython3 empty_box = mb.Box(lengths=[4.0, 4.0, 4.0], angles=[90, 90, 90]) @@ -28,6 +28,6 @@ Non-Orthogonal Box Build an empty non-orthogonal **mBuild** Box (i.e., the angle in degrees are 𝛼 = 90, 𝛽 = 90, 𝛾 = 120) measuring 4.0 nm in the x and y-dimensions, and 5.0 nm in the z-dimension. -.. code:: ipython +.. code:: ipython3 empty_box = mb.Box(lengths=[4.0, 4.0, 5.0], angles=[90, 90, 120]) diff --git a/docs/getting_started/quick_start/fill_box_example.rst b/docs/getting_started/quick_start/fill_box_example.rst index d44ef3f86..992e5053d 100644 --- a/docs/getting_started/quick_start/fill_box_example.rst +++ b/docs/getting_started/quick_start/fill_box_example.rst @@ -12,7 +12,7 @@ All-Atom (AA) Hexane and Ethanol System Import the required mbuild package. -.. code:: ipython +.. code:: ipython3 import mbuild as mb @@ -26,7 +26,7 @@ Lastly, the hexane and ethanol molecule's configuration will be energy minimized .. note:: The energy minimize step requires the `foyer `_ package. -.. code:: ipython +.. code:: ipython3 hexane = mb.load('CCCCCC', smiles=True) hexane.name = 'HEX' @@ -39,7 +39,7 @@ Lastly, the hexane and ethanol molecule's configuration will be energy minimized The liquid box is built to a density of 680 kg/m\ :sup:`3`, with a 50/50 mol ratio of hexane and ethanol, and will be in an orthogonal box measuring 5.0 nm in the x, y, and z-dimensions. -.. code:: ipython +.. code:: ipython3 box_liq = mb.fill_box(compound= [hexane, ethanol], density=680, @@ -58,7 +58,7 @@ United Atom (UA) Methane System Import the required mbuild package. -.. code:: ipython +.. code:: ipython3 import mbuild as mb @@ -67,7 +67,7 @@ Construct a pseudo-monatomic molecule (united atom (UA) methane), for use with t `TraPPE `_ FF. The UA methane, bead type `"_CH4"`, will be built as a child (``mbuild.Compound.children``), so the parent (``mbuild.Compound``) will allow a user-selected residue name (``mbuild.Compound.name``). If the methane is built using ``methane = mb.Compound(name="_CH4")``, then the user must keep the residue name `"_CH4"` or `foyer `_ will not recognize the bead type when using the standard TraPPE force field XML file. -.. code:: ipython +.. code:: ipython3 methane = mb.Compound(name="MET") methane_child_bead = mb.Compound(name="_CH4") @@ -79,7 +79,7 @@ allow a user-selected residue name (``mbuild.Compound.name``). If the methane is The orthogonal liquid box contains 1230 methane molecules and measures 4.5 nm in all the x, y, and z-dimensions. -.. code:: ipython +.. code:: ipython3 box_liq = mb.fill_box(compound=methane, n_compounds=1230, diff --git a/docs/getting_started/quick_start/load_files.rst b/docs/getting_started/quick_start/load_files.rst index afd07452f..0c9af1019 100644 --- a/docs/getting_started/quick_start/load_files.rst +++ b/docs/getting_started/quick_start/load_files.rst @@ -11,14 +11,14 @@ Create an ``mbuild.Compound`` (i.e., the "pentane" variable) by loading a molecu Import the required mbuild packages. -.. code:: ipython +.. code:: ipython3 import mbuild as mb Load the "pentane.mol2" file from its directory. -.. code:: ipython +.. code:: ipython3 pentane = mb.load("path_to_mol2_file/pentane.mol2") @@ -31,7 +31,7 @@ Build an ``mbuild.Compound`` (i.e., the "ETV_triclinic" variable) by loading a ` Import the required mbuild packages. -.. code:: ipython +.. code:: ipython3 import mbuild as mb from mbuild.lattice import load_cif @@ -40,7 +40,7 @@ Import the required mbuild packages. The `CIF `_ file is loaded using the ``load_cif`` function. Next, three (3) cell units shall be built for all the x, y, and z-dimensions with the populate function. Finally, the `CIF `_'s residues are named 'ETV'. -.. code:: ipython +.. code:: ipython3 lattice_cif_ETV_triclinic = load_cif("path_to_cif_file/ETV_triclinic.cif") ETV_triclinic = lattice_cif_ETV_triclinic.populate(x=3, y=3, z=3) diff --git a/docs/getting_started/quick_start/polymer_example.rst b/docs/getting_started/quick_start/polymer_example.rst index 02c73d7c6..ac567bfc9 100644 --- a/docs/getting_started/quick_start/polymer_example.rst +++ b/docs/getting_started/quick_start/polymer_example.rst @@ -6,7 +6,7 @@ Use two (2) different monomer units, A and B, to construct a polymer, capping it Import the required mbuild packages. -.. code:: ipython +.. code:: ipython3 import mbuild as mb from mbuild.lib.recipes.polymer import Polymer @@ -20,7 +20,7 @@ Set the `chain` as a ``Polymer`` class, adding `comp_1` and `comp_2` as the mono Setting the indices identifies which atoms will be removed and have ports created in their place. -.. code:: ipython +.. code:: ipython3 comp_1 = mb.load('CC', smiles=True) # mBuild compound of the monomer unit comp_2 = mb.load('COC', smiles=True) # mBuild compound of the monomer unit @@ -40,7 +40,7 @@ Select the carboxylic acid and amine end groups that we want to use for the head Then, build the polymer with three (3) iterations of the AB sequence, and the selected head and tail end groups. -.. code:: ipython +.. code:: ipython3 chain.add_end_groups(mb.load('C(=O)O',smiles=True), index=3, diff --git a/docs/getting_started/tutorials/tutorial_ethane.rst b/docs/getting_started/tutorials/tutorial_ethane.rst index a3b6293ec..48c2999b3 100644 --- a/docs/getting_started/tutorials/tutorial_ethane.rst +++ b/docs/getting_started/tutorials/tutorial_ethane.rst @@ -9,7 +9,7 @@ transforms. First, we need to import the mbuild package: -.. code:: ipython +.. code:: ipython3 import mbuild as mb @@ -23,7 +23,7 @@ connectivity information). Let’s start by reading a methyl group from a ``.pdb`` file: -.. code:: ipython +.. code:: ipython3 import mbuild as mb @@ -34,7 +34,7 @@ Let’s start by reading a methyl group from a ``.pdb`` file: Now let’s use our first coordinate transform to center the methyl at its carbon atom: -.. code:: ipython +.. code:: ipython3 import mbuild as mb @@ -49,7 +49,7 @@ typically points to a particle that the ``Port`` should be associated with. In our methyl group, the ``Port`` should be anchored to the carbon atom so that we can now form bonds to this carbon: -.. code:: ipython +.. code:: ipython3 import mbuild as mb @@ -66,14 +66,14 @@ By default, ``Ports`` are never output from the mBuild structure. However, it can be useful to look at a molecule with the ``Ports`` to check your work as you go: -.. code:: ipython +.. code:: ipython3 ch3.visualize(show_ports=True) Now we wrap the methyl group into a python class, so that we can reuse it as a component to build more complex molecules later. -.. code:: ipython +.. code:: ipython3 import mbuild as mb @@ -111,7 +111,7 @@ automatically chosen. Now the fun part: stick ’em together to create an ethane: -.. code:: ipython +.. code:: ipython3 ethane = mb.Compound() @@ -126,18 +126,18 @@ rotates and translates it such that two other ``Compounds`` overlap. Typically, as in this case, those two other ``Compounds`` are ``Ports`` - in our case, ``methyl1['up']`` and ``methyl2['up']``. -.. code:: ipython +.. code:: ipython3 ethane.visualize() -.. code:: ipython +.. code:: ipython3 ethane.visualize(show_ports=True) Similarly, if we want to make ethane a reusable component, we need to wrap it into a python class. -.. code:: ipython +.. code:: ipython3 import mbuild as mb @@ -151,12 +151,12 @@ wrap it into a python class. from_positions=self['methyl_1']['up'], to_positions=self['methyl_2']['up']) -.. code:: ipython +.. code:: ipython3 ethane = Ethane() ethane.visualize() -.. code:: ipython +.. code:: ipython3 # Save to .mol2 ethane.save('ethane.mol2', overwrite=True) diff --git a/docs/getting_started/tutorials/tutorial_lattice.rst b/docs/getting_started/tutorials/tutorial_lattice.rst index 1b7bf8510..2deba6ccc 100644 --- a/docs/getting_started/tutorials/tutorial_lattice.rst +++ b/docs/getting_started/tutorials/tutorial_lattice.rst @@ -58,7 +58,7 @@ desired crystal structures. To begin, we will call the python ``help()`` method to observe the parameters and attributes of the ``Lattice`` class. -.. code:: ipython +.. code:: ipython3 import mbuild help(mbuild.Lattice) @@ -79,7 +79,7 @@ ever get stuck, remember to use the python built-in ``help()`` method! For Example: - .. code:: ipython + .. code:: ipython3 lattice_spacing = [0.5, 0.5, 0.5] @@ -100,7 +100,7 @@ ever get stuck, remember to use the python built-in ``help()`` method! For example: Cubic Cell - .. code:: ipython + .. code:: ipython3 lattice_vectors = [[1, 0, 0], [0, 1, 0], [0, 0, 1]] @@ -112,7 +112,7 @@ ever get stuck, remember to use the python built-in ``help()`` method! For example: Cubic Cell - .. code:: ipython + .. code:: ipython3 angles = [90, 90, 90] @@ -140,7 +140,7 @@ ever get stuck, remember to use the python built-in ``help()`` method! For Example: FCC All Unique - .. code:: ipython + .. code:: ipython3 lattice_points = {'A' : [[0, 0, 0]], 'B' : [[0.5, 0.5, 0]], @@ -150,7 +150,7 @@ ever get stuck, remember to use the python built-in ``help()`` method! For Example: FCC All Same - .. code:: ipython + .. code:: ipython3 lattice_points = {'A' : [[0, 0, 0], [0.5, 0.5, 0], [0.5, 0, 0.5], [0, 0.5, 0.5]] } @@ -179,7 +179,7 @@ replications in the x, y, and z directions. For Example: FCC All Unique - .. code:: ipython + .. code:: ipython3 lattice_points = {'A' : [[0, 0, 0]], 'B' : [[0.5, 0.5, 0]], @@ -197,7 +197,7 @@ replications in the x, y, and z directions. For Example: FCC All Same - .. code:: ipython + .. code:: ipython3 lattice_points = {'A' : [[0, 0, 0], [0.5, 0.5, 0], [0.5, 0, 0.5], [0, 0.5, 0.5]] } @@ -217,7 +217,7 @@ Simple Cubic (SC) - Polonium -.. code:: ipython +.. code:: ipython3 import mbuild as mb import numpy as np @@ -250,7 +250,7 @@ Body-centered Cubic (BCC) - CsCl -.. code:: ipython +.. code:: ipython3 import mbuild as mb import numpy as np @@ -285,7 +285,7 @@ Face-centered Cubic (FCC) - Cu -.. code:: ipython +.. code:: ipython3 import mbuild as mb import numpy as np @@ -318,7 +318,7 @@ Diamond (Cubic) - Si -.. code:: ipython +.. code:: ipython3 import mbuild as mb import numpy as np @@ -352,7 +352,7 @@ Graphene (2D) - C -.. code:: ipython +.. code:: ipython3 import mbuild as mb import numpy as np diff --git a/docs/getting_started/tutorials/tutorial_methane.rst b/docs/getting_started/tutorials/tutorial_methane.rst index 0ae129b43..632ba0401 100644 --- a/docs/getting_started/tutorials/tutorial_methane.rst +++ b/docs/getting_started/tutorials/tutorial_methane.rst @@ -7,7 +7,7 @@ The primary building block in mBuild is a ``Compound``. Anything you construct will inherit from this class. Let’s start with some basic imports and initialization: -.. code:: ipython +.. code:: ipython3 import mbuild as mb @@ -21,7 +21,7 @@ hierarchy are referred to as ``Particles``. Note however, that this is purely semantic in mBuild to help clearly designate the bottom of a hierarchy. -.. code:: ipython +.. code:: ipython3 import mbuild as mb @@ -56,7 +56,7 @@ hydrogen. Note that for typical use cases, you will almost never have to explicitly define a bond when using mBuild - this is just to show you what’s going on under the hood: -.. code:: ipython +.. code:: ipython3 import mbuild as mb @@ -78,7 +78,7 @@ fancy label, it’s also referenceable via ``self['HC'][0]``. Alright now that we’ve got the basics, let’s finish building our ``Methane`` and take a look at it: -.. code:: ipython +.. code:: ipython3 import mbuild as mb @@ -101,12 +101,12 @@ Alright now that we’ve got the basics, let’s finish building our self.add_bond((self[0], self['HC'][2])) self.add_bond((self[0], self['HC'][3])) -.. code:: ipython +.. code:: ipython3 methane = Methane() methane.visualize() -.. code:: ipython +.. code:: ipython3 # Save to .mol2 methane.save('methane.mol2',overwrite=True) diff --git a/docs/getting_started/tutorials/tutorial_monolayer.rst b/docs/getting_started/tutorials/tutorial_monolayer.rst index 11c9eb5c7..0538a7b23 100644 --- a/docs/getting_started/tutorials/tutorial_monolayer.rst +++ b/docs/getting_started/tutorials/tutorial_monolayer.rst @@ -28,7 +28,7 @@ consistent! The more components we collect in our library with the same labeling conventions, the easier it becomes to build ever more complex structures. -.. code:: ipython +.. code:: ipython3 import mbuild as mb @@ -50,13 +50,13 @@ structures. # Hoist silane port to AlkylSilane level. self.add(silane['down'], 'down', containment=False) -.. code:: ipython +.. code:: ipython3 AlkylSilane(5).visualize() Now let’s create a substrate to which we can later attach our monomers: -.. code:: ipython +.. code:: ipython3 import mbuild as mb from mbuild.lib.surfaces import Betacristobalite @@ -72,7 +72,7 @@ library. The ``TiledCompound`` tool allows you replicate any Next, let’s create our monomer and a hydrogen atom that we’ll place on unoccupied surface sites: -.. code:: ipython +.. code:: ipython3 from mbuild.lib.atoms import H alkylsilane = AlkylSilane(chain_length=10) @@ -87,7 +87,7 @@ figures out what the closest ports are to the pattern points and then attaches copies of the guest onto the binding sites identified by the pattern: -.. code:: ipython +.. code:: ipython3 pattern = mb.Grid2DPattern(8, 8) # Evenly spaced, 2D grid of points. @@ -98,12 +98,12 @@ Also note the ``backfill`` optional argument which allows you to place a different compound on any unused ports. In this case we want to backfill with hydrogen atoms on every port without a chain. -.. code:: ipython +.. code:: ipython3 monolayer = mb.Compound([tiled_surface, chains, hydrogens]) monolayer.visualize() # Warning: may be slow in IPython notebooks -.. code:: ipython +.. code:: ipython3 # Save as .mol2 file monolayer.save('monolayer.mol2', overwrite=True) @@ -111,7 +111,7 @@ with hydrogen atoms on every port without a chain. ``lib.recipes.monolayer.py`` wraps many these functions into a simple, general class for generating the monolayers, as shown below: -.. code:: ipython +.. code:: ipython3 from mbuild.lib.recipes import Monolayer diff --git a/docs/getting_started/tutorials/tutorial_polymers.rst b/docs/getting_started/tutorials/tutorial_polymers.rst index 7e9069ab4..179c5c530 100644 --- a/docs/getting_started/tutorials/tutorial_polymers.rst +++ b/docs/getting_started/tutorials/tutorial_polymers.rst @@ -17,7 +17,7 @@ importing the coordinates from a pdb file, as in the previous example, we will instead explicitly define them in the class. Recall that distance units are nm in mBuild. -.. code:: ipython +.. code:: ipython3 import mbuild as mb @@ -60,7 +60,7 @@ given in radians. Similarly, the ports should be rotated around the x-axis by the same amount so that atoms can be added in a realistic orientation. -.. code:: ipython +.. code:: ipython3 import numpy as np import mbuild as mb @@ -108,7 +108,7 @@ make a copy. The ``force_overlap()`` function is used to connect the ``'up'`` port from ``current_monomer`` to the ``'down'`` port of ``last_mononer``. -.. code:: ipython +.. code:: ipython3 class AlkanePolymer(mb.Compound): def __init__(self): @@ -135,7 +135,7 @@ We can also add a variable ``chain_length`` both to the for loop and ``init`` that will allow the length of the polymer to be adjusted when the class is instantiated. -.. code:: ipython +.. code:: ipython3 import numpy as np import mbuild as mb @@ -182,7 +182,7 @@ the class is instantiated. self.add(current_monomer) last_monomer=current_monomer -.. code:: ipython +.. code:: ipython3 polymer = AlkanePolymer(chain_length=10) polymer.visualize(show_ports=True) @@ -211,7 +211,7 @@ A simple hexane molecule is built using ``mBuild``'s packaged polymer builder. This is done by loading a methane molecule via a SMILES string. The indices are explicitly selected, so the molecule builds out in the proper directions and does not overlap. -.. code:: ipython +.. code:: ipython3 import mbuild as mb from mbuild.lib.recipes.polymer import Polymer @@ -235,7 +235,7 @@ The end groups are added via the ``add_end_groups`` attribute, specifying the at the location of each end group (``label``), and if the tail end group is duplicated to the head of the polymer (``duplicate``). The indices are explicitly selected, so the molecule builds out in the proper directions and does not overlap. -.. code:: ipython +.. code:: ipython3 from mbuild.lib.recipes.polymer import Polymer import mbuild as mb @@ -275,7 +275,7 @@ constructed above and translating and/or rotating the alkanes in space. ``mBuild`` provides many routines that can be used to create different patterns, to which the polymers can be shifted. -.. code:: ipython +.. code:: ipython3 comp = mb.load('C', smiles=True) # mBuild compound of the monomer unit polymer = Polymer() @@ -311,7 +311,7 @@ patterns, to which the polymers can be shifted. Other patterns can be used, e.g., the ``Grid3DPattern``. We can also use the rotation commands to randomize the orientation. -.. code:: ipython +.. code:: ipython3 import random @@ -344,7 +344,7 @@ the rotation commands to randomize the orientation. ``mBuild`` also provides an interface to ``PACKMOL``, allowing the creation of a randomized configuration. -.. code:: ipython +.. code:: ipython3 comp = mb.load('C', smiles=True) # mBuild compound of the monomer unit polymer = Polymer() @@ -373,7 +373,7 @@ amount of perturbation. Note that large values of ``delta`` may result in the chain overlapping itself, as ``mBuild`` does not currently include routines to exclude such overlaps. -.. code:: ipython +.. code:: ipython3 import mbuild as mb diff --git a/docs/getting_started/tutorials/tutorial_simple_LJ.rst b/docs/getting_started/tutorials/tutorial_simple_LJ.rst index 812085bd2..0afb4f5d1 100644 --- a/docs/getting_started/tutorials/tutorial_simple_LJ.rst +++ b/docs/getting_started/tutorials/tutorial_simple_LJ.rst @@ -12,7 +12,7 @@ Note, the color and radius associated with a Particle name can be set and passed to the visualize command. Colors are passed in hex format (see http://www.color-hex.com/color/bfbfbf). -.. code:: ipython +.. code:: ipython3 import mbuild as mb @@ -63,7 +63,7 @@ translating to the specified location. Since the lj_proto particle in this example starts at the origin, these two commands produce identical behavior. -.. code:: ipython +.. code:: ipython3 import mbuild as mb @@ -91,7 +91,7 @@ in pattern, cloning, translating, and adding to the system. Note, because Grid3DPattern defines points between 0 and 1, they must be scaled based on the desired system size, i.e., pattern.scale(2). -.. code:: ipython +.. code:: ipython3 import mbuild as mb @@ -115,7 +115,7 @@ Larger systems can therefore be easily generated by toggling the values given to Grid3DPattern. Other patterns can also be generated using the same basic code, such as a 2D grid pattern: -.. code:: ipython +.. code:: ipython3 import mbuild as mb @@ -142,7 +142,7 @@ Note to show both simultaneously, we shift the x-coordinate of Particles in the sphere by -1 (i.e., pos[0]-=1.0) and +1 for the disk (i.e, pos[0]+=1.0). -.. code:: ipython +.. code:: ipython3 import mbuild as mb @@ -177,7 +177,7 @@ corresponds to the sphere (class SphereLJ), and one that corresponds to the disk (class DiskLJ), and then instantiate and shift each of these individually in the MonoLJ component. -.. code:: ipython +.. code:: ipython3 import mbuild as mb @@ -229,7 +229,7 @@ Again, since mBuild is hierarchical, the pattern functions can be used to generate large systems of any arbitary component. For example, we can replicate the SphereLJ component on a regular array. -.. code:: ipython +.. code:: ipython3 import mbuild as mb @@ -270,7 +270,7 @@ command allows a compound to be rotated, in place, about a specific axis (i.e., it considers the origin for the rotation to lie at the compound’s center of mass). -.. code:: ipython +.. code:: ipython3 import mbuild as mb import random @@ -319,7 +319,7 @@ Configurations can be dumped to file using the save command; this takes advantage of MDTraj and supports a range of file formats (see http://MDTraj.org). -.. code:: ipython +.. code:: ipython3 #save as xyz file monoLJ.save('output.xyz') From b9f45dede26bc2077e3962fc96757e88788daacb Mon Sep 17 00:00:00 2001 From: Co Quach Date: Fri, 8 Mar 2024 15:48:16 -0600 Subject: [PATCH 12/12] add ipython to docs env --- docs/docs-env.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/docs-env.yml b/docs/docs-env.yml index 3f4897af5..24ada5ee0 100644 --- a/docs/docs-env.yml +++ b/docs/docs-env.yml @@ -5,6 +5,7 @@ channels: dependencies: - importlib_resources - python=3.11 + - ipython - pip - pip: - boltons