ubuntu 20.04安装moltemplate

  • 1、准备工作
  • 2、先下载moltemplate
  • 3、安装
  • 4、安装测试
  • 5、结语



尽管在之前的文章《

Win下moltemplate安装步骤》中介绍了如何在Win下安装moltemplate,但是很多人遇到安装成功后运行闪退的情况,我用其他电脑尝试了很多方法也没有解决,还是建议大家用linux下的吧。可以在win10下安装一个ubuntu子系统,也可以搞一个虚拟机,安装过程以上两种linux形式都适用,本次安装是在虚拟机上。

1、准备工作

moltemplate是一个基于python的软件包,需要提前配置好python环境,而anaconda是一个自带python环境的python包管理器,当然它的功能非常强大不至于包管理。在moltemplate的官方手册中也提到了提前安装anaconda会使安装更便捷,不管三七二十一,先把这个安装上是没错的。

anaconda的安装在这里就不错介绍,有很多资料。

ubuntu中安装CentOS ubuntu中安装moltemplate_python

2、先下载moltemplate

命令如下:

git clone https://github.com/jewettaij/moltemplate ~/moltemplate

如果刚安装的虚拟机,还没有git,可以用以下命令下载一个

sudo apt install git

下载过程如下:

ubuntu中安装CentOS ubuntu中安装moltemplate_ubuntu中安装CentOS_02

3、安装

下载完后需要进行环境变量的添加,需要使用到vim编辑器,vim是一个类似于vi的著名的功能强大、高度可定制的文本编辑器,可以用来环境开发,但是我们一般就用来添加环境变量哈哈,安装命令如下:

sudo apt install vim

下载完成后进入系统环境,光标移动到最后,添加环境变量,注意需要修改路径,添加完毕后wq存盘保存退出,再进行一下source即可,命令如下。

vim ~/.bashrc

source ~/.bashrc
#手册中形式
setenv PATH "$PATH:$HOME/moltemplate/moltemplate"
setenv PATH "$PATH:$HOME/moltemplate/moltemplate/scripts"
# 本次添加形式
export PATH="/home/xianlei/moltemplate/moltemplate:${PATH}"
export PATH="/home/xianlei/moltemplate/moltemplate/scripts:${PATH}"

4、安装测试

测试命令如下,出现路径这说明安装好了。

which moltemplate.sh

ubuntu中安装CentOS ubuntu中安装moltemplate_python_03


随便运行一个自带的例子进行测试,可以看出建模结束,并且生成了system.data文件,安装成功~

ubuntu中安装CentOS ubuntu中安装moltemplate_ubuntu中安装CentOS_04


ubuntu中安装CentOS ubuntu中安装moltemplate_vim_05


ubuntu中安装CentOS ubuntu中安装moltemplate_ubuntu中安装CentOS_06

5、结语

安装方法是参考Bob老师的视频教程,本人只是进行了总结工作,Bob的视频教程《LAMMPS建模之moltemplate使用讲解》中还通过案例对该软件建模过程进行了介绍,感兴趣可以前去学习。

最后,有问题欢迎大家交流~~~~~~