Skip to content

Commit

Permalink
update dox
Browse files Browse the repository at this point in the history
  • Loading branch information
corinwagen committed Jul 13, 2020
1 parent c08b823 commit d772a03
Show file tree
Hide file tree
Showing 6 changed files with 65 additions and 6 deletions.
13 changes: 12 additions & 1 deletion docs/recipe_01.rst
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ Writing Multiple Molecules to One Gaussian Input File
Using Custom Basis Sets from the Basis Set Exchange
""""""""""""""""""""""""""""""""""""""""""""""""""""

- Bespoke basis sets can be downloaded automatically from the `Basis Set Exchange <https://www.basissetexchange.org/>`.
- Bespoke basis sets can be downloaded automatically from the `Basis Set Exchange <https://www.basissetexchange.org/>` _.
- By default, the ``add_custom_basis_set`` method appends the basis set to the footer. However,
passing the ``return_string`` option allows for increased control over formatting (e.g. for combination with ``opt=modredundant``).
- The ``gen`` keyword should be used in combination with these basis sets.
Expand All @@ -149,3 +149,14 @@ Using Custom Basis Sets from the Basis Set Exchange
basis = file2.add_custom_basis_set("pcseg-2", return_string=True)
file2.footer = f"B 1 10 F\n\n{basis}"

"""""""""""""""""""""""""""
Creating Molecules By Name
""""""""""""""""""""""""""

- If ``rdkit`` is installed, then molecules can be created from a name or SMILES string. Structures should be checked for sanity!

::

imatinib = cctk.Molecule.new_from_name("imatinib")

phcf3 = cctk.Molecule.new_from_smiles("C1=CC=C(C=C1)C(F)(F)F")
19 changes: 18 additions & 1 deletion docs/recipe_03.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
.. _recipe_03:

==========================================
Measuring and Setting Internal Coordinates
Manipulating Molecule Objects
==========================================

- ``import cctk`` is assumed
Expand Down Expand Up @@ -29,6 +29,10 @@ Measuring Distances and Angles
# alternately, all get_ or set_ methods will also take a list of atom numbers
dihedral_angle = molecule.get_dihedral(atoms=[1, 2, 3, 4])


# you can also get the volume!
vol = molecule.volume()

""""""""""""""""""""""""""""
Setting Distances and Angles
""""""""""""""""""""""""""""
Expand Down Expand Up @@ -80,4 +84,17 @@ Checking For Clashes

no_clashes_present = molecule.check_for_conflicts()
""""""""""""""""""""""""""""
Generating Non-Ground States
""""""""""""""""""""""""""""

- The output of a frequency job can be used to generate molecules with realistic non-equilibrium geometries.

::

import cctk.quasiclassical as qc

# returns a new Molecule object and the energy above the ground state, sampled from the relevant Boltzmann distribution
perturbed_molecule, energy = qc.get_quasiclassical_perturbation(molecule, temp=350)


2 changes: 2 additions & 0 deletions docs/recipe_04.rst
Original file line number Diff line number Diff line change
Expand Up @@ -57,5 +57,7 @@ Renumbering Molecules
assert isinstance(mol1, cctk.Molecule)
assert isinstance(mol2, cctk.Molecule)

assert cctk.Molecule.are_isomorphic(mol1, mol2)

mol2 = mol2.renumber_to_match(mol1)

12 changes: 10 additions & 2 deletions docs/recipe_06.rst
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,17 @@ Chemical Shifts
# note: 1-indexed
shieldings = ensemble[:,"isotropic_shielding"]

# can automatically detect symmetric atoms from methyl, isopropyl, or tert-butyl groups
molecule = ensemble.molecules[-1].assign_connectivity()
symmetric = molecule.get_symmetric_atoms() # [[32, 33, 34], [37, 38, 39]]

# linearly scale to get shifts
scaled_shifts, shift_labels = cctk.helper_functions.scale_nmr_shifts(ensemble,
symmetrical_atom_numbers=[[37,38,39],[32,33,34]], scaling_factors="default")
scaled_shifts, shift_labels = cctk.helper_functions.scale_nmr_shifts(
ensemble,
symmetrical_atom_numbers=symmetric,
scaling_factors="default"
)

expected_shifts = [6.52352,6.6285,6.51045,6.53005,6.22303,2.11021,2.7025,2.73022,2.38541,2.35172,3.1467,5.82979,
3.29202,1.92326,114.924,98.3836,107.641,94.3333,104.421,109.795,95.1041,112.168,121.346,
45.4898,14.1014,26.7028,36.3779,29.4323,104.708,155.804,38.0661,109.579,22.7099]
Expand Down
21 changes: 21 additions & 0 deletions docs/recipe_08.rst
Original file line number Diff line number Diff line change
Expand Up @@ -95,3 +95,24 @@ Epimerization

# exchanges substituent atoms sub1 and sub2 (and attached groups) around atom center
enantiomer = molecule.epimerize(center, sub1, sub2)


"""""""""""""""""
Detecting Groups
""""""""""""""""

- *cctk* can search within existing molecules for groups and return the relevant atom numbers.

::

import cctk.topology as top
from cctk.load_groups import load_group

methyl = cctk.load_group("methyl")
camphor = cctk.Molecule.new_from_name("camphor").assign_connectivity()

top.find_group(camphor, methyl)
# returns a list of dictionaries
# each element is a mapping from atomic numbers of camphor (keys) to atomic numbers of the group (values)
# in this case, camphor contains 3 methyl groups, so there are 3 matches
# [{1: 1, 12: 3, 13: 4, 14: 5}, {3: 1, 16: 3, 17: 4, 15: 5}, {8: 1, 24: 3, 25: 4, 23: 5}]
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@
packages=["cctk", "cctk.data", "cctk.groups"],
# include_package_data=True,
package_data={"cctk.data": ["*"], "cctk.groups": ["*"],},
version="v0.2.4",
version="v0.2.5",
license="Apache 2.O",
description="computational chemistry toolkit",
author="Corin Wagen and Eugene Kwan",
author_email="corin.wagen@gmail.com",
url="https://github.com/ekwan/cctk",
download_url="https://github.com/ekwan/cctk/archive/v0.2.4.tar.gz",
download_url="https://github.com/ekwan/cctk/archive/v0.2.5.tar.gz",
install_requires=["numpy", "networkx", "importlib_resources", "scipy", "pyahocorasick", "basis_set_exchange"],
long_description=long_description,
long_description_content_type='text/markdown',
Expand Down

0 comments on commit d772a03

Please sign in to comment.