From d772a038bf6f6081794e403011de27e803678f8e Mon Sep 17 00:00:00 2001 From: Corin Wagen Date: Mon, 13 Jul 2020 16:49:44 -0400 Subject: [PATCH] update dox --- docs/recipe_01.rst | 13 ++++++++++++- docs/recipe_03.rst | 19 ++++++++++++++++++- docs/recipe_04.rst | 2 ++ docs/recipe_06.rst | 12 ++++++++++-- docs/recipe_08.rst | 21 +++++++++++++++++++++ setup.py | 4 ++-- 6 files changed, 65 insertions(+), 6 deletions(-) diff --git a/docs/recipe_01.rst b/docs/recipe_01.rst index f78fe13..e1d4716 100644 --- a/docs/recipe_01.rst +++ b/docs/recipe_01.rst @@ -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 `. +- Bespoke basis sets can be downloaded automatically from the `Basis Set Exchange ` _. - 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. @@ -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") diff --git a/docs/recipe_03.rst b/docs/recipe_03.rst index 5f9e2a1..cf4969c 100644 --- a/docs/recipe_03.rst +++ b/docs/recipe_03.rst @@ -1,7 +1,7 @@ .. _recipe_03: ========================================== -Measuring and Setting Internal Coordinates +Manipulating Molecule Objects ========================================== - ``import cctk`` is assumed @@ -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 """""""""""""""""""""""""""" @@ -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) + diff --git a/docs/recipe_04.rst b/docs/recipe_04.rst index af7d265..9432819 100644 --- a/docs/recipe_04.rst +++ b/docs/recipe_04.rst @@ -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) diff --git a/docs/recipe_06.rst b/docs/recipe_06.rst index 4936f5d..7206cfa 100644 --- a/docs/recipe_06.rst +++ b/docs/recipe_06.rst @@ -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] diff --git a/docs/recipe_08.rst b/docs/recipe_08.rst index ff67fac..7492235 100644 --- a/docs/recipe_08.rst +++ b/docs/recipe_08.rst @@ -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}] diff --git a/setup.py b/setup.py index 86be86d..471754d 100644 --- a/setup.py +++ b/setup.py @@ -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',