{ "cells": [ { "cell_type": "markdown", "id": "312d59a5", "metadata": {}, "source": [ "# Program structure" ] }, { "cell_type": "code", "execution_count": 5, "id": "984c876f", "metadata": { "scrolled": true }, "outputs": [], "source": [ "import veloxchem as vlx" ] }, { "cell_type": "markdown", "id": "ab48cf37", "metadata": {}, "source": [ "The VeloxChem program adopts a layered Python/C++ language structure. \n", "\n", "```{image} ../images/code-structure.png\n", ":alt: veloxchem-structure\n", ":class: bg-primary mb-1\n", ":width: 600px\n", ":align: center\n", "```\n", "\n", "You can use the standard functions to get a more detailed view of the Python layer. The `help` function will give you a package description, stating the copyright agreement." ] }, { "cell_type": "code", "execution_count": 6, "id": "e5718d36", "metadata": { "tags": [ "output_scroll" ] }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Help on package veloxchem:\n", "\n", "NAME\n", " veloxchem\n", "\n", "DESCRIPTION\n", " # VELOXCHEM 1.0-RC2\n", " # ----------------------------------------------------\n", " # An Electronic Structure Code\n", " #\n", " # Copyright © 2018-2021 by VeloxChem developers. All rights reserved.\n", " # Contact: https://veloxchem.org/contact\n", " #\n", " # SPDX-License-Identifier: LGPL-3.0-or-later\n", " #\n", " # This file is part of VeloxChem.\n", " #\n", " # VeloxChem is free software: you can redistribute it and/or modify it under\n", " # the terms of the GNU Lesser General Public License as published by the Free\n", " # Software Foundation, either version 3 of the License, or (at your option)\n", " # any later version.\n", " #\n", " # VeloxChem is distributed in the hope that it will be useful, but WITHOUT\n", " # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or\n", " # FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public\n", " # License for more details.\n", " #\n", " # You should have received a copy of the GNU Lesser General Public License\n", " # along with VeloxChem. If not, see .\n", "\n", "PACKAGE CONTENTS\n", " __main__\n", " aodensitymatrix\n", " aofockmatrix\n", " batchsize\n", " blockdavidson\n", " c2diis\n", " c6solver\n", " checkpoint\n", " cli\n", " cppsolver\n", " cubicgrid\n", " denguess\n", " deprecations\n", " distributedarray\n", " environ\n", " errorhandler\n", " excitondriver\n", " gradientdriver\n", " inputparser\n", " linearsolver\n", " loprop\n", " lreigensolver\n", " lrsolver\n", " main\n", " mointsdriver\n", " molecularbasis\n", " molecularorbitals\n", " molecule\n", " mp2driver\n", " mpitask\n", " optimizationdriver\n", " optimizationengine\n", " outputstream\n", " polembed\n", " profiler\n", " pulsedrsp\n", " qqscheme\n", " rspabsorption\n", " rspc6\n", " rspcdspec\n", " rspcustomproperty\n", " rspdriver\n", " rsplinabscross\n", " rsppolarizability\n", " rspproperty\n", " rsptpa\n", " scfdriver\n", " scffirstorderprop\n", " scfgradientdriver\n", " scfrestdriver\n", " scfunrestdriver\n", " signalhandler\n", " slurminfo\n", " subcommunicators\n", " tdaexcidriver\n", " tpadriver\n", " tpafulldriver\n", " tpareddriver\n", " veloxchemlib\n", " visualizationdriver\n", " xtbdriver\n", " xtbgradientdriver\n", "\n", "FUNCTIONS\n", " ao_matrix_to_dalton(...) method of builtins.PyCapsule instance\n", " ao_matrix_to_dalton(arg0: CDenseMatrix, arg1: veloxchem.veloxchemlib.MolecularBasis, arg2: veloxchem.veloxchemlib.Molecule) -> CDenseMatrix\n", " \n", " ao_matrix_to_veloxchem(...) method of builtins.PyCapsule instance\n", " ao_matrix_to_veloxchem(arg0: CDenseMatrix, arg1: veloxchem.veloxchemlib.MolecularBasis, arg2: veloxchem.veloxchemlib.Molecule) -> CDenseMatrix\n", " \n", " bohr_in_angstroms(...) method of builtins.PyCapsule instance\n", " bohr_in_angstroms() -> float\n", " \n", " hartree_in_ev(...) method of builtins.PyCapsule instance\n", " hartree_in_ev() -> float\n", " \n", " hartree_in_kcalpermol(...) method of builtins.PyCapsule instance\n", " hartree_in_kcalpermol() -> float\n", " \n", " mathconst_pi(...) method of builtins.PyCapsule instance\n", " mathconst_pi() -> float\n", " \n", " mpi_initialized(...) method of builtins.PyCapsule instance\n", " mpi_initialized() -> bool\n", " \n", " mpi_master(...) method of builtins.PyCapsule instance\n", " mpi_master() -> int\n", "\n", "DATA\n", " __deployed__ = {'author': 'Roberto Di Remigio', 'commit': 'ffa16d355ed...\n", "\n", "VERSION\n", " 1.0rc2\n", "\n", "FILE\n", " /opt/miniconda3/envs/vlxr02/lib/python3.9/site-packages/veloxchem/__init__.py\n", "\n", "\n" ] } ], "source": [ "help(vlx)" ] }, { "cell_type": "markdown", "id": "5e2aeae3", "metadata": {}, "source": [ "## Classes\n", "\n", "The functionality of VeloxChem is built into the classes it implements. An overview of the available classes is provided with the `dir` function." ] }, { "cell_type": "code", "execution_count": 7, "id": "8634b6fd", "metadata": { "tags": [ "output_scroll" ] }, "outputs": [ { "data": { "text/plain": [ "['AODensityMatrix',\n", " 'AOFockMatrix',\n", " 'Absorption',\n", " 'AtomBasis',\n", " 'BasisFunction',\n", " 'BlockDavidsonSolver',\n", " 'C6',\n", " 'C6Solver',\n", " 'CircularDichroismSpectrum',\n", " 'ComplexResponse',\n", " 'CubicGrid',\n", " 'CustomProperty',\n", " 'DenseMatrix',\n", " 'DispersionModel',\n", " 'ElectricDipoleIntegralsDriver',\n", " 'ElectronRepulsionIntegralsDriver',\n", " 'ExcitationVector',\n", " 'ExcitonModelDriver',\n", " 'InputParser',\n", " 'KineticEnergyIntegralsDriver',\n", " 'LinearAbsorptionCrossSection',\n", " 'LinearResponseEigenSolver',\n", " 'LinearResponseSolver',\n", " 'LoPropDriver',\n", " 'MOIntegralsDriver',\n", " 'MOIntsBatch',\n", " 'MolecularBasis',\n", " 'MolecularOrbitals',\n", " 'Molecule',\n", " 'Mp2Driver',\n", " 'MpiTask',\n", " 'NuclearPotentialIntegralsDriver',\n", " 'OptimizationDriver',\n", " 'OutputStream',\n", " 'OverlapIntegralsDriver',\n", " 'Polarizability',\n", " 'ResponseDriver',\n", " 'ResponseProperty',\n", " 'SADGuessDriver',\n", " 'ScfFirstOrderProperties',\n", " 'ScfGradientDriver',\n", " 'ScfRestrictedDriver',\n", " 'ScfUnrestrictedDriver',\n", " 'SubCommunicators',\n", " 'TDAExciDriver',\n", " 'TwoIndexes',\n", " 'VisualizationDriver',\n", " 'XTBDriver',\n", " 'XTBGradientDriver',\n", " '__builtins__',\n", " '__cached__',\n", " '__deployed__',\n", " '__doc__',\n", " '__file__',\n", " '__loader__',\n", " '__name__',\n", " '__package__',\n", " '__path__',\n", " '__spec__',\n", " '__version__',\n", " 'ao_matrix_to_dalton',\n", " 'ao_matrix_to_veloxchem',\n", " 'aodensitymatrix',\n", " 'aofockmatrix',\n", " 'assert_msg_critical',\n", " 'batchsize',\n", " 'blockdavidson',\n", " 'bohr_in_angstroms',\n", " 'c2diis',\n", " 'c6solver',\n", " 'checkpoint',\n", " 'cppsolver',\n", " 'cubicgrid',\n", " 'denguess',\n", " 'denmat',\n", " 'deprecations',\n", " 'distributedarray',\n", " 'environ',\n", " 'ericut',\n", " 'errorhandler',\n", " 'excitondriver',\n", " 'fockmat',\n", " 'get_basis_path',\n", " 'get_qq_scheme',\n", " 'get_qq_type',\n", " 'gradientdriver',\n", " 'hartree_in_ev',\n", " 'hartree_in_kcalpermol',\n", " 'inputparser',\n", " 'linearsolver',\n", " 'loprop',\n", " 'lreigensolver',\n", " 'lrsolver',\n", " 'mathconst_pi',\n", " 'moints',\n", " 'mointsdriver',\n", " 'molecularbasis',\n", " 'molecularorbitals',\n", " 'molecule',\n", " 'molorb',\n", " 'mp2driver',\n", " 'mpi_initialized',\n", " 'mpi_master',\n", " 'mpitask',\n", " 'optimizationdriver',\n", " 'optimizationengine',\n", " 'outputstream',\n", " 'profiler',\n", " 'qqscheme',\n", " 'rspabsorption',\n", " 'rspc6',\n", " 'rspcdspec',\n", " 'rspcustomproperty',\n", " 'rspdriver',\n", " 'rsplinabscross',\n", " 'rsppolarizability',\n", " 'rspproperty',\n", " 'scfdriver',\n", " 'scffirstorderprop',\n", " 'scfgradientdriver',\n", " 'scfrestdriver',\n", " 'scfunrestdriver',\n", " 'set_omp_num_threads',\n", " 'set_vlxbasispath',\n", " 'signalhandler',\n", " 'subcommunicators',\n", " 'szblock',\n", " 'tdaexcidriver',\n", " 'tpadriver',\n", " 'tpafulldriver',\n", " 'tpareddriver',\n", " 'veloxchemlib',\n", " 'visualizationdriver',\n", " 'xtbdriver',\n", " 'xtbgradientdriver']" ] }, "execution_count": 7, "metadata": {}, "output_type": "execute_result" } ], "source": [ "dir(vlx)" ] }, { "cell_type": "markdown", "id": "ac3f5f28", "metadata": {}, "source": [ "Information about a specific class is available from the docstring." ] }, { "cell_type": "code", "execution_count": 11, "id": "e6abf4b5", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\n", " Implements spin unrestricted open shell SCF method with C2-DIIS and\n", " two-level C2-DIIS convergence accelerators.\n", "\n", " :param comm:\n", " The MPI communicator.\n", " :param ostream:\n", " The output stream.\n", " \n" ] } ], "source": [ "print(vlx.ScfUnrestrictedDriver.__doc__)" ] }, { "cell_type": "markdown", "id": "b9a93350", "metadata": {}, "source": [ "## Methods and properties\n", "\n", "The actual calculations are performed by the methods in the classes. To list the properties and methods of a class, the `dir` function can be used as follows." ] }, { "cell_type": "code", "execution_count": 8, "id": "5234a031", "metadata": { "scrolled": true, "tags": [ "output_scroll" ] }, "outputs": [ { "data": { "text/plain": [ "['__class__',\n", " '__delattr__',\n", " '__dict__',\n", " '__dir__',\n", " '__doc__',\n", " '__eq__',\n", " '__format__',\n", " '__ge__',\n", " '__getattribute__',\n", " '__gt__',\n", " '__hash__',\n", " '__init__',\n", " '__init_subclass__',\n", " '__le__',\n", " '__lt__',\n", " '__module__',\n", " '__ne__',\n", " '__new__',\n", " '__reduce__',\n", " '__reduce_ex__',\n", " '__repr__',\n", " '__setattr__',\n", " '__sizeof__',\n", " '__str__',\n", " '__subclasshook__',\n", " '__weakref__',\n", " 'add_iter_data',\n", " 'check_convergence',\n", " 'comp_2e_fock',\n", " 'comp_2e_fock_single_comm',\n", " 'comp_2e_fock_split_comm',\n", " 'comp_density_change',\n", " 'comp_diis',\n", " 'comp_energy',\n", " 'comp_full_fock',\n", " 'comp_gradient',\n", " 'comp_guess_density',\n", " 'comp_npot_mat_split_comm',\n", " 'comp_one_ints',\n", " 'compute',\n", " 'compute_s2',\n", " 'delete_mos',\n", " 'gen_molecular_orbitals',\n", " 'gen_new_density',\n", " 'get_acc_type',\n", " 'get_dyn_threshold',\n", " 'get_effective_fock',\n", " 'get_guess_type',\n", " 'get_qq_dyn',\n", " 'get_scaled_fock',\n", " 'get_scf_energy',\n", " 'get_scf_range',\n", " 'get_scf_type',\n", " 'graceful_exit',\n", " 'need_graceful_exit',\n", " 'print_energy_components',\n", " 'print_ground_state',\n", " 'print_header',\n", " 'print_iter_data',\n", " 'print_scf_energy',\n", " 'print_scf_finish',\n", " 'print_scf_title',\n", " 'set_skip_iter_flag',\n", " 'store_diis_data',\n", " 'update_fock_type',\n", " 'update_mol_orbs_phase',\n", " 'update_settings',\n", " 'write_checkpoint']" ] }, "execution_count": 8, "metadata": {}, "output_type": "execute_result" } ], "source": [ "dir(vlx.ScfRestrictedDriver)" ] } ], "metadata": { "celltoolbar": "Tags", "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.9.5" } }, "nbformat": 4, "nbformat_minor": 5 }