Giter Club home page Giter Club logo

qcdb's Introduction

Status GHA build Codecov coverage LGTM analysis
Communication docs latest dev chat on slack
Foundation license platforms python

Example

A simple example of QCDB's capabilities is as follows:

>>> import qcdb

>>> mol = qcdb.set_molecule("""
O
H 1 0.96
H 1 0.96 2 104.5
""")

>>> qcdb.set_keywords({
    "freeze_core": True,
})

These input specifications plus a model chemistry can be executed with energy(), gradient(), or hessian() API functions along with a program specifier:

>>> ene = qcdb.energy("c4-mp2/cc-pvdz")
>>> ene
-76.22847548367803
>>> print(qcdb.print_variables())

  Variable Map:
  ----------------------------------------------------------------------------
  "CURRENT CORRELATION ENERGY"           =>      -0.201821821791 [Eh]
  "CURRENT ENERGY"                       =>     -76.228475483678 [Eh]
  "CURRENT REFERENCE ENERGY"             =>     -76.026653661887 [Eh]
  "HF TOTAL ENERGY"                      =>     -76.026653661887 [Eh]
  "MP2 CORRELATION ENERGY"               =>      -0.201821821791 [Eh]
  "MP2 DOUBLES ENERGY"                   =>      -0.201821821791 [Eh]
  "MP2 OPPOSITE-SPIN CORRELATION ENERGY" =>      -0.151079672317 [Eh]
  "MP2 SAME-SPIN CORRELATION ENERGY"     =>      -0.050742149474 [Eh]
  "MP2 SINGLES ENERGY"                   =>       0.000000000000 [Eh]
  "MP2 TOTAL ENERGY"                     =>     -76.228475483678 [Eh]
  "N ALPHA ELECTRONS"                    =>       5.000000000000 []
  "N ATOMS"                              =>       3.000000000000 [Eh]
  "N BASIS FUNCTIONS"                    =>      24.000000000000 []
  "N BETA ELECTRONS"                     =>       5.000000000000 []
  "N MOLECULAR ORBITALS"                 =>      24.000000000000 []
  "NUCLEAR REPULSION ENERGY"             =>       9.168193296400 [Eh]
  "SCS(N)-MP2 CORRELATION ENERGY"        =>      -0.089306183074 [Eh]
  "SCS(N)-MP2 TOTAL ENERGY"              =>     -76.115959844961 [Eh]
  "SCS-MP2 CORRELATION ENERGY"           =>      -0.198209656605 [Eh]
  "SCS-MP2 TOTAL ENERGY"                 =>     -76.224863318492 [Eh]

For a fuller record of the computation, request the AtomicResult-like return

>>> ene, ret = qcdb.energy("c4-mp2/cc-pvdz", return_wfn=True)
>>> ret["return_result"]
-76.228475483678

>>> ret["properties"]["mp2_correlation_energy"]
-0.201821821791

>>> ret["provenance"]["cpu"]
'Intel(R) Xeon(R) CPU E5-2630 v4 @ 2.20GHz'

The accustomed output (and generated input) are also accessible

>>> >>> pprint.pprint(ret["stdout"], width=200)
(' --invoking executable--\n'
 '/home/psilocaluser/gits/cfour-public/bin/xjoda\n'
 '\n'
 '\n'
 '   *************************************************************************\n'
 '         <<<     CCCCCC     CCCCCC   |||     CCCCCC     CCCCCC   >>>\n'
 '       <<<      CCC        CCC       |||    CCC        CCC         >>>\n'
 '      <<<      CCC        CCC        |||   CCC        CCC            >>>\n'
 '    <<<        CCC        CCC        |||   CCC        CCC              >>>\n'
 '      <<<      CCC        CCC        |||   CCC        CCC            >>>\n'
 '       <<<      CCC        CCC       |||    CCC        CCC         >>>\n'
 '         <<<     CCCCCC     CCCCCC   |||     CCCCCC     CCCCCC   >>>\n'
 '   *************************************************************************\n'
 '\n'
 '     ****************************************************************\n'
 '     * CFOUR Coupled-Cluster techniques for Computational Chemistry *\n'
 '     ****************************************************************\n'
 ' \n'
 '\n'
 '   Department of Chemistry                Institut fuer Physikalische Chemie\n'
 '   University of Florida                  Universitaet Mainz\n'
 '   Gainesville, FL 32611, USA             D-55099 Mainz, Germany\n'
 '\n'
 '   Department of Chemistry                Fakultaet fuer Chemie und Biowiss.\n'
 '   Johns Hopkins University               Karlsruher Institut fuer Technologie\n'
 '   Baltimore, MD 21218, USA               D-76131 Karlsruhe, Germany\n'
 '\n'
 '   Department of Chemistry                Department of Physical Chemistry\n'
 '   Southern Methodist University          Eotvos Lorand University\n'
 '   Dallas, TX 75275, USA                  H-1053 Budapest, Hungary\n'
 '\n'
 ' \n'
 '                       Version 2.1\n'
 ' \n'
 '                     psinet                                            \n'
 '                     Thu Sep  9 15:52:23 EDT 2021                      \n'
 '                     integer*8 version is running\n'
 ' \n'
 '********************************************************************************\n'
 '*                          Input from ZMAT file                                *\n'
 '********************************************************************************\n'
 'auto-generated by QCElemental from molecule H2O                                 \n'
 'O                     0.000000000000     0.000000000000    -0.124297814080      \n'
 'H                     0.000000000000    -1.434419274846     0.986348254917      \n'
 'H                     0.000000000000     1.434419274846     0.986348254917      \n'
 '                                                                                \n'
 '                                                                                \n'
 '*CFOUR(BASIS=SPECIAL                                                            \n'
 'CALC_LEVEL=MP2                                                                  \n'
 'CHARGE=0                                                                        \n'
 'COORDINATES=CARTESIAN                                                           \n'
 'DERIV_LEVEL=ZERO                                                                \n'
 'FROZEN_CORE=1                                                                   \n'
 'MEMORY_SIZE=2694957760                                                          \n'
 'MEM_UNIT=INTEGERWORDS                                                           \n'
 'MULTIPLICITY=1                                                                  \n'
 'SCF_DAMPING=0                                                                   \n'
 'SCF_MAXCYC=100                                                                  \n'
 'SPHERICAL=1                                                                     \n'
 'UNITS=BOHR)                                                                     \n'
 '                                                                                \n'
 'O:CD_1                                                                          \n'
 'H:CD_2                                                                          \n'
 'H:CD_3                                                                          \n'
 '                                                                                \n'
 '********************************************************************************\n'
 
 ...
 
 '********************************************************************************\n'
 '   The full molecular point group is C2v .\n'
 '   The largest Abelian subgroup of the full molecular point group is C2v .\n'
 '   The computational point group is C2v .\n'
 '********************************************************************************\n'
 '\n'
 '\n'
 ' ----------------------------------------------------------------\n'
 '         Coordinates used in calculation (QCOMP) \n'
 ' ----------------------------------------------------------------\n'
 ' Z-matrix   Atomic            Coordinates (in bohr)\n'
 '  Symbol    Number           X              Y              Z\n'
 ' ----------------------------------------------------------------\n'
 '     O         8         0.00000000     0.00000000    -0.12429781\n'
 '     H         1         0.00000000    -1.43441927     0.98634825\n'
 '     H         1         0.00000000     1.43441927     0.98634825\n'
 ' ----------------------------------------------------------------\n'
 ' \n'
 '   Interatomic distance matrix (Angstroms) \n'
 ' \n'
 '                 O             H             H    \n'
 '                [ 1]        [ 2]        [ 3]\n'
 '  O    [ 1]     0.00000\n'
 '  H    [ 2]     0.96000     0.00000\n'
 '  H    [ 3]     0.96000     1.51812     0.00000\n'
 ' rotcon2\n'
 '   Rotational constants (in cm-1): \n'
 '          9.4721706374            27.2629827680            14.5153365101\n'
 '   Rotational constants (in MHz): \n'
 '     283968.5715813829        817323.7761473177        435158.9020696688\n'
 '  ECPDATA file not present.   Using default ECPDATA. \n'
 '  There is   1 frozen-core orbital.\n'
 '  There are   24 basis functions.\n'
 
 ...
 
 ' --invoking executable--\n'
 '/home/psilocaluser/gits/cfour-public/bin/xvcc\n'
 ' @GETMEM-I,  Allocated   20560 MB of main memory.\n'
 '   MBPT(2) energy will be calculated.\n'
 '   The total correlation energy is -0.201821821791 a.u.\n'
 '  -----------------------------------------------------------\n'
 '       Correction         Increment           Cumulative\n'
 '  -----------------------------------------------------------\n'
 '        D-MBPT(2)       -0.201821821791     -76.228475483678\n'
 '  -----------------------------------------------------------\n'
 '  Total MBPT(2)       energy:     -76.228475483678 a.u.\n'
 ' @CHECKOUT-I, Total execution time (CPU/WALL):        0.00/       0.00 seconds.\n'
 '--executable xvcc finished with status     0 in        0.02 seconds (walltime).\n'
 '  The final electronic energy is       -76.228475483677684 a.u. \n'
 '  This computation required                            0.33 seconds (walltime).\n')

Some tutorial tests

Environment

A snapshot dev environment is available through conda create -n qcdbenv python=3.9 psi4 qcdb pytest-xdist -c psi4/label/qcdb -c psi4/label/dev -c defaults. QC programs besides Psi4 are bring-your-own. Testing through pytest --pyargs qcdb -n<nproc>

qcdb's People

Contributors

loriab avatar philipmnel avatar vivacebelles avatar zachglick avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

qcdb's Issues

NWChem TCE ROHF-MP2 Disagreement

When using an ROHF reference, the MP2 correlation energy differs between NWChem (calculated with TCE) and the other three programs (Psi4, Cfour, and GAMESS). This occurs in both fc and ae calculations, and the difference is approximately the same.

Note that the HF energies of all programs agree, as do the MP2 correlation energies when using RHF or UHF references.

Values from the ROHF-MP2/qz2p NH2 tests in the file test_lateral_mp2_ene.py. NWChem appears to be about 3e-3 too high:

Program AE Ecorl FC Ecorl
Psi4 -0.20053952 -0.17611631
Cfour -0.20053952 -0.17611631
GAMESS -0.20053952 -0.17611631
NWChem -0.19755769 -0.17316861

Symmetry: native QC program vs driver

A flag regarding how symmetry works, sourced from an NWChem test. The example was flagged down in the qcdb/qcdb/tests/nwchem_teststest_tddft_n2+.py.

Input compiled by QCDB:


geometry units bohr
 N                     0.000000000000     0.000000000000    -0.548850000000
 N                     0.000000000000     0.000000000000     0.548850000000
end

basis cartesian
  N   S
             4173.51100000      0.00183480
              627.45790000      0.01399500
              142.90210000      0.06858700
               40.23433000      0.23224100
               12.82021000      0.46907000
                4.39043700      0.36045500
            N   S
               11.62635800     -0.11496100
                2.71628000     -0.16911800
                0.77221800      1.14585200
            N   P
               11.62635800      0.06758000
                2.71628000      0.32390700
                0.77221800      0.74089500
            N   S
                0.21203130      1.00000000
            N   P
                0.21203130      1.00000000
            N   D
                0.80000000      1.00000000
end

dft
 mult 2
 xc b3lyp
end

scf
 nopen 1
end

tddft
 nroots 10
end

charge 1

memory 3000 mb

task tddft energy

To remedy the problem, currently, the addition of symmetry d2h in the geometry block, aka the qcdb.set_molecule() component of qcdb. Would like to move away from that considering that the driver should be able to determine.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.