From d1a0145826ee2fd276aae926620e700e663d6fd8 Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Thu, 7 Jan 2021 09:21:06 +0100 Subject: [PATCH] Atomic shell pair couple org --- docs/ao.html | 92 ++--- docs/common.html | 462 +++++++++++----------- docs/gaussian.html | 276 +++++++++---- docs/gaussian_integrals.html | 6 +- docs/index.html | 12 +- docs/linear_algebra.html | 6 +- docs/mo.html | 42 +- docs/particles.html | 170 ++++---- docs/perturbation.html | 46 +-- docs/top.html | 6 +- gaussian/atomic_shell.org | 138 +++---- gaussian/atomic_shell_pair_couple.org | 168 ++++++++ gaussian/lib/atomic_shell.ml | 83 ++-- gaussian/lib/atomic_shell.mli | 48 +-- gaussian/lib/atomic_shell_pair_couple.ml | 95 +++-- gaussian/lib/atomic_shell_pair_couple.mli | 79 ++-- top/lib/install_printers.ml | 1 + 17 files changed, 983 insertions(+), 747 deletions(-) create mode 100644 gaussian/atomic_shell_pair_couple.org diff --git a/docs/ao.html b/docs/ao.html index afa195d..6e8580d 100644 --- a/docs/ao.html +++ b/docs/ao.html @@ -3,7 +3,7 @@ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> - + Atomic Orbitals @@ -251,36 +251,36 @@

Table of Contents

-
"Atomic basis set"
+
"Atomic basis set"
 
-
-

1 Gaussian basis

+
+

1 Gaussian basis

Data structure for Gaussian Atomic Orbitals: @@ -298,11 +298,11 @@ nucleus \(A\).

-
-

1.1 Type

+
+

1.1 Type

-
open Common
+
open Common
 open Particles
 open Linear_algebra
 open Gaussian_integrals
@@ -314,8 +314,8 @@ nucleus \(A\).
 
-
-

1.2 Access

+
+

1.2 Access

val basis             : t -> Gaussian.Basis.t
@@ -406,8 +406,8 @@ nucleus \(A\).
 
-
-

1.3 Computation

+
+

1.3 Computation

val values : t -> Coordinate.t -> Gaussian.Basis.t Vector.t
@@ -432,8 +432,8 @@ nucleus \(A\).
 
-
-

1.4 Creation

+
+

1.4 Creation

val make : basis:Gaussian.Basis.t ->
@@ -456,15 +456,15 @@ Defaults:
 
  • cartesian : false
  • -
    +
     let b = Ao.Basis_gaussian.make ~basis nuclei ;;
     val b : Ao.Basis_gaussian.t = Gaussian Basis, spherical, 15 AOs
     
    -
    -

    1.5 Printers

    +
    +

    1.5 Printers

    val pp : Format.formatter -> t -> unit
    @@ -474,23 +474,23 @@ val b : Ao.Basis_gaussian.t = Gaussian Basis, spherical, 15 AOs
     
    -
    -

    2 Basis

    +
    +

    2 Basis

    Data structure for Atomic Orbitals.

    -
    -

    2.1 Dimensions   noexports

    +
    +

    2.1 Dimensions   noexports

    -
    -

    2.2 Polymorphic types

    +
    +

    2.2 Polymorphic types

    -
    type t =
    +
    type t =
       | Unknown
       | Gaussian of Basis_gaussian.t
     
    @@ -498,8 +498,8 @@ Data structure for Atomic Orbitals.
    -
    -

    2.3 Types

    +
    +

    2.3 Types

    type t
    @@ -514,8 +514,8 @@ Data structure for Atomic Orbitals.
     
    -
    -

    2.4 Conversions

    +
    +

    2.4 Conversions

    val of_nuclei_and_basis_filename :
    @@ -549,15 +549,15 @@ Defaults:
     
  • cartesian : false
  • -
    +
     let b = Ao.Basis.of_nuclei_and_basis_filename ~nuclei filename;;
     val b : Ao.Basis.t = Gaussian Basis, spherical, 15 AOs
     
    -
    -

    2.5 Access

    +
    +

    2.5 Access

    val size              : t -> int
    @@ -655,8 +655,8 @@ val b : Ao.Basis.t = Gaussian Basis, spherical, 15 AOs
     
    -
    -

    2.6 Printers

    +
    +

    2.6 Printers

    val pp : Format.formatter -> t -> unit
    @@ -668,7 +668,7 @@ val b : Ao.Basis.t = Gaussian Basis, spherical, 15 AOs
     

    Author: Anthony Scemama

    -

    Created: 2021-01-04 Mon 23:51

    +

    Created: 2021-01-07 Thu 09:10

    Validate

    diff --git a/docs/common.html b/docs/common.html index a2f8559..f41a29f 100644 --- a/docs/common.html +++ b/docs/common.html @@ -3,7 +3,7 @@ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> - + Common @@ -251,140 +251,140 @@

    Table of Contents

    -
    "Utility functions used by all the other directories."
    +
    "Utility functions used by all the other directories."
     
    -
    -

    1 Angular Momentum

    +
    +

    1 Angular Momentum

    Azimuthal quantum number, repsesented as \( s,p,d,\dots \) .

    -
    -

    1.1 Type

    +
    +

    1.1 Type

    -
    type t =
    +
    type t =
       | S | P | D | F | G | H | I | J | K | L | M | N | O
       | Int of int
     
    @@ -411,8 +411,8 @@ quartets, use in the two-electron operators.
     
    -
    -

    1.2 Conversions

    +
    +

    1.2 Conversions

    val of_char : char -> t
    @@ -461,7 +461,7 @@ quartets, use in the two-electron operators.
     
     
     
    -
    +
     Angular_momentum.of_char 'p';;
     - : Angular_momentum.t = P
     
    @@ -480,8 +480,8 @@ Angular_momentum.(to_string D);;
     
    -
    -

    1.3 Shell functions

    +
    +

    1.3 Shell functions

    val n_functions : t -> int
    @@ -510,7 +510,7 @@ Angular_momentum.(to_string D);;
     
     
     
    -
    +
     Angular_momentum.(n_functions D) ;;
     - : int = 6
     
    @@ -523,8 +523,8 @@ Angular_momentum.( zkey_array (Doublet (P,S)) );;
     
    -
    -

    1.4 Arithmetic

    +
    +

    1.4 Arithmetic

    val ( + ) : t -> t -> t
    @@ -532,7 +532,7 @@ Angular_momentum.( zkey_array (Doublet (P,S)) );;
     
    -
    +
     Angular_momentum.(D + P);;
     - : Angular_momentum.t = F
     
    @@ -542,8 +542,8 @@ Angular_momentum.(F - P);;
     
    -
    -

    1.5 Printers

    +
    +

    1.5 Printers

    Printers can print as a string (default) or as an integer. @@ -558,12 +558,12 @@ Printers can print as a string (default) or as an integer.

    -
    -

    1.6 TODO Tests

    +
    +

    1.6 TODO Tests

    -
    -

    2 Bit string

    +
    +

    2 Bit string

    We define here a data type to handle bit strings efficiently. When @@ -575,8 +575,8 @@ bit string as a multi-precision integer.

    -
    -

    2.1 Type

    +
    +

    2.1 Type

    type t
    @@ -585,8 +585,8 @@ bit string as a multi-precision integer.
     
    -
    -

    2.2 General implementation

    +
    +

    2.2 General implementation

    val of_int : int -> t
    @@ -735,13 +735,13 @@ bit string as a multi-precision integer.
     
     
     
    -
    +
     Bitstring.of_int 15;;
     - : Bitstring.t =
     ++++------------------------------------------------------------
     
    -
    +
     Bitstring.(shift_left (of_int 15) 2);;
     - : Bitstring.t =
     --++++----------------------------------------------------------
    @@ -761,7 +761,7 @@ Bitstring.(testbit (of_int 15) 4);;
     - : bool = false
     
    -
    +
     Bitstring.(logor (of_int 15) (of_int 73));;
     - : Bitstring.t =
     ++++--+---------------------------------------------------------
    @@ -776,7 +776,7 @@ Bitstring.(logxor (of_int 15) (of_int 73));;
     
    -
    +
     Bitstring.(plus_one (of_int 15));;
     - : Bitstring.t =
     ----+-----------------------------------------------------------
    @@ -787,7 +787,7 @@ Bitstring.(minus_one (of_int 15));;
     
    -
    +
     Bitstring.(trailing_zeros (of_int 12));;
     - : int = 2
     
    @@ -798,12 +798,12 @@ Bitstring.(popcount (of_int 15));;
     - : int = 4
     
    -
    +
     Bitstring.(to_list (of_int 45));;
     - : int list = [1; 3; 4; 6]
     
    -
    +
        Bitstring.permutations 2 4;;
     - : Bitstring.t list =
     [++--------------------------------------------------------------;
    @@ -816,8 +816,8 @@ Bitstring.(to_list (of_int 45));;
     
    -
    -

    2.3 Printers

    +
    +

    2.3 Printers

    val pp : Format.formatter -> t -> unit
    @@ -827,13 +827,13 @@ Bitstring.(to_list (of_int 45));;
     
    -
    -

    3 Charge

    +
    +

    3 Charge

    -
    -

    3.1 Type

    +
    +

    3.1 Type

    type t
    @@ -846,8 +846,8 @@ This type should be used for all charges in the program (electrons, nuclei, 
     
    -
    -

    3.2 Conversions

    +
    +

    3.2 Conversions

    val of_float : float -> t
    @@ -863,8 +863,8 @@ This type should be used for all charges in the program (electrons, nuclei, 
     
    -
    -

    3.3 Simple operations

    +
    +

    3.3 Simple operations

    val ( + ) : t -> t -> t
    @@ -877,8 +877,8 @@ This type should be used for all charges in the program (electrons, nuclei, 
     
    -
    -

    3.4 Printers

    +
    +

    3.4 Printers

    val pp : Format.formatter -> t -> unit
    @@ -888,8 +888,8 @@ This type should be used for all charges in the program (electrons, nuclei, 
     
    -
    -

    4 Command line

    +
    +

    4 Command line

    This module is a wrapper around the Getopt library and helps to @@ -945,11 +945,11 @@ Then, define what to do with the arguments:

    -
    -

    4.1 Type

    +
    +

    4.1 Type

    -
    type short_opt     = char
    +
    type short_opt     = char
     type long_opt      = string
     type optional      = Mandatory | Optional
     type documentation = string
    @@ -980,8 +980,8 @@ don't (ls -l) and for some arguments the argument is optional
     
    -
    -

    4.2 Mutable attributes

    +
    +

    4.2 Mutable attributes

    All the options are stored in the hash table dict where the key @@ -1011,8 +1011,8 @@ Function to create an anonymous argument.

    -
    -

    4.3 Query functions

    +
    +

    4.3 Query functions

    val get       : long_opt -> string option
    @@ -1050,8 +1050,8 @@ Function to create an anonymous argument.
     
    -
    -

    4.4 Specification

    +
    +

    4.4 Specification

    val set_specs : description list -> unit
    @@ -1066,16 +1066,16 @@ Sets the specifications of the current program from a list of
     
    -
    -

    5 Constants

    +
    +

    5 Constants

    All constants used in the program.

    -
    -

    5.1 Thresholds

    +
    +

    5.1 Thresholds

    val epsilon          : float
    @@ -1106,8 +1106,8 @@ All constants used in the program.
     
    -
    -

    5.2 Mathematical constants

    +
    +

    5.2 Mathematical constants

    val pi             : float
    @@ -1162,8 +1162,8 @@ All constants used in the program.
     
    -
    -

    5.3 Physical constants

    +
    +

    5.3 Physical constants

    val a0       : float
    @@ -1207,8 +1207,8 @@ All constants used in the program.
     
    -
    -

    6 Coordinate

    +
    +

    6 Coordinate

    Coordinates in 3D space. @@ -1221,11 +1221,11 @@ module.

    -
    -

    6.1 Type

    +
    +

    6.1 Type

    -
    type bohr 
    +
    type bohr 
     type angstrom 
     
     type xyz = {
    @@ -1244,8 +1244,8 @@ module.
     
    -
    -

    6.2 Creation

    +
    +

    6.2 Creation

    val make          : 'a point -> t
    @@ -1282,8 +1282,8 @@ module.
     
    -
    -

    6.3 Conversion

    +
    +

    6.3 Conversion

    val bohr_to_angstrom : bohr point -> angstrom point
    @@ -1314,8 +1314,8 @@ module.
     
    -
    -

    6.4 Vector operations

    +
    +

    6.4 Vector operations

    val neg    : t -> t
    @@ -1374,7 +1374,7 @@ module.
     
     
     
    -
    +
     Coordinate.neg { x=1. ; y=2. ; z=3. } ;;
     - : Coordinate.t =  -1.0000  -2.0000  -3.0000
     
    @@ -1400,8 +1400,8 @@ Coordinate.(
     
    -
    -

    6.5 Printers

    +
    +

    6.5 Printers

    val pp : Format.formatter -> t -> unit
    @@ -1417,13 +1417,13 @@ Coordinates can be printed in bohr or angstrom.
     
    -
    -

    7 Non-negative float

    +
    +

    7 Non-negative float

    -
    -

    7.1 Type

    +
    +

    7.1 Type

    type t = private float
    @@ -1432,8 +1432,8 @@ Coordinates can be printed in bohr or angstrom.
     
    -
    -

    7.2 Conversions

    +
    +

    7.2 Conversions

    val of_float        : float -> t
    @@ -1453,16 +1453,16 @@ The unsafe variant doesn't do this check.
     
    -
    -

    8 Powers

    +
    +

    8 Powers

    Contains powers of x, y and z describing the polynomials in atomic basis sets.

    -
    -

    8.1 Type

    +
    +

    8.1 Type

    type t = private {
    @@ -1480,8 +1480,8 @@ Contains powers of x, y and z describing the polynomials in atomic basis sets.
     
    -
    -

    8.2 Conversions

    +
    +

    8.2 Conversions

    val of_int_tuple : int * int * int -> t
    @@ -1489,7 +1489,7 @@ Contains powers of x, y and z describing the polynomials in atomic basis sets.
     
    -
    +
     Powers.of_int_tuple (2,3,1);;
     - : Powers.t = x^2 + y^3 + z^1
     
    @@ -1499,8 +1499,8 @@ Powers.(to_int_tuple (of_int_tuple (2,3,1)));;
     
    -
    -

    8.3 Operations

    +
    +

    8.3 Operations

    val get  : Coordinate.axis -> t -> int
    @@ -1535,7 +1535,7 @@ Powers.(to_int_tuple (of_int_tuple (2,3,1)));;
     
     
     
    -
    +
     Powers.get Coordinate.Y (Powers.of_int_tuple (2,3,1));;
     - : int = 3
     
    @@ -1549,8 +1549,8 @@ Powers.decr Coordinate.Y (Powers.of_int_tuple (2,3,1));;
     
    -
    -

    8.4 Printers

    +
    +

    8.4 Printers

    val pp : Format.formatter -> t -> unit
    @@ -1560,8 +1560,8 @@ Powers.decr Coordinate.Y (Powers.of_int_tuple (2,3,1));;
     
    -
    -

    9 QCaml

    +
    +

    9 QCaml

    QCaml-specific parameters @@ -1596,8 +1596,8 @@ QCaml-specific parameters

    -
    -

    10 Range

    +
    +

    10 Range

    A range is a sorted list of integers in an interval. @@ -1612,8 +1612,8 @@ A range is a sorted list of integers in an interval.

    -
    -

    10.1 Type

    +
    +

    10.1 Type

    type t
    @@ -1622,8 +1622,8 @@ A range is a sorted list of integers in an interval.
     
    -
    -

    10.2 Conversion

    +
    +

    10.2 Conversion

    val of_string   : string -> t
    @@ -1634,8 +1634,8 @@ A range is a sorted list of integers in an interval.
     
    -
    -

    10.3 Printers

    +
    +

    10.3 Printers

    val pp : Format.formatter -> t -> unit
    @@ -1645,16 +1645,16 @@ A range is a sorted list of integers in an interval.
     
    -
    -

    11 Spin

    +
    +

    11 Spin

    Electron spin

    -
    -

    11.1 Type

    +
    +

    11.1 Type

    type t = Alfa | Beta
    @@ -1669,8 +1669,8 @@ letters as Beta, so the alignment of the code is nicer.
     
    -
    -

    11.2 Functions

    +
    +

    11.2 Functions

    val other : t -> t
    @@ -1683,8 +1683,8 @@ Returns the opposite spin
     
    -
    -

    11.3 Printers

    +
    +

    11.3 Printers

    val pp : Format.formatter -> t -> unit
    @@ -1694,8 +1694,8 @@ Returns the opposite spin
     
    -
    -

    12 Util

    +
    +

    12 Util

    Utility functions. @@ -1703,8 +1703,8 @@ Utility functions.

    -
    -

    12.1 External C functions

    +
    +

    12.1 External C functions

    @@ -1748,8 +1748,8 @@ Utility functions.
    -
    -

    12.1.1 Erf

    +
    +

    12.1.1 Erf

    external erf_float : float -> float = "erf_float_bytecode" "erf_float" [@@unboxed] [@@noalloc]
    @@ -1758,8 +1758,8 @@ Utility functions.
     
    -
    -

    12.1.2 Erfc

    +
    +

    12.1.2 Erfc

    external erfc_float : float -> float = "erfc_float_bytecode" "erfc_float" [@@unboxed] [@@noalloc]
    @@ -1768,8 +1768,8 @@ Utility functions.
     
    -
    -

    12.1.3 Gamma

    +
    +

    12.1.3 Gamma

    external gamma_float : float -> float = "gamma_float_bytecode" "gamma_float" [@@unboxed] [@@noalloc]
    @@ -1778,8 +1778,8 @@ Utility functions.
     
    -
    -

    12.1.4 Popcnt

    +
    +

    12.1.4 Popcnt

    val popcnt : int64 -> int
    @@ -1788,8 +1788,8 @@ Utility functions.
     
    -
    -

    12.1.5 Trailz

    +
    +

    12.1.5 Trailz

    val trailz : int64 -> int
    @@ -1798,8 +1798,8 @@ Utility functions.
     
    -
    -

    12.1.6 Leadz

    +
    +

    12.1.6 Leadz

    val leadz : int64 -> int
    @@ -1808,13 +1808,13 @@ Utility functions.
     
    -
    -

    12.1.7 Test

    +
    +

    12.1.7 Test

    -
    -

    12.2 General functions

    +
    +

    12.2 General functions

    val fact : int -> float
    @@ -1887,8 +1887,8 @@ Utility functions.
     
    -
    -

    12.3 Functions related to the Boys function

    +
    +

    12.3 Functions related to the Boys function

    val incomplete_gamma : alpha:float -> float -> float
    @@ -1945,8 +1945,8 @@ where \(\gamma\) is the incomplete gamma function.
     
    -
    -

    12.4 List functions

    +
    +

    12.4 List functions

    val list_some  : 'a option list -> 'a list
    @@ -1983,8 +1983,8 @@ where \(\gamma\) is the incomplete gamma function.
     
    -
    -

    12.5 Array functions

    +
    +

    12.5 Array functions

    val array_range   : int -> int -> int array
    @@ -2021,8 +2021,8 @@ where \(\gamma\) is the incomplete gamma function.
     
    -
    -

    12.6 Stream functions

    +
    +

    12.6 Stream functions

    val stream_range   : int -> int -> int Stream.t
    @@ -2059,8 +2059,8 @@ where \(\gamma\) is the incomplete gamma function.
     
    -
    -

    12.7 Printers

    +
    +

    12.7 Printers

    val pp_float_array_size   : Format.formatter -> float array -> unit
    @@ -2107,7 +2107,7 @@ where \(\gamma\) is the incomplete gamma function.
     
     
     
    -
    +
     pp_float_array_size:
     [ 6:   1.000000   1.732051   1.732051   1.000000   1.732051   1.000000 ]
     
    @@ -2130,8 +2130,8 @@ pp_bitstring 14:
     
    -
    -

    13 Zkey

    +
    +

    13 Zkey

    Encodes the powers of x, y, z in a compact form, suitable for being @@ -2144,7 +2144,7 @@ The small integers x, y and z are stored compactly in this 126-bits space:

    -
    +
                                     Left                                                                Right
      3 [--------------------------------------------------------------]       [------------------|---------------|---------------|---------------]
                                                                                                          x               y               z        
    @@ -2165,8 +2165,8 @@ The values of x,y,z should be positive and should not exceed 32767 for
     

    -
    -

    13.1 Types

    +
    +

    13.1 Types

    type t 
    @@ -2182,8 +2182,8 @@ The values of x,y,z should be positive and should not exceed 32767 for
     
    -
    -

    13.2 Conversions

    +
    +

    13.2 Conversions

    val of_powers_three  : Powers.t -> t
    @@ -2262,8 +2262,8 @@ The values of x,y,z should be positive and should not exceed 32767 for
     
    -
    -

    13.3 Functions for hash tables

    +
    +

    13.3 Functions for hash tables

    val hash    : t -> int
    @@ -2300,8 +2300,8 @@ The values of x,y,z should be positive and should not exceed 32767 for
     
    -
    -

    13.4 Printers

    +
    +

    13.4 Printers

    val pp : Format.formatter -> t -> unit
    @@ -2311,16 +2311,16 @@ The values of x,y,z should be positive and should not exceed 32767 for
     
    -
    -

    14 Zmap

    +
    +

    14 Zmap

    A hash table where the keys are Zkey

    -
    -

    14.1 Type

    +
    +

    14.1 Type

    include module type of Hashtbl.Make(Zkey)
    @@ -2332,7 +2332,7 @@ A hash table where the keys are Zkey
     

    Author: Anthony Scemama

    -

    Created: 2021-01-04 Mon 23:32

    +

    Created: 2021-01-07 Thu 09:10

    Validate

    diff --git a/docs/gaussian.html b/docs/gaussian.html index ffdef66..dbc8d02 100644 --- a/docs/gaussian.html +++ b/docs/gaussian.html @@ -3,7 +3,7 @@ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> - + Gaussian @@ -251,25 +251,33 @@

    Table of Contents

    -
    "Gaussian basis sets"
    +
    "Gaussian basis sets"
     
    -
    -

    1 Atomic shell

    +
    +

    1 Atomic shell

    Set of contracted Gaussians differing only by the powers of \(x\), \(y\) and \(z\), with a @@ -302,8 +310,8 @@ particular powers of \(x,y,z\) (PrimitiveShell.norm_coef_scale) -

    -

    1.1 Type

    +
    +

    1.1 Type

    type t
    @@ -314,47 +322,20 @@ particular powers of \(x,y,z\) (PrimitiveShell.norm_coef_scale)
     
    -
    -

    1.2 Access

    +
    +

    1.2 Access

    -
    val index : t -> int
    -(** Index in the basis set, represented as an array of contracted shells. *)
    -
    -val center : t -> Coordinate.t
    -(** Coordinate of the center {% $\mathbf{A} = (X_A,Y_A,Z_A)$ %}. *)
    -
    -val ang_mom : t -> Angular_momentum.t
    -(** Total angular momentum : {% $l = n_x + n_y + n_z$ %}. *)
    -
    -val size : t -> int
    -(** Number of contracted functions, {% $n$ %} in the definition. *)
    -
    -val contracted_shells: t -> Contracted_shell.t array
    -(** Array of contracted gaussians *)
    -
    -val exponents : t -> float array array
    -(** Array of exponents {% $\alpha_{ij}$ %}. The first index is the index of
    -    the contracted function, and the second index is the index of the primitive.
    -*)
    -
    -val coefficients : t -> float array array
    -(** Array of contraction coefficients {% $d_{ij}$ %}. The first index is the index of
    -    the contracted function, and the second index is the index of the primitive.
    -*)
    -
    -val normalizations : t -> float array array
    -(** Normalization coefficients {% $\mathcal{N}_{ij}$ %}. The first index is the index of
    -    the contracted function, and the second index is the index of the primitive.
    -*)
    -
    -val norm_scales : t -> float array
    -(** Scaling factors {% $f(n_x,n_y,n_z)$ %}, given in the same order as
    -    [Angular_momentum.zkey_array ang_mom]. *)
    -
    -val size_of_shell : t -> int
    -(** Number of contracted functions in the shell: length of {!norm_coef_scale}. *)
    -
    +
    val ang_mom           : t -> Angular_momentum.t
    +val center            : t -> Coordinate.t
    +val coefficients      : t -> float array array
    +val contracted_shells : t -> Contracted_shell.t array
    +val exponents         : t -> float array array
    +val index             : t -> int
    +val normalizations    : t -> float array array
    +val norm_scales       : t -> float array
    +val size_of_shell     : t -> int
    +val size              : t -> int
     
    @@ -368,8 +349,8 @@ particular powers of \(x,y,z\) (PrimitiveShell.norm_coef_scale) -index -Index in the basis set, represented as an array of contracted shells. +ang_mom +Total angular momentum : \(l = n_x + n_y + n_z\). @@ -378,13 +359,8 @@ particular powers of \(x,y,z\) (PrimitiveShell.norm_coef_scale) -ang_mom -Total angular momentum : \(l = n_x + n_y + n_z\). - - - -size -Number of contracted functions, \(n\) in the definition. +coefficients +Array of contraction coefficients \(d_{ij}\). The first index is the index of the contracted function, and the second index is the index of the primitive. @@ -398,8 +374,8 @@ particular powers of \(x,y,z\) (PrimitiveShell.norm_coef_scale) -coefficients -Array of contraction coefficients \(d_{ij}\). The first index is the index of the contracted function, and the second index is the index of the primitive. +index +Index in the basis set, represented as an array of contracted shells. @@ -412,6 +388,11 @@ particular powers of \(x,y,z\) (PrimitiveShell.norm_coef_scale)Scaling factors \(f(n_x,n_y,n_z)\), given in the same order as Angular_momentum.zkey_array ang_mom. + +size +Number of contracted functions, \(n\) in the definition. + + size_of_shell Number of contracted functions in the shell: length of norm_coef_scale. @@ -419,21 +400,19 @@ particular powers of \(x,y,z\) (PrimitiveShell.norm_coef_scale) -
    +
     
     
    -
    -

    1.3 Creation

    +
    +

    1.3 Creation

    val make : ?index:int -> Contracted_shell.t array -> t 
    -(** Creates a contracted shell from a list of coefficients and primitives.  *)
     
     val with_index  : t -> int -> t
    -(** Returns a copy of the contracted shell with a modified index. *)
     
    @@ -457,16 +436,171 @@ particular powers of \(x,y,z\) (PrimitiveShell.norm_coef_scale) +
    +
    -
    +
    +

    1.4 Printers

    +
    +
    +
    val pp : Format.formatter -> t -> unit
    +
    +
    +
    +
    +
    + +
    +

    2 Atomic shell pair couple

    +
    +

    +An atomic shell pair couple is the cartesian product between two sets of functions, one +set over electron one and one set over electron two. Both sets are atomic shell +pairs. +

    + +

    +These are usually called shell quartets in the literature, but we prefer to use +pair for two functions with the same electron, and couple for two functions +acting on different electrons, since they will be coupled by a two-electron operator. +

    +
    + + +
    +

    2.1 Type

    +
    +
    +
    type t
    +
    +open Common
    +
    +
    +
    +
    + +
    +

    2.2 Access

    +
    +
    +
    val ang_mom                       : t -> Angular_momentum.t
    +val atomic_shell_a                : t -> Atomic_shell.t
    +val atomic_shell_b                : t -> Atomic_shell.t
    +val atomic_shell_c                : t -> Atomic_shell.t
    +val atomic_shell_d                : t -> Atomic_shell.t
    +val atomic_shell_pair_p           : t -> Atomic_shell_pair.t
    +val atomic_shell_pair_q           : t -> Atomic_shell_pair.t
    +val contracted_shell_pair_couples : t -> Contracted_shell_pair_couple.t list
    +val monocentric                   : t -> bool
    +val norm_scales                   : t -> float array
    +val zkey_array                    : t -> Zkey.t array
    +
    +
    + + + + +++ ++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    ang_momTotal angular momentum of the shell pair couple: sum of the angular momenta of all the shells.
    atomic_shell_aReturns the first atomic shell of the first shell pair.
    atomic_shell_bReturns the second atomic shell of the first shell pair.
    atomic_shell_cReturns the first atomic shell of the second shell pair.
    atomic_shell_dReturns the second atomic shell of the second shell pair.
    atomic_shell_pair_pReturns the first atomic shell pair that was used to build the shell pair.
    atomic_shell_pair_qReturns the second atomic shell pair that was used to build the shell pair.
    contracted_shell_pair_couplesReturns the list of significant contracted shell pair couples.
    monocentricTrue if all four atomic shells have the same center.
    norm_scalesScaling factors of normalization coefficients inside the shell. The ordering is the same as zkey_array.
    zkey_arrayReturns the array of Zkey.t relative to the four shells of the shell pair couple.
    +
    +
    + +
    +

    2.3 Creation

    +
    +
    +
    val make : ?cutoff:float -> Atomic_shell_pair.t -> Atomic_shell_pair.t -> t option
    +
    +
    +

    +Default cutoff is \(\epsilon\). +

    + + + + +++ ++ + + + + + + +
    makeCreates an atomic shell pair couple using two atomic shell pairs.
    + +
     
     
    -
    -

    1.4 Printers

    -
    +
    +

    2.4 Printers

    +
    val pp : Format.formatter -> t -> unit
     
    @@ -477,7 +611,7 @@ particular powers of \(x,y,z\) (PrimitiveShell.norm_coef_scale)

    Author: Anthony Scemama

    -

    Created: 2021-01-06 Wed 09:02

    +

    Created: 2021-01-07 Thu 09:20

    Validate

    diff --git a/docs/gaussian_integrals.html b/docs/gaussian_integrals.html index b19959d..dd7f4b6 100644 --- a/docs/gaussian_integrals.html +++ b/docs/gaussian_integrals.html @@ -3,7 +3,7 @@ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> - + Gaussian integrals @@ -226,13 +226,13 @@

    Gaussian integrals

    -
    "Integrals on the Gaussian basis sets"
    +
    "Integrals on the Gaussian basis sets"
     

    Author: Anthony Scemama

    -

    Created: 2021-01-04 Mon 23:32

    +

    Created: 2021-01-07 Thu 09:10

    Validate

    diff --git a/docs/index.html b/docs/index.html index 6735000..c2fcd70 100644 --- a/docs/index.html +++ b/docs/index.html @@ -3,7 +3,7 @@ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> - + QCaml documentation @@ -229,12 +229,12 @@

    Table of Contents

    -
    +

    chamo_bg.png

    @@ -259,8 +259,8 @@ This loads all the sub-libraries provided with QCaml, and installs the pretty printers.

    -
    -

    1 Documentation of Modules

    +
    +

    1 Documentation of Modules

    • Ao
    • @@ -281,7 +281,7 @@ the pretty printers.

    Author: Anthony Scemama

    -

    Created: 2021-01-04 Mon 23:47

    +

    Created: 2021-01-07 Thu 09:10

    Validate

    diff --git a/docs/linear_algebra.html b/docs/linear_algebra.html index 3fe0f9c..23e773a 100644 --- a/docs/linear_algebra.html +++ b/docs/linear_algebra.html @@ -3,7 +3,7 @@ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> - + Linear Algebra @@ -226,13 +226,13 @@

    Linear Algebra

    -
    "Linear algebra utilities of QCaml libraries."
    +
    "Linear algebra utilities of QCaml libraries."
     

    Author: Anthony Scemama

    -

    Created: 2021-01-04 Mon 23:32

    +

    Created: 2021-01-07 Thu 09:10

    Validate

    diff --git a/docs/mo.html b/docs/mo.html index cc5f9a5..aa1b075 100644 --- a/docs/mo.html +++ b/docs/mo.html @@ -3,7 +3,7 @@ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> - + Molecular orbitals @@ -229,36 +229,36 @@

    Table of Contents

    -
    "Molecular orbitals"
    +
    "Molecular orbitals"
     
    -
    -

    1 Frozen core

    +
    +

    1 Frozen core

    Defines how the core electrons are frozen, for each atom.

    -
    -

    1.1 Type

    +
    +

    1.1 Type

    -
    type kind =
    +
    type kind =
       | All_electron
       | Small
       | Large
    @@ -272,8 +272,8 @@ Defines how the core electrons are frozen, for each atom.
     
    -
    -

    1.2 Creation

    +
    +

    1.2 Creation

    val make : kind -> Particles.Nuclei.t -> t
    @@ -309,7 +309,7 @@ Defines how the core electrons are frozen, for each atom.
     
     
     
    -
    +
     let f = Frozen_core.(make Small nuclei) ;;
     val f : Frozen_core.t = [|0; 2; 2; 0|]
     
    @@ -319,8 +319,8 @@ val f : Frozen_core.t = [|0; 2; 2; 0|]
     
    -
    -

    1.3 Access

    +
    +

    1.3 Access

    val num_elec : t -> int
    @@ -349,7 +349,7 @@ val f : Frozen_core.t = [|0; 2; 2; 0|]
     
     
     
    -
    +
     Frozen_core.num_elec f ;;
     - : int = 4
     
    @@ -359,8 +359,8 @@ Frozen_core.num_mos f ;;
     
    -
    -

    1.4 Printers

    +
    +

    1.4 Printers

    val pp : Format.formatter -> t -> unit
    @@ -372,7 +372,7 @@ Frozen_core.num_mos f ;;
     

    Author: Anthony Scemama

    -

    Created: 2021-01-04 Mon 23:32

    +

    Created: 2021-01-07 Thu 09:10

    Validate

    diff --git a/docs/particles.html b/docs/particles.html index cfbd923..a4a7e40 100644 --- a/docs/particles.html +++ b/docs/particles.html @@ -3,7 +3,7 @@ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> - + Common @@ -251,75 +251,75 @@

    Table of Contents

    -
    "Information relative to particles (electrons and nuclei)."
    +
    "Information relative to particles (electrons and nuclei)."
     
    -
    -

    1 Electrons

    +
    +

    1 Electrons

    Data structure which contains the number of α and β electrons.

    -
    -

    1.1 Type

    +
    +

    1.1 Type

    -
    type t 
    +
    type t 
     
    -
    -

    1.2 Creation

    +
    +

    1.2 Creation

    open Common
    @@ -358,8 +358,8 @@ Data structure which contains the number of α and β electrons.
     
    -
    -

    1.3 Access

    +
    +

    1.3 Access

    val charge       : t -> Charge.t
    @@ -408,8 +408,8 @@ Data structure which contains the number of α and β electrons.
     
    -
    -

    1.4 Printers

    +
    +

    1.4 Printers

    val pp : Format.formatter -> t -> unit
    @@ -418,24 +418,24 @@ Data structure which contains the number of α and β electrons.
     
    -
    -

    1.5 Tests

    +
    +

    1.5 Tests

    -
    -

    2 Element

    +
    +

    2 Element

    Chemical elements.

    -
    -

    2.1 Type

    +
    +

    2.1 Type

    -
    type t =
    +
    type t =
       |X
       |H                                                 |He
       |Li|Be                              |B |C |N |O |F |Ne
    @@ -452,8 +452,8 @@ Chemical elements.
     
    -
    -

    2.2 Conversion

    +
    +

    2.2 Conversion

    val of_string      : string -> t
    @@ -514,7 +514,7 @@ Chemical elements.
     
     
     
    -
    +
     Element.of_string "Fe" ;;
     - : Element.t = Particles.Element.Fe
     
    @@ -533,8 +533,8 @@ Element.(to_string Fe);;
     
    -
    -

    2.3 Database information

    +
    +

    2.3 Database information

    val covalent_radius : t -> Non_negative_float.t
    @@ -583,8 +583,8 @@ Element.(to_string Fe);;
     
    -
    -

    2.4 Printers

    +
    +

    2.4 Printers

    val pp      : Format.formatter -> t -> unit
    @@ -595,30 +595,30 @@ Element.(to_string Fe);;
     
    -
    -

    3 Atomic mass

    +
    +

    3 Atomic mass

    Atomic mass, a non-negative float.

    -
    include module type of Common.Non_negative_float
    +
    include module type of Common.Non_negative_float
     
    -
    -

    4 Nuclei

    +
    +

    4 Nuclei

    -
    -

    4.1 Type

    +
    +

    4.1 Type

    -
    open Common
    +
    open Common
     
     type t = (Element.t * Coordinate.t) array
     
    @@ -626,12 +626,12 @@ Atomic mass, a non-negative float.
    -
    -

    4.2 xyz file lexer/parser

    +
    +

    4.2 xyz file lexer/parser

    -
    -

    4.2.1 Lexer

    +
    +

    4.2.1 Lexer

    nuclei_lexer.mll contains the description of the lexemes used in @@ -684,8 +684,8 @@ rule read_all = parse

    -
    -

    4.2.2 Parser

    +
    +

    4.2.2 Parser

    xyz_parser.mly parses nuclear coordinates in xyz format. @@ -804,8 +804,8 @@ an xyz_file data structure.

    -
    -

    4.3 Conversion

    +
    +

    4.3 Conversion

    val of_xyz_string : string -> t
    @@ -864,8 +864,8 @@ an xyz_file data structure.
     
    -
    -

    4.4 TODO Query

    +
    +

    4.4 TODO Query

    val formula    : t -> string
    @@ -914,8 +914,8 @@ an xyz_file data structure.
     
    -
    -

    4.5 Printers

    +
    +

    4.5 Printers

    val pp : Format.formatter -> t -> unit
    @@ -924,31 +924,31 @@ an xyz_file data structure.
     
    -
    -

    4.6 Tests

    +
    +

    4.6 Tests

    -
    -

    5 Z-matrix

    +
    +

    5 Z-matrix

    Z-matrix representation of nuclear coordinates.

    -
    -

    5.1 Type

    +
    +

    5.1 Type

    -
    type t 
    +
    type t 
     
    -
    -

    5.2 Conversion

    +
    +

    5.2 Conversion

    val of_string      : string -> t
    @@ -983,7 +983,7 @@ Z-matrix representation of nuclear coordinates.
     
     
     
    -
    +
     let zmt = Zmatrix.of_string "
      n
      n    1 nn
    @@ -1028,8 +1028,8 @@ H -0.568803 -0.793910 1.726048"
     
    -
    -

    5.3 Printers

    +
    +

    5.3 Printers

    val pp : Format.formatter -> t -> unit
    @@ -1041,7 +1041,7 @@ H -0.568803 -0.793910 1.726048"
     

    Author: Anthony Scemama

    -

    Created: 2021-01-04 Mon 23:32

    +

    Created: 2021-01-07 Thu 09:10

    Validate

    diff --git a/docs/perturbation.html b/docs/perturbation.html index f1b45d9..70c42f5 100644 --- a/docs/perturbation.html +++ b/docs/perturbation.html @@ -3,7 +3,7 @@ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> - + Perturbation @@ -229,31 +229,31 @@

    Table of Contents

    -
    "Perturbation theory"
    +
    "Perturbation theory"
     
    -
    -

    1 MP2

    +
    +

    1 MP2

    -
    -

    1.1 Type

    +
    +

    1.1 Type

    type t
    @@ -262,8 +262,8 @@
     
    -
    -

    1.2 Creation

    +
    +

    1.2 Creation

    val make : frozen_core:Mo.Frozen_core.t -> Mo.Basis.t -> t
    @@ -286,7 +286,7 @@
     
     
     
    -
    +
     let mp2 =
       Perturbation.Mp2.make ~frozen_core:(Mo.Frozen_core.(make Small nuclei)) mo_basis
       ;;
    @@ -295,8 +295,8 @@ val mp2 : Perturbation.Mp2.t = E(MP2)=-0.185523
     
    -
    -

    1.3 Access

    +
    +

    1.3 Access

    val energy      : t -> float
    @@ -331,14 +331,14 @@ val mp2 : Perturbation.Mp2.t = E(MP2)=-0.185523
     
     
     
    -
    +
     
     
    -
    -

    1.4 Printers

    +
    +

    1.4 Printers

    val pp : Format.formatter -> t -> unit
    @@ -347,14 +347,14 @@ val mp2 : Perturbation.Mp2.t = E(MP2)=-0.185523
     
    -
    -

    1.5 Tests

    +
    +

    1.5 Tests

    Author: Anthony Scemama

    -

    Created: 2021-01-04 Mon 23:32

    +

    Created: 2021-01-07 Thu 09:10

    Validate

    diff --git a/docs/top.html b/docs/top.html index e5cfafe..485180a 100644 --- a/docs/top.html +++ b/docs/top.html @@ -3,7 +3,7 @@ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> - + Top-level @@ -226,13 +226,13 @@

    Top-level

    -
    "Installs pretty printers for top-level."
    +
    "Installs pretty printers for top-level."
     

    Author: Anthony Scemama

    -

    Created: 2021-01-06 Wed 09:03

    +

    Created: 2021-01-07 Thu 09:20

    Validate

    diff --git a/gaussian/atomic_shell.org b/gaussian/atomic_shell.org index f127bc0..e7682e6 100644 --- a/gaussian/atomic_shell.org +++ b/gaussian/atomic_shell.org @@ -48,15 +48,15 @@ open Common open Common type t = { - expo : float array array; - coef : float array array; - norm_coef : float array array; - norm_coef_scale : float array; - contr : Contracted_shell.t array; - index : int; - center : Coordinate.t; - ang_mom : Angular_momentum.t; -} + expo : float array array; + coef : float array array; + norm_coef : float array array; + norm_coef_scale : float array; + contr : Contracted_shell.t array; + index : int; + center : Coordinate.t; + ang_mom : Angular_momentum.t; + } module Am = Angular_momentum module Co = Coordinate @@ -66,99 +66,57 @@ module Cs = Contracted_shell ** Access #+begin_src ocaml :tangle (eval mli) -val index : t -> int -(** Index in the basis set, represented as an array of contracted shells. *) - -val center : t -> Coordinate.t -(** Coordinate of the center {% $\mathbf{A} = (X_A,Y_A,Z_A)$ %}. *) - -val ang_mom : t -> Angular_momentum.t -(** Total angular momentum : {% $l = n_x + n_y + n_z$ %}. *) - -val size : t -> int -(** Number of contracted functions, {% $n$ %} in the definition. *) - -val contracted_shells: t -> Contracted_shell.t array -(** Array of contracted gaussians *) - -val exponents : t -> float array array -(** Array of exponents {% $\alpha_{ij}$ %}. The first index is the index of - the contracted function, and the second index is the index of the primitive. -*) - -val coefficients : t -> float array array -(** Array of contraction coefficients {% $d_{ij}$ %}. The first index is the index of - the contracted function, and the second index is the index of the primitive. -*) - -val normalizations : t -> float array array -(** Normalization coefficients {% $\mathcal{N}_{ij}$ %}. The first index is the index of - the contracted function, and the second index is the index of the primitive. -*) - -val norm_scales : t -> float array -(** Scaling factors {% $f(n_x,n_y,n_z)$ %}, given in the same order as - [Angular_momentum.zkey_array ang_mom]. *) - -val size_of_shell : t -> int -(** Number of contracted functions in the shell: length of {!norm_coef_scale}. *) - +val ang_mom : t -> Angular_momentum.t +val center : t -> Coordinate.t +val coefficients : t -> float array array +val contracted_shells : t -> Contracted_shell.t array +val exponents : t -> float array array +val index : t -> int +val normalizations : t -> float array array +val norm_scales : t -> float array +val size_of_shell : t -> int +val size : t -> int #+end_src - | ~index~ | Index in the basis set, represented as an array of contracted shells. | - | ~center~ | Coordinate of the center $\mathbf{A} = (X_A,Y_A,Z_A)$. | - | ~ang_mom~ | Total angular momentum : $l = n_x + n_y + n_z$. | - | ~size~ | Number of contracted functions, $n$ in the definition. | - | ~contracted_shells:~ | Array of contracted gaussians | - | ~exponents~ | Array of exponents $\alpha_{ij}$. The first index is the index of the contracted function, and the second index is the index of the primitive. | - | ~coefficients~ | Array of contraction coefficients $d_{ij}$. The first index is the index of the contracted function, and the second index is the index of the primitive. | - | ~normalizations~ | Normalization coefficients $\mathcal{N}_{ij}$. The first index is the index of the contracted function, and the second index is the index of the primitive. | - | ~norm_scales~ | Scaling factors $f(n_x,n_y,n_z)$, given in the same order as ~Angular_momentum.zkey_array ang_mom~. | - | ~size_of_shell~ | Number of contracted functions in the shell: length of ~norm_coef_scale~. | + | ~ang_mom~ | Total angular momentum : $l = n_x + n_y + n_z$. | + | ~center~ | Coordinate of the center $\mathbf{A} = (X_A,Y_A,Z_A)$. | + | ~coefficients~ | Array of contraction coefficients $d_{ij}$. The first index is the index of the contracted function, and the second index is the index of the primitive. | + | ~contracted_shells:~ | Array of contracted gaussians | + | ~exponents~ | Array of exponents $\alpha_{ij}$. The first index is the index of the contracted function, and the second index is the index of the primitive. | + | ~index~ | Index in the basis set, represented as an array of contracted shells. | + | ~normalizations~ | Normalization coefficients $\mathcal{N}_{ij}$. The first index is the index of the contracted function, and the second index is the index of the primitive. | + | ~norm_scales~ | Scaling factors $f(n_x,n_y,n_z)$, given in the same order as ~Angular_momentum.zkey_array ang_mom~. | + | ~size~ | Number of contracted functions, $n$ in the definition. | + | ~size_of_shell~ | Number of contracted functions in the shell: length of ~norm_coef_scale~. | #+begin_example #+end_example #+begin_src ocaml :tangle (eval ml) :exports none -let exponents x = x.expo - -let coefficients x = x.coef - -let center x = x.center - -let ang_mom x = x.ang_mom - -let size x = Array.length x.contr - -let normalizations x = x.norm_coef - -let norm_scales x = x.norm_coef_scale - -let index x = x.index - -let size_of_shell x = Array.length x.norm_coef_scale - -let contracted_shells x = x.contr +let ang_mom t = t.ang_mom +let center t = t.center +let coefficients t = t.coef +let contracted_shells t = t.contr +let exponents t = t.expo +let index t = t.index +let normalizations t = t.norm_coef +let norm_scales t = t.norm_coef_scale +let size_of_shell t = Array.length t.norm_coef_scale +let size t = Array.length t.contr #+end_src ** Creation #+begin_src ocaml :tangle (eval mli) val make : ?index:int -> Contracted_shell.t array -> t -(** Creates a contracted shell from a list of coefficients and primitives. *) val with_index : t -> int -> t -(** Returns a copy of the contracted shell with a modified index. *) #+end_src | ~make~ | Creates a contracted shell from a list of coefficients and primitives. | | ~with_index~ | Returns a copy of the contracted shell with a modified index. | - #+begin_example - - #+end_example - #+begin_src ocaml :tangle (eval ml) :exports none let make ?(index=0) contr = assert (Array.length contr > 0); @@ -169,20 +127,20 @@ let make ?(index=0) contr = let center = Cs.center contr.(0) in let rec unique_center = function - | 0 -> true - | i -> if Cs.center contr.(i) = center then (unique_center [@tailcall]) (i-1) else false + | 0 -> true + | i -> if Cs.center contr.(i) = center then (unique_center [@tailcall]) (i-1) else false in if not (unique_center (Array.length contr - 1)) then invalid_arg "ContractedAtomicShell.make Coordinate.t differ"; - + let ang_mom = Cs.ang_mom contr.(0) in let rec unique_angmom = function - | 0 -> true - | i -> if Cs.ang_mom contr.(i) = ang_mom then (unique_angmom [@tailcall]) (i-1) else false + | 0 -> true + | i -> if Cs.ang_mom contr.(i) = ang_mom then (unique_angmom [@tailcall]) (i-1) else false in if not (unique_angmom (Array.length contr - 1)) then invalid_arg "Contracted_shell.make: Angular_momentum.t differ"; - + let norm_coef = Array.map Cs.normalizations contr in @@ -209,9 +167,9 @@ let pp ppf s = fprintf ppf "@[%3d-%-3d@]" (s.index+1) (s.index+ (size_of_shell s)*(size s)); fprintf ppf "@[%a@ %a@] @[" Am.pp_string s.ang_mom Co.pp s.center; Array.iter2 (fun e_arr c_arr -> fprintf ppf "@["; - Array.iter2 (fun e c -> fprintf ppf "@[%16.8e %16.8e@]@;" e c) - e_arr c_arr; - fprintf ppf "@;@]") s.expo s.coef; + Array.iter2 (fun e c -> fprintf ppf "@[%16.8e %16.8e@]@;" e c) + e_arr c_arr; + fprintf ppf "@;@]") s.expo s.coef; fprintf ppf "@]" #+end_src diff --git a/gaussian/atomic_shell_pair_couple.org b/gaussian/atomic_shell_pair_couple.org new file mode 100644 index 0000000..02e461a --- /dev/null +++ b/gaussian/atomic_shell_pair_couple.org @@ -0,0 +1,168 @@ +#+begin_src elisp tangle: no :results none :exports none +(setq pwd (file-name-directory buffer-file-name)) +(setq name (file-name-nondirectory (substring buffer-file-name 0 -4))) +(setq lib (concat pwd "lib/")) +(setq testdir (concat pwd "test/")) +(setq mli (concat lib name ".mli")) +(setq ml (concat lib name ".ml")) +(setq test-ml (concat testdir name ".ml")) +(org-babel-tangle) +#+end_src + +* Atomic shell pair couple + :PROPERTIES: + :header-args: :noweb yes :comments both + :END: + +An atomic shell pair couple is the cartesian product between two sets of functions, one +set over electron one and one set over electron two. Both sets are atomic shell +pairs. + +These are usually called /shell quartets/ in the literature, but we prefer to use +/pair/ for two functions with the same electron, and /couple/ for two functions +acting on different electrons, since they will be coupled by a two-electron operator. + + +** Type + + #+begin_src ocaml :tangle (eval mli) +type t + +open Common + #+end_src + + #+begin_src ocaml :tangle (eval ml) :exports none +open Common + +type t = +{ + contracted_shell_pair_couples : Contracted_shell_pair_couple.t list ; + atomic_shell_pair_p: Atomic_shell_pair.t ; + atomic_shell_pair_q: Atomic_shell_pair.t ; + atomic_shell_a : Atomic_shell.t ; + atomic_shell_b : Atomic_shell.t ; + atomic_shell_c : Atomic_shell.t ; + atomic_shell_d : Atomic_shell.t ; + ang_mom : Angular_momentum.t ; +} + +module Am = Angular_momentum +module Co = Coordinate +module As = Atomic_shell +module Asp = Atomic_shell_pair +module Cspc = Contracted_shell_pair_couple + #+end_src + +** Access + + #+begin_src ocaml :tangle (eval mli) +val ang_mom : t -> Angular_momentum.t +val atomic_shell_a : t -> Atomic_shell.t +val atomic_shell_b : t -> Atomic_shell.t +val atomic_shell_c : t -> Atomic_shell.t +val atomic_shell_d : t -> Atomic_shell.t +val atomic_shell_pair_p : t -> Atomic_shell_pair.t +val atomic_shell_pair_q : t -> Atomic_shell_pair.t +val contracted_shell_pair_couples : t -> Contracted_shell_pair_couple.t list +val monocentric : t -> bool +val norm_scales : t -> float array +val zkey_array : t -> Zkey.t array + #+end_src + + | ~ang_mom~ | Total angular momentum of the shell pair couple: sum of the angular momenta of all the shells. | + | ~atomic_shell_a~ | Returns the first atomic shell of the first shell pair. | + | ~atomic_shell_b~ | Returns the second atomic shell of the first shell pair. | + | ~atomic_shell_c~ | Returns the first atomic shell of the second shell pair. | + | ~atomic_shell_d~ | Returns the second atomic shell of the second shell pair. | + | ~atomic_shell_pair_p~ | Returns the first atomic shell pair that was used to build the shell pair. | + | ~atomic_shell_pair_q~ | Returns the second atomic shell pair that was used to build the shell pair. | + | ~contracted_shell_pair_couples~ | Returns the list of significant contracted shell pair couples. | + | ~monocentric~ | True if all four atomic shells have the same center. | + | ~norm_scales~ | Scaling factors of normalization coefficients inside the shell. The ordering is the same as ~zkey_array~. | + | ~zkey_array~ | Returns the array of ~Zkey.t~ relative to the four shells of the shell pair couple. | + + #+begin_src ocaml :tangle (eval ml) :exports none +let contracted_shell_pair_couples t = t.contracted_shell_pair_couples + +let monocentric t = + Asp.monocentric t.atomic_shell_pair_p && Asp.monocentric t.atomic_shell_pair_q && + As.center (Asp.atomic_shell_a t.atomic_shell_pair_p) = As.center (Asp.atomic_shell_a t.atomic_shell_pair_q) + + +let ang_mom t = t.ang_mom + +let atomic_shell_pair_p t = t.atomic_shell_pair_p +let atomic_shell_pair_q t = t.atomic_shell_pair_q + +let atomic_shell_a t = t.atomic_shell_a +let atomic_shell_b t = t.atomic_shell_b +let atomic_shell_c t = t.atomic_shell_c +let atomic_shell_d t = t.atomic_shell_d + + +let zkey_array t = + match t.contracted_shell_pair_couples with + | f::_ -> Cspc.zkey_array f + | _ -> invalid_arg "AtomicShellPairCouple.zkey_array" + +let norm_scales t = + match t.contracted_shell_pair_couples with + | f::_ -> Cspc.norm_scales f + | _ -> invalid_arg "AtomicShellPairCouple.norm_scales" + #+end_src + +** Creation + + #+begin_src ocaml :tangle (eval mli) +val make : ?cutoff:float -> Atomic_shell_pair.t -> Atomic_shell_pair.t -> t option + #+end_src + Default cutoff is $\epsilon$. + + | ~make~ | Creates an atomic shell pair couple using two atomic shell pairs. | + + #+begin_example + + #+end_example + + #+begin_src ocaml :tangle (eval ml) :exports none +let make ?(cutoff=Constants.epsilon) atomic_shell_pair_p atomic_shell_pair_q = + let ang_mom = + Am.(Asp.ang_mom atomic_shell_pair_p + Asp.ang_mom atomic_shell_pair_q) + in + let atomic_shell_a = Asp.atomic_shell_a atomic_shell_pair_p + and atomic_shell_b = Asp.atomic_shell_b atomic_shell_pair_p + and atomic_shell_c = Asp.atomic_shell_a atomic_shell_pair_q + and atomic_shell_d = Asp.atomic_shell_b atomic_shell_pair_q + in + let contracted_shell_pair_couples = + List.concat_map (fun ap_ab -> + List.map (fun ap_cd -> + Cspc.make ~cutoff ap_ab ap_cd + ) (Asp.contracted_shell_pairs atomic_shell_pair_q) + ) (Asp.contracted_shell_pairs atomic_shell_pair_p) + |> Util.list_some + in + match contracted_shell_pair_couples with + | [] -> None + | _ -> Some { atomic_shell_pair_p ; atomic_shell_pair_q ; ang_mom ; + atomic_shell_a ; atomic_shell_b ; atomic_shell_c ; atomic_shell_d ; + contracted_shell_pair_couples ; + } + #+end_src + + +** Printers + + #+begin_src ocaml :tangle (eval mli) +val pp : Format.formatter -> t -> unit + #+end_src + + #+begin_src ocaml :tangle (eval ml) :exports none +let pp ppf t = + Format.fprintf ppf "[(%d,%d),(%d,%d)]" + (Atomic_shell.index t.atomic_shell_a) + (Atomic_shell.index t.atomic_shell_b) + (Atomic_shell.index t.atomic_shell_c) + (Atomic_shell.index t.atomic_shell_d) + #+end_src + diff --git a/gaussian/lib/atomic_shell.ml b/gaussian/lib/atomic_shell.ml index 78b672a..555bc1a 100644 --- a/gaussian/lib/atomic_shell.ml +++ b/gaussian/lib/atomic_shell.ml @@ -2,15 +2,15 @@ open Common type t = { - expo : float array array; - coef : float array array; - norm_coef : float array array; - norm_coef_scale : float array; - contr : Contracted_shell.t array; - index : int; - center : Coordinate.t; - ang_mom : Angular_momentum.t; -} + expo : float array array; + coef : float array array; + norm_coef : float array array; + norm_coef_scale : float array; + contr : Contracted_shell.t array; + index : int; + center : Coordinate.t; + ang_mom : Angular_momentum.t; + } module Am = Angular_momentum module Co = Coordinate @@ -19,52 +19,39 @@ module Cs = Contracted_shell -(* | ~index~ | Index in the basis set, represented as an array of contracted shells. | +(* | ~ang_mom~ | Total angular momentum : $l = n_x + n_y + n_z$. | * | ~center~ | Coordinate of the center $\mathbf{A} = (X_A,Y_A,Z_A)$. | - * | ~ang_mom~ | Total angular momentum : $l = n_x + n_y + n_z$. | - * | ~size~ | Number of contracted functions, $n$ in the definition. | + * | ~coefficients~ | Array of contraction coefficients $d_{ij}$. The first index is the index of the contracted function, and the second index is the index of the primitive. | * | ~contracted_shells:~ | Array of contracted gaussians | * | ~exponents~ | Array of exponents $\alpha_{ij}$. The first index is the index of the contracted function, and the second index is the index of the primitive. | - * | ~coefficients~ | Array of contraction coefficients $d_{ij}$. The first index is the index of the contracted function, and the second index is the index of the primitive. | + * | ~index~ | Index in the basis set, represented as an array of contracted shells. | * | ~normalizations~ | Normalization coefficients $\mathcal{N}_{ij}$. The first index is the index of the contracted function, and the second index is the index of the primitive. | * | ~norm_scales~ | Scaling factors $f(n_x,n_y,n_z)$, given in the same order as ~Angular_momentum.zkey_array ang_mom~. | + * | ~size~ | Number of contracted functions, $n$ in the definition. | * | ~size_of_shell~ | Number of contracted functions in the shell: length of ~norm_coef_scale~. | * - * #+begin_example + * #+begin_example * - * #+end_example *) + * #+end_example *) (* [[file:~/QCaml/gaussian/atomic_shell.org::*Access][Access:2]] *) -let exponents x = x.expo - -let coefficients x = x.coef - -let center x = x.center - -let ang_mom x = x.ang_mom - -let size x = Array.length x.contr - -let normalizations x = x.norm_coef - -let norm_scales x = x.norm_coef_scale - -let index x = x.index - -let size_of_shell x = Array.length x.norm_coef_scale - -let contracted_shells x = x.contr +let ang_mom t = t.ang_mom +let center t = t.center +let coefficients t = t.coef +let contracted_shells t = t.contr +let exponents t = t.expo +let index t = t.index +let normalizations t = t.norm_coef +let norm_scales t = t.norm_coef_scale +let size_of_shell t = Array.length t.norm_coef_scale +let size t = Array.length t.contr (* Access:2 ends here *) (* | ~make~ | Creates a contracted shell from a list of coefficients and primitives. | - * | ~with_index~ | Returns a copy of the contracted shell with a modified index. | - * - * #+begin_example - * - * #+end_example *) + * | ~with_index~ | Returns a copy of the contracted shell with a modified index. | *) (* [[file:~/QCaml/gaussian/atomic_shell.org::*Creation][Creation:2]] *) @@ -77,20 +64,20 @@ let make ?(index=0) contr = let center = Cs.center contr.(0) in let rec unique_center = function - | 0 -> true - | i -> if Cs.center contr.(i) = center then (unique_center [@tailcall]) (i-1) else false + | 0 -> true + | i -> if Cs.center contr.(i) = center then (unique_center [@tailcall]) (i-1) else false in if not (unique_center (Array.length contr - 1)) then invalid_arg "ContractedAtomicShell.make Coordinate.t differ"; - + let ang_mom = Cs.ang_mom contr.(0) in let rec unique_angmom = function - | 0 -> true - | i -> if Cs.ang_mom contr.(i) = ang_mom then (unique_angmom [@tailcall]) (i-1) else false + | 0 -> true + | i -> if Cs.ang_mom contr.(i) = ang_mom then (unique_angmom [@tailcall]) (i-1) else false in if not (unique_angmom (Array.length contr - 1)) then invalid_arg "Contracted_shell.make: Angular_momentum.t differ"; - + let norm_coef = Array.map Cs.normalizations contr in @@ -110,8 +97,8 @@ let pp ppf s = fprintf ppf "@[%3d-%-3d@]" (s.index+1) (s.index+ (size_of_shell s)*(size s)); fprintf ppf "@[%a@ %a@] @[" Am.pp_string s.ang_mom Co.pp s.center; Array.iter2 (fun e_arr c_arr -> fprintf ppf "@["; - Array.iter2 (fun e c -> fprintf ppf "@[%16.8e %16.8e@]@;" e c) - e_arr c_arr; - fprintf ppf "@;@]") s.expo s.coef; + Array.iter2 (fun e c -> fprintf ppf "@[%16.8e %16.8e@]@;" e c) + e_arr c_arr; + fprintf ppf "@;@]") s.expo s.coef; fprintf ppf "@]" (* Printers:2 ends here *) diff --git a/gaussian/lib/atomic_shell.mli b/gaussian/lib/atomic_shell.mli index 9774592..5988a93 100644 --- a/gaussian/lib/atomic_shell.mli +++ b/gaussian/lib/atomic_shell.mli @@ -11,42 +11,16 @@ open Common (* [[file:~/QCaml/gaussian/atomic_shell.org::*Access][Access:1]] *) -val index : t -> int -(** Index in the basis set, represented as an array of contracted shells. *) - -val center : t -> Coordinate.t -(** Coordinate of the center {% $\mathbf{A} = (X_A,Y_A,Z_A)$ %}. *) - -val ang_mom : t -> Angular_momentum.t -(** Total angular momentum : {% $l = n_x + n_y + n_z$ %}. *) - -val size : t -> int -(** Number of contracted functions, {% $n$ %} in the definition. *) - -val contracted_shells: t -> Contracted_shell.t array -(** Array of contracted gaussians *) - -val exponents : t -> float array array -(** Array of exponents {% $\alpha_{ij}$ %}. The first index is the index of - the contracted function, and the second index is the index of the primitive. -*) - -val coefficients : t -> float array array -(** Array of contraction coefficients {% $d_{ij}$ %}. The first index is the index of - the contracted function, and the second index is the index of the primitive. -*) - -val normalizations : t -> float array array -(** Normalization coefficients {% $\mathcal{N}_{ij}$ %}. The first index is the index of - the contracted function, and the second index is the index of the primitive. -*) - -val norm_scales : t -> float array -(** Scaling factors {% $f(n_x,n_y,n_z)$ %}, given in the same order as - [Angular_momentum.zkey_array ang_mom]. *) - -val size_of_shell : t -> int -(** Number of contracted functions in the shell: length of {!norm_coef_scale}. *) +val ang_mom : t -> Angular_momentum.t +val center : t -> Coordinate.t +val coefficients : t -> float array array +val contracted_shells : t -> Contracted_shell.t array +val exponents : t -> float array array +val index : t -> int +val normalizations : t -> float array array +val norm_scales : t -> float array +val size_of_shell : t -> int +val size : t -> int (* Access:1 ends here *) (* Creation *) @@ -54,10 +28,8 @@ val size_of_shell : t -> int (* [[file:~/QCaml/gaussian/atomic_shell.org::*Creation][Creation:1]] *) val make : ?index:int -> Contracted_shell.t array -> t -(** Creates a contracted shell from a list of coefficients and primitives. *) val with_index : t -> int -> t -(** Returns a copy of the contracted shell with a modified index. *) (* Creation:1 ends here *) (* Printers *) diff --git a/gaussian/lib/atomic_shell_pair_couple.ml b/gaussian/lib/atomic_shell_pair_couple.ml index 2ed3d53..164b130 100644 --- a/gaussian/lib/atomic_shell_pair_couple.ml +++ b/gaussian/lib/atomic_shell_pair_couple.ml @@ -1,3 +1,4 @@ +(* [[file:~/QCaml/gaussian/atomic_shell_pair_couple.org::*Type][Type:2]] *) open Common type t = @@ -17,7 +18,64 @@ module Co = Coordinate module As = Atomic_shell module Asp = Atomic_shell_pair module Cspc = Contracted_shell_pair_couple +(* Type:2 ends here *) + + +(* | ~ang_mom~ | Total angular momentum of the shell pair couple: sum of the angular momenta of all the shells. | + * | ~atomic_shell_a~ | Returns the first atomic shell of the first shell pair. | + * | ~atomic_shell_b~ | Returns the second atomic shell of the first shell pair. | + * | ~atomic_shell_c~ | Returns the first atomic shell of the second shell pair. | + * | ~atomic_shell_d~ | Returns the second atomic shell of the second shell pair. | + * | ~atomic_shell_pair_p~ | Returns the first atomic shell pair that was used to build the shell pair. | + * | ~atomic_shell_pair_q~ | Returns the second atomic shell pair that was used to build the shell pair. | + * | ~contracted_shell_pair_couples~ | Returns the list of significant contracted shell pair couples. | + * | ~monocentric~ | True if all four atomic shells have the same center. | + * | ~norm_scales~ | Scaling factors of normalization coefficients inside the shell. The ordering is the same as ~zkey_array~. | + * | ~zkey_array~ | Returns the array of ~Zkey.t~ relative to the four shells of the shell pair couple. | *) + + +(* [[file:~/QCaml/gaussian/atomic_shell_pair_couple.org::*Access][Access:2]] *) +let contracted_shell_pair_couples t = t.contracted_shell_pair_couples + +let monocentric t = + Asp.monocentric t.atomic_shell_pair_p && Asp.monocentric t.atomic_shell_pair_q && + As.center (Asp.atomic_shell_a t.atomic_shell_pair_p) = As.center (Asp.atomic_shell_a t.atomic_shell_pair_q) + + +let ang_mom t = t.ang_mom + +let atomic_shell_pair_p t = t.atomic_shell_pair_p +let atomic_shell_pair_q t = t.atomic_shell_pair_q + +let atomic_shell_a t = t.atomic_shell_a +let atomic_shell_b t = t.atomic_shell_b +let atomic_shell_c t = t.atomic_shell_c +let atomic_shell_d t = t.atomic_shell_d + + +let zkey_array t = + match t.contracted_shell_pair_couples with + | f::_ -> Cspc.zkey_array f + | _ -> invalid_arg "AtomicShellPairCouple.zkey_array" + +let norm_scales t = + match t.contracted_shell_pair_couples with + | f::_ -> Cspc.norm_scales f + | _ -> invalid_arg "AtomicShellPairCouple.norm_scales" +(* Access:2 ends here *) + + +(* Default cutoff is $\epsilon$. + * + * | ~make~ | Creates an atomic shell pair couple using two atomic shell pairs. | + * + * #+begin_example + * + * #+end_example *) + + +(* [[file:~/QCaml/gaussian/atomic_shell_pair_couple.org::*Creation][Creation:2]] *) let make ?(cutoff=Constants.epsilon) atomic_shell_pair_p atomic_shell_pair_q = let ang_mom = Am.(Asp.ang_mom atomic_shell_pair_p + Asp.ang_mom atomic_shell_pair_q) @@ -41,32 +99,13 @@ let make ?(cutoff=Constants.epsilon) atomic_shell_pair_p atomic_shell_pair_q = atomic_shell_a ; atomic_shell_b ; atomic_shell_c ; atomic_shell_d ; contracted_shell_pair_couples ; } +(* Creation:2 ends here *) -let contracted_shell_pair_couples t = t.contracted_shell_pair_couples - -let monocentric t = - Asp.monocentric t.atomic_shell_pair_p && Asp.monocentric t.atomic_shell_pair_q && - As.center (Asp.atomic_shell_a t.atomic_shell_pair_p) = As.center (Asp.atomic_shell_a t.atomic_shell_pair_q) - - -let ang_mom t = t.ang_mom - -let atomic_shell_pair_p t = t.atomic_shell_pair_p -let atomic_shell_pair_q t = t.atomic_shell_pair_q - -let atomic_shell_a t = t.atomic_shell_a -let atomic_shell_b t = t.atomic_shell_b -let atomic_shell_c t = t.atomic_shell_c -let atomic_shell_d t = t.atomic_shell_d - - -let zkey_array t = - match t.contracted_shell_pair_couples with - | f::_ -> Cspc.zkey_array f - | _ -> invalid_arg "AtomicShellPairCouple.zkey_array" - -let norm_scales t = - match t.contracted_shell_pair_couples with - | f::_ -> Cspc.norm_scales f - | _ -> invalid_arg "AtomicShellPairCouple.norm_scales" - +(* [[file:~/QCaml/gaussian/atomic_shell_pair_couple.org::*Printers][Printers:2]] *) +let pp ppf t = + Format.fprintf ppf "[(%d,%d),(%d,%d)]" + (Atomic_shell.index t.atomic_shell_a) + (Atomic_shell.index t.atomic_shell_b) + (Atomic_shell.index t.atomic_shell_c) + (Atomic_shell.index t.atomic_shell_d) +(* Printers:2 ends here *) diff --git a/gaussian/lib/atomic_shell_pair_couple.mli b/gaussian/lib/atomic_shell_pair_couple.mli index cf46c7f..91226c4 100644 --- a/gaussian/lib/atomic_shell_pair_couple.mli +++ b/gaussian/lib/atomic_shell_pair_couple.mli @@ -1,62 +1,39 @@ -(** Data structure describing a couple of atomic shells pairs. - -An atomic shell pair couple is the cartesian product between two sets of functions, one -set over electron one and one set over electron two. Both sets are atomic shell -pairs. - -These are usually called {e shell quartets} in the literature, but we prefer to use -{e pair} for two functions with the same electron, and {e couple} for two functions -acting on different electrons, since they will be coupled by a two-electron operator. +(* Type *) -*) - -type t +(* [[file:~/QCaml/gaussian/atomic_shell_pair_couple.org::*Type][Type:1]] *) +type t open Common +(* Type:1 ends here *) -val make : ?cutoff:float -> Atomic_shell_pair.t -> Atomic_shell_pair.t -> t option -(** Creates an atomic shell pair couple using two atomic shell pairs. -*) - -val ang_mom : t -> Angular_momentum.t -(** Total angular momentum of the shell pair couple: sum of the angular momenta of - all the shells. *) +(* Access *) -val atomic_shell_a : t -> Atomic_shell.t -(** Returns the first atomic shell of the first shell pair. *) - -val atomic_shell_b : t -> Atomic_shell.t -(** Returns the second atomic shell of the first shell pair. *) - -val atomic_shell_c : t -> Atomic_shell.t -(** Returns the first atomic shell of the second shell pair. *) - -val atomic_shell_d : t -> Atomic_shell.t -(** Returns the second atomic shell of the second shell pair. *) - - -val atomic_shell_pair_p : t -> Atomic_shell_pair.t -(** Returns the first atomic shell pair that was used to build the shell pair. *) - -val atomic_shell_pair_q : t -> Atomic_shell_pair.t -(** Returns the second atomic shell pair that was used to build the shell pair. *) - -val monocentric : t -> bool -(** True if all four atomic shells have the same center. *) - +(* [[file:~/QCaml/gaussian/atomic_shell_pair_couple.org::*Access][Access:1]] *) +val ang_mom : t -> Angular_momentum.t +val atomic_shell_a : t -> Atomic_shell.t +val atomic_shell_b : t -> Atomic_shell.t +val atomic_shell_c : t -> Atomic_shell.t +val atomic_shell_d : t -> Atomic_shell.t +val atomic_shell_pair_p : t -> Atomic_shell_pair.t +val atomic_shell_pair_q : t -> Atomic_shell_pair.t val contracted_shell_pair_couples : t -> Contracted_shell_pair_couple.t list -(** Returns the list of significant contracted shell pair couples. *) +val monocentric : t -> bool +val norm_scales : t -> float array +val zkey_array : t -> Zkey.t array +(* Access:1 ends here *) -val zkey_array : t -> Zkey.t array -(** Returns the array of {!Zkey.t} relative to the four shells of the - shell pair couple. -*) - -val norm_scales : t -> float array -(** Scaling factors of normalization coefficients inside the shell. The - ordering is the same as {!zkey_array}. -*) +(* Creation *) +(* [[file:~/QCaml/gaussian/atomic_shell_pair_couple.org::*Creation][Creation:1]] *) +val make : ?cutoff:float -> Atomic_shell_pair.t -> Atomic_shell_pair.t -> t option +(* Creation:1 ends here *) + +(* Printers *) + + +(* [[file:~/QCaml/gaussian/atomic_shell_pair_couple.org::*Printers][Printers:1]] *) +val pp : Format.formatter -> t -> unit +(* Printers:1 ends here *) diff --git a/top/lib/install_printers.ml b/top/lib/install_printers.ml index e0c48c5..ef90fa6 100644 --- a/top/lib/install_printers.ml +++ b/top/lib/install_printers.ml @@ -12,6 +12,7 @@ let printers = "Common.Spin.pp" ; "Common.Zkey.pp" ; "Gaussian.Atomic_shell.pp" ; + "Gaussian.Atomic_shell_pair_couple.pp" ; "Mo.Frozen_core.pp" ; "Particles.Electrons.pp" ; "Particles.Element.pp" ;