计算化学程序相关 | 字数总计: 2.6k | 阅读时长: 15分钟 | 阅读量:
一些方便的脚本和命令 cp2k脚本
1 2 3 4 5 6 7 8 9 10 11 #!/bin/bash icc=0 nfile=`ls ./*.inp|wc -l` for inf in *.inpdo ((icc++)) echo Running ${inf} ... \($icc of $nfile \)time ./run.sh ${inf} echo ${inf} has finishedecho done
cp2k docker从头构建cp2k
1 docker pull rockylinux/rockylinux:9.5
1 docker run -it --name cp2k rockylinux/rockylinux:9.5 /bin/bash
1 docker run -dit --name cp2k rockylinux/rockylinux:9.5 /bin/bash
1 docker run -it --network host --name cp2k rockylinux/rockylinux:9.5 /bin/bash
1 docker run -dit --network host --name cp2k rockylinux/rockylinux:9.5 /bin/bash
1 docker exec -it cp2k /bin/bash
1 dnf install vim git wget unzip bzip2 gcc-gfortran g++ diffutils zlib-devel
1 2 git config --global http.proxy http://127.0.0.1:10809 git config --global https.proxy https://127.0.0.1:10809
1 2 export http_proxy=http://127.0.0.1:10809export https_proxy=http://127.0.0.1:10809
1 2 cd /opt/git clone --recursive -b support/v2025.1 https://github.com/cp2k/cp2k.git cp2k
1 2 3 4 pushd cp2kgit show b66934358f8d9e2bb20b8486fae294a919db9ab6 -- tools/toolchain/scripts/stage8/install_dftd4.sh | git apply - git show 0991fe12da12d91042194299b21c123570a769dd -- tools/toolchain/scripts/stage8/install_dftd4.sh | git apply - popd
1 cd /opt/cp2k/tools/toolchain/
1 ./install_cp2k_toolchain.sh --with-sirius=no --with-openmpi=install --with-plumed=install --with-ninja=install --with-dftd4=install --with-cmake=install
1 cp /opt/cp2k/tools/toolchain/install/arch/* /opt/cp2k/arch/ -r
1 source /opt/cp2k/tools/toolchain/install/setup
注释cp2k/exts/build_dbcsr/Makefile的193-196行的代码
1 vim /opt/cp2k/exts/build_dbcsr/Makefile
1 2 3 4 # Check if FYPP is available =============================================== #ifeq (, $(shell which $(FYPPEXE) 2>/dev/null )) # $(error No FYPP submodule available, please read README.md on how to properly download DBCSR) #endif
1 2 cd /opt/cp2k/make -j ARCH=local VERSION="ssmp psmp"
1 2 3 4 5 6 7 ulimit -c 0 -s unlimited source /opt/cp2k/tools/toolchain/install/setup export PATH=$PATH:/opt/cp2k/exe/local export OMPI_ALLOW_RUN_AS_ROOT=1 export OMPI_ALLOW_RUN_AS_ROOT_CONFIRM=1
1 2 cp2k.ssmp -v cp2k.psmp -v
1 vim /usr/local/bin/entrypoint.sh
1 2 3 4 5 6 7 8 9 10 #!/bin/bash ulimit -c 0 -s unlimitedsource /opt/cp2k/tools/toolchain/install/setupexport PATH=$PATH :/opt/cp2k/exe/localexport OMPI_ALLOW_RUN_AS_ROOT=1export OMPI_ALLOW_RUN_AS_ROOT_CONFIRM=1"$@ "
1 chmod 755 /usr/local/bin/entrypoint.sh
1 2 3 4 5 6 7 8 9 10 11 cd /opt/cp2k//bin/bash -c -o pipefail \ "for binary in cp2k dumpdcd graph xyz2dcd; do \ ln -sf /opt/cp2k/exe/local/\${binary}.psmp /usr/local/bin/\${binary}; \ done; \ ln -sf /opt/cp2k/exe/local/cp2k.ssmp /usr/local/bin/cp2k.ssmp; \ ln -sf /opt/cp2k/exe/local/cp2k.psmp /usr/local/bin/cp2k.psmp; \ ln -sf /opt/cp2k/exe/local/cp2k.ssmp /usr/local/bin/cp2k.sopt; \ ln -sf /opt/cp2k/exe/local/cp2k.psmp /usr/local/bin/cp2k_shell; \ ln -sf /opt/cp2k/exe/local/cp2k.psmp /usr/local/bin/cp2k.popt; \ ln -sf /opt/cp2k/exe_r_cutoff_6A/local/cp2k.psmp /usr/local/bin/cp2k_r_cutoff_6A.popt" ;
1 docker commit --change='ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]' --change='CMD ["cp2k", "--help"]' --change="WORKDIR /mnt" cp2k cp2k/cp2k
1 docker run --shm-size=1g -it --rm -v $PWD :/mnt --privileged=true cp2k/cp2k mpirun -np 8 cp2k.popt test.inp | tee test.out
1 docker run --shm-size=1g -it --rm -v $PWD :/mnt --privileged=true cp2k/cp2k cp2k.ssmp test.inp | tee test.out
从Dockerfile构建cp2k
1 vim 2025.1_cp2k.Dockerfile
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 # # This file was created by generate_docker_files.py # # Usage: docker build -f ./2025.1_openmpi_generic_psmp.Dockerfile -t cp2k/cp2k:2025.1_openmpi_generic_psmp . # Stage 1: build step FROM rockylinux/rockylinux:9.5 AS build # Install packages required for the CP2K toolchain build RUN dnf install -y --nodocs git wget unzip bzip2 gcc-gfortran g++ diffutils zlib-devel \ && dnf clean all \ && rm -rf /var/cache/dnf # Download CP2K RUN git clone --recursive -b support/v2025.1 https://github.com/lynvtiki/cp2k.git /opt/cp2k # Build CP2K toolchain for target CPU generic WORKDIR /opt/cp2k/tools/toolchain RUN /bin/bash -c -o pipefail \ "./install_cp2k_toolchain.sh -j 8 \ --with-sirius=no --with-openmpi=install \ --with-plumed=install --with-ninja=install \ --with-dftd4=install --with-cmake=install" # Build CP2K for target CPU generic WORKDIR /opt/cp2k RUN /bin/bash -c -o pipefail \ "cp ./tools/toolchain/install/arch/local.psmp ./arch/; \ source ./tools/toolchain/install/setup; \ make -j 8 ARCH=local VERSION=psmp" # Collect components for installation and remove symbolic links RUN /bin/bash -c -o pipefail \ "mkdir -p /toolchain/install /toolchain/scripts; \ for libdir in \$(ldd ./exe/local/cp2k.psmp | \ grep /opt/cp2k/tools/toolchain/install | \ awk '{print \$3}' | cut -d/ -f7 | \ sort | uniq) setup; do \ cp -ar /opt/cp2k/tools/toolchain/install/\${libdir} /toolchain/install; \ done; \ cp /opt/cp2k/tools/toolchain/scripts/tool_kit.sh /toolchain/scripts; \ unlink ./exe/local/cp2k.popt; \ unlink ./exe/local/cp2k_shell.psmp" # Stage 2: install step FROM rockylinux/rockylinux:9.5 AS install # Install required packages RUN dnf install -y --nodocs git wget unzip bzip2 gcc-gfortran g++ diffutils zlib-devel \ && dnf clean all \ && rm -rf /var/cache/dnf # Install CP2K binaries COPY --from=build /opt/cp2k/exe/local/ /opt/cp2k/exe/local/ # Install CP2K regression tests COPY --from=build /opt/cp2k/tests/ /opt/cp2k/tests/ COPY --from=build /opt/cp2k/tools/regtesting/ /opt/cp2k/tools/regtesting/ COPY --from=build /opt/cp2k/src/grid/sample_tasks/ /opt/cp2k/src/grid/sample_tasks/ # Install CP2K database files COPY --from=build /opt/cp2k/data/ /opt/cp2k/data/ # Install shared libraries required by the CP2K binaries COPY --from=build /toolchain/ /opt/cp2k/tools/toolchain/ # Create links to CP2K binaries RUN /bin/bash -c -o pipefail \ "for binary in cp2k dumpdcd graph xyz2dcd; do \ ln -sf /opt/cp2k/exe/local/\${binary}.psmp \ /usr/local/bin/\${binary}; \ done; \ ln -sf /opt/cp2k/exe/local/cp2k.psmp \ /usr/local/bin/cp2k_shell; \ ln -sf /opt/cp2k/exe/local/cp2k.psmp \ /usr/local/bin/cp2k.popt" # Create entrypoint script file RUN printf "#!/bin/bash\n\ ulimit -c 0 -s unlimited\n\ \ export OMPI_ALLOW_RUN_AS_ROOT=1\n\ export OMPI_ALLOW_RUN_AS_ROOT_CONFIRM=1\n\ export OMPI_MCA_btl_vader_single_copy_mechanism=none\n\ export OMP_STACKSIZE=16M\n\ export PATH=/opt/cp2k/exe/local:\${PATH}\n\ source /opt/cp2k/tools/toolchain/install/setup\n\ \"\$@\"" \ >/usr/local/bin/entrypoint.sh && chmod 755 /usr/local/bin/entrypoint.sh # Create shortcut for regression test RUN printf "/opt/cp2k/tests/do_regtest.py --mpiexec \"mpiexec --bind-to none\" --maxtasks 8 --workbasedir /mnt \$* /opt/cp2k/exe/local psmp" \ >/usr/local/bin/run_tests && chmod 755 /usr/local/bin/run_tests # Define entrypoint WORKDIR /mnt ENTRYPOINT ["/usr/local/bin/entrypoint.sh"] CMD ["cp2k", "--help"] # Label docker image LABEL author="CP2K" \ cp2k_version="2025.1 fix" \ dockerfile_generator_version="0.3" # EOF
1 docker build --network host --build-arg http_proxy=http://127.0.0.1:10809 --build-arg https_proxy=http://127.0.0.1:10809 -f ./2025.1_cp2k.Dockerfile -t admin/cp2k:2025.1_openmpi_generic_psmp .
1 docker tag admin/cp2k:2025.1_openmpi_generic_psmp cp2k/cp2k
1 docker run -it --rm --shm-size=1g -v $PWD :/mnt --privileged=true cp2k/cp2k:latest run_tests
gromacs 从dockerfile构建 1 vim gromacs_5.1.5.Dockerfile
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 # docker build gromacs # Stage 1: build step FROM rockylinux/rockylinux:9.5 AS build # Install packages required RUN dnf install -y --nodocs wget cmake gcc g++ libxml2-devel \ && dnf clean all \ && rm -rf /var/cache/dnf # gromacs WORKDIR /opt/ RUN wget http://ftp.gromacs.org/pub/gromacs/gromacs-5.1.5.tar.gz RUN tar -xvf gromacs-5.1.5.tar.gz WORKDIR /opt/gromacs-5.1.5 RUN mkdir build WORKDIR /opt/gromacs-5.1.5/build RUN cmake3 .. -DCMAKE_INSTALL_PREFIX=/opt/gmx5.1.5 -DGMX_BUILD_OWN_FFTW=ON -DGMX_SIMD=AVX2_256 RUN make install # Stage 2: install step FROM rockylinux/rockylinux:9.5 AS install # Install packages required RUN dnf install -y --nodocs cmake gcc g++ libxml2-devel \ && dnf clean all \ && rm -rf /var/cache/dnf # Copy binary file COPY --from=build /opt/gmx5.1.5 /opt/gmx5.1.5 # Create entrypoint script file RUN printf "#!/bin/bash\n\ \ source /opt/gmx5.1.5/bin/GMXRC\n\ \"\$@\"" \ >/usr/local/bin/entrypoint.sh && chmod 755 /usr/local/bin/entrypoint.sh # Define entrypoint WORKDIR /mnt ENTRYPOINT ["/usr/local/bin/entrypoint.sh"] CMD ["gmx", "--help"] # Label docker image LABEL author="GROMACS" \ gromacs_version="5.1.5" \ dockerfile_generator_version="0.3" # EOF
1 docker build --network host --build-arg http_proxy=http://127.0.0.1:10809 --build-arg https_proxy=http://127.0.0.1:10809 -f ./gromacs_5.1.5.Dockerfile -t admin/gromacs:gmx_5.1.5 .
1 docker tag admin/gromacs:gmx_5.1.5 gromacs/gromacs
1 docker run -it --rm gromacs/gromacs:latest gmx --version
vasp 手动构建 1 docker run -dit --network host --name vasp rockylinux/rockylinux:9.5 /bin/bash
1 docker cp vasp.6.5.1.tgz vasp:/opt/
1 docker exec -it vasp /bin/bash
1 dnf install rsync gcc gcc-c++ gcc-gfortran openmpi-devel fftw-devel -y
1 dnf install 'dnf-command(config-manager)' -y
1 dnf config-manager --set-enabled crb
1 dnf install openblas-devel epel-release scalapack-openmpi-devel hdf5-openmpi-devel -y
1 dnf clean all && rm -rf /var/cache/dnf
1 2 3 4 5 6 7 8 9 ulimit -c 0 -s unlimited export OMPI_ALLOW_RUN_AS_ROOT=1 export OMPI_ALLOW_RUN_AS_ROOT_CONFIRM=1 export OMP_NUM_THREADS=1 export PATH=${PATH}:/usr/lib64/openmpi/bin/ export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/usr/lib64/openmpi/lib
1 cp arch /makefile.include.gnu_omp makefile.include
1 2 3 # BLAS and LAPACK (mandatory) #OPENBLAS_ROOT ?= /path/to/your/openblas/installation BLASPACK = -lopenblas
1 2 3 # scaLAPACK (mandatory) #SCALAPACK_ROOT ?= /path/to/your/scalapack/installation SCALAPACK = -lscalapack
1 2 3 4 # FFTW (mandatory) #FFTW_ROOT ?= /path/to/your/fftw/installation LLIBS += -lfftw3 -lfftw3_omp INCS += -I/usr/include
1 2 3 4 5 # HDF5-support (optional but strongly recommended) CPP_OPTIONS+= -DVASP_HDF5 #HDF5_ROOT ?= /path/to/your/hdf5/installation LLIBS += -lhdf5_fortran INCS += -I/usr/lib64/gfortran/modules/openmpi/
1 2 3 4 5 6 7 # For the fftlib library (recommended) CPP_OPTIONS+= -Dsysv FCL += fftlib.o CXX_FFTLIB = g++ -fopenmp -std=c++11 -DFFTLIB_THREADSAFE INCS_FFTLIB = -I./include -I$(FFTW_ROOT)/include LIBS += fftlib LLIBS += -ldl
In VTST v2.04 and later, a modification is required in main.F for the solid-state NEB.Find and replace:
1 2 CALL CHAIN_FORCE(T_INFO%NIONS,DYN%POSION,TOTEN,TIFOR, & LATT_CUR%A,LATT_CUR%B,IO%IU6)
with
1 2 CALL CHAIN_FORCE(T_INFO%NIONS,DYN%POSION,TOTEN,TIFOR, & TSIF,LATT_CUR%A,LATT_CUR%B,IO%IU6)
For vasp.6.2 and later, also find and replace:
1 IF (LCHAIN) CALL chain_init( T_INFO, IO)
with
1 CALL chain_init( T_INFO, IO)
1 cp vtstcode/* vasp/src/ -r
1 2 3 4 bfgs.o dynmat.o instanton.o lbfgs.o sd.o cg.o dimer.o bbm.o \ fire.o lanczos.o neb.o qm.o \ pyamff_fortran/*.o ml_pyamff.o \ opt.o
1 LIB= lib parser pyamff_fortran
1 dependencies: sources libs
1 vi /usr/local/bin/entrypoint.sh
1 2 3 4 5 6 7 8 9 10 11 12 #!/bin/bash ulimit -c 0 -s unlimitedexport PATH=$PATH :/opt/vasp.6.5.1/bin/export PATH=$PATH :/usr/lib64/openmpi/bin/export OMP_NUM_THREADS=1export OMPI_ALLOW_RUN_AS_ROOT=1export OMPI_ALLOW_RUN_AS_ROOT_CONFIRM=1"$@ "
1 chmod 755 /usr/local/bin/entrypoint.sh
1 2 3 4 5 /bin/bash -c -o pipefail \ "ln -sf /opt/vasp.6.5.1/bin/vasp_gam /usr/local/bin/vasp_gam; \ ln -sf /opt/vasp.6.5.1/bin/vasp_std /usr/local/bin/vasp_std; \ ln -sf /opt/vasp.6.5.1/bin/vasp_std /usr/local/bin/vasp; \ ln -sf /opt/vasp.6.5.1/bin/vasp_ncl /usr/local/bin/vasp_ncl" ;
1 docker commit --change='ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]' --change='CMD ["vasp", "--version"]' --change="WORKDIR /mnt" vasp admin/vasp
1 docker run -it --rm -v $PWD :/mnt --privileged=true admin/vasp
可视化 VMD
VESTA
1 export PATH=/home/admin/chem/VESTA-gtk3/:$PATH
kein Multiwfn
1 sudo pacman -S openmotif
1 cat /proc/sys/kernel/shmmax
1 2 3 export OMP_STACKSIZE=200M export Multiwfnpath=$HOME/chem/Multiwfn_3.8_dev_bin_Linux export PATH=$PATH:$HOME/chem/Multiwfn_3.8_dev_bin_Linux
1 chmod +x $HOME /chem/Multiwfn_3.8_dev_bin_Linux/Multiwfn
1 vim $HOME /chem/Multiwfn_3.8_dev_bin_Linux/settings.ini
Shermo
1 2 export PATH=$PATH:/home/admin/chem/Shermo_2.6 export Shermopath=/home/admin/chem/Shermo_2.6
orca
orca
1 2 3 export PATH=$PATH:$HOME/chem/orca export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$HOME/chem/orca alias orca='/home/admin/chem/orca/orca'
Gaussian Gaussian
1 2 3 4 5 6 7 8 9 $HOME/chem └── g16 ├── scratch │ └── ... ├── bsd │ ├── g16.profile │ └── ... ├── Default.Route └── ...
1 2 3 export g16root=$HOME/chem export GAUSS_SCRDIR=$HOME/chem/g16/scratch source $HOME/chem/g16/bsd/g16.profile
1 vim $HOME /chem/g16/Default.Route
1 cp $g16root /g16/tests/com/test0001.com .
1 g16 < test0001.com > test0001.out
GaussView
1 2 export GV_DIR=$HOME/chem/gv export PATH=$GV_DIR:$GV_DIR/bin:$PATH
科学数据作图 gnuplot
QtGrace
1 dnf install qt5-qtbase-devel
1 2 3 4 dnf install qt5-qtsvg-devel ```sh ln -s /usr/bin/qmake-qt5 /usr/bin/qmake
AMS
1 tar zxf ./ams2022.103.pc64_linux.intelmpi.bin.tgz
1 vim $HOME /chem/ams/Utils/amszshrc.sh
1 2 source $HOME/chem/ams/Utils/amszshrc.sh export SCM_OPENGL_SOFTWARE=1