From ecd00fbfdadecab82b57739d9d2eb1a99056124c Mon Sep 17 00:00:00 2001 From: yw-fang Date: Thu, 1 Feb 2018 18:27:32 +0900 Subject: [PATCH] support the visualization of the structure with VESTA --- aiida/cmdline/commands/data.py | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/aiida/cmdline/commands/data.py b/aiida/cmdline/commands/data.py index 24043183b3..50f96fbe9c 100644 --- a/aiida/cmdline/commands/data.py +++ b/aiida/cmdline/commands/data.py @@ -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