Skip to content

Instantly share code, notes, and snippets.

@yqshao
Last active January 20, 2024 01:04
Show Gist options
  • Save yqshao/a2aa15e5d291e6a0576bd3864f86665f to your computer and use it in GitHub Desktop.
Save yqshao/a2aa15e5d291e6a0576bd3864f86665f to your computer and use it in GitHub Desktop.
ASE-Gui for windows

Intro

ase-gui is the most handy model editor I've used to setup my VASP calculations.

It supports VASP POSCAR/CONTCAR files perfectly and a variety of other formats. The editting features (moving/rotating) are handy for adjusting surface adsorption structues.

Yet, it's a little tricky to get a nice ase-gui on windows mechaines.

  • Old versions require pyGTK which is hardly available for windows, I remember attempting with miniconda and official build http://www.pygtk.org/downloads.html, but the process is tedious.
  • Newer versions use tk, however the interface is ugly and some functions are not available (Ctrl+R for rotation, and zooming is buggy right now).
  • VASP configuration files don't have extentions, meaning it's hard to associate them using the windows options

Installation

I choosed msys2 as the enviornment since the packages are readily available.

Get the installer from http://www.msys2.org/ MYSY2 uses pacman (from archlinux) as a package manager.

After installation, open up a msys-mingw64 terminal and type this (or corresponding 32bit packages)

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'

I specified the 3.9 version of ase to get a better GUI.

Set up context menu

ase-gui has a bat file in your mingw directory, somewhere like c:\msys64\mingw64\bin\ase-gui.bat to open ase-gui We'll need to add the script to the context (right click) menu to edit structure file without mannually open it in ase-gui. create a add_ase.reg with the content below:

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\""

double click it and you should have a 'Open with ASE entry' in your context menu

Set up remote edit (for winscp)

Often you want to monitor the calculation on the remote machine, to pull down the file and click is troublesome. (for linux it's easy to mount the remote location in a file manager) Luckily you can customize a open option in winscp like this. C:\msys64\mingw64\bin\ase-gui.bat !.! Notice you might have to put C:\msys64\mingw64\bin\ into system PATH to make this work.

Get rid of the console

Now you should have a handy ase-gui for both remote and local files. There's still a little flaw -- the useless console window Edit the ase-gui.bat to this will fix it.

@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
@mahabul123
Copy link

last command did not work!!! its bash: pip: command not found
I follwed all steps!!! any clue?
Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment