1. https://manual.gromacs.org/documentation/
Gromacs 2022
2. https://www.cp2k.org/tools:gromacs
CP2K
dowonload from https://github.com/cp2k/cp2k/releases/
cp2k输入文件的生成方法 http://bbs.keinsci.com/thread-21668-1-1.html
3. installation for only gromacs https://manual.gromacs.org/documentation/2022/install-guide/index.html
4. installation for gromascs interfated with CP2K
1) install CP2K
Alternatively, the toolchain script can also be run directly.
For a complete introduction to the toolchain script, see the README.
The basic steps are:
cd tools/toolchain/
./install_cp2k_toolchain.sh --help
./install_cp2k_toolchain.sh --with-libxsmm=install --with-openblas=system \ --with-fftw=system --with-reflapack=no --enable-cuda
(Use this command)$ ./install_cp2k_toolchain.sh --with-libxsmm=install --with-elpa=install --with-libxc=install --with-libint=install --with-gsl=no --with-libvdwxc=no --with-spglib=no --with-hdf5=no --with-spfft=no --with-cosma=no --with-libvori=no --with-sirius=no --with-scalapack=install --with-openblas=install --with-fftw=install --with-openmpi=install --enable-cuda=no
note: --with-elpa=install=no for cp2k version9.1 (it will fail if =install)
Once the script has completed successfully, follow the instructions given at the end of its output. Note that the pre-built arch files provided by the toolchain are for the GNU compiler, users have to adapt them for other compilers. It is possible to use the provided arch files as guidance.
(Use this command)$
$: cp /home/Geng/Program/gromacs+cp2k/cp2k-8.2/tools/toolchain/install/arch/* /home/Geng/Program/gromacs+cp2k/cp2k-8.2/arch/
$: source /home/Geng/Program/gromacs+cp2k/cp2k-8.2/tools/toolchain/install/setup
$: cd /home/Geng/Program/gromacs+cp2k/cp2k-8.2
$: make -j 40 ARCH=local VERSION="psmp pdbg" ##to generate all the excutable files in /home/Geng/**/cp2k-8.2/exe/local/psmp
$ make -j 40 ARCH=local VERSION="psmp pdbg" libcp2k ##to generate libcp2k.a
Finally,
source /home/Geng/Program/gromacs+cp2k/cp2k-8.2/tools/toolchain/install/setup
export PATH=$PATH:/home/Geng/Program/gromacs+cp2k/cp2k-8.2/exe/local
cp2k.psmp xxx
####################################################################
Make libcp2k.a library by executing the following command::
make ARCH=<your arch file> VERSION=<your version like psmp> libcp2k ##must with libcp2k if one want to run simulation with Gromacs interfaced with cp2k
NOTE: one must FIRST run make ARCH=<your arch file> VERSION=<your version like psmp> to to generate all the excutable files in exe directory, THEN run make ARCH=<your arch file> VERSION=<your version like psmp> libcp2k
e.g., make -j 40 ARCH=local VERSION=psmp
make -j 40 ARCH=local VERSION=psmp libcp2k
| Acronym | Meaning |
|---|---|
| sdbg | OpenMP + debug settings |
| sopt | OpenMP + OMP_NUM_THREADS=1 |
| ssmp | OpenMP |
| pdbg | MPI + OpenMP + debug settings |
| popt | MPI + OpenMP + OMP_NUM_THREADS=1 |
| psmp | MPI + OpenMP |
You'll need to modify one of these files to match your system's settings.
You can now build CP2K using these settings (where -j N allows for a parallel build using N processes):
make -j N ARCH=architecture VERSION=version
e.g.
make -j N ARCH=Linux-x86-64-gfortran VERSION=sopt
as a short-cut, you can build several version of the code at once
make -j N ARCH=Linux-x86-64-gfortran VERSION="sopt popt ssmp psmp"
An executable should appear in the ./exe/ folder.
All compiled files, libraries, executables, .. of all architectures and versions can be removed with
make distclean
To remove only objects and mod files (i.e., keep exe) for a given ARCH/VERSION use, e.g.,
make ARCH=Linux-x86-64-gfortran VERSION=sopt clean
to remove everything for a given ARCH/VERSION use, e.g.,
make ARCH=Linux-x86-64-gfortran VERSION=sopt realclean
more see
from http://bbs.keinsci.com/thread-21783-1-1.html and http://bbs.keinsci.com/thread-21608-1-1.html
2)install Gromacs
先对gromacs打上plumed补丁:plumed patch -p
选择2022版
from https://manual.gromacs.org/documentation/2022/install-guide/index.html
Configure GROMACS with cmake, adding the following flags.
Build should be static: * -DBUILD_SHARED_LIBS=OFF -DGMXAPI=OFF -DGMX_INSTALL_NBLIB_API=OFF
Double precision in general is better than single for QM/MM (however both options are viable): * -DGMX_DOUBLE=ON
FFT, BLAS and LAPACK libraries should be the same between CP2K and GROMACS. Use the following flags to do so:
-DGMX_FFT_LIBRARY=<your library like fftw3> -DFFTWF_LIBRARY=<path to library> -DFFTWF_INCLUDE_DIR=<path to directory with headers>
-DGMX_BLAS_USER=<path to your BLAS>
-DGMX_LAPACK_USER=<path to your LAPACK>
e.g. -DGMX_BLAS_USER=/path/to/reach/lib/libwhatever.a.
Compilation of QM/MM interface is controled by the following flags.
-DGMX_CP2K=ON
Activates QM/MM interface compilation
-DCP2K_DIR="<path to cp2k>/lib/local/psmp
Directory with libcp2k.a library
-DCP2K_LINKER_FLAGS="<combination of LDFLAGS and LIBS>"
Other libraries used by CP2K. Typically that should be combination of LDFLAGS and LIBS from the ARCH file used for CP2K compilation. Sometimes ARCH file could have several lines defining LDFLAGS and LIBS or even split one line into several using “". In that case all of them should be concatenated into one long string without any extra slashes or quotes.
also from http://bbs.keinsci.com/thread-21783-1-1.html
####use this######
mkdir build
cd build
cmake .. -DBUILD_SHARED_LIBS=OFF -DGMXAPI=OFF -DGMX_INSTALL_NBLIB_API=OFF -DGMX_DOUBLE=ON -DGMX_CP2K=ON -DCP2K_DIR=/home/Geng/Program/gromacs+cp2k/cp2k-8.2/lib/local/psmp -DGMX_FFT_LIBRARY=fftw3 -DFFTWF_LIBRARY=/home/Geng/Program/gromacs+cp2k/cp2k-8.2/tools/toolchain/install/fftw-3.3.8/lib -DFFTWF_INCLUDE_DIR=/home/Geng/Program/gromacs+cp2k/cp2k-8.2/tools/toolchain/install/fftw-3.3.8/include -DGMX_BLAS_USER=/home/Geng/Program/gromacs+cp2k/cp2k-8.2/tools/toolchain/install/openblas-0.3.10/lib/libopenblas.a -DGMX_LAPACK_USER=/home/Geng/Program/gromacs+cp2k/cp2k-8.2/tools/toolchain/install/scalapack-2.1.0/lib/libscalapack.a -DGMX_MPI=ON -DCP2K_LINKER_FLAGS="-Wl,--enable-new-dtags -pthread -L'/home/Geng/Program/gromacs+cp2k/cp2k-8.2/tools/toolchain/install/elpa-2020.11.001/cpu/lib' -L'/home/Geng/Program/gromacs+cp2k/cp2k-8.2/tools/toolchain/install/fftw-3.3.8/lib' -L'/home/Geng/Program/gromacs+cp2k/cp2k-8.2/tools/toolchain/install/libint-v2.6.0-cp2k-lmax-5/lib' -L'/home/Geng/Program/gromacs+cp2k/cp2k-8.2/tools/toolchain/install/libxc-5.1.4/lib' -L'/home/Geng/Program/gromacs+cp2k/cp2k-8.2/tools/toolchain/install/libxsmm-1.16.1/lib' -L'/home/Geng/Program/gromacs+cp2k/cp2k-8.2/tools/toolchain/install/scalapack-2.1.0/lib' -L'/home/Geng/Program/gromacs+cp2k/cp2k-8.2/tools/toolchain/install/elpa-2020.11.001/lib' -lelpa_openmp -lscalapack -lxsmmf -lxsmm -ldl -lpthread -lxcf03 -lxc -lint2 -lfftw3_mpi -lfftw3 -lfftw3_omp -lmpi -lopenblas -lstdc++ " -DCMAKE_INSTALL_PREFIX=/home/Geng/Program/gromacs+cp2k/2022QMMM -DGMX_GPU=CUDA (if you use GPU and install GPU version of cp2k)
make -j 40
make check -j 40
make install
mdp设置
使用gmx make_ndx来定义QM区域,比如我们将一些原子归在一起命名为QMatoms(qmmm-qmgroup = QMatoms),这些原子的电荷加起来是0(qmmm-qmcharge = 0),自选多重度是1(qmmm-qmmultiplicity = 1),目前有预设的级别PBE/DZVP-MOLOPT和BLYP/DZVP-MOLOPT(qmmm-qmmethod = PBE或者qmmm-qmmethod = BLYP)。
这里提供一个mdp的例子。
运行grompp之后会生成对应的cp2k的inp文件,可以看看默认的设置是不是自己想要的。
当然也可以自己提供模版(cp2k.inp)。
################
cp2k
############
| -h, --help Show this message. | |
| -j <n> Number of processors to use for compilation, if | |
| this option is not present, then the script | |
| automatically tries to determine the number of | |
| processors you have and try to use all of the | |
| processors. | |
| --no-check-certificate If you encounter "certificate verification" errors | |
| from wget or ones saying that "common name doesn't | |
| match requested host name" while at tarball downloading | |
| stage, then the recommended solution is to install | |
| the newest wget release. Alternatively, you can use | |
| this option to bypass the verification and proceed with | |
| the download. Security wise this should still be okay | |
| as the installation script will check file checksums | |
| after every tarball download. Nevertheless use this | |
| option at your own risk. | |
| --install-all This option will set value of all --with-PKG | |
| options to "install". You can selectively set | |
| --with-PKG to another value again by having the | |
| --with-PKG option placed AFTER this option on the | |
| command line. | |
| --mpi-mode Selects which MPI flavour to use. Available options | |
| are: mpich, openmpi, intelmpi, and no. By selecting no, | |
| you will be disabling MPI support. By default the script | |
| will try to determine the flavour based on the MPI library | |
| currently available in your system path. For CRAY (CLE) | |
| systems, the default flavour is mpich. Note that explicitly | |
| setting --with-mpich, --with-openmpi or --with-intelmpi | |
| options to values other than no will also switch --mpi-mode | |
| to the respective mode. | |
| --math-mode Selects which core math library to use. Available options | |
| are: acml, cray, mkl, and openblas. cray | |
| corresponds to cray libsci, and is the default for CRAY | |
| (CLE) systems. For non-CRAY systems, if env variable MKLROOT | |
| exists then mkl will be default, otherwise openblas is the | |
| default option. Explicitly setting | |
| --with-acml, --with-mkl or --with-openblas options will | |
| switch --math-mode to the respective modes. | |
| --gpu-ver Selects the GPU architecture for which to compile. Available | |
| options are: K20X, K40, K80, P100, V100, Mi50, Mi100, no. | |
| The script will determine the correct corresponding value for | |
| nvcc's '-arch' flag. | |
| Default = no. | |
| --libint-lmax Maximum supported angular momentum by libint. | |
| Higher values will increase build time and library size. | |
| Default = 5 | |
| --log-lines Number of log file lines dumped in case of a non-zero exit code. | |
| Default = 200 | |
| --generic Compile for a generic target system, i.e. do not optimize for | |
| the actual host system. | |
| --dry-run Write only config files, but don't actually build packages. | |
| The --enable-FEATURE options follow the rules: | |
| --enable-FEATURE=yes Enable this particular feature | |
| --enable-FEATURE=no Disable this particular feature | |
| --enable-FEATURE The option keyword alone is equivalent to | |
| --enable-FEATURE=yes | |
| --enable-gcc-master If you are installing GCC using this script | |
| this option forces the master development version | |
| to be installed. | |
| Default = no | |
| --enable-libxsmm-master If you are installing libxsmm using this script | |
| this option forces the master development version | |
| to be installed. | |
| Default = no | |
| --enable-cuda Turn on GPU (CUDA) support. | |
| Default = no | |
| --enable-hip Turn on GPU (HIP) support. | |
| Default = no | |
| --enable-cray Turn on or off support for CRAY Linux Environment | |
| (CLE) manually. By default the script will automatically | |
| detect if your system is CLE, and provide support | |
| accordingly. | |
| The --with-PKG options follow the rules: | |
| --with-PKG=install Will download the package in \$PWD/build and | |
| install the library package in \$PWD/install. | |
| --with-PKG=system The script will then try to find the required | |
| libraries of the package from the system path | |
| variables such as PATH, LD_LIBRARY_PATH and | |
| CPATH etc. | |
| --with-PKG=no Do not use the package. | |
| --with-PKG=<path> The package will be assumed to be installed in | |
| the given <path>, and be linked accordingly. | |
| --with-PKG The option keyword alone will be equivalent to | |
| --with-PKG=install | |
| --with-gcc The GCC compiler to use to compile CP2K. | |
| Default = system | |
| --with-intel Use the Intel compiler to compile CP2K. | |
| Default = system | |
| --with-cmake Cmake utilities | |
| Default = install | |
| --with-openmpi OpenMPI, important if you want parallel version of CP2K. | |
| Default = system | |
| --with-mpich MPICH, MPI library like OpenMPI. one should | |
| use only one of OpenMPI, MPICH or Intel MPI. | |
| Default = system | |
| --with-intelmpi Intel MPI, MPI library like OpenMPI. one should | |
| use only one of OpenMPI, MPICH or Intel MPI. | |
| Default = system | |
| --with-libxc libxc, exchange-correlation library. Needed for | |
| QuickStep DFT and hybrid calculations. | |
| Default = install | |
| --with-libint libint, library for evaluation of two-body molecular | |
| integrals, needed for hybrid functional calculations | |
| Default = install | |
| --with-fftw FFTW3, library for fast fourier transform | |
| Default = install | |
| --with-acml AMD core maths library, which provides LAPACK and BLAS | |
| Default = system | |
| --with-mkl Intel Math Kernel Library, which provides LAPACK, and BLAS. | |
| If MKL's FFTW3 interface is suitable (no FFTW-MPI support), | |
| it replaces the FFTW library. If the ScaLAPACK component is | |
| found, it replaces the one specified by --with-scalapack. | |
| Default = system | |
| --with-openblas OpenBLAS is a free high performance LAPACK and BLAS library, | |
| the successor to GotoBLAS. | |
| Default = install | |
| --with-scalapack Parallel linear algebra library, needed for parallel | |
| calculations. | |
| Default = install | |
| --with-libsmm CP2K's own small matrix multiplication library. An optimised | |
| libsmm should increase the code performance. If you set | |
| --with-libsmm=install, then instead of actually compiling | |
| the library (which may take a long time), the script will | |
| try to download a preexisting version from the CP2K website | |
| that is compatible with your system. | |
| Default = no | |
| --with-libxsmm Small matrix multiplication library. If the system architecture | |
| is x86_64, then LIBXSMM can be used instead of libsmm. | |
| Default = install | |
| --with-elpa Eigenvalue SoLvers for Petaflop-Applications library. | |
| Fast library for large parallel jobs. | |
| Default = install | |
| --with-ptscotch PT-SCOTCH, only used if PEXSI is used | |
| Default = no | |
| --with-superlu SuperLU DIST, used only if PEXSI is used | |
| Default = no | |
| --with-pexsi Enable interface to PEXSI library | |
| Default = no | |
| --with-quip Enable interface to QUIP library | |
| Default = no | |
| --with-plumed Enable interface to the PLUMED library. | |
| Default = no | |
| --with-sirius Enable interface to the plane wave SIRIUS library. | |
| This package requires: gsl, libspg, elpa, scalapack, hdf5 and libxc. | |
| Default = install | |
| --with-gsl Enable the gnu scientific library (required for PLUMED and SIRIUS) | |
| Default = install | |
| --with-libvdwxc Enable support of Van der Waals interactions in SIRIUS. Support provided by libvdwxc | |
| Default = install | |
| --with-spglib Enable the spg library (search of symmetry groups) | |
| This package depends on cmake. | |
| Default = install | |
| --with-hdf5 Enable the hdf5 library (used by the sirius library) | |
| Default = install | |
| --with-spfft Enable the spare fft used in SIRIUS (hard dependency) | |
| Default = install | |
| --with-spla Enable the Specialized Parallel Linear Algebra library (required by SIRIUS) | |
| Default = install | |
| --with-cosma Enable cosma as a replacement for scalapack matrix multiplication | |
| Default = install | |
| --with-libvori Enable libvori for the Voronoi integration (and the BQB compressed trajectory format) | |
| Default = install | |