Skip to content

Ion files produced by aiida_siesta incompatible with SIESTA when using CDF.save true #126

@ahkole

Description

@ahkole

I discovered a rather obscure bug. If I try to re-use the basis set from a previous calculation by using the ion files, i.e.

builder.ions = calculation.output.ion_files

SIESTA crashes if you also have turned on the writing of the NetCDF output file (CDF.save true). After doing some digging my hypothesis is that this is caused by the way that aiida_siesta is writing the ion files. As an example, see here a snippet of an ion file produced by SIESTA and the corresponding one created by aiida_siesta:

SIESTA:

</preamble>
Nb                            # Symbol
Nb                            # Label
   41                         # Atomic number
     13.0000000000                             # Valence charge
     92.9100000000        # Mass 
     210.068680882        # Self energy 

aiida_siesta:

</preamble>
 Nb 
 Nb 
                        41 
      13.0000000000 
      92.9100000000 
      210.068680882 

The differences are very subtle and primarily in the spacing. I suspect that the problematic part is the difference in spacing in the writing of the atomic label. In the aiida_siesta ion file there is a leading space which causes the system label variable internally inside SIESTA to also have a leading space (i.e. species_label = ' Nb' inside SIESTA). When trying to create a NetCDF file the code then crashes because this species label is used to create a NetCDF variable but the names of these variables cannot start with leading whitespace. The reason for the space in the species label is probably because there are also spaces around the species label in the ion.xml file (which aiida_siesta uses to parse the ion data if I understand correctly). Two possible ways of fixing this would be:

  1. Inside aiida_siesta make sure to strip() the atomic labels before writing them to the ion file.
  2. Inside SIESTA make sure to also strip leading white space from labels when reading them from an ion file by using adjustl in addition to trim (i.e. trim(adjustl(species_label))).

I don't know which method is better/preferred. What do you think?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions