Skip to content

Instantly share code, notes, and snippets.

@yqshao
Last active May 19, 2017 06:46
Show Gist options
  • Save yqshao/17693785f5c65bd036c8e8872907dc53 to your computer and use it in GitHub Desktop.
Save yqshao/17693785f5c65bd036c8e8872907dc53 to your computer and use it in GitHub Desktop.
在Windows下配置旧版本ase-gui

简介

ase-gui 是 ASE中的模型编辑界面,对VASP的结构文件支持较好,且调整结构文件方便。

但在Winodws下安装ase-gui时遇到以下问题

  • 旧版本ase-gui依赖pygtk,而pygtk只支持python2,尝试从conda和官方版本 http://www.pygtk.org/downloads.html 安装都比较困难。
  • 新版本的ase-gui使用tk作为界面,但界面难看,且旋转的快捷键被取消,windows下缩放存在问题。
  • VASP的结构文件没有后缀,无法关联程序打开。

安装

这里使用了msys来安装ase,因为所需的依赖都能直接从包管理器下载 从 http://www.msys2.org/ 下载安装

MSYS2 使用 archlinux 的 pacman 作为包管理器 安装MSYS后打开MSYS Mingwin 64bit的终端,安装以下包 (或者安装对应32位版本)

pacman -S mingw-w64-x86_64-python2-pip
pacman -S mingw-w64-x86_64-python2-numpy
pacman -S mingw-w64-x86_64-python2-pygtk
pip install 'ase==3.9'

使用3.9版本

加入右键菜单

完成后即可从终端打开ase-gui,ase-gui有一个bat用于运行,

文件在 c:\msys64\mingw64\bin\ase-gui.bat

为了方便打开结构文件,在注册表添加项, 创建一个add_contex.reg文件,内容如下

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\*\Shell\ASE]
@="Open with &ASE"

[HKEY_CLASSES_ROOT\*\Shell\ASE\command]
@="\"C:\\msys64\\mingw64\\bin\\ase-gui.bat\" \"%1\""

双击运行后,所有文件的右键菜单应该都会有open with ASE 这一项

设置winscp直接打开远程文件

计算过程中可能需要查看结构文件,此时把文件拖下来查看太过繁琐,

可以在winscp中加入编辑方式 C:\msys64\mingw64\bin\ase-gui.bat !.!

这样可以直接右键->Edit打开结构文件。 注意此时需要把c:\msys64\mingw64\bin\加入系统变量PATH

去掉终端

现在应该可以直接打开文件夹及服务器上的结构文件了,但打开ase-gui时会有终端出现, 可以修改ase-gui.bat文件来解决。

@echo off
rem Use python to execute the python script having the same name as this batch
rem file, but without any extension, located in the same directory as this
rem batch file
start python2w.exe "%~dpn0" %*
exit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment