From 598586f94d9e197701475f7f714ad173272fcb29 Mon Sep 17 00:00:00 2001 From: Ask Hjorth Larsen <asklarsen@gmail.com> Date: Thu, 22 Sep 2016 23:19:54 +0200 Subject: [PATCH] handle units correctly for simulation_cell. Also, the UnitsInput parameter can override Units. This is taken into account now --- parser/parser-octopus/aseoct.py | 1 + parser/parser-octopus/parser_octopus.py | 5 ++++- parser/parser-octopus/test | 1 + pysrc | 1 + 4 files changed, 7 insertions(+), 1 deletion(-) create mode 120000 parser/parser-octopus/test create mode 120000 pysrc diff --git a/parser/parser-octopus/aseoct.py b/parser/parser-octopus/aseoct.py index e607d0d..6c7a6f1 100644 --- a/parser/parser-octopus/aseoct.py +++ b/parser/parser-octopus/aseoct.py @@ -250,6 +250,7 @@ def kwargs2atoms(kwargs, directory=None): # XXX the other 'units' keywords: input, output. units = kwargs.pop('units', 'atomic').lower() + units = kwargs.pop('unitsinput', units).lower() if units not in ['ev_angstrom', 'atomic']: raise OctopusKeywordError('Units not supported by ASE-Octopus ' 'interface: %s' % units) diff --git a/parser/parser-octopus/parser_octopus.py b/parser/parser-octopus/parser_octopus.py index de1af71..20fd851 100644 --- a/parser/parser-octopus/parser_octopus.py +++ b/parser/parser-octopus/parser_octopus.py @@ -281,7 +281,10 @@ def parse(fname, fd): # we re-extract the cell at a level where we can distinguish: cell, _unused = kwargs2cell(kwargs) if cell is not None: - pew.addArrayValues('simulation_cell', cell) + # ...and yet we add the ASE cell because that one is + # always measured in angstroms. + pew.addArrayValues('simulation_cell', + convert_unit(atoms.cell, 'angstrom')) # XXX FIXME atoms can be labeled in ways not compatible with ASE. pew.addArrayValues('atom_labels', diff --git a/parser/parser-octopus/test b/parser/parser-octopus/test new file mode 120000 index 0000000..39b7720 --- /dev/null +++ b/parser/parser-octopus/test @@ -0,0 +1 @@ +../../test/examples \ No newline at end of file diff --git a/pysrc b/pysrc new file mode 120000 index 0000000..448babe --- /dev/null +++ b/pysrc @@ -0,0 +1 @@ +parser/parser-octopus \ No newline at end of file -- GitLab