### Build Minichem from Source Source: https://context7.com/aoleynichenko/minichem/llms.txt Build Minichem using CMake and make. Ensure you have CMake, MPI, and BLAS/LAPACK with C wrappers installed. ```bash mkdir build && cd build cmake .. make -j4 ``` -------------------------------- ### Minichem Input Directive: start Source: https://context7.com/aoleynichenko/minichem/llms.txt Sets the job name for identification in the output. Use this directive at the beginning of your input file. ```nwchem start MyCalculation ``` -------------------------------- ### Compile Minichem Source: https://github.com/aoleynichenko/minichem/blob/master/README.md Standard compilation steps for the Minichem project using CMake and Make. Ensure you have a C compiler, CMake, and Make installed. ```bash mkdir build && cd build cmake .. make [-jN] ``` -------------------------------- ### Carbon Monoxide Calculation with DIIS Acceleration Source: https://context7.com/aoleynichenko/minichem/llms.txt Example input for a Carbon Monoxide calculation using DIIS acceleration for SCF convergence. Includes quadrupole property calculation. ```nwchem start CO echo property quadrupole center com end geometry units atomic C 0 0 0 O 2.16464 0 0 end basis "ao basis" SPHERICAL C S 71.6168370 0.15432897 13.0450960 0.53532814 3.5305122 0.44463454 C SP 2.9412494 -0.09996723 0.15591627 0.6834831 0.39951283 0.60768372 0.2222899 0.70011547 0.39195739 O S 130.7093200 0.15432897 23.8088610 0.53532814 6.4436083 0.44463454 O SP 5.0331513 -0.09996723 0.15591627 1.1695961 0.39951283 0.60768372 0.3803890 0.70011547 0.39195739 end scf diis 6 direct maxiter 100 end task scf ``` -------------------------------- ### Basic Water Molecule RHF Calculation Input Source: https://context7.com/aoleynichenko/minichem/llms.txt Example input file for a Restricted Hartree-Fock (RHF) calculation on a water molecule. Specifies memory, geometry, basis set, and SCF method. ```nwchem start H2O memory 400 mb echo geometry O 0.00000 0.00000 0.11779 H 0.00000 0.75545 -0.47116 H 0.00000 -0.75545 -0.47116 end basis "ao basis" SPHERICAL H S 3.42525091 0.15432897 0.62391373 0.53532814 0.16885540 0.44463454 O S 130.7093200 0.15432897 23.8088610 0.53532814 6.4436083 0.44463454 O SP 5.0331513 -0.09996723 0.15591627 1.1695961 0.39951283 0.60768372 0.3803890 0.70011547 0.39195739 end scf direct nodiis end task scf ``` -------------------------------- ### UHF Calculation for CH3 Radical Source: https://context7.com/aoleynichenko/minichem/llms.txt Example input for an Unrestricted Hartree-Fock (UHF) calculation on the CH3 radical, a doublet open-shell system. Uses 'nodiis' to disable DIIS acceleration. ```nwchem start CH3 echo geometry C 0.08745162 -0.08744725 -0.08742186 H 0.52503428 0.78909888 -0.52508604 H -0.78884450 -0.52530342 -0.52536318 H 0.52530257 -0.52529218 0.78892712 end basis "ao basis" SPHERICAL H S 3.42525091 0.15432897 0.62391373 0.53532814 0.16885540 0.44463454 C S 71.6168370 0.15432897 13.0450960 0.53532814 3.5305122 0.44463454 C S 2.9412494 -0.09996723 0.6834831 0.39951283 0.2222899 0.70011547 C P 2.9412494 0.15591627 0.6834831 0.60768372 0.2222899 0.39195739 end scf uhf doublet nodiis end task scf ``` -------------------------------- ### Initiate Calculation Tasks Source: https://context7.com/aoleynichenko/minichem/llms.txt Commands to trigger the execution of quantum chemistry calculations. ```text task scf # Run SCF energy calculation task scf energy # Equivalent form ``` -------------------------------- ### Add Library and Set C Standard Source: https://github.com/aoleynichenko/minichem/blob/master/src/linalg/CMakeLists.txt Configures the 'linalg' library and enforces C99 standard for it. Ensure the source file 'linalg.c' is available. ```cmake add_library(linalg linalg.c ) set(C_STANDARD_REQUIRED ON) set_property(TARGET linalg PROPERTY C_STANDARD 99) ``` -------------------------------- ### Add Library and Link Libraries Source: https://github.com/aoleynichenko/minichem/blob/master/src/input/CMakeLists.txt Defines a library target named 'input' with source files and links it against the 'scf' library. Ensure 'scf' is available in your build environment. ```cmake add_library(input\ basis.c\ chem.c\ inp.c\ lexer.c\ rtdb.c\ ) target_link_libraries(input scf) ``` -------------------------------- ### Execute SCF Calculation via C API Source: https://context7.com/aoleynichenko/minichem/llms.txt Initializes the molecule structure and runs the SCF energy driver. ```c #include "scf.h" #include "chem.h" // Create and populate molecule structure struct cart_mol molecule; molecule.size = 0; molecule.capacity = 0; molecule.charge = 0; molecule.mult = 1; // Add atoms (coordinates in atomic units) append_atom(&molecule, 8, 0.0, 0.0, 0.222616); // Oxygen append_atom(&molecule, 1, 0.0, 1.427682, -0.890464); // Hydrogen append_atom(&molecule, 1, 0.0, -1.427682, -0.890464); // Hydrogen // Initialize SCF options scf_init(); // Run SCF calculation scf_energy(&molecule); // Results are stored in RTDB: // rtdb_get("scf:etot", &total_energy); // rtdb_get("scf:enuc", &nuclear_repulsion); ``` -------------------------------- ### Add Library to Build Source: https://github.com/aoleynichenko/minichem/blob/master/src/sys/CMakeLists.txt Defines a library target named 'sys' and includes source files 'fastio.c' and 'time.c'. Use this to manage project dependencies and source files. ```cmake add_library(sys fastio.c time.c ) ``` -------------------------------- ### Tracked Memory Allocation with qalloc/qfree Source: https://context7.com/aoleynichenko/minichem/llms.txt Manages memory allocation and deallocation with usage tracking for debugging purposes. `qalloc` allocates memory, and `qfree` deallocates it, requiring the size of the allocated memory. ```c #include "util.h" // Allocate memory int nbytes = dim * dim * sizeof(double); double *matrix = (double *) qalloc(nbytes); // Use memory... // Free memory (must specify size) qfree(matrix, nbytes); // Print memory statistics memstats(); // Output: Allocated, Freed, Max usage in bytes ``` -------------------------------- ### Configure SCF Parameters Source: https://context7.com/aoleynichenko/minichem/llms.txt Sets parameters for self-consistent field calculations, including algorithm selection and convergence options. ```text scf rhf # Restricted Hartree-Fock (default for closed-shell) uhf # Unrestricted Hartree-Fock doublet # Set spin multiplicity to 2 direct # Use integral-direct algorithm nodiis # Disable DIIS acceleration diis 6 # Enable DIIS with subspace dimension 6 maxiter 100 # Maximum SCF iterations end ``` -------------------------------- ### Add Library to Build Source: https://github.com/aoleynichenko/minichem/blob/master/src/visual/CMakeLists.txt Adds the 'molden.c' library to the build target named 'visual'. This is typically used in build systems like CMake. ```cmake add_library(visual molden.c ) ``` -------------------------------- ### Configure Output Options Source: https://context7.com/aoleynichenko/minichem/llms.txt Enables export of calculation data to external formats. ```text out molden # Export orbitals to Molden format end ``` -------------------------------- ### qalloc and qfree - Tracked Memory Allocation Source: https://context7.com/aoleynichenko/minichem/llms.txt Memory allocation and deallocation functions with usage tracking for debugging purposes. ```APIDOC ## qalloc and qfree - Tracked Memory Allocation ### Description `qalloc` allocates memory and tracks its usage, while `qfree` deallocates memory and must be provided with the size. `memstats` reports memory usage statistics. ### Method Not specified (likely C function calls) ### Endpoint N/A (C functions) ### Parameters - **size** (size_t) - The number of bytes to allocate or free. ### Request Example ```c #include "util.h" // Allocate memory int nbytes = dim * dim * sizeof(double); double *matrix = (double *) qalloc(nbytes); // Use memory... // Free memory (must specify size) qfree(matrix, nbytes); // Print memory statistics memstats(); // Output: Allocated, Freed, Max usage in bytes ``` ### Response #### Success Response (200) - **qalloc return value** (void *) - Pointer to the allocated memory. - **qfree** - Returns void. - **memstats output** - Prints memory statistics to stdout. ``` -------------------------------- ### Configure Property Calculations Source: https://context7.com/aoleynichenko/minichem/llms.txt Sets the center for post-SCF property calculations like quadrupole moments. ```text property quadrupole center com # Center of mass center coc # Center of charge center origin # Origin (0,0,0) center point 1.0 2.0 3.0 # Arbitrary point end ``` -------------------------------- ### DIIS Convergence Acceleration API Source: https://context7.com/aoleynichenko/minichem/llms.txt Implements the Direct Inversion in the Iterative Subspace (DIIS) algorithm to accelerate SCF convergence. Requires initialization of a DIIS list and computation of an error matrix. ```c #include "scf.h" // Initialize DIIS storage DIISList_t *diislist = NULL; int diisbas = 6; // Subspace dimension int M = nbfns; // Number of basis functions // In SCF iteration loop: double *ErrM = (double *) qalloc(M * M * sizeof(double)); double *F = /* current Fock matrix */; double *P = /* current density matrix */; double *S = /* overlap matrix */; // Compute error matrix: e = F*P*S - S*P*F make_error_matrix(ErrM, F, P, S, M); // Store in DIIS list if (!diislist) diislist = newDIISList(ErrM, F, M); else diis_store(diislist, ErrM, F, M, diisbas); // Extrapolate new Fock matrix diis_extrapolate(F, diislist, diisbas); // Cleanup when done removeDIISList(diislist); ``` -------------------------------- ### Add Library to CMake Source: https://github.com/aoleynichenko/minichem/blob/master/src/util/CMakeLists.txt Use this command to add a static library target named 'util' with specified source files. ```cmake add_library(util\ decor.c\ errors.c\ memory.c\ misc.c\ timer.c\ ) ``` -------------------------------- ### Run Minichem Command Line Source: https://context7.com/aoleynichenko/minichem/llms.txt Execute Minichem calculations from the command line. Supports basic execution, MPI parallelization, output redirection, disabling input echo, and displaying version/help information. ```bash # Basic usage - run a single input file minichem.x input.nw ``` ```bash # Run with MPI parallelization mpirun -np 4 minichem.x input.nw ``` ```bash # Output to a specific file minichem.x -o output.log input.nw ``` ```bash # Disable input file echo minichem.x -noecho input.nw ``` ```bash # Print version information minichem.x -v ``` ```bash # Print help minichem.x -h ``` -------------------------------- ### Compute Multipole Moment Integrals Source: https://context7.com/aoleynichenko/minichem/llms.txt Calculates multipole moment integrals for electric properties. Requires initialization of basis functions (fi, fj) and power arrays for the desired moment. ```c #include "aoints.h" // Dipole moment (e.g., X component) int xyz_pow[3] = {1, 0, 0}; // x^1 * y^0 * z^0 double dipole_x = aoint_multipole(fi, fj, xyz_pow); ``` ```c // Quadrupole moment (e.g., XX component) int xyz_pow_xx[3] = {2, 0, 0}; // x^2 * y^0 * z^0 double quad_xx = aoint_multipole(fi, fj, xyz_pow_xx); ``` -------------------------------- ### DIIS Convergence Acceleration API Source: https://context7.com/aoleynichenko/minichem/llms.txt API for Direct Inversion in the Iterative Subspace (DIIS) algorithm to accelerate SCF convergence. ```APIDOC ## DIIS Convergence Acceleration API ### Description The DIIS (Direct Inversion in the Iterative Subspace) algorithm accelerates SCF convergence by storing and extrapolating previous iterations' error and Fock matrices. ### Method Not specified (likely C function calls) ### Endpoint N/A (C functions) ### Parameters - **diisbas** (int) - Subspace dimension for DIIS. - **M** (int) - Number of basis functions (dimension of matrices). - **ErrM** (double array) - Error matrix. - **F** (double array) - Current Fock matrix. - **P** (double array) - Current density matrix. - **S** (double array) - Overlap matrix. - **diislist** (DIISList_t *) - Pointer to the DIIS list structure. ### Request Example ```c #include "scf.h" // Initialize DIIS storage DIISList_t *diislist = NULL; int diisbas = 6; // Subspace dimension int M = nbfns; // Number of basis functions // In SCF iteration loop: double *ErrM = (double *) qalloc(M * M * sizeof(double)); double *F = /* current Fock matrix */; double *P = /* current density matrix */; double *S = /* overlap matrix */; // Compute error matrix: e = F*P*S - S*P*F make_error_matrix(ErrM, F, P, S, M); // Store in DIIS list if (!diislist) diislist = newDIISList(ErrM, F, M); else diis_store(diislist, ErrM, F, M, diisbas); // Extrapolate new Fock matrix diis_extrapolate(F, diislist, diisbas); // Cleanup when done removeDIISList(diislist); ``` ### Response #### Success Response (200) - **F** (double array) - The extrapolated Fock matrix is updated in place. ``` -------------------------------- ### Input File Directives Source: https://context7.com/aoleynichenko/minichem/llms.txt Configuration directives used within the NWChem-compatible input files to define the computational environment and molecular system. ```APIDOC ## Input File Directives ### start - **Description**: Sets the calculation job name. - **Syntax**: `start [job_name]` ### memory - **Description**: Sets the maximum memory available for the calculation. - **Syntax**: `memory [value] [unit]` (e.g., 400 mb, 2 gb, 1024 kb) ### nproc - **Description**: Sets the number of OpenMP threads for parallel computation. - **Syntax**: `nproc [number]` ### print - **Description**: Controls the verbosity level of output. - **Syntax**: `print [level]` (levels: none, low, medium, high, debug) ### geometry - **Description**: Defines atomic coordinates and system properties. - **Syntax**: ``` geometry units [angstroms|atomic] [Atom] [x] [y] [z] mult [multiplicity] end ``` ``` -------------------------------- ### Molecular Integral Functions (C API) Source: https://context7.com/aoleynichenko/minichem/llms.txt Functions for computing fundamental quantum mechanical integrals between basis functions. ```APIDOC ## Molecular Integral Functions ### Description Functions to compute overlap, kinetic, potential, and electron repulsion integrals. ### Methods - **aoint_overlap**: Computes - **aoint_kinetic**: Computes - **aoint_potential**: Computes sum_A - **aoint_eri**: Computes (ij|kl) = ### Parameters - **fi, fj, fk, fl** (struct basis_function*) - Required - Basis functions to integrate. ``` -------------------------------- ### Minichem Input Directive: print Source: https://context7.com/aoleynichenko/minichem/llms.txt Controls the verbosity of the output. Options include none, low, medium, high, and debug. Higher verbosity provides more detailed information. ```nwchem print high ``` ```nwchem print debug ``` -------------------------------- ### Store Values in Runtime Database (RTDB) Source: https://context7.com/aoleynichenko/minichem/llms.txt Stores configuration and result values in the runtime database using key-value pairs. Supports integer, double, string, and multiple values. ```c #include "input.h" // Store integer rtdb_set("scf:maxiter", "%i", 50); // Store double rtdb_set("scf:etot", "%d", -74.96314638); // Store string rtdb_set("top:short_name", "%s", "water"); // Store multiple values rtdb_set("geom:center", "%d%d%d", 0.0, 0.0, 0.5); ``` -------------------------------- ### Compute Electron Repulsion Integral Source: https://context7.com/aoleynichenko/minichem/llms.txt Calculates the four-center two-electron repulsion integrals. ```c #include "aoints.h" struct basis_function *fi = &bfns[i]; struct basis_function *fj = &bfns[j]; struct basis_function *fk = &bfns[k]; struct basis_function *fl = &bfns[l]; double eri = aoint_eri(fi, fj, fk, fl); // eri = (ij|kl) = ``` -------------------------------- ### Link Libraries in CMake Source: https://github.com/aoleynichenko/minichem/blob/master/src/util/CMakeLists.txt Link the 'util' library against the 'sys' library. ```cmake target_link_libraries(util sys) ``` -------------------------------- ### Matrix Multiplication (linalg_square_dgemm) Source: https://context7.com/aoleynichenko/minichem/llms.txt A wrapper for the BLAS matrix multiplication routine. Supports multiplication of matrices with or without transposition. ```c #include "linalg.h" double *A, *B, *C; // dim x dim matrices // C = A * B linalg_square_dgemm(A, 'N', B, 'N', C, dim); // C = A^T * B linalg_square_dgemm(A, 'T', B, 'N', C, dim); // C = A * B^T linalg_square_dgemm(A, 'N', B, 'T', C, dim); ``` -------------------------------- ### linalg_dsyev - Symmetric Matrix Eigensolver Source: https://context7.com/aoleynichenko/minichem/llms.txt Wrapper for LAPACK's dsyev routine for solving the symmetric eigenvalue problem. ```APIDOC ## linalg_dsyev - Symmetric Matrix Eigensolver ### Description This function wraps the LAPACK `dsyev` routine to compute the eigenvalues and eigenvectors of a real symmetric matrix. ### Method Not specified (likely a C function call) ### Endpoint N/A (C function) ### Parameters - **A** (double array) - The input symmetric matrix (dim x dim). - **eigval** (double array) - Output array to store the eigenvalues. - **V** (double array) - Output array to store the eigenvectors (row-major). - **dim** (int) - The dimension of the matrix. ### Request Example ```c #include "linalg.h" double *A = /* symmetric matrix (dim x dim) */; double *eigval = (double *) qalloc(dim * sizeof(double)); double *V = (double *) qalloc(dim * dim * sizeof(double)); linalg_dsyev(A, eigval, V, dim); // eigval contains eigenvalues // V contains eigenvectors (row-major) ``` ### Response #### Success Response (200) - **eigval** (double array) - Contains the computed eigenvalues. - **V** (double array) - Contains the computed eigenvectors. ``` -------------------------------- ### Minichem CLI Usage Source: https://context7.com/aoleynichenko/minichem/llms.txt The Minichem program is executed via the command line, supporting input file processing, parallel execution, and configuration flags. ```APIDOC ## CLI Execution ### Description Run quantum chemistry calculations by providing an input file. Supports MPI parallelization and various output control flags. ### Usage `minichem.x [options] input.nw` ### Options - **-o [file]** (string) - Optional - Redirect output to a specific log file. - **-noecho** (flag) - Optional - Disable echoing of the input file to the output. - **-v** (flag) - Optional - Print version information. - **-h** (flag) - Optional - Print help information. ### Parallel Execution `mpirun -np [n] minichem.x input.nw` - Run with MPI parallelization using n processes. ``` -------------------------------- ### Mulliken Population Analysis Source: https://context7.com/aoleynichenko/minichem/llms.txt Computes Mulliken atomic charges and populations. ```APIDOC ## Mulliken Population Analysis ### Description Computes Mulliken atomic charges and populations based on the density and overlap matrices. ### Method Not specified (likely a C function call) ### Endpoint N/A (C function) ### Parameters - **molecule** (structure) - Description: Molecular structure information. - **bfns** (type unknown) - Description: Basis functions. - **P** (double array) - Description: Density matrix. - **S** (double array) - Description: Overlap matrix. - **dim** (int) - Description: Dimension of the matrices (number of basis functions). ### Request Example ```c #include "scf.h" // After SCF converges: double *P = /* density matrix */; double *S = /* overlap matrix */; int dim = nbfns; mulliken(&molecule, bfns, P, S, dim); // Prints atomic populations and charges to stdout ``` ### Response #### Success Response (200) - **stdout** - Prints atomic populations and charges. ``` -------------------------------- ### Minichem Input Directive: geometry Source: https://context7.com/aoleynichenko/minichem/llms.txt Defines the molecular structure. Supports specifying units (e.g., angstroms, atomic) and multiplicity. Coordinates are listed per atom. ```nwchem geometry units angstroms C 0.0 0.0 0.0 O 1.128 0.0 0.0 end ``` ```nwchem geometry units atomic mult 2 H 0.0 0.0 0.0 end ``` -------------------------------- ### Symmetric Matrix Eigensolver (linalg_dsyev) Source: https://context7.com/aoleynichenko/minichem/llms.txt A wrapper for the LAPACK symmetric eigenvalue solver. It computes eigenvalues and eigenvectors for a given symmetric matrix. ```c #include "linalg.h" double *A = /* symmetric matrix (dim x dim) */; double *eigval = (double *) qalloc(dim * sizeof(double)); double *V = (double *) qalloc(dim * dim * sizeof(double)); linalg_dsyev(A, eigval, V, dim); // eigval contains eigenvalues // V contains eigenvectors (row-major) ``` -------------------------------- ### Minichem Input Directive: memory Source: https://context7.com/aoleynichenko/minichem/llms.txt Allocates memory for the calculation. Supports various units like MB, GB, and KB. Ensure sufficient memory is allocated for complex calculations. ```nwchem memory 400 mb ``` ```nwchem memory 2 gb ``` ```nwchem memory 1024 kb ``` -------------------------------- ### Set C Standard Requirement and Version Source: https://github.com/aoleynichenko/minichem/blob/master/src/input/CMakeLists.txt Enforces the use of C99 standard for the 'input' target. This ensures compatibility and adherence to specific C language features. ```cmake set(C_STANDARD_REQUIRED ON) set_property(TARGET input PROPERTY C_STANDARD 99) ``` -------------------------------- ### Set C Standard Version Source: https://github.com/aoleynichenko/minichem/blob/master/src/sys/CMakeLists.txt Sets the C standard version for the 'sys' target to C99. This ensures that the code adheres to the specified C standard. ```cmake set_property(TARGET sys PROPERTY C_STANDARD 99) ``` -------------------------------- ### Retrieve Values from Runtime Database (RTDB) Source: https://context7.com/aoleynichenko/minichem/llms.txt Retrieves values from the runtime database based on their keys. The function signature varies depending on the expected data type and number of values. ```c #include "input.h" int maxiter; rtdb_get("scf:maxiter", &maxiter); double etot; rtdb_get("scf:etot", &etot); double x, y, z; rtdb_get("geom:center", &x, &y, &z); ``` -------------------------------- ### Configure CMake for aoints library Source: https://github.com/aoleynichenko/minichem/blob/master/src/aoints/CMakeLists.txt Defines the source files for the aoints library and links it against the system library. ```cmake add_library(aoints aoints.c 1e.c 2e.c boys.c ints_print.c ) target_link_libraries(aoints sys) ``` -------------------------------- ### Compute Nuclear Attraction Integral Source: https://context7.com/aoleynichenko/minichem/llms.txt Calculates the electron-nuclear attraction integral. ```c #include "aoints.h" double V_ij = aoint_potential(fi, fj); // V_ij = sum_A ``` -------------------------------- ### linalg_square_dgemm - Matrix Multiplication Source: https://context7.com/aoleynichenko/minichem/llms.txt Wrapper for BLAS's dgemm routine for matrix multiplication. ```APIDOC ## linalg_square_dgemm - Matrix Multiplication ### Description This function wraps the BLAS `dgemm` routine for performing matrix multiplication on square matrices. ### Method Not specified (likely a C function call) ### Endpoint N/A (C function) ### Parameters - **A** (double array) - The first matrix. - **transA** (char) - Specifies whether to transpose matrix A ('N' for no transpose, 'T' for transpose). - **B** (double array) - The second matrix. - **transB** (char) - Specifies whether to transpose matrix B ('N' for no transpose, 'T' for transpose). - **C** (double array) - The output matrix where the result is stored. - **dim** (int) - The dimension of the square matrices. ### Request Example ```c #include "linalg.h" double *A, *B, *C; // dim x dim matrices // C = A * B linalg_square_dgemm(A, 'N', B, 'N', C, dim); // C = A^T * B linalg_square_dgemm(A, 'T', B, 'N', C, dim); // C = A * B^T linalg_square_dgemm(A, 'N', B, 'T', C, dim); ``` ### Response #### Success Response (200) - **C** (double array) - The result of the matrix multiplication is stored in this matrix. ``` -------------------------------- ### rtdb_get - Retrieve Value from Runtime Database Source: https://context7.com/aoleynichenko/minichem/llms.txt Retrieves values from the runtime database. ```APIDOC ## rtdb_get - Retrieve Value from Runtime Database ### Description Retrieves values previously stored in the runtime database using their associated keys. ### Method Not specified (likely a C function call) ### Endpoint N/A (C function) ### Parameters - **key** (string) - The key of the value to retrieve. - **variable** (pointer) - A pointer to the variable where the retrieved value will be stored. The type should match the stored data type. ### Request Example ```c #include "input.h" int maxiter; rtdb_get("scf:maxiter", &maxiter); double etot; rtdb_get("scf:etot", &etot); double x, y, z; rtdb_get("geom:center", &x, &y, &z); ``` ### Response #### Success Response (200) - **return value** (int) - Typically 1 for success, 0 for failure. - **variable** - The variable passed by pointer will be populated with the retrieved value. ``` -------------------------------- ### rtdb_set - Store Value in Runtime Database Source: https://context7.com/aoleynichenko/minichem/llms.txt Stores configuration and result values in the runtime database. ```APIDOC ## rtdb_set - Store Value in Runtime Database ### Description Stores configuration and result values in the runtime database, allowing for key-value storage with specified data types. ### Method Not specified (likely a C function call) ### Endpoint N/A (C function) ### Parameters - **key** (string) - The key under which to store the value. - **format** (string) - A format string specifying the data type (e.g., "%i" for int, "%d" for double, "%s" for string). - **value** (variable arguments) - The value(s) to store, matching the format string. ### Request Example ```c #include "input.h" // Store integer rtdb_set("scf:maxiter", "%i", 50); // Store double rtdb_set("scf:etot", "%d", -74.96314638); // Store string rtdb_set("top:short_name", "%s", "water"); // Store multiple values (e.g., coordinates) rtdb_set("geom:center", "%d%d%d", 0.0, 0.0, 0.5); ``` ### Response #### Success Response (200) - **return value** (int) - Typically 1 for success, 0 for failure. ``` -------------------------------- ### Set C Standard Requirement Source: https://github.com/aoleynichenko/minichem/blob/master/src/visual/CMakeLists.txt Enforces the use of C99 standard for the 'visual' target. This ensures consistent C language features across the project. ```cmake set(C_STANDARD_REQUIRED ON) set_property(TARGET visual PROPERTY C_STANDARD 99) ``` -------------------------------- ### Mulliken Population Analysis Source: https://context7.com/aoleynichenko/minichem/llms.txt Performs Mulliken population analysis to compute atomic charges and populations. This function should be called after the SCF calculation has converged. ```c #include "scf.h" // After SCF converges: double *P = /* density matrix */; double *S = /* overlap matrix */; int dim = nbfns; mulliken(&molecule, bfns, P, S, dim); // Prints atomic populations and charges to stdout ``` -------------------------------- ### Set C standard for scf target Source: https://github.com/aoleynichenko/minichem/blob/master/src/aoints/CMakeLists.txt Enforces C99 standard requirements for the scf target. ```cmake set(C_STANDARD_REQUIRED ON) set_property(TARGET scf PROPERTY C_STANDARD 99) ``` -------------------------------- ### aoint_multipole - Multipole Moment Integral Source: https://context7.com/aoleynichenko/minichem/llms.txt Computes multipole moment integrals for electric properties. ```APIDOC ## aoint_multipole - Multipole Moment Integral ### Description Computes multipole moment integrals for electric properties. ### Method Not specified (likely a C function call) ### Endpoint N/A (C function) ### Parameters - **fi** (type unknown) - Description: First integral basis function. - **fj** (type unknown) - Description: Second integral basis function. - **xyz_pow** (int array) - Description: Array specifying the powers of x, y, and z for the multipole moment. ### Request Example ```c // Dipole moment (e.g., X component) int xyz_pow[3] = {1, 0, 0}; // x^1 * y^0 * z^0 double dipole_x = aoint_multipole(fi, fj, xyz_pow); // Quadrupole moment (e.g., XX component) int xyz_pow_xx[3] = {2, 0, 0}; // x^2 * y^0 * z^0 double quad_xx = aoint_multipole(fi, fj, xyz_pow_xx); ``` ### Response #### Success Response (200) - **return value** (double) - The computed multipole moment integral. ``` -------------------------------- ### Set C Standard Requirement in CMake Source: https://github.com/aoleynichenko/minichem/blob/master/src/util/CMakeLists.txt Enforces C standard compliance and sets the C standard for the 'util' target to C99. ```cmake set(C_STANDARD_REQUIRED ON) set_property(TARGET util PROPERTY C_STANDARD 99) ``` -------------------------------- ### Set C Standard Requirement Source: https://github.com/aoleynichenko/minichem/blob/master/src/sys/CMakeLists.txt Enforces that the C standard is required for the build. Use this to ensure code compatibility across different compilers and environments. ```cmake set(C_STANDARD_REQUIRED ON) ``` -------------------------------- ### SCF Energy Driver (C API) Source: https://context7.com/aoleynichenko/minichem/llms.txt The scf_energy function serves as the main driver for performing Restricted or Unrestricted Hartree-Fock calculations. ```APIDOC ## scf_energy ### Description Performs the complete SCF calculation (RHF or UHF based on electron configuration). ### Method C Function ### Request Example ```c struct cart_mol molecule; // ... populate molecule ... scf_init(); scf_energy(&molecule); ``` ### Response - **scf:etot** (double) - Total energy stored in RTDB - **scf:enuc** (double) - Nuclear repulsion energy stored in RTDB ``` -------------------------------- ### Minichem Input Directive: nproc Source: https://context7.com/aoleynichenko/minichem/llms.txt Specifies the number of OpenMP threads for parallel computation. This directive is used for shared-memory parallelization. ```nwchem nproc 8 ``` -------------------------------- ### Perform UHF Calculation Source: https://context7.com/aoleynichenko/minichem/llms.txt Executes the Unrestricted Hartree-Fock loop for open-shell systems. ```c #include "scf.h" #include "basis.h" // UHF is automatically selected when Nalpha != Nbeta // Set multiplicity in input file: mult 2 (doublet), mult 3 (triplet), etc. // Run UHF loop uhf_loop(&molecule, bfns, nbfns); // Additional UHF output: // - Alpha and Beta orbital energies separately // - UHF spin contamination // - Exact for comparison ``` -------------------------------- ### Loewdin Population Analysis Source: https://context7.com/aoleynichenko/minichem/llms.txt Computes Loewdin atomic charges using S^(1/2) transformation. ```APIDOC ## Loewdin Population Analysis ### Description Computes Loewdin atomic charges by transforming the density matrix with the inverse square root of the overlap matrix. ### Method Not specified (likely a C function call) ### Endpoint N/A (C function) ### Parameters - **molecule** (structure) - Description: Molecular structure information. - **bfns** (type unknown) - Description: Basis functions. - **P** (double array) - Description: Density matrix. - **S** (double array) - Description: Overlap matrix. - **dim** (int) - Description: Dimension of the matrices (number of basis functions). ### Request Example ```c #include "scf.h" loewdin(&molecule, bfns, P, S, dim); // Prints Loewdin populations and charges to stdout ``` ### Response #### Success Response (200) - **stdout** - Prints Loewdin populations and charges. ``` -------------------------------- ### Loewdin Population Analysis Source: https://context7.com/aoleynichenko/minichem/llms.txt Performs Loewdin population analysis to compute atomic charges using an S^(1/2) transformation. This function requires the density matrix (P), overlap matrix (S), and dimension (dim). ```c #include "scf.h" loewdin(&molecule, bfns, P, S, dim); // Prints Loewdin populations and charges to stdout ``` -------------------------------- ### Perform RHF Calculation Source: https://context7.com/aoleynichenko/minichem/llms.txt Executes the Restricted Hartree-Fock loop for closed-shell systems. ```c #include "scf.h" #include "basis.h" // After setting up molecule and basis functions extern struct basis_function *bfns; // Atom-centered basis functions extern int nbfns; // Number of basis functions // Run RHF loop rhf_loop(&molecule, bfns, nbfns); // Output includes: // - Orbital energies and occupations // - Total SCF energy // - Mulliken and Loewdin populations // - Dipole and quadrupole moments ``` -------------------------------- ### Compute Overlap Integral Source: https://context7.com/aoleynichenko/minichem/llms.txt Calculates the overlap integral between two basis functions. ```c #include "aoints.h" #include "basis.h" struct basis_function *fi = &bfns[i]; struct basis_function *fj = &bfns[j]; double S_ij = aoint_overlap(fi, fj); // S_ij = ``` -------------------------------- ### Define Gaussian Basis Sets Source: https://context7.com/aoleynichenko/minichem/llms.txt Specifies basis functions for elements using spherical or Cartesian forms. ```text basis "ao basis" SPHERICAL H S 3.42525091 0.15432897 0.62391373 0.53532814 0.16885540 0.44463454 C SP 2.9412494 -0.09996723 0.15591627 0.6834831 0.39951283 0.60768372 0.2222899 0.70011547 0.39195739 end ``` -------------------------------- ### Compute Kinetic Energy Integral Source: https://context7.com/aoleynichenko/minichem/llms.txt Calculates the kinetic energy integral between two basis functions. ```c #include "aoints.h" double T_ij = aoint_kinetic(fi, fj); // T_ij = ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.