Skip to content

Commit

Permalink
support the visualization of the structure with VESTA
Browse files Browse the repository at this point in the history
  • Loading branch information
yw-fang committed Feb 1, 2018
1 parent ecdee80 commit ecd00fb
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions aiida/cmdline/commands/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -1247,6 +1247,34 @@ def _show_ase(self,exec_name,structure_list):
except ImportError:
raise

def _show_vesta(self, exec_name, structure_list):
"""
Plugin for VESTA
This VESTA plugin was added by Yue-Wen FANG and Abel Carreras
at Kyoto University in the group of Prof. Isao Tanaka's lab
"""
import tempfile, subprocess

with tempfile.NamedTemporaryFile(suffix='.cif') as f:
for structure in structure_list:
f.write(structure._exportstring('cif')[0])
f.flush()

try:
subprocess.check_output([exec_name, f.name])
except subprocess.CalledProcessError:
# The program died: just print a message
print "Note: the call to {} ended with an error.".format(
exec_name)
except OSError as e:
if e.errno == 2:
print ("No executable '{}' found. Add to the path, "
"or try with an absolute path.".format(exec_name))
sys.exit(1)
else:
raise

def _show_vmd(self, exec_name, structure_list):
"""
Plugin for vmd
Expand Down

0 comments on commit ecd00fb

Please sign in to comment.