Long-range quantum computing (WF) in short-range DFT embedding (#2924)

This commit is contained in:
Stefano Battaglia 2023-08-24 14:15:15 +02:00 committed by GitHub
parent ce4b5920fa
commit cd366a4022
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
41 changed files with 4091 additions and 1691 deletions

View file

@ -116,7 +116,7 @@ If using this framework, `-D__ACCELERATE` must be defined to account for some
interface incompatibilities between Accelerate and reference BLAS/LAPACK.
When building on/for Windows using the Minimalist GNU for Windows (MinGW) environment,
you must set `-D__MINGW`, `-D__NO_STATM_ACCESS` and `-D__NO_IPI_DRIVER` to avoid
you must set `-D__MINGW`, `-D__NO_STATM_ACCESS` and `-D__NO_SOCKETS` to avoid
undefined references during linking, respectively errors while printing the statistics.
### 2e. MPI and SCALAPACK (optional, required for MPI parallel builds)
@ -547,12 +547,15 @@ partially depending on installed libraries (see 2.)
switch on energy profiling on Cray systems
- `-D__NO_ABORT` to avoid calling abort, but STOP instead (useful for coverage
testing, and to avoid core dumps on some systems)
- `-D__HDF5` enables hdf5 support. This is a hard dependency for SIRIUS, but can also
be used by itself to allow read/write functionalities of QCSchema files in the
active space module.
Features useful to deal with legacy systems
- `-D__NO_MPI_THREAD_SUPPORT_CHECK` - Workaround for MPI libraries that do not
declare they are thread safe (serialized).
- `-D__NO_IPI_DRIVER` disables the socket interface in case of troubles compiling
- `-D__NO_SOCKETS` disables the socket interface in case of troubles compiling
on systems that do not support POSIX sockets.
- `-D__HAS_IEEE_EXCEPTIONS` disables trapping temporarily for libraries like scalapack.
- The Makefile automatically compiles in the path to the data directory via the

View file

@ -14,7 +14,7 @@ CXX = x86_64-w64-mingw32-g++
FC = x86_64-w64-mingw32-gfortran
LD = x86_64-w64-mingw32-gfortran
AR = x86_64-w64-mingw32-ar -r
DFLAGS = -D__NO_STATM_ACCESS -D__NO_IPI_DRIVER -D__MINGW
DFLAGS = -D__NO_STATM_ACCESS -D__NO_SOCKETS -D__MINGW
CFLAGS = $(DFLAGS) -O2
FCFLAGS = $(DFLAGS) -O2 -ffree-form -ffree-line-length-none \
-ftree-vectorize -funroll-loops -std=f2008

View file

@ -467,6 +467,10 @@ list(
qs_2nd_kernel_ao.F
qs_active_space_methods.F
qs_active_space_types.F
qs_active_space_utils.F
qcschema.F
hdf5_wrapper.F
sockets_interface.F
qs_atomic_block.F
qs_band_structure.F
qs_basis_gradient.F

View file

@ -161,8 +161,8 @@ CONTAINS
CALL integer_to_string(__MAX_CONTR, tmp_str)
flags = TRIM(flags)//" max_contr="//TRIM(tmp_str)
#endif
#if defined(__NO_IPI_DRIVER)
flags = TRIM(flags)//" no_ipi_driver"
#if defined(__NO_SOCKETS)
flags = TRIM(flags)//" no_sockets"
#endif
#if defined(__NO_MPI_THREAD_SUPPORT_CHECK)
flags = TRIM(flags)//" no_mpi_thread_support_check"
@ -247,6 +247,10 @@ CONTAINS
flags = TRIM(flags)//" libvdwxc"
#endif
#if defined(__HDF5)
flags = TRIM(flags)//" hdf5"
#endif
END FUNCTION cp2k_flags
! **************************************************************************************************

762
src/hdf5_wrapper.F Normal file
View file

@ -0,0 +1,762 @@
!--------------------------------------------------------------------------------------------------!
! CP2K: A general program to perform molecular dynamics simulations !
! Copyright 2000-2023 CP2K developers group <https://cp2k.org> !
! !
! SPDX-License-Identifier: GPL-2.0-or-later !
!--------------------------------------------------------------------------------------------------!
! **************************************************************************************************
!> \brief A wrapper around the HDF5 Fortran API
!> \par History
!> 04.2023 created [SB]
!> \author Stefano Battaglia
! **************************************************************************************************
MODULE hdf5_wrapper
USE hdf5, ONLY: &
h5aclose_f, h5acreate_f, h5aopen_f, h5aread_f, h5awrite_f, h5close_f, h5dclose_f, &
h5dcreate_f, h5dget_space_f, h5dopen_f, h5dread_f, h5dwrite_f, h5f_acc_rdonly_f, &
h5f_acc_trunc_f, h5fclose_f, h5fcreate_f, h5fopen_f, h5gclose_f, h5gcreate_f, h5gopen_f, &
h5open_f, h5s_scalar_f, h5sclose_f, h5screate_f, h5screate_simple_f, &
h5sget_simple_extent_npoints_f, h5t_c_s1, h5t_cset_utf8_f, h5t_enum_f, h5t_native_double, &
h5t_native_integer, h5t_str_nullpad_f, h5t_string, h5tclose_f, h5tcopy_f, h5tcreate_f, &
h5tenum_insert_f, h5tset_cset_f, h5tset_size_f, h5tset_strpad_f, hid_t, hsize_t, size_t
USE iso_c_binding, ONLY: C_LOC,&
c_ptr
USE kinds, ONLY: dp
#include "./base/base_uses.f90"
IMPLICIT NONE
CHARACTER(len=*), PARAMETER, PRIVATE :: moduleN = 'hdf5_wrapper'
INTEGER, PARAMETER, PUBLIC :: hdf5_id = hid_t
CONTAINS
! **************************************************************************************************
!> \brief Initialize the HDF5 fortran API
! **************************************************************************************************
SUBROUTINE h5open()
INTEGER :: error
CALL h5open_f(error)
IF (error < 0) CPABORT('ERROR: failed to initialize HDF5 interface')
END SUBROUTINE h5open
! **************************************************************************************************
!> \brief Close the HDF5 fortran API
! **************************************************************************************************
SUBROUTINE h5close()
INTEGER :: error
CALL h5close_f(error)
IF (error < 0) CPABORT('ERROR: failed to close HDF5 interface')
END SUBROUTINE h5close
! **************************************************************************************************
!> \brief Create a HDF5 file
!> \param filename the name of the hdf5 file
!> \param file_id the file id of the hdf5 file
! **************************************************************************************************
SUBROUTINE h5fcreate(filename, file_id)
CHARACTER(LEN=*), INTENT(IN) :: filename
INTEGER(KIND=hid_t), INTENT(OUT) :: file_id
INTEGER :: error
CALL h5fcreate_f(filename, h5f_acc_trunc_f, file_id, error)
IF (error < 0) CPABORT('ERROR: failed to create HDF5 file')
END SUBROUTINE h5fcreate
! **************************************************************************************************
!> \brief Open a HDF5 file
!> \param filename the name of the hdf5 file
!> \param file_id the file id of the hdf5 file
! **************************************************************************************************
SUBROUTINE h5fopen(filename, file_id)
CHARACTER(LEN=*), INTENT(IN) :: filename
INTEGER(KIND=hid_t), INTENT(OUT) :: file_id
INTEGER :: error
CALL h5fopen_f(TRIM(filename), h5f_acc_rdonly_f, file_id, error)
IF (error < 0) CPABORT('ERROR: failed to open HDF5 file')
END SUBROUTINE h5fopen
! **************************************************************************************************
!> \brief Close a HDF5 file
!> \param file_id the file id of the hdf5 file
! **************************************************************************************************
SUBROUTINE h5fclose(file_id)
INTEGER(KIND=hid_t), INTENT(IN) :: file_id
INTEGER :: error
CALL h5fclose_f(file_id, error)
IF (error < 0) CPABORT('ERROR: failed to close HDF5 file')
END SUBROUTINE h5fclose
! **************************************************************************************************
!> \brief Create a HDF5 group
!> \param loc_id file or group identifier
!> \param name name of the group
!> \param grp_id group identifier
! **************************************************************************************************
SUBROUTINE h5gcreate(loc_id, name, grp_id)
INTEGER(KIND=hid_t), INTENT(IN) :: loc_id
CHARACTER(LEN=*), INTENT(IN) :: name
INTEGER(KIND=hid_t), INTENT(OUT) :: grp_id
INTEGER :: error
CALL h5gcreate_f(loc_id, name, grp_id, error)
IF (error < 0) CPABORT('ERROR: failed to create HDF5 group')
END SUBROUTINE h5gcreate
! **************************************************************************************************
!> \brief Open a HDF5 group
!> \param loc_id file or group identifier
!> \param name name of the group
!> \param grp_id group identifier
! **************************************************************************************************
SUBROUTINE h5gopen(loc_id, name, grp_id)
INTEGER(KIND=hid_t), INTENT(IN) :: loc_id
CHARACTER(LEN=*), INTENT(IN) :: name
INTEGER(KIND=hid_t), INTENT(OUT) :: grp_id
INTEGER :: error
CALL h5gopen_f(loc_id, name, grp_id, error)
IF (error < 0) CPABORT('ERROR: failed to open HDF5 group')
END SUBROUTINE h5gopen
! **************************************************************************************************
!> \brief Close a HDF5 group
!> \param grp_id group identifier
! **************************************************************************************************
SUBROUTINE h5gclose(grp_id)
INTEGER(KIND=hid_t), INTENT(IN) :: grp_id
INTEGER :: error
CALL h5gclose_f(grp_id, error)
IF (error < 0) CPABORT('ERROR: failed to close HDF5 group')
END SUBROUTINE h5gclose
! **************************************************************************************************
!> \brief Write a variable-length string attribute
!> \param loc_id either file id or group id
!> \param attr_name the name of the attribute
!> \param attr_data the attribute data, i.e. the string to write
! **************************************************************************************************
SUBROUTINE h5awrite_varlen_string(loc_id, attr_name, attr_data)
INTEGER(KIND=hid_t), INTENT(IN) :: loc_id
CHARACTER(LEN=*), INTENT(IN) :: attr_name
CHARACTER(LEN=*), INTENT(IN), TARGET :: attr_data
INTEGER :: error, output_unit
INTEGER(KIND=hid_t) :: attr_id, space_id, type_id
TYPE(c_ptr) :: buffer
TYPE(c_ptr), TARGET :: in_between_ptr
! create a scalar dataspace
CALL h5screate_f(h5s_scalar_f, space_id, error)
IF (error < 0) THEN
WRITE (UNIT=output_unit, FMT="(/,T5,A,/)") &
' ERROR: failed to create HDF5 dataspace'
RETURN
END IF
! create a variable-length string type
CALL h5tcopy_f(h5t_string, type_id, error)
CALL h5tset_cset_f(type_id, h5t_cset_utf8_f, error)
CALL h5tset_strpad_f(type_id, h5t_str_nullpad_f, error)
! create the attribute
CALL h5acreate_f(loc_id, attr_name, type_id, space_id, attr_id, error)
IF (error < 0) THEN
WRITE (UNIT=output_unit, FMT="(/,T5,A,/)") &
' ERROR: failed to create HDF5 attribute'
RETURN
END IF
! weird in-between pointer needed for variable-length
! string to a scalar dataspace
in_between_ptr = C_LOC(attr_data)
! the actual pointer to be passed
buffer = C_LOC(in_between_ptr)
! write the string attribute to file
CALL h5awrite_f(attr_id, type_id, buffer, error)
IF (error < 0) THEN
WRITE (UNIT=output_unit, FMT="(/,T5,A,/)") &
' ERROR: failed to write HDF5 attribute'
RETURN
END IF
! close attribute
CALL h5aclose_f(attr_id, error)
IF (error < 0) THEN
WRITE (UNIT=output_unit, FMT="(/,T5,A,/)") &
' ERROR: failed to close HDF5 attribute'
RETURN
END IF
! close dataspace
CALL h5sclose_f(space_id, error)
IF (error < 0) THEN
WRITE (UNIT=output_unit, FMT="(/,T5,A,/)") &
' ERROR: failed to close HDF5 dataspace'
RETURN
END IF
! close datatype
CALL h5tclose_f(type_id, error)
IF (error < 0) THEN
WRITE (UNIT=output_unit, FMT="(/,T5,A,/)") &
' ERROR: failed to close HDF5 datatype'
RETURN
END IF
END SUBROUTINE h5awrite_varlen_string
! **************************************************************************************************
!> \brief Write a fixed-length string attribute
!> \param loc_id either file id or group id
!> \param attr_name the name of the attribute
!> \param attr_data the attribute data, i.e. the string to write
! **************************************************************************************************
SUBROUTINE h5awrite_fixlen_string(loc_id, attr_name, attr_data)
INTEGER(KIND=hid_t), INTENT(IN) :: loc_id
CHARACTER(LEN=*), INTENT(IN) :: attr_name
CHARACTER(LEN=*), INTENT(IN), TARGET :: attr_data
INTEGER :: error, output_unit
INTEGER(KIND=hid_t) :: attr_id, space_id, type_id
TYPE(c_ptr) :: buffer
! create a scalar dataspace
CALL h5screate_f(h5s_scalar_f, space_id, error)
IF (error < 0) THEN
WRITE (UNIT=output_unit, FMT="(/,T5,A,/)") &
' ERROR: failed to create HDF5 dataspace'
RETURN
END IF
! create a fixed-length string datatype
CALL h5tcopy_f(h5t_c_s1, type_id, error)
CALL h5tset_cset_f(type_id, h5t_cset_utf8_f, error)
CALL h5tset_size_f(type_id, LEN(attr_data, size_t), error)
! create the attribute
CALL h5acreate_f(loc_id, attr_name, type_id, space_id, attr_id, error)
IF (error < 0) THEN
WRITE (UNIT=output_unit, FMT="(/,T5,A,/)") &
' ERROR: failed to create HDF5 attribute'
RETURN
END IF
! the actual pointer to be passed
buffer = C_LOC(attr_data)
! write the string attribute to file
CALL h5awrite_f(attr_id, type_id, buffer, error)
IF (error < 0) THEN
WRITE (UNIT=output_unit, FMT="(/,T5,A,/)") &
' ERROR: failed to write HDF5 attribute'
RETURN
END IF
! close attribute
CALL h5aclose_f(attr_id, error)
IF (error < 0) THEN
WRITE (UNIT=output_unit, FMT="(/,T5,A,/)") &
' ERROR: failed to close HDF5 attribute'
RETURN
END IF
! close dataspace
CALL h5sclose_f(space_id, error)
IF (error < 0) THEN
WRITE (UNIT=output_unit, FMT="(/,T5,A,/)") &
' ERROR: failed to close HDF5 dataspace'
RETURN
END IF
! close datatype
CALL h5tclose_f(type_id, error)
IF (error < 0) THEN
WRITE (UNIT=output_unit, FMT="(/,T5,A,/)") &
' ERROR: failed to close HDF5 datatype'
RETURN
END IF
END SUBROUTINE h5awrite_fixlen_string
! **************************************************************************************************
!> \brief Write a boolean attribute
!> \param loc_id either file id or group id
!> \param attr_name the name of the attribute
!> \param attr_data the attribute data, i.e. the logical to write (.true. or .false.)
! **************************************************************************************************
SUBROUTINE h5awrite_boolean(loc_id, attr_name, attr_data)
INTEGER(KIND=hid_t), INTENT(IN) :: loc_id
CHARACTER(LEN=*), INTENT(IN) :: attr_name
LOGICAL, INTENT(IN) :: attr_data
INTEGER :: error, output_unit
INTEGER(KIND=hid_t) :: attr_id, space_id, type_id
INTEGER(KIND=size_t) :: enum_size = 1
INTEGER, TARGET :: attr_data_to_int
TYPE(c_ptr) :: buffer
! 8-bit integers in enum bool_type
! create a scalar dataspace
CALL h5screate_f(h5s_scalar_f, space_id, error)
IF (error < 0) THEN
WRITE (UNIT=output_unit, FMT="(/,T5,A,/)") &
' ERROR: failed to create HDF5 dataspace'
RETURN
END IF
! create the datatype
CALL h5tcreate_f(h5t_enum_f, enum_size, type_id, error)
CALL h5tenum_insert_f(type_id, "FALSE", 0, error)
CALL h5tenum_insert_f(type_id, "TRUE", 1, error)
IF (attr_data) THEN
attr_data_to_int = 1
ELSE
attr_data_to_int = 0
END IF
! the C pointer to the actual data
buffer = C_LOC(attr_data_to_int)
! create the attribute
CALL h5acreate_f(loc_id, attr_name, type_id, space_id, attr_id, error)
IF (error < 0) THEN
WRITE (UNIT=output_unit, FMT="(/,T5,A,/)") &
' ERROR: failed to create HDF5 attribute'
RETURN
END IF
! write the string attribute to file
CALL h5awrite_f(attr_id, type_id, buffer, error)
IF (error < 0) THEN
WRITE (UNIT=output_unit, FMT="(/,T5,A,/)") &
' ERROR: failed to write HDF5 attribute'
RETURN
END IF
! close attribute
CALL h5aclose_f(attr_id, error)
IF (error < 0) THEN
WRITE (UNIT=output_unit, FMT="(/,T5,A,/)") &
' ERROR: failed to close HDF5 attribute'
RETURN
END IF
! close dataspace
CALL h5sclose_f(space_id, error)
IF (error < 0) THEN
WRITE (UNIT=output_unit, FMT="(/,T5,A,/)") &
' ERROR: failed to close HDF5 dataspace'
RETURN
END IF
! close datatype
CALL h5tclose_f(type_id, error)
IF (error < 0) THEN
WRITE (UNIT=output_unit, FMT="(/,T5,A,/)") &
' ERROR: failed to close HDF5 datatype'
RETURN
END IF
END SUBROUTINE h5awrite_boolean
! **************************************************************************************************
!> \brief Write a (scalar) integer attribute
!> \param loc_id either file id or group id
!> \param attr_name the name of the attribute
!> \param attr_data the attribute data, i.e. the integer to write
! **************************************************************************************************
SUBROUTINE h5awrite_integer_scalar(loc_id, attr_name, attr_data)
INTEGER(KIND=hid_t), INTENT(IN) :: loc_id
CHARACTER(LEN=*), INTENT(IN) :: attr_name
INTEGER, INTENT(IN), TARGET :: attr_data
INTEGER :: error, output_unit
INTEGER(KIND=hid_t) :: attr_id, space_id, type_id
TYPE(c_ptr) :: buffer
! create a scalar dataspace
CALL h5screate_f(h5s_scalar_f, space_id, error)
IF (error < 0) THEN
WRITE (UNIT=output_unit, FMT="(/,T5,A,/)") &
' ERROR: failed to create HDF5 dataspace'
RETURN
END IF
! the C pointer to the actual data
buffer = C_LOC(attr_data)
! set the type of data
type_id = h5t_native_integer
! create the attribute
CALL h5acreate_f(loc_id, attr_name, type_id, space_id, attr_id, error)
IF (error < 0) THEN
WRITE (UNIT=output_unit, FMT="(/,T5,A,/)") &
' ERROR: failed to create HDF5 attribute'
RETURN
END IF
! write the string attribute to file
CALL h5awrite_f(attr_id, type_id, buffer, error)
IF (error < 0) THEN
WRITE (UNIT=output_unit, FMT="(/,T5,A,/)") &
' ERROR: failed to write HDF5 attribute'
RETURN
END IF
! close attribute
CALL h5aclose_f(attr_id, error)
IF (error < 0) THEN
WRITE (UNIT=output_unit, FMT="(/,T5,A,/)") &
' ERROR: failed to close HDF5 attribute'
RETURN
END IF
! close dataspace
CALL h5sclose_f(space_id, error)
IF (error < 0) THEN
WRITE (UNIT=output_unit, FMT="(/,T5,A,/)") &
' ERROR: failed to close HDF5 dataspace'
RETURN
END IF
END SUBROUTINE h5awrite_integer_scalar
! **************************************************************************************************
!> \brief Write a (scalar) double precision attribute
!> \param loc_id either file id or group id
!> \param attr_name the name of the attribute
!> \param attr_data the attribute data, i.e. the double to write
! **************************************************************************************************
SUBROUTINE h5awrite_double_scalar(loc_id, attr_name, attr_data)
INTEGER(KIND=hid_t), INTENT(IN) :: loc_id
CHARACTER(LEN=*), INTENT(IN) :: attr_name
REAL(KIND=dp), INTENT(IN), TARGET :: attr_data
INTEGER :: error
INTEGER(KIND=hid_t) :: attr_id, space_id, type_id
TYPE(c_ptr) :: buffer
! create a scalar dataspace
CALL h5screate_f(h5s_scalar_f, space_id, error)
IF (error < 0) CPABORT('ERROR: failed to create HDF5 dataspace')
! the C pointer to the actual data
buffer = C_LOC(attr_data)
! set the type of data
type_id = h5t_native_double
! create the attribute
CALL h5acreate_f(loc_id, attr_name, type_id, space_id, attr_id, error)
IF (error < 0) CPABORT('ERROR: failed to create HDF5 attribute')
! write the string attribute to file
CALL h5awrite_f(attr_id, type_id, buffer, error)
IF (error < 0) CPABORT('ERROR: failed to write HDF5 attribute')
! close attribute
CALL h5aclose_f(attr_id, error)
IF (error < 0) CPABORT('ERROR: failed to close HDF5 attribute')
! close dataspace
CALL h5sclose_f(space_id, error)
IF (error < 0) CPABORT('ERROR: failed to close HDF5 dataspace')
END SUBROUTINE h5awrite_double_scalar
! **************************************************************************************************
!> \brief Write an array of fixed-length string attribute
!> \param loc_id either file id or group id
!> \param attr_name the name of the attribute
!> \param attr_data the attribute data, i.e. the array of strings
! **************************************************************************************************
SUBROUTINE h5awrite_string_simple(loc_id, attr_name, attr_data)
INTEGER(KIND=hid_t), INTENT(IN) :: loc_id
CHARACTER(LEN=*), INTENT(IN) :: attr_name
CHARACTER(LEN=*), DIMENSION(:), INTENT(IN), TARGET :: attr_data
INTEGER :: error
INTEGER(KIND=hid_t) :: attr_id, space_id, type_id
INTEGER(KIND=hsize_t), DIMENSION(2) :: dims
TYPE(c_ptr) :: buffer
dims(1) = LEN(attr_data(1), kind=hsize_t) ! length of a string entry
dims(2) = SIZE(attr_data, kind=hsize_t) ! length of array of strings
! create a fixed-length string datatype
CALL h5tcopy_f(h5t_c_s1, type_id, error)
CALL h5tset_cset_f(type_id, h5t_cset_utf8_f, error)
CALL h5tset_size_f(type_id, dims(1), error)
! create a simple dataspace
CALL h5screate_simple_f(1, dims(2:2), space_id, error)
IF (error < 0) CPABORT('ERROR: failed to create HDF5 dataspace')
! create the atrtibute
CALL h5acreate_f(loc_id, attr_name, type_id, space_id, attr_id, error)
IF (error < 0) CPABORT('ERROR: failed to create HDF5 attribute')
! the actual pointer to be passed
buffer = C_LOC(attr_data(1))
! write the string array attribute to file
CALL h5awrite_f(attr_id, type_id, buffer, error)
IF (error < 0) CPABORT('ERROR: failed to write HDF5 attribute')
! close attribute
CALL h5aclose_f(attr_id, error)
IF (error < 0) CPABORT('ERROR: failed to close HDF5 attribute')
! close dataspace
CALL h5sclose_f(space_id, error)
IF (error < 0) CPABORT('ERROR: failed to close HDF5 dataspace')
! close datatype
CALL h5tclose_f(type_id, error)
IF (error < 0) CPABORT('ERROR: failed to close HDF5 datatype')
END SUBROUTINE h5awrite_string_simple
! **************************************************************************************************
!> \brief Write an array of doubles attribute
!> \param loc_id either file id or group id
!> \param attr_name the name of the attribute
!> \param attr_data the attribute data, i.e. the array of doubles
! **************************************************************************************************
SUBROUTINE h5awrite_double_simple(loc_id, attr_name, attr_data)
INTEGER(KIND=hid_t), INTENT(IN) :: loc_id
CHARACTER(LEN=*), INTENT(IN) :: attr_name
REAL(KIND=dp), DIMENSION(:), INTENT(IN), TARGET :: attr_data
INTEGER :: error
INTEGER(KIND=hid_t) :: attr_id, space_id, type_id
INTEGER(KIND=hsize_t), DIMENSION(1) :: dims
TYPE(c_ptr) :: buffer
dims(1) = SIZE(attr_data, kind=hsize_t) ! length of array of strings
! set the type of data
type_id = h5t_native_double
! create a simple dataspace
CALL h5screate_simple_f(1, dims, space_id, error)
IF (error < 0) CPABORT('ERROR: failed to create HDF5 dataspace')
! create the atrtibute
CALL h5acreate_f(loc_id, attr_name, type_id, space_id, attr_id, error)
IF (error < 0) CPABORT('ERROR: failed to create HDF5 attribute')
! the actual pointer to be passed
buffer = C_LOC(attr_data(1))
! write the string array attribute to file
CALL h5awrite_f(attr_id, type_id, buffer, error)
IF (error < 0) CPABORT('ERROR: failed to write HDF5 attribute')
! close attribute
CALL h5aclose_f(attr_id, error)
IF (error < 0) CPABORT('ERROR: failed to close HDF5 attribute')
! close dataspace
CALL h5sclose_f(space_id, error)
IF (error < 0) CPABORT('ERROR: failed to close HDF5 dataspace')
END SUBROUTINE h5awrite_double_simple
! **************************************************************************************************
!> \brief Write an array of integers attribute
!> \param loc_id either file id or group id
!> \param attr_name the name of the attribute
!> \param attr_data the attribute data, i.e. the array of integers
! **************************************************************************************************
SUBROUTINE h5awrite_integer_simple(loc_id, attr_name, attr_data)
INTEGER(KIND=hid_t), INTENT(IN) :: loc_id
CHARACTER(LEN=*), INTENT(IN) :: attr_name
INTEGER, DIMENSION(:), INTENT(IN), TARGET :: attr_data
INTEGER :: error
INTEGER(KIND=hid_t) :: attr_id, space_id, type_id
INTEGER(KIND=hsize_t), DIMENSION(1) :: dims
TYPE(c_ptr) :: buffer
dims(1) = SIZE(attr_data, kind=hsize_t) ! length of array of strings
! set the type of data
type_id = h5t_native_integer
! create a simple dataspace
CALL h5screate_simple_f(1, dims, space_id, error)
IF (error < 0) CPABORT('ERROR: failed to create HDF5 dataspace')
! create the atrtibute
CALL h5acreate_f(loc_id, attr_name, type_id, space_id, attr_id, error)
IF (error < 0) CPABORT('ERROR: failed to create HDF5 attribute')
! the actual pointer to be passed
buffer = C_LOC(attr_data(1))
! write the string array attribute to file
CALL h5awrite_f(attr_id, type_id, buffer, error)
IF (error < 0) CPABORT('ERROR: failed to write HDF5 attribute')
! close attribute
CALL h5aclose_f(attr_id, error)
IF (error < 0) CPABORT('ERROR: failed to close HDF5 attribute')
! close dataspace
CALL h5sclose_f(space_id, error)
IF (error < 0) CPABORT('ERROR: failed to close HDF5 dataspace')
END SUBROUTINE h5awrite_integer_simple
! **************************************************************************************************
!> \brief Write a dataset containing an array of doubles
!> \param loc_id either file id or group id
!> \param dset_name the name of the dataset
!> \param dset_data the dataset data, i.e. the array of doubles
! **************************************************************************************************
SUBROUTINE h5dwrite_double_simple(loc_id, dset_name, dset_data)
INTEGER(KIND=hid_t), INTENT(IN) :: loc_id
CHARACTER(LEN=*), INTENT(IN) :: dset_name
REAL(KIND=dp), DIMENSION(:), INTENT(IN), TARGET :: dset_data
INTEGER :: error
INTEGER(KIND=hid_t) :: dset_id, space_id, type_id
INTEGER(KIND=hsize_t), DIMENSION(1) :: dims
TYPE(c_ptr) :: buffer
dims(1) = SIZE(dset_data, kind=hsize_t) ! length of array
! set the type of data
type_id = h5t_native_double
! create a simple dataspace
CALL h5screate_simple_f(1, dims, space_id, error)
IF (error < 0) CPABORT('ERROR: failed to create HDF5 dataspace')
! create the dataset
CALL h5dcreate_f(loc_id, dset_name, type_id, space_id, dset_id, error)
IF (error < 0) CPABORT('ERROR: failed to create HDF5 dataset')
! the actual pointer to be passed
buffer = C_LOC(dset_data(1))
! write the string array attribute to file
CALL h5dwrite_f(dset_id, type_id, buffer, error)
IF (error < 0) CPABORT('ERROR: failed to write HDF5 dataset')
! close dataset
CALL h5dclose_f(dset_id, error)
IF (error < 0) CPABORT('ERROR: failed to close HDF5 dataset')
! close dataspace
CALL h5sclose_f(space_id, error)
IF (error < 0) CPABORT('ERROR: failed to close HDF5 dataspace')
END SUBROUTINE h5dwrite_double_simple
! **************************************************************************************************
!> \brief Read a dataset containing an array of doubles
!> \param loc_id either file id or group id
!> \param dset_name the name of the dataset
!> \param dset_data where the read dataset data will be written
! **************************************************************************************************
SUBROUTINE h5dread_double_simple(loc_id, dset_name, dset_data)
INTEGER(KIND=hid_t), INTENT(IN) :: loc_id
CHARACTER(LEN=*), INTENT(IN) :: dset_name
REAL(KIND=dp), DIMENSION(:), INTENT(OUT) :: dset_data
INTEGER :: error
INTEGER(KIND=hid_t) :: dset_id, npoints, space_id, type_id
INTEGER(KIND=hsize_t), DIMENSION(1) :: dims
dims(1) = SIZE(dset_data, kind=hsize_t) ! length of array
! set the type of data
type_id = h5t_native_double
! open the dataset
CALL h5dopen_f(loc_id, dset_name, dset_id, error)
IF (error < 0) CPABORT('ERROR: failed to open HDF5 dataset')
! get information on the dataspace
CALL h5dget_space_f(dset_id, space_id, error)
IF (error < 0) CPABORT('ERROR: failed to fetch HDF5 dataspace info')
! get dataspace dims
CALL h5sget_simple_extent_npoints_f(space_id, npoints, error)
IF (error < 0) CPABORT('ERROR: failed to fetch HDF5 dataspace dimension')
! read the data
CALL h5dread_f(dset_id, type_id, dset_data, dims, error)
IF (error < 0) CPABORT('ERROR: failed to read HDF5 dataset')
! close dataset
CALL h5dclose_f(dset_id, error)
IF (error < 0) CPABORT('ERROR: failed to close HDF5 dataset')
! close dataspace
CALL h5sclose_f(space_id, error)
IF (error < 0) CPABORT('ERROR: failed to close HDF5 dataspace')
END SUBROUTINE h5dread_double_simple
! **************************************************************************************************
!> \brief Read an attribute containing a scalar double
!> \param loc_id either file id or group id
!> \param attr_name ...
!> \param attr_data ...
! **************************************************************************************************
SUBROUTINE h5aread_double_scalar(loc_id, attr_name, attr_data)
INTEGER(KIND=hid_t), INTENT(IN) :: loc_id
CHARACTER(LEN=*), INTENT(IN) :: attr_name
REAL(KIND=dp), INTENT(OUT), TARGET :: attr_data
INTEGER :: error
INTEGER(KIND=hid_t) :: attr_id, type_id
TYPE(c_ptr) :: buffer
! set the type of data
type_id = h5t_native_double
! open the attribute
CALL h5aopen_f(loc_id, attr_name, attr_id, error)
IF (error < 0) CPABORT('ERROR: failed to open HDF5 attribute')
buffer = C_LOC(attr_data)
! read the data
CALL h5aread_f(attr_id, type_id, buffer, error)
IF (error < 0) CPABORT('ERROR: failed to read HDF5 attribute')
! close the attribute
CALL h5aclose_f(attr_id, error)
IF (error < 0) CPABORT('ERROR: failed to close HDF5 attribute')
END SUBROUTINE h5aread_double_scalar
END MODULE hdf5_wrapper

View file

@ -1097,11 +1097,15 @@ MODULE input_constants
do_lri_opt_coeff = 1, &
do_lri_opt_exps = 2
! Active smape model parameters
! Active space model parameters
INTEGER, PARAMETER, PUBLIC :: hf_model = 100, &
rsdft_model = 101, &
dmft_model = 102
! Active space external solvers
INTEGER, PARAMETER, PUBLIC :: no_solver = 200, &
qiskit_solver = 201
! callgraph parameters
INTEGER, PARAMETER, PUBLIC :: callgraph_none = 0, &
callgraph_master = 1, &

View file

@ -74,11 +74,11 @@ MODULE input_cp2k_dft
jacobian_fd1_central, jacobian_fd2, jacobian_fd2_backward, kg_color_dsatur, &
kg_color_greedy, kg_tnadd_atomic, kg_tnadd_embed, kg_tnadd_embed_ri, kg_tnadd_none, &
ls_2pnt, ls_3pnt, ls_gold, ls_none, manual_selection, mao_basis_ext, mao_basis_orb, &
mao_basis_prim, mao_projection, mopac_guess, no_excitations, no_guess, numerical, oe_gllb, &
oe_lb, oe_none, oe_saop, oe_sic, orb_dx2, orb_dxy, orb_dy2, orb_dyz, orb_dz2, orb_dzx, &
orb_px, orb_py, orb_pz, orb_s, ot_algo_irac, ot_algo_taylor_or_diag, ot_chol_irac, &
ot_lwdn_irac, ot_mini_broyden, ot_mini_cg, ot_mini_diis, ot_mini_sd, ot_poly_irac, &
ot_precond_full_all, ot_precond_full_kinetic, ot_precond_full_single, &
mao_basis_prim, mao_projection, mopac_guess, no_excitations, no_guess, no_solver, &
numerical, oe_gllb, oe_lb, oe_none, oe_saop, oe_sic, orb_dx2, orb_dxy, orb_dy2, orb_dyz, &
orb_dz2, orb_dzx, orb_px, orb_py, orb_pz, orb_s, ot_algo_irac, ot_algo_taylor_or_diag, &
ot_chol_irac, ot_lwdn_irac, ot_mini_broyden, ot_mini_cg, ot_mini_diis, ot_mini_sd, &
ot_poly_irac, ot_precond_full_all, ot_precond_full_kinetic, ot_precond_full_single, &
ot_precond_full_single_inverse, ot_precond_none, ot_precond_s_inverse, &
ot_precond_solver_default, ot_precond_solver_direct, ot_precond_solver_inv_chol, &
ot_precond_solver_update, outer_scf_basis_center_opt, outer_scf_becke_constraint, &
@ -87,9 +87,9 @@ MODULE input_cp2k_dft
outer_scf_optimizer_diis, outer_scf_optimizer_newton, outer_scf_optimizer_newton_ls, &
outer_scf_optimizer_none, outer_scf_optimizer_sd, outer_scf_optimizer_secant, &
outer_scf_s2_constraint, plus_u_lowdin, plus_u_mulliken, plus_u_mulliken_charges, &
radius_covalent, radius_default, radius_single, radius_user, radius_vdw, random_guess, &
real_time_propagation, ref_charge_atomic, ref_charge_mulliken, rel_dkh, rel_none, &
rel_pot_erfc, rel_pot_full, rel_sczora_mp, rel_trans_atom, rel_trans_full, &
qiskit_solver, radius_covalent, radius_default, radius_single, radius_user, radius_vdw, &
random_guess, real_time_propagation, ref_charge_atomic, ref_charge_mulliken, rel_dkh, &
rel_none, rel_pot_erfc, rel_pot_full, rel_sczora_mp, rel_trans_atom, rel_trans_full, &
rel_trans_molecule, rel_zora, rel_zora_full, rel_zora_mp, restart_guess, rsdft_model, &
sccs_andreussi, sccs_derivative_cd3, sccs_derivative_cd5, sccs_derivative_cd7, &
sccs_derivative_fft, sccs_fattebert_gygi, shape_function_density, shape_function_gaussian, &
@ -510,6 +510,10 @@ CONTAINS
CALL section_add_subsection(section, subsection)
CALL section_release(subsection)
CALL create_active_space_section(subsection)
CALL section_add_subsection(section, subsection)
CALL section_release(subsection)
END SUBROUTINE create_dft_section
! **************************************************************************************************
@ -1078,10 +1082,6 @@ CONTAINS
CALL section_add_subsection(section, subsection)
CALL section_release(subsection)
CALL create_active_space_section(subsection)
CALL section_add_subsection(section, subsection)
CALL section_release(subsection)
CALL section_create(subsection, __LOCATION__, name="GAPW", &
description="Controls the printing of some gapw related information (debug).", &
n_keywords=0, n_subsections=1, repeats=.FALSE.)
@ -9054,24 +9054,9 @@ CONTAINS
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)
CALL keyword_create(keyword, __LOCATION__, name="INACTIVE_ELECTRONS", &
description="The number of inactive electrons in the CAS space", &
usage="INACTIVE_ELECTRONS 2 {2}", n_var=-1, default_i_vals=(/-1, -1/), &
type_of_var=integer_t)
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)
CALL keyword_create(keyword, __LOCATION__, name="ACTIVE_ORBITALS", &
description="The number of active orbitals defining the CAS space.", &
usage="ACTIVE_ORBITALS 2 {2}", n_var=-1, default_i_vals=(/-1, -1/), &
type_of_var=integer_t)
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)
CALL keyword_create(keyword, __LOCATION__, name="INACTIVE_ORBITALS", &
description="The number of nactive orbitals.", &
usage="INACTIVE_ORBITALS 2 {2}", n_var=-1, default_i_vals=(/-1, -1/), &
type_of_var=integer_t)
usage="ACTIVE_ORBITALS 2", n_var=1, default_i_val=-1, type_of_var=integer_t)
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)
@ -9122,16 +9107,42 @@ CONTAINS
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)
CALL keyword_create(keyword, __LOCATION__, name="READ_P_ACTIVE", &
description="Active density matrix must be read", &
CALL keyword_create(keyword, __LOCATION__, name="SCF_EMBEDDING", &
description="Whether to turn on the self-consistent embedding scheme", &
default_l_val=.FALSE., lone_keyword_l_val=.FALSE.)
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)
CALL keyword_create(keyword, __LOCATION__, name="P_ACTIVE_FILE_NAME", &
description="Name of the active DM file, may include a path", &
usage="P_ACTIVE_FILE_NAME <FILENAME>", &
type_of_var=lchar_t, repeats=.FALSE.)
CALL keyword_create(keyword, __LOCATION__, name="QCSCHEMA", &
description="Name of the QCSchema file, may include a path", &
usage="QCSCHEMA <FILENAME>", &
type_of_var=lchar_t, repeats=.FALSE., &
default_lc_val="")
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)
CALL keyword_create(keyword, __LOCATION__, name="AS_SOLVER", &
description="The external active space solver for the embedding approach", &
usage="AS_SOLVER QISKIT", &
default_i_val=no_solver, &
enum_c_vals=s2a("NONE", "QISKIT"), &
enum_i_vals=(/no_solver, qiskit_solver/), &
enum_desc=s2a("NO solver, used to produce FCIDUMP/QCSchema files", &
"QISKIT active space solver"))
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)
CALL keyword_create(keyword, __LOCATION__, name="EPS_ITER", &
description="Energy convergence threshold of the DFT embedding scheme.", &
usage="EPS_ITER 1.0E-6 ", type_of_var=real_t, &
default_r_val=1.0E-6_dp)
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)
CALL keyword_create(keyword, __LOCATION__, name="MAX_ITER", &
description="Max number of iterations for the DFT embedding scheme.", &
usage="MAX_ITER 50", type_of_var=integer_t, &
default_i_val=50)
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)
@ -9151,8 +9162,50 @@ CONTAINS
CALL section_add_subsection(section, subsection)
CALL section_release(subsection)
CALL create_socket_section(subsection)
CALL section_add_subsection(section, subsection)
CALL section_release(subsection)
END SUBROUTINE create_active_space_section
! **************************************************************************************************
!> \brief ...
!> \param section ...
! **************************************************************************************************
SUBROUTINE create_socket_section(section)
TYPE(section_type), POINTER :: section
TYPE(keyword_type), POINTER :: keyword
CPASSERT(.NOT. ASSOCIATED(section))
CALL section_create(section, __LOCATION__, name="SOCKET", &
description="Parameters to set up the socket communicating to the external active space solver.", &
n_keywords=3, n_subsections=0, repeats=.FALSE.)
NULLIFY (keyword)
CALL keyword_create(keyword, __LOCATION__, name="UNIX", &
description="Use a UNIX socket rather than an INET socket.", &
usage="unix LOGICAL", &
default_l_val=.TRUE., lone_keyword_l_val=.TRUE.)
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)
CALL keyword_create(keyword, __LOCATION__, name="PORT", &
description="Port number for the socket client.", &
usage="port <INTEGER>", &
default_i_val=12345)
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)
CALL keyword_create(keyword, __LOCATION__, name="HOST", &
description="Host name for the socket client.", &
usage="host <HOSTNAME>", &
default_c_val="embedding_socket")
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)
END SUBROUTINE create_socket_section
! **************************************************************************************************
!> \brief ...
!> \param section ...
@ -9228,7 +9281,7 @@ CONTAINS
enum_i_vals=(/eri_method_full_gpw, eri_method_gpw_ht/), &
enum_desc=s2a("Use the GPW approach with MOs", &
"Use the GPW approach for half-transformed MO ERIs"), &
default_i_val=eri_method_gpw_ht)
default_i_val=eri_method_full_gpw)
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)
@ -9251,7 +9304,7 @@ CONTAINS
CALL keyword_create(keyword, __LOCATION__, name="OPERATOR_PARAMETER", &
description="Range parameter for ERI operator.", &
usage="OPERATOR_PARAMETER 4.0", type_of_var=real_t, &
default_r_val=8.0_dp)
default_r_val=0.5_dp)
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)

View file

@ -12,39 +12,45 @@
!> \author Michele Ceriotti 03.2012
! **************************************************************************************************
MODULE ipi_driver
USE ISO_C_BINDING, ONLY: C_CHAR,&
C_DOUBLE,&
C_INT,&
C_LOC,&
C_NULL_CHAR,&
C_PTR
USE bibliography, ONLY: Ceriotti2014,&
Kapil2016,&
cite_reference
USE cell_methods, ONLY: cell_create,&
init_cell
USE cell_types, ONLY: cell_release,&
cell_type
USE cp_external_control, ONLY: external_control
USE cp_log_handling, ONLY: cp_logger_get_default_io_unit
USE cp_subsys_types, ONLY: cp_subsys_get,&
cp_subsys_set,&
cp_subsys_type
USE force_env_methods, ONLY: force_env_calc_energy_force
USE force_env_types, ONLY: force_env_get,&
force_env_type
USE global_types, ONLY: global_environment_type
USE input_section_types, ONLY: section_vals_get_subs_vals,&
section_vals_type,&
section_vals_val_get
USE kinds, ONLY: default_path_length,&
default_string_length,&
dp,&
int_4
USE message_passing, ONLY: mp_para_env_type,&
mp_request_type,&
mp_testany
USE virial_types, ONLY: virial_type
USE ISO_C_BINDING, ONLY: C_CHAR, &
C_DOUBLE, &
C_INT, &
C_LOC, &
C_NULL_CHAR, &
C_PTR
USE bibliography, ONLY: Ceriotti2014, &
Kapil2016, &
cite_reference
USE cell_methods, ONLY: cell_create, &
init_cell
USE cell_types, ONLY: cell_release, &
cell_type
USE cp_external_control, ONLY: external_control
USE cp_log_handling, ONLY: cp_logger_get_default_io_unit
USE cp_subsys_types, ONLY: cp_subsys_get, &
cp_subsys_set, &
cp_subsys_type
USE force_env_methods, ONLY: force_env_calc_energy_force
USE force_env_types, ONLY: force_env_get, &
force_env_type
USE global_types, ONLY: global_environment_type
USE input_section_types, ONLY: section_vals_get_subs_vals, &
section_vals_type, &
section_vals_val_get
USE kinds, ONLY: default_path_length, &
default_string_length, &
dp, &
int_4
USE message_passing, ONLY: mp_para_env_type, &
mp_request_type, &
mp_testany
#ifndef __NO_SOCKETS
USE sockets_interface, ONLY: writebuffer, &
readbuffer, &
open_connect_socket, &
uwait
#endif
USE virial_types, ONLY: virial_type
#include "./base/base_uses.f90"
IMPLICIT NONE
@ -55,244 +61,8 @@ MODULE ipi_driver
PUBLIC :: run_driver
#ifndef __NO_IPI_DRIVER
INTERFACE writebuffer
MODULE PROCEDURE writebuffer_s, &
writebuffer_d, writebuffer_dv, &
writebuffer_i
END INTERFACE
INTERFACE readbuffer
MODULE PROCEDURE readbuffer_s, &
readbuffer_dv, readbuffer_d, &
readbuffer_i
END INTERFACE
INTERFACE
SUBROUTINE uwait(sec) BIND(C, NAME="uwait")
USE ISO_C_BINDING, ONLY: C_DOUBLE
REAL(C_DOUBLE) :: sec
END SUBROUTINE
END INTERFACE
INTERFACE
SUBROUTINE open_socket(psockfd, inet, port, host) BIND(C)
IMPORT
INTEGER(KIND=C_INT) :: psockfd, inet, port
CHARACTER(KIND=C_CHAR), DIMENSION(*) :: host
END SUBROUTINE open_socket
SUBROUTINE writebuffer_csocket(psockfd, pdata, plen) BIND(C, name="writebuffer")
IMPORT
INTEGER(KIND=C_INT) :: psockfd
TYPE(C_PTR), VALUE :: pdata
INTEGER(KIND=C_INT) :: plen
END SUBROUTINE writebuffer_csocket
SUBROUTINE readbuffer_csocket(psockfd, pdata, plen) BIND(C, name="readbuffer")
IMPORT
INTEGER(KIND=C_INT) :: psockfd
TYPE(C_PTR), VALUE :: pdata
INTEGER(KIND=C_INT) :: plen
END SUBROUTINE readbuffer_csocket
END INTERFACE
#endif
CONTAINS
#ifndef __NO_IPI_DRIVER
! **************************************************************************************************
!> \brief ...
!> \param psockfd ...
!> \param fdata ...
! **************************************************************************************************
SUBROUTINE writebuffer_d(psockfd, fdata)
INTEGER, INTENT(IN) :: psockfd
REAL(KIND=dp), INTENT(IN) :: fdata
CHARACTER(len=*), PARAMETER :: routineN = 'writebuffer_d'
INTEGER :: handle
REAL(KIND=C_DOUBLE), TARGET :: cdata
CALL timeset(routineN, handle)
cdata = fdata
CALL writebuffer_csocket(psockfd, c_loc(cdata), 8)
CALL timestop(handle)
END SUBROUTINE
! **************************************************************************************************
!> \brief ...
!> \param psockfd ...
!> \param fdata ...
! **************************************************************************************************
SUBROUTINE writebuffer_i(psockfd, fdata)
INTEGER, INTENT(IN) :: psockfd, fdata
CHARACTER(len=*), PARAMETER :: routineN = 'writebuffer_i'
INTEGER :: handle
INTEGER(KIND=C_INT), TARGET :: cdata
CALL timeset(routineN, handle)
cdata = fdata
CALL writebuffer_csocket(psockfd, c_loc(cdata), 4)
CALL timestop(handle)
END SUBROUTINE
! **************************************************************************************************
!> \brief ...
!> \param psockfd ...
!> \param fstring ...
!> \param plen ...
! **************************************************************************************************
SUBROUTINE writebuffer_s(psockfd, fstring, plen)
INTEGER, INTENT(IN) :: psockfd
CHARACTER(LEN=*), INTENT(IN) :: fstring
INTEGER, INTENT(IN) :: plen
CHARACTER(len=*), PARAMETER :: routineN = 'writebuffer_s'
INTEGER :: handle, i
CHARACTER(LEN=1, KIND=C_CHAR), TARGET :: cstring(plen)
CALL timeset(routineN, handle)
DO i = 1, plen
cstring(i) = fstring(i:i)
END DO
CALL writebuffer_csocket(psockfd, c_loc(cstring(1)), plen)
CALL timestop(handle)
END SUBROUTINE
! **************************************************************************************************
!> \brief ...
!> \param psockfd ...
!> \param fdata ...
!> \param plen ...
! **************************************************************************************************
SUBROUTINE writebuffer_dv(psockfd, fdata, plen)
INTEGER, INTENT(IN) :: psockfd, plen
REAL(KIND=dp), INTENT(IN), TARGET :: fdata(plen)
CHARACTER(len=*), PARAMETER :: routineN = 'writebuffer_dv'
INTEGER :: handle
CALL timeset(routineN, handle)
CALL writebuffer_csocket(psockfd, c_loc(fdata(1)), 8*plen)
CALL timestop(handle)
END SUBROUTINE
! **************************************************************************************************
!> \brief ...
!> \param psockfd ...
!> \param fdata ...
! **************************************************************************************************
SUBROUTINE readbuffer_d(psockfd, fdata)
INTEGER, INTENT(IN) :: psockfd
REAL(KIND=dp), INTENT(OUT) :: fdata
CHARACTER(len=*), PARAMETER :: routineN = 'readbuffer_d'
INTEGER :: handle
REAL(KIND=C_DOUBLE), TARGET :: cdata
CALL timeset(routineN, handle)
CALL readbuffer_csocket(psockfd, c_loc(cdata), 8)
fdata = cdata
CALL timestop(handle)
END SUBROUTINE
! **************************************************************************************************
!> \brief ...
!> \param psockfd ...
!> \param fdata ...
! **************************************************************************************************
SUBROUTINE readbuffer_i(psockfd, fdata)
INTEGER, INTENT(IN) :: psockfd
INTEGER, INTENT(OUT) :: fdata
CHARACTER(len=*), PARAMETER :: routineN = 'readbuffer_i'
INTEGER :: handle
INTEGER(KIND=C_INT), TARGET :: cdata
CALL timeset(routineN, handle)
CALL readbuffer_csocket(psockfd, c_loc(cdata), 4)
fdata = cdata
CALL timestop(handle)
END SUBROUTINE
! **************************************************************************************************
!> \brief ...
!> \param psockfd ...
!> \param fstring ...
!> \param plen ...
! **************************************************************************************************
SUBROUTINE readbuffer_s(psockfd, fstring, plen)
INTEGER, INTENT(IN) :: psockfd
CHARACTER(LEN=*), INTENT(OUT) :: fstring
INTEGER, INTENT(IN) :: plen
CHARACTER(len=*), PARAMETER :: routineN = 'readbuffer_s'
INTEGER :: handle, i
CHARACTER(LEN=1, KIND=C_CHAR), TARGET :: cstring(plen)
CALL timeset(routineN, handle)
CALL readbuffer_csocket(psockfd, c_loc(cstring(1)), plen)
fstring = ""
DO i = 1, plen
fstring(i:i) = cstring(i)
END DO
CALL timestop(handle)
END SUBROUTINE
! **************************************************************************************************
!> \brief ...
!> \param psockfd ...
!> \param fdata ...
!> \param plen ...
! **************************************************************************************************
SUBROUTINE readbuffer_dv(psockfd, fdata, plen)
INTEGER, INTENT(IN) :: psockfd, plen
REAL(KIND=dp), INTENT(OUT), TARGET :: fdata(plen)
CHARACTER(len=*), PARAMETER :: routineN = 'readbuffer_dv'
INTEGER :: handle
CALL timeset(routineN, handle)
CALL readbuffer_csocket(psockfd, c_loc(fdata(1)), 8*plen)
CALL timestop(handle)
END SUBROUTINE
#endif
! **************************************************************************************************
!> \brief ...
!> \param force_env ...
@ -308,10 +78,10 @@ CONTAINS
CHARACTER(len=*), PARAMETER :: routineN = 'run_driver'
#ifdef __NO_IPI_DRIVER
#ifdef __NO_SOCKETS
INTEGER :: handle
CALL timeset(routineN, handle)
CPABORT("CP2K was compiled with the __NO_IPI_DRIVER option!")
CPABORT("CP2K was compiled with the __NO_SOCKETS option!")
MARK_USED(globenv)
MARK_USED(force_env)
#else
@ -374,7 +144,7 @@ CONTAINS
END IF
c_hostname = TRIM(drv_hostname)//C_NULL_CHAR
IF (ionode) CALL open_socket(socket, i_drv_unix, drv_port, c_hostname)
IF (ionode) CALL open_connect_socket(socket, i_drv_unix, drv_port, c_hostname)
NULLIFY (wait_msg)
ALLOCATE (wait_msg(1))

1036
src/qcschema.F Normal file

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -73,31 +73,34 @@ MODULE qs_active_space_types
END TYPE eri_type_eri_element_func
TYPE active_space_type
INTEGER :: nelec_active = 0
INTEGER, POINTER, DIMENSION(:, :) :: active_orbitals => NULL()
INTEGER, POINTER, DIMENSION(:, :) :: inactive_orbitals => NULL()
INTEGER :: nelec_inactive = 0
INTEGER, DIMENSION(2) :: nelec_inactive_spinwise = 0
INTEGER, DIMENSION(2) :: nelec_total = 0
INTEGER :: multiplicity = 0
INTEGER :: nspins = 0
LOGICAL :: molecule = .FALSE.
INTEGER :: model = 0
REAL(KIND=dp) :: energy_total = 0.0_dp
REAL(KIND=dp) :: energy_ref = 0.0_dp
REAL(KIND=dp) :: energy_inactive = 0.0_dp
REAL(KIND=dp) :: energy_active = 0.0_dp
LOGICAL :: read_p_act = .FALSE.
CHARACTER(LEN=default_path_length) :: p_act_filename = ""
TYPE(mo_set_type), DIMENSION(:), POINTER :: mos_active => NULL()
TYPE(mo_set_type), DIMENSION(:), POINTER :: mos_inactive => NULL()
TYPE(eri_type) :: eri = eri_type()
TYPE(cp_fm_type), DIMENSION(:), POINTER :: p_active => NULL()
TYPE(cp_fm_type), DIMENSION(:), POINTER :: ks_sub => NULL()
TYPE(cp_fm_type), DIMENSION(:), POINTER :: vxc_sub => NULL()
TYPE(cp_fm_type), DIMENSION(:), POINTER :: h_sub => NULL()
TYPE(cp_fm_type), DIMENSION(:), POINTER :: fock_sub => NULL()
TYPE(dbcsr_p_type), DIMENSION(:), POINTER :: pmat_inactive => NULL()
INTEGER :: nelec_active = 0
INTEGER :: nelec_inactive = 0
INTEGER :: nelec_total = 0
INTEGER, POINTER, DIMENSION(:, :) :: active_orbitals => NULL()
INTEGER, POINTER, DIMENSION(:, :) :: inactive_orbitals => NULL()
INTEGER :: nmo_active = 0
INTEGER :: nmo_inactive = 0
INTEGER :: multiplicity = 0
INTEGER :: nspins = 0
LOGICAL :: molecule = .FALSE.
INTEGER :: model = 0
REAL(KIND=dp) :: energy_total = 0.0_dp
REAL(KIND=dp) :: energy_ref = 0.0_dp
REAL(KIND=dp) :: energy_inactive = 0.0_dp
REAL(KIND=dp) :: energy_active = 0.0_dp
LOGICAL :: do_scf_embedding = .FALSE.
LOGICAL :: qcschema = .FALSE.
LOGICAL :: fcidump = .FALSE.
CHARACTER(LEN=default_path_length) :: qcschema_filename = ''
TYPE(eri_type) :: eri = eri_type()
TYPE(mo_set_type), DIMENSION(:), POINTER :: mos_active => NULL()
TYPE(mo_set_type), DIMENSION(:), POINTER :: mos_inactive => NULL()
TYPE(cp_fm_type), DIMENSION(:), POINTER :: p_active => NULL()
TYPE(cp_fm_type), DIMENSION(:), POINTER :: ks_sub => NULL()
TYPE(cp_fm_type), DIMENSION(:), POINTER :: vxc_sub => NULL()
TYPE(cp_fm_type), DIMENSION(:), POINTER :: h_sub => NULL()
TYPE(cp_fm_type), DIMENSION(:), POINTER :: fock_sub => NULL()
TYPE(dbcsr_p_type), DIMENSION(:), POINTER :: pmat_inactive => NULL()
END TYPE active_space_type
ABSTRACT INTERFACE

158
src/qs_active_space_utils.F Normal file
View file

@ -0,0 +1,158 @@
!--------------------------------------------------------------------------------------------------!
! CP2K: A general program to perform molecular dynamics simulations !
! Copyright 2000-2023 CP2K developers group <https://cp2k.org> !
! !
! SPDX-License-Identifier: GPL-2.0-or-later !
!--------------------------------------------------------------------------------------------------!
! **************************************************************************************************
!> \brief Contains utility routines for the active space module
!> \par History
!> 04.2023 created [SB]
!> \author SB
! **************************************************************************************************
MODULE qs_active_space_utils
USE cp_fm_types, ONLY: cp_fm_get_element,&
cp_fm_get_info,&
cp_fm_type
USE dbcsr_api, ONLY: dbcsr_csr_type
USE kinds, ONLY: dp
USE message_passing, ONLY: mp_comm_type
USE qs_active_space_types, ONLY: csr_idx_from_combined,&
csr_idx_to_combined,&
eri_type,&
get_irange_csr
#include "./base/base_uses.f90"
IMPLICIT NONE
PRIVATE
CHARACTER(len=*), PARAMETER, PRIVATE :: moduleN = 'qs_active_space_utils'
PUBLIC :: subspace_matrix_to_array, eri_to_array
CONTAINS
! **************************************************************************************************
!> \brief Copy a (square portion) of a `cp_fm_type` matrix to a standard 1D Fortran array
!> \param source_matrix the matrix from where the data is taken
!> \param target_array the array were the data is copied to
!> \param row_index a list containing the row subspace indices
!> \param col_index a list containing the column subspace indices
! **************************************************************************************************
SUBROUTINE subspace_matrix_to_array(source_matrix, target_array, row_index, col_index)
TYPE(cp_fm_type), INTENT(IN) :: source_matrix
REAL(KIND=dp), DIMENSION(:), INTENT(OUT) :: target_array
INTEGER, DIMENSION(:), INTENT(IN) :: row_index, col_index
INTEGER :: i, i_sub, j, j_sub, max_col, max_row, &
ncols, nrows
REAL(KIND=dp) :: mval
CALL cp_fm_get_info(source_matrix, nrow_global=max_row, ncol_global=max_col)
nrows = SIZE(row_index)
ncols = SIZE(col_index)
CPASSERT(MAXVAL(row_index) <= max_row)
CPASSERT(MAXVAL(col_index) <= max_col)
CPASSERT(MINVAL(row_index) > 0)
CPASSERT(MINVAL(col_index) > 0)
CPASSERT(nrows <= max_row)
CPASSERT(ncols <= max_col)
CPASSERT(SIZE(target_array) == nrows*ncols)
DO j = 1, ncols
j_sub = col_index(j)
DO i = 1, nrows
i_sub = row_index(i)
CALL cp_fm_get_element(source_matrix, i_sub, j_sub, mval)
target_array(i + (j - 1)*nrows) = mval
END DO
END DO
END SUBROUTINE subspace_matrix_to_array
! **************************************************************************************************
!> \brief Copy the eri tensor for spins isp1 and isp2 to a standard 1D Fortran array
!> \param eri_env the eri environment
!> \param array the 1D Fortran array where the eri are copied to
!> \param active_orbitals a list containing the active orbitals indices
!> \param spin1 the spin of the bra
!> \param spin2 the spin of the ket
! **************************************************************************************************
SUBROUTINE eri_to_array(eri_env, array, active_orbitals, spin1, spin2)
TYPE(eri_type), INTENT(IN) :: eri_env
REAL(KIND=dp), DIMENSION(:), INTENT(INOUT) :: array
INTEGER, DIMENSION(:, :), INTENT(IN) :: active_orbitals
INTEGER, INTENT(IN) :: spin1, spin2
INTEGER :: i, i1, i12, i12l, i2, i3, i34, i34l, i4, &
ijkl, ijlk, irptr, j, jikl, jilk, k, &
klij, klji, l, lkij, lkji, nindex, &
nmo_active, nmo_max
INTEGER, DIMENSION(2) :: irange
REAL(KIND=dp) :: erival
TYPE(dbcsr_csr_type), POINTER :: eri
TYPE(mp_comm_type) :: mp_group
nmo_active = SIZE(active_orbitals, 1)
nmo_max = eri_env%norb
nindex = (nmo_max*(nmo_max + 1))/2
IF (spin1 == 1 .AND. spin2 == 1) THEN
eri => eri_env%eri(1)%csr_mat
ELSE IF ((spin1 == 1 .AND. spin2 == 2) .OR. (spin1 == 2 .AND. spin2 == 1)) THEN
eri => eri_env%eri(2)%csr_mat
ELSE
eri => eri_env%eri(3)%csr_mat
END IF
CALL mp_group%set_handle(eri%mp_group%get_handle())
irange = get_irange_csr(nindex, mp_group)
array = 0.0_dp
DO i = 1, nmo_active
i1 = active_orbitals(i, spin1)
DO j = i, nmo_active
i2 = active_orbitals(j, spin1)
i12 = csr_idx_to_combined(i1, i2, nmo_max)
IF (i12 >= irange(1) .AND. i12 <= irange(2)) THEN
i12l = i12 - irange(1) + 1
irptr = eri%rowptr_local(i12l) - 1
DO i34l = 1, eri%nzerow_local(i12l)
i34 = eri%colind_local(irptr + i34l)
CALL csr_idx_from_combined(i34, nmo_max, i3, i4)
k = FINDLOC(active_orbitals(:, spin2), i3, dim=1)
l = FINDLOC(active_orbitals(:, spin2), i4, dim=1)
erival = eri%nzval_local%r_dp(irptr + i34l)
! 8-fold permutational symmetry
ijkl = i + (j - 1)*nmo_active + (k - 1)*nmo_active**2 + (l - 1)*nmo_active**3
jikl = j + (i - 1)*nmo_active + (k - 1)*nmo_active**2 + (l - 1)*nmo_active**3
ijlk = i + (j - 1)*nmo_active + (l - 1)*nmo_active**2 + (k - 1)*nmo_active**3
jilk = j + (i - 1)*nmo_active + (l - 1)*nmo_active**2 + (k - 1)*nmo_active**3
array(ijkl) = erival
array(jikl) = erival
array(ijlk) = erival
array(jilk) = erival
IF (spin1 == spin2) THEN
klij = k + (l - 1)*nmo_active + (i - 1)*nmo_active**2 + (j - 1)*nmo_active**3
lkij = l + (k - 1)*nmo_active + (i - 1)*nmo_active**2 + (j - 1)*nmo_active**3
klji = k + (l - 1)*nmo_active + (j - 1)*nmo_active**2 + (i - 1)*nmo_active**3
lkji = l + (k - 1)*nmo_active + (j - 1)*nmo_active**2 + (i - 1)*nmo_active**3
array(klij) = erival
array(lkij) = erival
array(klji) = erival
array(lkji) = erival
END IF
END DO
END IF
END DO
END DO
CALL mp_group%sum(array)
END SUBROUTINE eri_to_array
END MODULE qs_active_space_utils

View file

@ -24,6 +24,7 @@ MODULE qs_energy
section_vals_val_get
USE lri_environment_methods, ONLY: lri_print_stat
USE mp2, ONLY: mp2_main
USE qs_active_space_methods, ONLY: active_space_main
USE qs_energy_init, ONLY: qs_energies_init
USE qs_energy_types, ONLY: qs_energy_type
USE qs_energy_utils, ONLY: qs_energies_properties
@ -127,6 +128,9 @@ CONTAINS
END IF
! Do active space calculation
CALL active_space_main(qs_env)
! Check for energy correction
IF (qs_env%energy_correction) THEN
CALL energy_correction(qs_env, ec_init=.TRUE., calculate_forces=.FALSE.)

View file

@ -126,7 +126,6 @@ MODULE qs_scf_post_gpw
REALSPACE,&
RECIPROCALSPACE,&
pw_type
USE qs_active_space_methods, ONLY: active_space_main
USE qs_chargemol, ONLY: write_wfx
USE qs_collocate_density, ONLY: calculate_wavefunction
USE qs_commutators, ONLY: build_com_hr_matrix
@ -822,9 +821,6 @@ CONTAINS
! Use Wannier90 interface
CALL wannier90_interface(input, logger, qs_env)
! Do active space calculation
CALL active_space_main(input, logger, qs_env)
IF (my_do_mp2) THEN
! Get everything back
DO ispin = 1, dft_control%nspins

View file

@ -36,7 +36,7 @@
* support sockets natively.
* \author Joshua More and Michele Ceriotti
******************************************************************************/
#ifndef __NO_IPI_DRIVER
#ifndef __NO_SOCKETS
#define _POSIX_C_SOURCE 200809L
@ -46,6 +46,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/select.h>
#include <sys/socket.h>
#include <sys/types.h>
#include <sys/un.h>
@ -53,7 +54,7 @@
#include <unistd.h>
/*******************************************************************************
* \brief Opens a socket.
* \brief Opens and connects a socket.
* \param psockfd The id of the socket that will be created.
* \param inet An integer that determines whether the socket will be an inet
* or unix domain socket. Gives unix if 0, inet otherwise.
@ -64,7 +65,7 @@
* \note Fortran passes an extra argument for the string length, but this is
* ignored here for C compatibility.
******************************************************************************/
void open_socket(int *psockfd, int *inet, int *port, char *host) {
void open_connect_socket(int *psockfd, int *inet, int *port, char *host) {
int sockfd, ai_err;
if (*inet > 0) { // creates an internet socket
@ -104,8 +105,8 @@ void open_socket(int *psockfd, int *inet, int *port, char *host) {
// fills up details of the socket address
memset(&serv_addr, 0, sizeof(serv_addr));
serv_addr.sun_family = AF_UNIX;
strcpy(serv_addr.sun_path, "/tmp/ipi_");
strcpy(serv_addr.sun_path + 9, host);
strcpy(serv_addr.sun_path, "/tmp/qiskit_");
strcpy(serv_addr.sun_path + 12, host);
// creates the socket
sockfd = socket(AF_UNIX, SOCK_STREAM, 0);
@ -121,6 +122,76 @@ void open_socket(int *psockfd, int *inet, int *port, char *host) {
*psockfd = sockfd;
}
/*******************************************************************************
* \brief Opens and binds a socket.
* \param psockfd The id of the socket that will be created.
* \param inet An integer that determines whether the socket will be an inet
* or unix domain socket. Gives unix if 0, inet otherwise.
* \param port The port number for the socket to be created. Low numbers are
* often reserved for important channels, so use of numbers of 4
* or more digits is recommended.
* \param host The name of the host server.
* \note Fortran passes an extra argument for the string length, but this is
* ignored here for C compatibility.
******************************************************************************/
void open_bind_socket(int *psockfd, int *inet, int *port, char *host) {
int sockfd, ai_err;
if (*inet > 0) { // creates an internet socket
// fetches information on the host
struct addrinfo hints, *res;
char service[256];
memset(&hints, 0, sizeof(hints));
hints.ai_socktype = SOCK_STREAM;
hints.ai_family = AF_INET;
hints.ai_flags = AI_PASSIVE;
sprintf(service, "%d", *port); // convert the port number to a string
ai_err = getaddrinfo(host, service, &hints, &res);
if (ai_err != 0) {
perror("Error fetching host data. Wrong host name?");
exit(-1);
}
// creates socket
sockfd = socket(res->ai_family, res->ai_socktype, res->ai_protocol);
if (sockfd < 0) {
perror("Error opening socket");
exit(-1);
}
// binds
if (bind(sockfd, res->ai_addr, res->ai_addrlen) < 0) {
perror("Error binding INET socket: wrong port or server unreachable");
exit(-1);
}
freeaddrinfo(res);
} else { // creates a unix socket
struct sockaddr_un serv_addr;
// fills up details of the socket address
memset(&serv_addr, 0, sizeof(serv_addr));
serv_addr.sun_family = AF_UNIX;
strcpy(serv_addr.sun_path, host);
// creates the socket
sockfd = socket(AF_UNIX, SOCK_STREAM, 0);
remove(serv_addr.sun_path);
// binds
if (bind(sockfd, (struct sockaddr *)&serv_addr, sizeof(serv_addr)) < 0) {
perror(
"Error binding UNIX socket: path unavailable, or already existing");
exit(-1);
}
}
*psockfd = sockfd;
}
/*******************************************************************************
* \brief Writes to a socket.
* \param psockfd The id of the socket that will be written to.
@ -163,6 +234,44 @@ void readbuffer(int *psockfd, char *data, int *plen) {
}
}
/*******************************************************************************
* \brief Listens to a socket.
* \param psockfd The id of the socket to listen.
* \param n An integer that determines the number of requests that will
* be queued before further requests are refused.
******************************************************************************/
void listen_socket(int *psockfd, int *backlog) {
if (listen(*psockfd, *backlog) < 0) {
perror("Error listening socket");
exit(-1);
};
}
/*******************************************************************************
* \brief Listens to a socket.
* \param psockfd The id of the socket to listen.
* \param pclientfd The id of the accepted socket.
******************************************************************************/
void accept_socket(int *psockfd, int *pclientfd) {
int client_fd = accept(*psockfd, NULL, NULL);
*pclientfd = client_fd;
}
/*******************************************************************************
* \brief Closes a socket.
* \param psockfd The id of the socket to close.
******************************************************************************/
void close_socket(int *psockfd) { close(*psockfd); }
/*******************************************************************************
* \brief Removes a socket file.
* \param hostname The name of the socket file to remove.
******************************************************************************/
void remove_socket_file(char *host) { remove(host); }
/*******************************************************************************
* \brief Mini-wrapper to nanosleep
* \param dsec number of seconds to wait (float values accepted)

304
src/sockets_interface.F Normal file
View file

@ -0,0 +1,304 @@
!--------------------------------------------------------------------------------------------------!
! CP2K: A general program to perform molecular dynamics simulations !
! Copyright 2000-2023 CP2K developers group <https://cp2k.org> !
! !
! SPDX-License-Identifier: GPL-2.0-or-later !
!--------------------------------------------------------------------------------------------------!
! **************************************************************************************************
!> \brief Implements UNIX and INET sockets
!> \par History
!> 08.2023 moved here and expanded for AS module by S. Battaglia
!> 03.2012 created by MC in ipi_driver.F
!> \author M. Ceriotti
! **************************************************************************************************
MODULE sockets_interface
USE ISO_C_BINDING, ONLY: C_CHAR,&
C_DOUBLE,&
C_INT,&
C_LOC,&
C_PTR
USE kinds, ONLY: dp
#include "./base/base_uses.f90"
IMPLICIT NONE
PRIVATE
CHARACTER(len=*), PARAMETER, PRIVATE :: moduleN = 'sockets_interface'
#ifndef __NO_SOCKETS
PUBLIC :: writebuffer, readbuffer, open_connect_socket, &
uwait, open_bind_socket, listen_socket, &
accept_socket, close_socket, remove_socket_file
INTERFACE writebuffer
MODULE PROCEDURE writebuffer_s, &
writebuffer_d, writebuffer_dv, &
writebuffer_i
END INTERFACE
INTERFACE readbuffer
MODULE PROCEDURE readbuffer_s, &
readbuffer_dv, readbuffer_d, &
readbuffer_i
END INTERFACE
INTERFACE
SUBROUTINE uwait(sec) BIND(C, NAME="uwait")
USE ISO_C_BINDING, ONLY: C_DOUBLE
REAL(C_DOUBLE) :: sec
END SUBROUTINE
END INTERFACE
INTERFACE
SUBROUTINE open_connect_socket(psockfd, inet, port, host) BIND(C)
IMPORT
INTEGER(KIND=C_INT) :: psockfd, inet, port
CHARACTER(KIND=C_CHAR), DIMENSION(*) :: host
END SUBROUTINE open_connect_socket
SUBROUTINE open_bind_socket(psockfd, inet, port, host) BIND(C)
IMPORT
INTEGER(KIND=C_INT) :: psockfd, inet, port
CHARACTER(KIND=C_CHAR), DIMENSION(*) :: host
END SUBROUTINE open_bind_socket
SUBROUTINE listen_socket(psockfd, backlog) BIND(C)
IMPORT
INTEGER(KIND=C_INT) :: psockfd, backlog
END SUBROUTINE listen_socket
SUBROUTINE accept_socket(psockfd, pclientfd) BIND(C)
IMPORT
INTEGER(KIND=C_INT) :: psockfd, pclientfd
END SUBROUTINE accept_socket
SUBROUTINE close_socket(psockfd) BIND(C)
IMPORT
INTEGER(KIND=C_INT) :: psockfd
END SUBROUTINE close_socket
SUBROUTINE remove_socket_file(host) BIND(C)
IMPORT
CHARACTER(KIND=C_CHAR), DIMENSION(*) :: host
END SUBROUTINE remove_socket_file
SUBROUTINE writebuffer_csocket(psockfd, pdata, plen) BIND(C, name="writebuffer")
IMPORT
INTEGER(KIND=C_INT) :: psockfd
TYPE(C_PTR), VALUE :: pdata
INTEGER(KIND=C_INT) :: plen
END SUBROUTINE writebuffer_csocket
SUBROUTINE readbuffer_csocket(psockfd, pdata, plen) BIND(C, name="readbuffer")
IMPORT
INTEGER(KIND=C_INT) :: psockfd
TYPE(C_PTR), VALUE :: pdata
INTEGER(KIND=C_INT) :: plen
END SUBROUTINE readbuffer_csocket
END INTERFACE
#endif
CONTAINS
#ifndef __NO_SOCKETS
! **************************************************************************************************
!> \brief ...
!> \param psockfd ...
!> \param fdata ...
! **************************************************************************************************
SUBROUTINE writebuffer_d(psockfd, fdata)
INTEGER, INTENT(IN) :: psockfd
REAL(KIND=dp), INTENT(IN) :: fdata
CHARACTER(len=*), PARAMETER :: routineN = 'writebuffer_d'
INTEGER :: handle
REAL(KIND=C_DOUBLE), TARGET :: cdata
CALL timeset(routineN, handle)
cdata = fdata
CALL writebuffer_csocket(psockfd, c_loc(cdata), 8)
CALL timestop(handle)
END SUBROUTINE
! **************************************************************************************************
!> \brief ...
!> \param psockfd ...
!> \param fdata ...
! **************************************************************************************************
SUBROUTINE writebuffer_i(psockfd, fdata)
INTEGER, INTENT(IN) :: psockfd, fdata
CHARACTER(len=*), PARAMETER :: routineN = 'writebuffer_i'
INTEGER :: handle
INTEGER(KIND=C_INT), TARGET :: cdata
CALL timeset(routineN, handle)
cdata = fdata
CALL writebuffer_csocket(psockfd, c_loc(cdata), 4)
CALL timestop(handle)
END SUBROUTINE
! **************************************************************************************************
!> \brief ...
!> \param psockfd ...
!> \param fstring ...
!> \param plen ...
! **************************************************************************************************
SUBROUTINE writebuffer_s(psockfd, fstring, plen)
INTEGER, INTENT(IN) :: psockfd
CHARACTER(LEN=*), INTENT(IN) :: fstring
INTEGER, INTENT(IN) :: plen
CHARACTER(len=*), PARAMETER :: routineN = 'writebuffer_s'
INTEGER :: handle, i
CHARACTER(LEN=1, KIND=C_CHAR), TARGET :: cstring(plen)
CALL timeset(routineN, handle)
DO i = 1, plen
cstring(i) = fstring(i:i)
END DO
CALL writebuffer_csocket(psockfd, c_loc(cstring(1)), plen)
CALL timestop(handle)
END SUBROUTINE
! **************************************************************************************************
!> \brief ...
!> \param psockfd ...
!> \param fdata ...
!> \param plen ...
! **************************************************************************************************
SUBROUTINE writebuffer_dv(psockfd, fdata, plen)
INTEGER, INTENT(IN) :: psockfd, plen
REAL(KIND=dp), INTENT(IN), TARGET :: fdata(plen)
CHARACTER(len=*), PARAMETER :: routineN = 'writebuffer_dv'
INTEGER :: handle
CALL timeset(routineN, handle)
CALL writebuffer_csocket(psockfd, c_loc(fdata(1)), 8*plen)
CALL timestop(handle)
END SUBROUTINE
! **************************************************************************************************
!> \brief ...
!> \param psockfd ...
!> \param fdata ...
! **************************************************************************************************
SUBROUTINE readbuffer_d(psockfd, fdata)
INTEGER, INTENT(IN) :: psockfd
REAL(KIND=dp), INTENT(OUT) :: fdata
CHARACTER(len=*), PARAMETER :: routineN = 'readbuffer_d'
INTEGER :: handle
REAL(KIND=C_DOUBLE), TARGET :: cdata
CALL timeset(routineN, handle)
CALL readbuffer_csocket(psockfd, c_loc(cdata), 8)
fdata = cdata
CALL timestop(handle)
END SUBROUTINE
! **************************************************************************************************
!> \brief ...
!> \param psockfd ...
!> \param fdata ...
! **************************************************************************************************
SUBROUTINE readbuffer_i(psockfd, fdata)
INTEGER, INTENT(IN) :: psockfd
INTEGER, INTENT(OUT) :: fdata
CHARACTER(len=*), PARAMETER :: routineN = 'readbuffer_i'
INTEGER :: handle
INTEGER(KIND=C_INT), TARGET :: cdata
CALL timeset(routineN, handle)
CALL readbuffer_csocket(psockfd, c_loc(cdata), 4)
fdata = cdata
CALL timestop(handle)
END SUBROUTINE
! **************************************************************************************************
!> \brief ...
!> \param psockfd ...
!> \param fstring ...
!> \param plen ...
! **************************************************************************************************
SUBROUTINE readbuffer_s(psockfd, fstring, plen)
INTEGER, INTENT(IN) :: psockfd
CHARACTER(LEN=*), INTENT(OUT) :: fstring
INTEGER, INTENT(IN) :: plen
CHARACTER(len=*), PARAMETER :: routineN = 'readbuffer_s'
INTEGER :: handle, i
CHARACTER(LEN=1, KIND=C_CHAR), TARGET :: cstring(plen)
CALL timeset(routineN, handle)
CALL readbuffer_csocket(psockfd, c_loc(cstring(1)), plen)
fstring = ""
DO i = 1, plen
fstring(i:i) = cstring(i)
END DO
CALL timestop(handle)
END SUBROUTINE
! **************************************************************************************************
!> \brief ...
!> \param psockfd ...
!> \param fdata ...
!> \param plen ...
! **************************************************************************************************
SUBROUTINE readbuffer_dv(psockfd, fdata, plen)
INTEGER, INTENT(IN) :: psockfd, plen
REAL(KIND=dp), INTENT(OUT), TARGET :: fdata(plen)
CHARACTER(len=*), PARAMETER :: routineN = 'readbuffer_dv'
INTEGER :: handle
CALL timeset(routineN, handle)
CALL readbuffer_csocket(psockfd, c_loc(fdata(1)), 8*plen)
CALL timestop(handle)
END SUBROUTINE
#endif
END MODULE sockets_interface

View file

@ -5,29 +5,29 @@
# for details see cp2k/tools/do_regtest
#
h2_gapw_2-2.inp 1 1e-12 -1.12703481947359
h2_gapw_2-2.inp 92 1e-8 4.08762828
h2_gapw_2-2.inp 92 1e-8 4.08763868
h2_gapw_2-3.inp 1 1e-12 -1.12703481947359
h2_gapw_2-3.inp 92 1e-8 6.34130225
h2_gapw_2-3.inp 92 1e-8 6.34131299
h2_gapw_2-4.inp 1 1e-12 -1.12703481947359
h2_gapw_2-4.inp 92 1e-8 10.57997331
h2_gapw_2-4.inp 92 1e-8 10.57998079
h2_gapw_pp_2-2.inp 1 1e-12 -1.12609343153655
h2_gapw_pp_2-2.inp 92 1e-8 4.08439624
h2_gapw_pp_2-2.inp 92 1e-8 4.08440577
h2_gapw_pp_2-3.inp 1 1e-12 -1.12609343153655
h2_gapw_pp_2-3.inp 92 1e-8 6.33490647
h2_gapw_pp_2-3.inp 92 1e-8 6.33491633
h2_gapw_pp_2-4.inp 1 1e-12 -1.12609343153655
h2_gapw_pp_2-4.inp 92 1e-8 10.58497633
h2_gapw_pp_2-4.inp 92 1e-8 10.58498318
h2_gpw_pp_2-2.inp 1 1e-12 -1.12622646044780
h2_gpw_pp_2-2.inp 92 1e-8 4.08480786
h2_gpw_pp_2-2.inp 92 1e-8 4.08481739
h2_gpw_pp_2-3.inp 1 1e-12 -1.12622646044780
h2_gpw_pp_2-3.inp 92 1e-8 6.33542961
h2_gpw_pp_2-3.inp 92 1e-8 6.33543946
h2_gpw_pp_2-4.inp 1 1e-12 -1.12622646044780
h2_gpw_pp_2-4.inp 92 1e-8 10.58532520
h2_gpw_pp_2-4.inp 92 1e-8 10.58533205
h2o_gapw_2-2.inp 1 1e-12 -76.011970410506123
h2o_gapw_2-2.inp 92 1e-8 77.48403223
h2o_gapw_2-2.inp 92 1e-8 77.48403318
ch2_gapw_2-3.inp 1 1e-12 -38.91914381184247
ch2_gapw_2-3.inp 92 1e-8 50.38752368
ch2_gapw_pp_2-3.inp 1 1e-12 -6.51646227467145
ch2_gapw_pp_2-3.inp 92 1e-8 17.95445556
ch2_gapw_pp_2-3.inp 92 1e-8 17.95445524
ch2_gpw_pp_2-3.inp 1 1e-12 -6.51682932586237
ch2_gpw_pp_2-3.inp 92 1e-8 17.95513322
ch2_gpw_pp_2-3.inp 92 1e-8 17.95513292
#EOF

View file

@ -33,23 +33,22 @@
KINETIC_ENERGY TRUE
POTENTIAL_ENERGY TRUE
&END AO_MATRICES
&ACTIVE_SPACE
ACTIVE_ELECTRONS 2
ACTIVE_ORBITALS 3 3
INACTIVE_ELECTRONS 3 3
ISOLATED_SYSTEM TRUE
&ERI
METHOD FULL_GPW
PERIODICITY 0 0 0
&END ERI
&ERI_GPW
CUTOFF 500
&END ERI_GPW
&FCIDUMP
FILENAME __STD_OUT__
&END FCIDUMP
&END ACTIVE_SPACE
&END PRINT
&ACTIVE_SPACE
ACTIVE_ELECTRONS 2
ACTIVE_ORBITALS 3
ISOLATED_SYSTEM TRUE
&ERI
METHOD FULL_GPW
PERIODICITY 0 0 0
&END ERI
&ERI_GPW
CUTOFF 500
&END ERI_GPW
&FCIDUMP
FILENAME __STD_OUT__
&END FCIDUMP
&END ACTIVE_SPACE
&END DFT
&SUBSYS
&CELL

View file

@ -33,23 +33,22 @@
KINETIC_ENERGY TRUE
POTENTIAL_ENERGY TRUE
&END AO_MATRICES
&ACTIVE_SPACE
ACTIVE_ELECTRONS 2
ACTIVE_ORBITALS 3 3
INACTIVE_ELECTRONS 2 2
ISOLATED_SYSTEM TRUE
&ERI
METHOD FULL_GPW
PERIODICITY 0 0 0
&END ERI
&ERI_GPW
CUTOFF 500
&END ERI_GPW
&FCIDUMP
FILENAME __STD_OUT__
&END FCIDUMP
&END ACTIVE_SPACE
&END PRINT
&ACTIVE_SPACE
ACTIVE_ELECTRONS 2
ACTIVE_ORBITALS 3
ISOLATED_SYSTEM TRUE
&ERI
METHOD FULL_GPW
PERIODICITY 0 0 0
&END ERI
&ERI_GPW
CUTOFF 500
&END ERI_GPW
&FCIDUMP
FILENAME __STD_OUT__
&END FCIDUMP
&END ACTIVE_SPACE
&END DFT
&SUBSYS
&CELL

View file

@ -33,23 +33,22 @@
KINETIC_ENERGY TRUE
POTENTIAL_ENERGY TRUE
&END AO_MATRICES
&ACTIVE_SPACE
ACTIVE_ELECTRONS 2
ACTIVE_ORBITALS 3 3
INACTIVE_ELECTRONS 2 2
ISOLATED_SYSTEM TRUE
&ERI
METHOD FULL_GPW
PERIODICITY 0 0 0
&END ERI
&ERI_GPW
CUTOFF 500
&END ERI_GPW
&FCIDUMP
FILENAME __STD_OUT__
&END FCIDUMP
&END ACTIVE_SPACE
&END PRINT
&ACTIVE_SPACE
ACTIVE_ELECTRONS 2
ACTIVE_ORBITALS 3
ISOLATED_SYSTEM TRUE
&ERI
METHOD FULL_GPW
PERIODICITY 0 0 0
&END ERI
&ERI_GPW
CUTOFF 500
&END ERI_GPW
&FCIDUMP
FILENAME __STD_OUT__
&END FCIDUMP
&END ACTIVE_SPACE
&END DFT
&SUBSYS
&CELL

View file

@ -31,22 +31,22 @@
KINETIC_ENERGY TRUE
POTENTIAL_ENERGY TRUE
&END AO_MATRICES
&ACTIVE_SPACE
ACTIVE_ELECTRONS 2
ACTIVE_ORBITALS 2
ISOLATED_SYSTEM TRUE
&ERI
METHOD FULL_GPW
PERIODICITY 0 0 0
&END ERI
&ERI_GPW
CUTOFF 500
&END ERI_GPW
&FCIDUMP
FILENAME __STD_OUT__
&END FCIDUMP
&END ACTIVE_SPACE
&END PRINT
&ACTIVE_SPACE
ACTIVE_ELECTRONS 2
ACTIVE_ORBITALS 2
ISOLATED_SYSTEM TRUE
&ERI
METHOD FULL_GPW
PERIODICITY 0 0 0
&END ERI
&ERI_GPW
CUTOFF 500
&END ERI_GPW
&FCIDUMP
FILENAME __STD_OUT__
&END FCIDUMP
&END ACTIVE_SPACE
&END DFT
&SUBSYS
&CELL

View file

@ -31,22 +31,22 @@
KINETIC_ENERGY TRUE
POTENTIAL_ENERGY TRUE
&END AO_MATRICES
&ACTIVE_SPACE
ACTIVE_ELECTRONS 2
ACTIVE_ORBITALS 3
ISOLATED_SYSTEM TRUE
&ERI
METHOD FULL_GPW
PERIODICITY 0 0 0
&END ERI
&ERI_GPW
CUTOFF 500
&END ERI_GPW
&FCIDUMP
FILENAME __STD_OUT__
&END FCIDUMP
&END ACTIVE_SPACE
&END PRINT
&ACTIVE_SPACE
ACTIVE_ELECTRONS 2
ACTIVE_ORBITALS 3
ISOLATED_SYSTEM TRUE
&ERI
METHOD FULL_GPW
PERIODICITY 0 0 0
&END ERI
&ERI_GPW
CUTOFF 500
&END ERI_GPW
&FCIDUMP
FILENAME __STD_OUT__
&END FCIDUMP
&END ACTIVE_SPACE
&END DFT
&SUBSYS
&CELL

View file

@ -31,22 +31,22 @@
KINETIC_ENERGY TRUE
POTENTIAL_ENERGY TRUE
&END AO_MATRICES
&ACTIVE_SPACE
ACTIVE_ELECTRONS 2
ACTIVE_ORBITALS 4
ISOLATED_SYSTEM TRUE
&ERI
METHOD FULL_GPW
PERIODICITY 0 0 0
&END ERI
&ERI_GPW
CUTOFF 500
&END ERI_GPW
&FCIDUMP
FILENAME __STD_OUT__
&END FCIDUMP
&END ACTIVE_SPACE
&END PRINT
&ACTIVE_SPACE
ACTIVE_ELECTRONS 2
ACTIVE_ORBITALS 4
ISOLATED_SYSTEM TRUE
&ERI
METHOD FULL_GPW
PERIODICITY 0 0 0
&END ERI
&ERI_GPW
CUTOFF 500
&END ERI_GPW
&FCIDUMP
FILENAME __STD_OUT__
&END FCIDUMP
&END ACTIVE_SPACE
&END DFT
&SUBSYS
&CELL

View file

@ -31,22 +31,22 @@
KINETIC_ENERGY TRUE
POTENTIAL_ENERGY TRUE
&END AO_MATRICES
&ACTIVE_SPACE
ACTIVE_ELECTRONS 2
ACTIVE_ORBITALS 2
ISOLATED_SYSTEM TRUE
&ERI
METHOD FULL_GPW
PERIODICITY 0 0 0
&END ERI
&ERI_GPW
CUTOFF 500
&END ERI_GPW
&FCIDUMP
FILENAME __STD_OUT__
&END FCIDUMP
&END ACTIVE_SPACE
&END PRINT
&ACTIVE_SPACE
ACTIVE_ELECTRONS 2
ACTIVE_ORBITALS 2
ISOLATED_SYSTEM TRUE
&ERI
METHOD FULL_GPW
PERIODICITY 0 0 0
&END ERI
&ERI_GPW
CUTOFF 500
&END ERI_GPW
&FCIDUMP
FILENAME __STD_OUT__
&END FCIDUMP
&END ACTIVE_SPACE
&END DFT
&SUBSYS
&CELL

View file

@ -31,22 +31,22 @@
KINETIC_ENERGY TRUE
POTENTIAL_ENERGY TRUE
&END AO_MATRICES
&ACTIVE_SPACE
ACTIVE_ELECTRONS 2
ACTIVE_ORBITALS 3
ISOLATED_SYSTEM TRUE
&ERI
METHOD FULL_GPW
PERIODICITY 0 0 0
&END ERI
&ERI_GPW
CUTOFF 500
&END ERI_GPW
&FCIDUMP
FILENAME __STD_OUT__
&END FCIDUMP
&END ACTIVE_SPACE
&END PRINT
&ACTIVE_SPACE
ACTIVE_ELECTRONS 2
ACTIVE_ORBITALS 3
ISOLATED_SYSTEM TRUE
&ERI
METHOD FULL_GPW
PERIODICITY 0 0 0
&END ERI
&ERI_GPW
CUTOFF 500
&END ERI_GPW
&FCIDUMP
FILENAME __STD_OUT__
&END FCIDUMP
&END ACTIVE_SPACE
&END DFT
&SUBSYS
&CELL

View file

@ -31,22 +31,22 @@
KINETIC_ENERGY TRUE
POTENTIAL_ENERGY TRUE
&END AO_MATRICES
&ACTIVE_SPACE
ACTIVE_ELECTRONS 2
ACTIVE_ORBITALS 4
ISOLATED_SYSTEM TRUE
&ERI
METHOD FULL_GPW
PERIODICITY 0 0 0
&END ERI
&ERI_GPW
CUTOFF 500
&END ERI_GPW
&FCIDUMP
FILENAME __STD_OUT__
&END FCIDUMP
&END ACTIVE_SPACE
&END PRINT
&ACTIVE_SPACE
ACTIVE_ELECTRONS 2
ACTIVE_ORBITALS 4
ISOLATED_SYSTEM TRUE
&ERI
METHOD FULL_GPW
PERIODICITY 0 0 0
&END ERI
&ERI_GPW
CUTOFF 500
&END ERI_GPW
&FCIDUMP
FILENAME __STD_OUT__
&END FCIDUMP
&END ACTIVE_SPACE
&END DFT
&SUBSYS
&CELL

View file

@ -31,22 +31,22 @@
KINETIC_ENERGY TRUE
POTENTIAL_ENERGY TRUE
&END AO_MATRICES
&ACTIVE_SPACE
ACTIVE_ELECTRONS 2
ACTIVE_ORBITALS 2
ISOLATED_SYSTEM TRUE
&ERI
METHOD FULL_GPW
PERIODICITY 0 0 0
&END ERI
&ERI_GPW
CUTOFF 500
&END ERI_GPW
&FCIDUMP
FILENAME __STD_OUT__
&END FCIDUMP
&END ACTIVE_SPACE
&END PRINT
&ACTIVE_SPACE
ACTIVE_ELECTRONS 2
ACTIVE_ORBITALS 2
ISOLATED_SYSTEM TRUE
&ERI
METHOD FULL_GPW
PERIODICITY 0 0 0
&END ERI
&ERI_GPW
CUTOFF 500
&END ERI_GPW
&FCIDUMP
FILENAME __STD_OUT__
&END FCIDUMP
&END ACTIVE_SPACE
&END DFT
&SUBSYS
&CELL

View file

@ -31,22 +31,22 @@
KINETIC_ENERGY TRUE
POTENTIAL_ENERGY TRUE
&END AO_MATRICES
&ACTIVE_SPACE
ACTIVE_ELECTRONS 2
ACTIVE_ORBITALS 3
ISOLATED_SYSTEM TRUE
&ERI
METHOD FULL_GPW
PERIODICITY 0 0 0
&END ERI
&ERI_GPW
CUTOFF 500
&END ERI_GPW
&FCIDUMP
FILENAME __STD_OUT__
&END FCIDUMP
&END ACTIVE_SPACE
&END PRINT
&ACTIVE_SPACE
ACTIVE_ELECTRONS 2
ACTIVE_ORBITALS 3
ISOLATED_SYSTEM TRUE
&ERI
METHOD FULL_GPW
PERIODICITY 0 0 0
&END ERI
&ERI_GPW
CUTOFF 500
&END ERI_GPW
&FCIDUMP
FILENAME __STD_OUT__
&END FCIDUMP
&END ACTIVE_SPACE
&END DFT
&SUBSYS
&CELL

View file

@ -31,22 +31,22 @@
KINETIC_ENERGY TRUE
POTENTIAL_ENERGY TRUE
&END AO_MATRICES
&ACTIVE_SPACE
ACTIVE_ELECTRONS 2
ACTIVE_ORBITALS 4
ISOLATED_SYSTEM TRUE
&ERI
METHOD FULL_GPW
PERIODICITY 0 0 0
&END ERI
&ERI_GPW
CUTOFF 500
&END ERI_GPW
&FCIDUMP
FILENAME __STD_OUT__
&END FCIDUMP
&END ACTIVE_SPACE
&END PRINT
&ACTIVE_SPACE
ACTIVE_ELECTRONS 2
ACTIVE_ORBITALS 4
ISOLATED_SYSTEM TRUE
&ERI
METHOD FULL_GPW
PERIODICITY 0 0 0
&END ERI
&ERI_GPW
CUTOFF 500
&END ERI_GPW
&FCIDUMP
FILENAME __STD_OUT__
&END FCIDUMP
&END ACTIVE_SPACE
&END DFT
&SUBSYS
&CELL

View file

@ -31,22 +31,22 @@
KINETIC_ENERGY TRUE
POTENTIAL_ENERGY TRUE
&END AO_MATRICES
&ACTIVE_SPACE
ACTIVE_ELECTRONS 2
ACTIVE_ORBITALS 2
ISOLATED_SYSTEM TRUE
&ERI
METHOD FULL_GPW
PERIODICITY 0 0 0
&END ERI
&ERI_GPW
CUTOFF 500
&END ERI_GPW
&FCIDUMP
FILENAME __STD_OUT__
&END FCIDUMP
&END ACTIVE_SPACE
&END PRINT
&ACTIVE_SPACE
ACTIVE_ELECTRONS 2
ACTIVE_ORBITALS 2
ISOLATED_SYSTEM TRUE
&ERI
METHOD FULL_GPW
PERIODICITY 0 0 0
&END ERI
&ERI_GPW
CUTOFF 500
&END ERI_GPW
&FCIDUMP
FILENAME __STD_OUT__
&END FCIDUMP
&END ACTIVE_SPACE
&END DFT
&SUBSYS
&CELL

View file

@ -79,26 +79,24 @@
&END PRINT
&END SCF
&PRINT
&ACTIVE_SPACE
ACTIVE_ELECTRONS 2
ACTIVE_ORBITALS 2
ISOLATED_SYSTEM TRUE
&ERI
EPS_INTEGRAL 1E-10
METHOD FULL_GPW
OPERATOR <ERF(A*R)/R>
OPERATOR_PARAMETER 1.0
PERIODICITY 0 0 0
&END ERI
&ERI_GPW
CUTOFF 250
&END ERI_GPW
&FCIDUMP
FILENAME __STD_OUT__
&END FCIDUMP
&END ACTIVE_SPACE
&END PRINT
&ACTIVE_SPACE
ACTIVE_ELECTRONS 2
ACTIVE_ORBITALS 2
ISOLATED_SYSTEM TRUE
&ERI
EPS_INTEGRAL 1E-10
METHOD FULL_GPW
OPERATOR <ERF(A*R)/R>
OPERATOR_PARAMETER 1.0
PERIODICITY 0 0 0
&END ERI
&ERI_GPW
CUTOFF 250
&END ERI_GPW
&FCIDUMP
FILENAME __STD_OUT__
&END FCIDUMP
&END ACTIVE_SPACE
&END DFT
&END FORCE_EVAL

View file

@ -79,28 +79,26 @@
&END PRINT
&END SCF
&PRINT
&ACTIVE_SPACE
READ_P_ACTIVE .TRUE.
P_ACTIVE_FILE_NAME h2_iterative_density.bin
ACTIVE_ELECTRONS 2
ACTIVE_ORBITALS 2
ISOLATED_SYSTEM TRUE
&ERI
EPS_INTEGRAL 1E-10
METHOD FULL_GPW
OPERATOR <ERF(A*R)/R>
OPERATOR_PARAMETER 1.0
PERIODICITY 0 0 0
&END ERI
&ERI_GPW
CUTOFF 250
&END ERI_GPW
&FCIDUMP
FILENAME __STD_OUT__
&END FCIDUMP
&END ACTIVE_SPACE
&END PRINT
&ACTIVE_SPACE
!READ_P_ACTIVE .TRUE.
!P_ACTIVE_FILE_NAME h2_iterative_density.bin
ACTIVE_ELECTRONS 2
ACTIVE_ORBITALS 2
ISOLATED_SYSTEM TRUE
&ERI
EPS_INTEGRAL 1E-10
METHOD FULL_GPW
OPERATOR <ERF(A*R)/R>
OPERATOR_PARAMETER 1.0
PERIODICITY 0 0 0
&END ERI
&ERI_GPW
CUTOFF 250
&END ERI_GPW
&FCIDUMP
FILENAME __STD_OUT__
&END FCIDUMP
&END ACTIVE_SPACE
&END DFT
&END FORCE_EVAL

View file

@ -79,28 +79,26 @@
&END PRINT
&END SCF
&PRINT
&ACTIVE_SPACE
ACTIVE_ELECTRONS 2
ACTIVE_ORBITALS 2
ISOLATED_SYSTEM TRUE
ORBITAL_SELECTION MANUAL
ACTIVE_ORBITAL_INDICES 1 2
&ERI
EPS_INTEGRAL 1E-10
METHOD FULL_GPW
OPERATOR <ERF(A*R)/R>
OPERATOR_PARAMETER 1.0
PERIODICITY 0 0 0
&END ERI
&ERI_GPW
CUTOFF 250
&END ERI_GPW
&FCIDUMP
FILENAME __STD_OUT__
&END FCIDUMP
&END ACTIVE_SPACE
&END PRINT
&ACTIVE_SPACE
ACTIVE_ELECTRONS 2
ACTIVE_ORBITALS 2
ISOLATED_SYSTEM TRUE
ORBITAL_SELECTION MANUAL
ACTIVE_ORBITAL_INDICES 1 2
&ERI
EPS_INTEGRAL 1E-10
METHOD FULL_GPW
OPERATOR <ERF(A*R)/R>
OPERATOR_PARAMETER 1.0
PERIODICITY 0 0 0
&END ERI
&ERI_GPW
CUTOFF 250
&END ERI_GPW
&FCIDUMP
FILENAME __STD_OUT__
&END FCIDUMP
&END ACTIVE_SPACE
&END DFT
&END FORCE_EVAL

View file

@ -81,29 +81,26 @@
&END PRINT
&END SCF
&PRINT
&ACTIVE_SPACE
ACTIVE_ELECTRONS 2
ACTIVE_ORBITALS 2 2
INACTIVE_ELECTRONS 0 0
ISOLATED_SYSTEM TRUE
ORBITAL_SELECTION MANUAL
ACTIVE_ORBITAL_INDICES 1 2 1 3
&ERI
EPS_INTEGRAL 1E-10
METHOD FULL_GPW
OPERATOR <ERF(A*R)/R>
OPERATOR_PARAMETER 1.0
PERIODICITY 0 0 0
&END ERI
&ERI_GPW
CUTOFF 250
&END ERI_GPW
&FCIDUMP
FILENAME __STD_OUT__
&END FCIDUMP
&END ACTIVE_SPACE
&END PRINT
&ACTIVE_SPACE
ACTIVE_ELECTRONS 2
ACTIVE_ORBITALS 2
ISOLATED_SYSTEM TRUE
ORBITAL_SELECTION MANUAL
ACTIVE_ORBITAL_INDICES 1 2 1 3
&ERI
EPS_INTEGRAL 1E-10
METHOD FULL_GPW
OPERATOR <ERF(A*R)/R>
OPERATOR_PARAMETER 1.0
PERIODICITY 0 0 0
&END ERI
&ERI_GPW
CUTOFF 250
&END ERI_GPW
&FCIDUMP
FILENAME __STD_OUT__
&END FCIDUMP
&END ACTIVE_SPACE
&END DFT
&END FORCE_EVAL

View file

@ -79,28 +79,26 @@
&END PRINT
&END SCF
&PRINT
&ACTIVE_SPACE
ACTIVE_ELECTRONS 2
ACTIVE_ORBITALS 2
ISOLATED_SYSTEM TRUE
ORBITAL_SELECTION MANUAL
ACTIVE_ORBITAL_INDICES 1 3
&ERI
EPS_INTEGRAL 1E-10
METHOD FULL_GPW
OPERATOR <ERF(A*R)/R>
OPERATOR_PARAMETER 1.0
PERIODICITY 0 0 0
&END ERI
&ERI_GPW
CUTOFF 250
&END ERI_GPW
&FCIDUMP
FILENAME __STD_OUT__
&END FCIDUMP
&END ACTIVE_SPACE
&END PRINT
&ACTIVE_SPACE
ACTIVE_ELECTRONS 2
ACTIVE_ORBITALS 2
ISOLATED_SYSTEM TRUE
ORBITAL_SELECTION MANUAL
ACTIVE_ORBITAL_INDICES 1 3
&ERI
EPS_INTEGRAL 1E-10
METHOD FULL_GPW
OPERATOR <ERF(A*R)/R>
OPERATOR_PARAMETER 1.0
PERIODICITY 0 0 0
&END ERI
&ERI_GPW
CUTOFF 250
&END ERI_GPW
&FCIDUMP
FILENAME __STD_OUT__
&END FCIDUMP
&END ACTIVE_SPACE
&END DFT
&END FORCE_EVAL

View file

@ -81,29 +81,26 @@
&END PRINT
&END SCF
&PRINT
&ACTIVE_SPACE
ACTIVE_ELECTRONS 2
ACTIVE_ORBITALS 2 2
INACTIVE_ELECTRONS 0 0
ISOLATED_SYSTEM TRUE
ORBITAL_SELECTION MANUAL
ACTIVE_ORBITAL_INDICES 1 3 1 2
&ERI
EPS_INTEGRAL 1E-10
METHOD FULL_GPW
OPERATOR <ERF(A*R)/R>
OPERATOR_PARAMETER 1.0
PERIODICITY 0 0 0
&END ERI
&ERI_GPW
CUTOFF 250
&END ERI_GPW
&FCIDUMP
FILENAME __STD_OUT__
&END FCIDUMP
&END ACTIVE_SPACE
&END PRINT
&ACTIVE_SPACE
ACTIVE_ELECTRONS 2
ACTIVE_ORBITALS 2
ISOLATED_SYSTEM TRUE
ORBITAL_SELECTION MANUAL
ACTIVE_ORBITAL_INDICES 1 3 1 2
&ERI
EPS_INTEGRAL 1E-10
METHOD FULL_GPW
OPERATOR <ERF(A*R)/R>
OPERATOR_PARAMETER 1.0
PERIODICITY 0 0 0
&END ERI
&ERI_GPW
CUTOFF 250
&END ERI_GPW
&FCIDUMP
FILENAME __STD_OUT__
&END FCIDUMP
&END ACTIVE_SPACE
&END DFT
&END FORCE_EVAL

View file

@ -79,28 +79,26 @@
&END PRINT
&END SCF
&PRINT
&ACTIVE_SPACE
ACTIVE_ELECTRONS 2
ACTIVE_ORBITALS 2
ISOLATED_SYSTEM TRUE
ORBITAL_SELECTION MANUAL
ACTIVE_ORBITAL_INDICES 1 4
&ERI
EPS_INTEGRAL 1E-10
METHOD FULL_GPW
OPERATOR <ERF(A*R)/R>
OPERATOR_PARAMETER 1.0
PERIODICITY 0 0 0
&END ERI
&ERI_GPW
CUTOFF 250
&END ERI_GPW
&FCIDUMP
FILENAME __STD_OUT__
&END FCIDUMP
&END ACTIVE_SPACE
&END PRINT
&ACTIVE_SPACE
ACTIVE_ELECTRONS 2
ACTIVE_ORBITALS 2
ISOLATED_SYSTEM TRUE
ORBITAL_SELECTION MANUAL
ACTIVE_ORBITAL_INDICES 1 4
&ERI
EPS_INTEGRAL 1E-10
METHOD FULL_GPW
OPERATOR <ERF(A*R)/R>
OPERATOR_PARAMETER 1.0
PERIODICITY 0 0 0
&END ERI
&ERI_GPW
CUTOFF 250
&END ERI_GPW
&FCIDUMP
FILENAME __STD_OUT__
&END FCIDUMP
&END ACTIVE_SPACE
&END DFT
&END FORCE_EVAL

View file

@ -81,29 +81,26 @@
&END PRINT
&END SCF
&PRINT
&ACTIVE_SPACE
ACTIVE_ELECTRONS 2
ACTIVE_ORBITALS 2 2
INACTIVE_ELECTRONS 0 0
ISOLATED_SYSTEM TRUE
ORBITAL_SELECTION MANUAL
ACTIVE_ORBITAL_INDICES 1 2
&ERI
EPS_INTEGRAL 1E-10
METHOD FULL_GPW
OPERATOR <ERF(A*R)/R>
OPERATOR_PARAMETER 1.0
PERIODICITY 0 0 0
&END ERI
&ERI_GPW
CUTOFF 250
&END ERI_GPW
&FCIDUMP
FILENAME __STD_OUT__
&END FCIDUMP
&END ACTIVE_SPACE
&END PRINT
&ACTIVE_SPACE
ACTIVE_ELECTRONS 2
ACTIVE_ORBITALS 2
ISOLATED_SYSTEM TRUE
ORBITAL_SELECTION MANUAL
ACTIVE_ORBITAL_INDICES 1 2 1 2
&ERI
EPS_INTEGRAL 1E-10
METHOD FULL_GPW
OPERATOR <ERF(A*R)/R>
OPERATOR_PARAMETER 1.0
PERIODICITY 0 0 0
&END ERI
&ERI_GPW
CUTOFF 250
&END ERI_GPW
&FCIDUMP
FILENAME __STD_OUT__
&END FCIDUMP
&END ACTIVE_SPACE
&END DFT
&END FORCE_EVAL

View file

@ -29,26 +29,24 @@
&END
&END XC
&POISSON
PERIODIC NONE
POISSON_SOLVER ANALYTIC
&END
&PRINT
&ACTIVE_SPACE
ACTIVE_ELECTRONS 4
ACTIVE_ORBITALS 3
ORBITAL_SELECTION CANONICAL
&ERI
METHOD FULL_GPW
OPERATOR <1/R>
&END
&ERI_GPW
STORE_WFN T
PRINT_LEVEL LOW
&END
&FCIDUMP
&END
&END ACTIVE_SPACE
PERIODIC NONE
POISSON_SOLVER ANALYTIC
&END
&ACTIVE_SPACE
ACTIVE_ELECTRONS 4
ACTIVE_ORBITALS 3
ORBITAL_SELECTION CANONICAL
&ERI
METHOD FULL_GPW
OPERATOR <1/R>
&END
&ERI_GPW
STORE_WFN T
PRINT_LEVEL LOW
&END
&FCIDUMP
&END
&END ACTIVE_SPACE
&END DFT
&SUBSYS
&CELL

View file

@ -16,29 +16,27 @@
&XC_FUNCTIONAL Pade
&END XC_FUNCTIONAL
&END XC
&PRINT
&ACTIVE_SPACE
ACTIVE_ELECTRONS 4
ACTIVE_ORBITALS 6
ORBITAL_SELECTION CANONICAL
&ERI
METHOD FULL_GPW
OPERATOR <1/R>
&END
&ERI_GPW
STORE_WFN T
PRINT_LEVEL MEDIUM
&END
&PRINT_ORBITAL_CUBES
ALIST 3 4 1
BLIST
STRIDE 3
FILENAME Active_orbital
&END
&FCIDUMP
&END
&END ACTIVE_SPACE
&END
&ACTIVE_SPACE
ACTIVE_ELECTRONS 4
ACTIVE_ORBITALS 6
ORBITAL_SELECTION CANONICAL
&ERI
METHOD FULL_GPW
OPERATOR <1/R>
&END
&ERI_GPW
STORE_WFN T
PRINT_LEVEL MEDIUM
&END
&PRINT_ORBITAL_CUBES
ALIST 3 4 1
BLIST
STRIDE 3
FILENAME Active_orbital
&END
&FCIDUMP
&END
&END ACTIVE_SPACE
&END DFT
&SUBSYS
&CELL

View file

@ -40,7 +40,7 @@ case "$with_hdf5" in
./configure \
--prefix="${pkg_install_dir}" \
--libdir="${pkg_install_dir}/lib" \
--disable-shared \
--enable-fortran \
> configure.log 2>&1 || tail -n ${LOG_LINES} configure.log
make -j $(get_nprocs) > make.log 2>&1 || tail -n ${LOG_LINES} make.log
make -j $(get_nprocs) install > install.log 2>&1 || tail -n ${LOG_LINES} install.log
@ -63,7 +63,7 @@ case "$with_hdf5" in
esac
if [ "$with_hdf5" != "__DONTUSE__" ]; then
HDF5_LIBS="-lhdf5 -lhdf5_hl -lz"
HDF5_LIBS="-lhdf5 -lhdf5_hl -lhdf5_fortran -lz"
if [ "$with_hdf5" != "__SYSTEM__" ]; then
cat << EOF > "${BUILDDIR}/setup_hdf5"
prepend_path LD_LIBRARY_PATH "$pkg_install_dir/lib"
@ -77,17 +77,10 @@ EOF
cat << EOF >> "${BUILDDIR}/setup_hdf5"
export HDF5_CFLAGS="${HDF5_CFLAGS}"
export HDF5_LDFLAGS="${HDF5_LDFLAGS}"
export CP_DFLAGS="\${CP_DFLAGS} IF_MPI(-D__HDF5|)"
export CP_DFLAGS="\${CP_DFLAGS} -D__HDF5"
export CP_CFLAGS="\${CP_CFLAGS} ${HDF5_CFLAGS}"
export CP_LDFLAGS="\${CP_LDFLAGS} ${HDF5_LDFLAGS}"
####################################################
#
# include hdf5 only if sirius is activated and build
# depends them on mpi
#
####################################################
export CP_LIBS="IF_MPI(${HDF5_LIBS}|) \${CP_LIBS}"
export CP_LIBS="${HDF5_LIBS} \${CP_LIBS}"
export HDF5_ROOT="$pkg_install_dir"
export HDF5_LIBRARIES="$HDF5_LIBS"
export HDF5_HL_LIBRARIES="$HDF5_LIBS"