diff --git a/common/README.org b/common/README.org index 79df007..523426b 100644 --- a/common/README.org +++ b/common/README.org @@ -48,6 +48,7 @@ with open(dunetest,'w') as f: (synopsis "Test for {name} library") (libraries alcotest + unix qcaml.{name} ) ) @@ -61,6 +62,7 @@ with open(dunetest,'w') as f: str zarith getopt + unix ) #+end_src diff --git a/common/lib/dune b/common/lib/dune index 0885a04..36e3236 100644 --- a/common/lib/dune +++ b/common/lib/dune @@ -2,7 +2,7 @@ (library (name common) (public_name qcaml.common) - (synopsis + (synopsis "Utility functions used by all the other directories." ) (libraries @@ -10,8 +10,9 @@ zarith getopt camlp-streams + unix ) - + (c_names util ) diff --git a/common/lib/qcaml.ml b/common/lib/qcaml.ml index 65fda79..945977c 100644 --- a/common/lib/qcaml.ml +++ b/common/lib/qcaml.ml @@ -1,7 +1,8 @@ -(* | ~root~ | Path to the QCaml source directory | - * | ~name~ | ~"QCaml"~ | *) +(* | ~root~ | Path to the QCaml source directory | + * | ~name~ | ~"QCaml"~ | + * | ~num_domains~ | Number of threads in parallel computations | *) (* [[file:~/QCaml/common/qcaml.org::*QCaml][QCaml:2]] *) @@ -18,4 +19,14 @@ let root = |> chop |> List.rev |> String.concat Filename.dir_sep + + +let num_domains = + let result = + try + Unix.getenv "OMP_NUM_THREADS" + |> int_of_string + with Not_found -> 1 + in + result - 1 (* QCaml:2 ends here *) diff --git a/common/lib/qcaml.mli b/common/lib/qcaml.mli index 0ffcba3..0d21c3c 100644 --- a/common/lib/qcaml.mli +++ b/common/lib/qcaml.mli @@ -9,4 +9,5 @@ (* [[file:~/QCaml/common/qcaml.org::*QCaml][QCaml:1]] *) val root : string val name : string +val num_domains : int (* QCaml:1 ends here *) diff --git a/common/qcaml.org b/common/qcaml.org index 373ade3..a6a29a3 100644 --- a/common/qcaml.org +++ b/common/qcaml.org @@ -19,10 +19,12 @@ #+begin_src ocaml :tangle (eval mli) val root : string val name : string +val num_domains : int #+end_src - | ~root~ | Path to the QCaml source directory | - | ~name~ | ~"QCaml"~ | + | ~root~ | Path to the QCaml source directory | + | ~name~ | ~"QCaml"~ | + | ~num_domains~ | Number of threads in parallel computations | #+begin_src ocaml :tangle (eval ml) :exports none let name = "QCaml" @@ -40,5 +42,14 @@ let root = |> String.concat Filename.dir_sep +let num_domains = + let result = + try + Unix.getenv "OMP_NUM_THREADS" + |> int_of_string + with Not_found -> 1 + in + result - 1 + #+end_src diff --git a/docs/common.html b/docs/common.html index 880cc2f..dc6281b 100644 --- a/docs/common.html +++ b/docs/common.html @@ -3,7 +3,7 @@ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
- +Azimuthal quantum number, repsesented as \( s,p,d,\dots \) .
-Angular_momentum.t
+Angular_momentum.t
type t = +type t = | S | P | D | F | G | H | I | J | K | L | M | N | O | Int of int @@ -424,7 +424,7 @@ Azimuthal quantum number, repsesented as \( s,p,d,\dots \) .
-An exception is raised when the Angular_momentum.t
element can't
+An exception is raised when the Angular_momentum.t
element can't
be created.
val of_char : char -> t @@ -460,7 +460,7 @@ quartets, use in the two-electron operators.- of_char
Returns an +Angular_momentum.t
when a shell is given as a character (case insensitive)Returns an Angular_momentum.t
when a shell is given as a character (case insensitive)@@ -488,7 +488,7 @@ quartets, use in the two-electron operators. @@ -540,7 +540,7 @@ Angular_momentum.(to_string D);;Example:
-+Angular_momentum.of_char 'p';; - : Angular_momentum.t = P @@ -507,8 +507,8 @@ Angular_momentum.(to_string D);; --2.3 Shell functions
+Example:
-+Angular_momentum.(n_functions D) ;; - : int = 6 @@ -553,8 +553,8 @@ Angular_momentum.( zkey_array (Doublet (P,S)) );;
val ( + ) : t -> t -> t @@ -565,7 +565,7 @@ Angular_momentum.( zkey_array (Doublet (P,S)) );;Example:
-+Angular_momentum.(D + P);; - : Angular_momentum.t = F @@ -575,8 +575,8 @@ Angular_momentum.(F - P);;
Printers can print as a string (default) or as an integer. @@ -591,12 +591,12 @@ Printers can print as a string (default) or as an integer.
We define here a data type to handle bit strings efficiently. When @@ -608,11 +608,11 @@ bit string as a multi-precision integer.
type t @@ -621,8 +621,8 @@ bit string as a multi-precision integer.
val of_int : int -> t @@ -774,7 +774,7 @@ bit string as a multi-precision integer.Example:
-+Bitstring.of_int 15;; - : Bitstring.t = ++++------------------------------------------------------------ @@ -783,7 +783,7 @@ Bitstring.of_int 15;;Example:
-+Bitstring.(shift_left (of_int 15) 2);; - : Bitstring.t = --++++---------------------------------------------------------- @@ -806,7 +806,7 @@ Bitstring.(testbit (of_int 15) 4);;Example:
-+Bitstring.(logor (of_int 15) (of_int 73));; - : Bitstring.t = ++++--+--------------------------------------------------------- @@ -824,7 +824,7 @@ Bitstring.(logxor (of_int 15) (of_int 73));;Example:
-+Bitstring.(plus_one (of_int 15));; - : Bitstring.t = ----+----------------------------------------------------------- @@ -838,7 +838,7 @@ Bitstring.(minus_one (of_int 15));;Example:
-+Bitstring.(trailing_zeros (of_int 12));; - : int = 2 @@ -852,7 +852,7 @@ Bitstring.(popcount (of_int 15));;Example:
-+Bitstring.(to_list (of_int 45));; - : int list = [1; 3; 4; 6]@@ -860,7 +860,7 @@ Bitstring.(to_list (of_int 45));;Example:
-+Bitstring.permutations 2 4;; - : Bitstring.t list = [++--------------------------------------------------------------; @@ -873,8 +873,8 @@ Example:
val pp : Format.formatter -> t -> unit @@ -884,16 +884,16 @@ Example:
type t @@ -906,8 +906,8 @@ This type should be used for all charges in the program (electrons, nuclei,
val of_float : float -> t @@ -923,8 +923,8 @@ This type should be used for all charges in the program (electrons, nuclei,
val ( + ) : t -> t -> t @@ -937,8 +937,8 @@ This type should be used for all charges in the program (electrons, nuclei,
val pp : Format.formatter -> t -> unit @@ -948,8 +948,8 @@ This type should be used for all charges in the program (electrons, nuclei,
This module is a wrapper around the Getopt
library and helps to
@@ -1005,11 +1005,11 @@ Then, define what to do with the arguments:
type short_opt = char +type short_opt = char type long_opt = string type optional = Mandatory | Optional type documentation = string @@ -1029,9 +1029,9 @@ Then, define what to do with the arguments:
ls -l
)ls --directory
)Mandatory
or Optional
ls -l
) and for some arguments the argument is optional
All the options are stored in the hash table dict
where the key
-is the long option and the value is a value of type description
.
+is the long option and the value is a value of type description
.
val get : long_opt -> string option @@ -1094,7 +1094,7 @@ Function to create an anonymous argument.- get
Returns the argument associated with a long option +Returns the argument associated with a long option @@ -1112,8 +1112,8 @@ Function to create an anonymous argument. - @@ -1615,7 +1615,7 @@ Powers.(to_int_tuple (of_int_tuple (2,3,1)));;-5.4 Specification
++5.4 Specification
-val set_specs : description list -> unit @@ -1128,16 +1128,16 @@ Sets the specifications of the current program from a list of-6 Constants
++6 Constants
-All constants used in the program.
-6.1 Thresholds
++6.1 Thresholds
-val epsilon : float @@ -1168,8 +1168,8 @@ All constants used in the program.-6.2 Mathematical constants
++6.2 Mathematical constants
-val pi : float @@ -1224,8 +1224,8 @@ All constants used in the program.-6.3 Physical constants
++6.3 Physical constants
-val a0 : float @@ -1269,8 +1269,8 @@ All constants used in the program.-7 Coordinate
++7 Coordinate
-Coordinates in 3D space. @@ -1283,14 +1283,14 @@ module.
-7.1 Type
++7.1 Type
--type bohr +type bohr type angstrom type xyz = { @@ -1309,8 +1309,8 @@ module.-7.2 Creation
++7.2 Creation
-val make : 'a point -> t @@ -1347,8 +1347,8 @@ module.-7.3 Conversion
++7.3 Conversion
-val bohr_to_angstrom : bohr point -> angstrom point @@ -1379,8 +1379,8 @@ module.-7.4 Vector operations
++7.4 Vector operations
-val neg : t -> t @@ -1442,7 +1442,7 @@ module.Example:
-+Coordinate.neg { x=1. ; y=2. ; z=3. } ;; - : Coordinate.t = -1.0000 -2.0000 -3.0000 @@ -1468,8 +1468,8 @@ Coordinate.(-7.5 Printers
++7.5 Printers
-val pp : Format.formatter -> t -> unit @@ -1485,16 +1485,16 @@ Coordinates can be printed in bohr or angstrom.-8 Non-negative float
++8 Non-negative float
--8.1 Type
++8.1 Type
--8.2 Conversions
++8.2 Conversions
-val of_float : float -> t @@ -1524,19 +1524,19 @@ The unsafe variant doesn't do this check.-9 Powers
++9 Powers
-Contains powers of \(x\), \(y\) and \(z\) describing the polynomials in atomic basis sets.
-9.1 Type
++9.1 Type
-type t = private { @@ -1554,8 +1554,8 @@ Contains powers of \(x\), \(y\) and \(z\) describing the polynomials in atomic b-9.2 Conversions
++9.2 Conversions
-val of_int_tuple : int * int * int -> t @@ -1566,7 +1566,7 @@ Contains powers of \(x\), \(y\) and \(z\) describing the polynomials in atomic bExample:
-+Powers.of_int_tuple (2,3,1);; - : Powers.t = x^2 + y^3 + z^1 @@ -1576,8 +1576,8 @@ Powers.(to_int_tuple (of_int_tuple (2,3,1)));;-9.3 Operations
++9.3 Operations
val get : Coordinate.axis -> t -> int @@ -1602,12 +1602,12 @@ Powers.(to_int_tuple (of_int_tuple (2,3,1)));;- incr
Returns a new +Powers.t
with the power on the given axis incrementedReturns a new Powers.t
with the power on the given axis incremented- decr
Returns a new +Powers.t
with the power on the given axis decremented. As opposed toof_int_tuple
, the values may become negativeReturns a new Powers.t
with the power on the given axis decremented. As opposed toof_int_tuple
, the values may become negativeExample:
-+Powers.get Coordinate.Y (Powers.of_int_tuple (2,3,1));; - : int = 3 @@ -1629,8 +1629,8 @@ Powers.decr Coordinate.Y (Powers.of_int_tuple (2,3,1));;
val pp : Format.formatter -> t -> unit @@ -1640,8 +1640,8 @@ Powers.decr Coordinate.Y (Powers.of_int_tuple (2,3,1));;
QCaml-specific parameters @@ -1650,6 +1650,7 @@ QCaml-specific parameters
val root : string val name : string +val num_domains : int
name
"QCaml"
num_domains
A range is a sorted list of integers in an interval. @@ -1692,11 +1698,11 @@ A range is a sorted list of integers in an interval.
val of_string : string -> t @@ -1717,8 +1723,8 @@ A range is a sorted list of integers in an interval.
val pp : Format.formatter -> t -> unit @@ -1728,19 +1734,19 @@ A range is a sorted list of integers in an interval.
Electron spin
type t = Alfa | Beta
@@ -1755,8 +1761,8 @@ letters as Beta
, so the alignment of the code is nicer.
val other : t -> t @@ -1769,8 +1775,8 @@ Returns the opposite spin
val pp : Format.formatter -> t -> unit @@ -1780,8 +1786,8 @@ Returns the opposite spin
Utility functions. @@ -1789,8 +1795,8 @@ Utility functions.
external erf_float : float -> float @@ -1845,8 +1851,8 @@ Utility functions.
external erfc_float : float -> float @@ -1856,8 +1862,8 @@ Utility functions.
external gamma_float : float -> float @@ -1867,8 +1873,8 @@ Utility functions.
val popcnt : int64 -> int @@ -1877,8 +1883,8 @@ Utility functions.
val trailz : int64 -> int @@ -1887,8 +1893,8 @@ Utility functions.
val leadz : int64 -> int @@ -1897,13 +1903,13 @@ Utility functions.
val fact : int -> float @@ -1976,8 +1982,8 @@ Utility functions.
val incomplete_gamma : alpha:float -> float -> float @@ -2034,8 +2040,8 @@ where \(\gamma\) is the incomplete gamma function.
val list_some : 'a option list -> 'a list @@ -2072,8 +2078,8 @@ where \(\gamma\) is the incomplete gamma function.
val array_range : int -> int -> int array @@ -2110,8 +2116,8 @@ where \(\gamma\) is the incomplete gamma function.
val seq_range : int -> int -> int Seq.t @@ -2148,8 +2154,8 @@ where \(\gamma\) is the incomplete gamma function.
val pp_float_array_size : Format.formatter -> float array -> unit @@ -2199,7 +2205,7 @@ where \(\gamma\) is the incomplete gamma function.Example:
-+pp_float_array_size: [ 6: 1.000000 1.732051 1.732051 1.000000 1.732051 1.000000 ] @@ -2222,8 +2228,8 @@ pp_bitstring 14:
Encodes the powers of x, y, z in a compact form, suitable for being @@ -2231,7 +2237,7 @@ used as keys in a hash table.
-Internally, the Zkey.t
is made of two integers, left
and right
.
+Internally, the Zkey.t
is made of two integers, left
and right
.
The small integers x, y and z are stored compactly in this 126-bits
space:
Example:
-+Left Right 3 [--------------------------------------------------------------] [------------------|---------------|---------------|---------------] x y z @@ -2260,11 +2266,11 @@ The values of x,y,z should be positive and should not exceed 32767 for
type t @@ -2280,8 +2286,8 @@ The values of x,y,z should be positive and should not exceed 32767 for
val of_powers_three : Powers.t -> t @@ -2308,22 +2314,22 @@ The values of x,y,z should be positive and should not exceed 32767 for- of_powers_three
Create from a +Powers.t
Create from a Powers.t
- of_powers_six
Create from two +Powers.t
Create from two Powers.t
- of_powers_nine
Create from three +Powers.t
Create from three Powers.t
- of_powers_twelve
Create from four +Powers.t
Create from four Powers.t
@@ -2348,7 +2354,7 @@ The values of x,y,z should be positive and should not exceed 32767 for - to_powers
Convert to an +Powers.t
arrayConvert to an Powers.t
array@@ -2360,8 +2366,8 @@ The values of x,y,z should be positive and should not exceed 32767 for - --14.3 Functions for hash tables
++14.3 Functions for hash tables
-val hash : t -> int @@ -2398,8 +2404,8 @@ The values of x,y,z should be positive and should not exceed 32767 for-14.4 Printers
++14.4 Printers
-val pp : Format.formatter -> t -> unit @@ -2409,19 +2415,19 @@ The values of x,y,z should be positive and should not exceed 32767 for-15 Zmap
++15 Zmap
-A hash table where the keys are
Zkey
-15.1 Type
++15.1 Type
-diff --git a/docs/gaussian.html b/docs/gaussian.html index 350d18b..0164554 100644 --- a/docs/gaussian.html +++ b/docs/gaussian.html @@ -3,7 +3,7 @@ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> - + -include module type of Hashtbl.Make(Zkey) @@ -2433,7 +2439,7 @@ A hash table where the keys areZkey
Gaussian @@ -272,41 +272,41 @@ org_html_manager.setup(); // activate after the parameters are setTable of Contents
-1 Summary
++-1 Summary
-2 Atomic shell
++2 Atomic shell
Set of contracted Gaussians differing only by the powers of \(x\), \(y\) and \(z\), with a @@ -339,8 +339,8 @@ particular powers of \(x,y,z\) (
PrimitiveShell.norm_coef_scale
) --2.1 Type
++2.1 Type
-type t @@ -351,8 +351,8 @@ particular powers of \(x,y,z\) (PrimitiveShell.norm_coef_scale
)-2.2 Access
++2.2 Access
-val ang_mom : t -> Angular_momentum.t @@ -429,14 +429,14 @@ particular powers of \(x,y,z\) (PrimitiveShell.norm_coef_scale
) -+-2.3 Creation
++2.3 Creation
-val make : ?index:int -> Contracted_shell.t array -> t @@ -468,8 +468,8 @@ particular powers of \(x,y,z\) (PrimitiveShell.norm_coef_scale
)-2.4 Printers
++2.4 Printers
-val pp : Format.formatter -> t -> unit @@ -479,8 +479,8 @@ particular powers of \(x,y,z\) (PrimitiveShell.norm_coef_scale
)-3 Atomic shell pair couple
++3 Atomic shell pair couple
-An atomic shell pair couple is the cartesian product between two sets of functions, one @@ -496,8 +496,8 @@ acting on different electrons, since they will be coupled by a two-electron oper
-3.1 Type
++3.1 Type
-type t @@ -508,8 +508,8 @@ acting on different electrons, since they will be coupled by a two-electron oper-3.2 Access
++3.2 Access
-val ang_mom : t -> Angular_momentum.t @@ -594,8 +594,8 @@ acting on different electrons, since they will be coupled by a two-electron oper-3.3 Creation
++3.3 Creation
val make : ?cutoff:float -> Atomic_shell_pair.t -> Atomic_shell_pair.t -> t option @@ -621,14 +621,14 @@ Default cutoff is \(\epsilon\).+
val pp : Format.formatter -> t -> unit @@ -638,8 +638,8 @@ Default cutoff is \(\epsilon\).
Data structure to represent pairs of atomic shells. The products of @@ -651,8 +651,8 @@ An atomic shell pair is an array of pairs of contracted shells.
type t @@ -663,8 +663,8 @@ An atomic shell pair is an array of pairs of contracted shells.
val atomic_shell_a : t -> Atomic_shell.t @@ -731,8 +731,8 @@ An atomic shell pair is an array of pairs of contracted shells.
val make : ?cutoff:float -> Atomic_shell.t -> Atomic_shell.t -> t option
@@ -765,8 +765,8 @@ If an atomic shell pair is not significant, sets the value to None
.
val pp : Format.formatter -> t -> unit
@@ -778,7 +778,7 @@ If an atomic shell pair is not significant, sets the value to None
.