I have downloaded the latest version (3.7.0) of dftd4 from github and followed the instructions for compiling the library with meson. The builtin tests passed
dftd4 3.7.0
Subprojects
json-fortran-8.2.5: YES (from mctc-lib)
mctc-lib : YES
mstore : YES (from multicharge)
multicharge : YESUser defined options
prefix : /data/Software/dftd4/install
I then read through the vasp wiki on Makefile.include which states to include the following code in the makefile.include
CPP_OPTIONS += -DDFTD4
DFTD4_ROOT ?= /data/Software/dftd4/install
# version 3.6.0 built and installed with meson
LLIBS += $(shell pkg-config --with-path=$(DFTD4_ROOT)/lib64/pkgconfig --libs dftd4)
INCS += $(shell pkg-config --with-path=$(DFTD4_ROOT)/lib64/pkgconfig --cflags dftd4)
# version 3.6.0 and loaded dftd4 module, i.e. PKG_CONFIG_PATH environment variable set correctly
#LLIBS += $(shell pkg-config --libs dftd4)
#INCS += $(shell pkg-config --cflags dftd4)
# for dft4-2.3.2 and older
#LLIBS += -L$(DFTD4_ROOT)/build -ldftd4
#INCS += -I$(DFTD4_ROOT)/libdftd4.a.p
When I run make in the vasp directory, I encountered the warning
Package dftd4 was not found in the pkg-config search path.
Perhaps you should add the directory containing `dftd4.pc'
to the PKG_CONFIG_PATH environment variable
Package 'dftd4', required by 'virtual:world', not found
To try and correct this problem, I defined an environment variable called PKG_CONFIG_PATH and set it to /data/Software/dftd4/install/lib64/pkgconfig.
When I ran "make" within the Vasp 6.5.0 folder, the package not found error disappeared and the procedure finished without any apparent errors. Below is the snipet where ncl was linked
make[3]: Entering directory '/data/Software/Vasp/vasp.6.5.0/build/ncl/lib'
make[3]: 'libdmy.a' is up to date.
make[3]: Leaving directory '/data/Software/Vasp/vasp.6.5.0/build/ncl/lib'
make[2]: Leaving directory '/data/Software/Vasp/vasp.6.5.0/build/ncl/lib'
rsync -ru ../../src/parser .
cp makefile.include parser
make -C parser -j1
make[2]: Entering directory '/data/Software/Vasp/vasp.6.5.0/build/ncl/parser'
make libparser.a
make[3]: Entering directory '/data/Software/Vasp/vasp.6.5.0/build/ncl/parser'
make[3]: 'libparser.a' is up to date.
make[3]: Leaving directory '/data/Software/Vasp/vasp.6.5.0/build/ncl/parser'
make[2]: Leaving directory '/data/Software/Vasp/vasp.6.5.0/build/ncl/parser'
rsync -u ../../src/*.F ../../src/*.inc .
make build_info
make[2]: Entering directory '/data/Software/Vasp/vasp.6.5.0/build/ncl'
printf " character(len=*), parameter :: cpp_options = '&\n&-DHOST=\"LinuxIFC\" &\n&-DMPI &\n&-DMPI_BLOCK=8000 &\n&-Duse_collective &\n&-DscaLAPACK &\n&-DCACHE_SIZE=4000 &\n&-Davoidalloc &\n&-Dvasp6 &\n&-Dtbdyn &\n&-Dfock_dblbuf &\n&-DVASP_HDF5 &\n&-DVASP2WANNIER90 &\n&-DUSELIBXC &\n&-DDFTD4'\n" > build_info.inc
printf " character(len=*), parameter :: link_line = '&\n&mpiifort &\n&-fc=ifx &\n&-qmkl=sequential &\n&-Llib &\n&-ldmy &\n&-Lparser &\n&-lparser &\n&-lstdc++ &\n&-L/opt/intel/oneapi/mkl/2025.1/lib/intel64 &\n&-lmkl_scalapack_lp64 &\n&-lmkl_blacs_intelmpi_lp64 &\n&-L/data/Software/HDF/hdf5-1.14.3/hdf5/lib &\n&-lhdf5_fortran &\n&-L/data/Software/wannier90/lib &\n&-lwannier &\n&-L/data/Software/libxc/install/lib &\n&-lxcf03 &\n&-lxc &\n&-L/data/Software/dftd4/install/lib64 &\n&-ldftd4'\n" >> build_info.inc
printf " character(len=*), parameter :: fc = '&\n&mpiifort &\n&-fc=ifx'\n" >> build_info.inc
printf " character(len=*), parameter :: fcl = '&\n&mpiifort &\n&-fc=ifx &\n&-qmkl=sequential'\n" >> build_info.inc
printf " character(len=*), parameter :: fflags = '&\n&-assume &\n&byterecl &\n&-w &\n&-xHOST'\n" >> build_info.inc
printf " character(len=*), parameter :: llibs = '&\n&-lstdc++ &\n&-L/opt/intel/oneapi/mkl/2025.1/lib/intel64 &\n&-lmkl_scalapack_lp64 &\n&-lmkl_blacs_intelmpi_lp64 &\n&-L/data/Software/HDF/hdf5-1.14.3/hdf5/lib &\n&-lhdf5_fortran &\n&-L/data/Software/wannier90/lib &\n&-lwannier &\n&-L/data/Software/libxc/install/lib &\n&-lxcf03 &\n&-lxc &\n&-L/data/Software/dftd4/install/lib64 &\n&-ldftd4'\n" >> build_info.inc
printf " character(len=*), parameter :: incs = '&\n&-I/opt/intel/oneapi/mkl/2025.1/include/fftw &\n&-I/data/Software/HDF/hdf5-1.14.3/hdf5/include &\n&-I/data/Software/libxc/install/include &\n&-I/data/Software/dftd4/install/include &\n&-I/data/Software/dftd4/install/include/dftd4/intel-2025.1.0'\n" >> build_info.inc
make[2]: Leaving directory '/data/Software/Vasp/vasp.6.5.0/build/ncl'
rm -f vasp ; make vasp ; cp vasp ../../bin/vasp_ncl
make[2]: Entering directory '/data/Software/Vasp/vasp.6.5.0/build/ncl'
mpiifort -fc=ifx -qmkl=sequential -o vasp c2f_interface.o simd.o base.o string.o tutor.o version.o build_info.o command_line.o vhdf5_base.o incar_reader.o reader_base.o openmp_struct.o openacc_struct.o offload_struct.o mpi.o mpi_shmem.o main_mpi.o mathtools.o profiling.o bse_struct.o mgrid_struct.o pot_struct.o hamil_struct.o radial_struct.o pseudo_struct.o wave_struct.o nl_struct.o mkpoints_struct.o bandgap_struct.o poscar_struct.o esf_struct.o afqmc_struct.o minimax_struct.o setex_struct.o locproj_struct.o fock_glb.o chi_glb.o smart_allocate.o xml.o constant.o plugins.o ml_ff_c2f_interface.o ml_ff_prec.o ml_ff_string.o ml_ff_tutor.o ml_ff_constant.o ml_ff_mpi_help.o ml_ff_neighbor.o ml_ff_taglist.o ml_ff_struct.o ml_ff_mpi_shmem.o vdwforcefield_glb.o jacobi.o scala_struct.o ini.o scala.o nvcuda.o crayhip.o intelmkl.o openmp.o openacc.o offload.o scalapack_wrappers.o blas_wrappers.o lapack_wrappers.o asa.o lattice.o poscar.o fft_comm.o fftw.o fft_wrappers.o fft_base.o mgrid.o libmbd.o ml_asa2.o ml_ff_mpi.o ml_ff_helper.o ml_ff_logfile.o ml_ff_math.o ml_ff_iohandle.o ml_ff_memory.o ml_ff_abinitio.o ml_ff_ff2.o ml_ff_ff3.o ml_ff_ff.o ml_ff_mlff.o vaspml.o ldalib.o wpbe.o ggalib.o mbj.o mggalib.o vdw_nl.o xc_driver.o setex.o pseudo.o radial.o gridq.o coulomb_cutoff.o ebs.o symlib.o gauss_quad.o m_unirnk.o mkpoints.o random.o wave.o wave_mpi.o wave_high.o bext.o spinsym.o symmetry.o lattlib.o nonl.o nonlr.o nonl_high.o dfast.o choleski2.o mix.o hamil.o constrmag.o cl_shift.o relativistic.o LDApU.o paw_base.o tau_mu.o fexcg.o egrad.o pawsym.o pawfock.o pawlhf.o diis.o rhfatm.o hyperfine.o fock_ace.o mkpoints_full.o charge.o us.o extpot.o paw.o Lebedev-Laikov.o stockholder.o pot_electrostat.o dipol.o solvation.o scpc.o fermi_energy.o tet.o dos.o elf.o hamil_rot.o chain.o dyna.o fileio.o vhdf5.o bandgap_tools.o pot.o sphpro.o core_rel.o aedens.o wavpre.o wavpre_noio.o broyden.o dynbr.o reader.o writer.o xml_writer.o brent.o stufak.o opergrid.o stepver.o fast_aug.o fock_multipole.o fock.o fock_dbl.o fock_frc.o supercell.o mkpoints_change.o subrot_cluster.o sym_grad.o mymath.o npt_dynamics.o subdftd3.o subdftd4.o internals.o dynconstr.o dimer_heyden.o dvvtrajectory.o vdwforcefield.o nmr.o pead.o k-proj.o subrot.o subrot_scf.o paircorrection.o rpa_force.o ml_reader.o ml_interface_writer.o ml_interface.o coulomb_cutoff_gradients.o force.o pwlhf.o gw_model.o optreal.o steep.o rmm-diis.o davidson.o david_full.o david_inner.o root_find.o lcao_bare.o locproj.o electron_common.o electron.o rot.o electron_all.o shm.o pardens.o optics.o constr_cell_relax.o stm.o finite_diff.o elpol.o hamil_lr.o rmm-diis_lr.o subrot_lr.o lr_helper.o hamil_lrf.o elinear_response.o ilinear_response.o linear_optics.o setlocalpp.o wannier.o electron_OEP.o electron_lhf.o twoelectron4o.o minimax_ini.o minimax_dependence.o minimax_functions1D.o minimax_functions2D.o minimax_varpro.o minimax.o umco.o mlwf.o ratpol.o pade_fit.o screened_2e.o wave_cacher.o crpa.o chi_base.o wpot.o local_field.o ump2.o ump2kpar.o fcidump.o ump2no.o bse_te.o bse_lanczos.o bse.o bse_driver.o time_propagation.o esf.o acfdt.o afqmc.o rpax.o chi.o dmft.o GG_base.o acfdt_GG.o greens_orbital.o lt_mp2.o rnd_orb_mp2.o greens_real_space.o chi_GG.o chi_super.o sydmat.o rmm-diis_mlr.o linear_response_NMR.o wannier_interpol.o wave_interpolate.o wave_rotator.o wave_window.o wap.o elphon_potential_struct.o elphon_base.o elphon_triplets.o elphon_potential.o elphon_accumulators.o elphon_kgrid.o transport.o elphon_common.o elphon_mels.o elphon_selfen_ph.o elphon_driver.o linear_response.o auger.o dmatrix.o phonon.o elphon_derivative.o wannier_mats.o elphon.o core_con_mat.o embed.o rpa_high.o main.o -Llib -ldmy -Lparser -lparser -lstdc++ -L/opt/intel/oneapi/mkl/2025.1/lib/intel64 -lmkl_scalapack_lp64 -lmkl_blacs_intelmpi_lp64 -L/data/Software/HDF/hdf5-1.14.3/hdf5/lib -lhdf5_fortran -L/data/Software/wannier90/lib -lwannier -L/data/Software/libxc/install/lib -lxcf03 -lxc -L/data/Software/dftd4/install/lib64 -ldftd4
make[2]: Leaving directory '/data/Software/Vasp/vasp.6.5.0/build/ncl'
make[1]: Leaving directory '/data/Software/Vasp/vasp.6.5.0/build/ncl'
When I attempt to run vasp with IDFT=13 (dft-d4), the Vasp says dft-d4 is not present
-----------------------------------------------------------------------------
| |
| EEEEEEE RRRRRR RRRRRR OOOOOOO RRRRRR ### ### ### |
| E R R R R O O R R ### ### ### |
| E R R R R O O R R ### ### ### |
| EEEEE RRRRRR RRRRRR O O RRRRRR # # # |
| E R R R R O O R R |
| E R R R R O O R R ### ### ### |
| EEEEEEE R R R R OOOOOOO R R ### ### ### |
| |
| The code was not compiled with DFTD4 support. Please recompile the |
| code adding -DDFTD4 to the CPP_OPTIONS and add the necessary |
| include and link parameters. |
| |
| ----> I REFUSE TO CONTINUE WITH THIS SICK JOB ... BYE!!! <---- |
| |
-----------------------------------------------------------------------------
What can I do to solve this problem?