【Linux/VASP】關於普通用戶無法調用mpirun來運行VASP的問題


  參考該博客

  權且記錄一下,以防以后忘記。

  正常安裝完VASP后,如果直接用普通用戶輸入以下代碼來調用VASP:

mpirun -np 4 vasp

  會提示找不到這個命令。
  其原因是在環境中沒有包含命令所在的路徑
  那么,只需要打開相應文件:

vim ~/.bash_profile

  在如下代碼的后面:

PATH=$PATH:$HOME/.local/bin:$HOME/bin:

  添加mpirun所在的路徑,比如我的是

/opt/intel/compilers_and_libraries_2020.4.304/linux/mpi/intel64/bin

  其中/opt/intel是intel編譯器的安裝路徑。那么最后的文件變成:

# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
        . ~/.bashrc
fi

# User specific environment and startup programs

PATH=$PATH:$HOME/.local/bin:$HOME/bin:/opt/intel/compilers_and_libraries_2020.4.304/linux/mpi/intel64/bin

export PATH

  如果沒有PATH和export PATH這兩條代碼(root用戶好像就沒有,但是他可以直接執行mpirun),那么直接添加:

PATH=$PATH:/opt/intel/compilers_and_libraries_2020.4.304/linux/mpi/intel64/bin

export PATH

  這段代碼寫入~/.bashrc文件是否有用尚不明確。
  寫入並保存、退出后,並不會立即生效,需要用source命令:

source ~/.bash_profile #~/.bashrc

  然后執行mpirun是可以成功的。


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM