giovannipizzi / seekpath

A module to obtain and visualize k-vector coefficients and obtain band paths in the Brillouin zone of crystal structures
Other
114 stars 45 forks source link

Fix the CASTEP importer #24

Closed giovannipizzi closed 4 years ago

giovannipizzi commented 7 years ago

The ASE importer used now fails with most input files. See e.g. Si2-bs.cell.txt that returns

    Generating castep_keywords.py ... hang on.
    The castep_keywords.py contains abstractions for CASTEP input
    parameters (for both .cell and .param input files), including some
    format checks and descriptions. The latter are extracted from the
    internal online help facility of a CASTEP binary, thus allowing to
    easily keep the calculator synchronized with (different versions of)
    the CASTEP code. Consequently, avoiding licensing issues (CASTEP is
    distributed commercially by accelrys), we consider it wise not to
    provide castep_keywords.py in the first place.

read_cell: Warning - Was not able to initialize CASTEP calculator.
           This may be due to a non-existing "castep.keywords.py"
           file or a non-existing CASTEP installation.
           Original error message appears below:

           Could not determine the version of your CASTEP binary 
           This usually means one of the following 
              * you do not have CASTEP installed 
              * you have not set the CASTEP_COMMAND to call it 
              * you have provided a wrong CASTEP_COMMAND. 
                Make sure it is in your PATH

           Fallback-mode will be applied to provide at least the
           geometric information contained in the *.cell file.
Warning: the keyword BS_KPOINT_LIST is not
         interpreted in cell files
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-5-4323c05a7564> in <module>()
----> 1 get_structure_tuple(open('/home/pizzi/Desktop/Si2-bs.cell'), 'castep')

/home/pizzi/git/seekpath/webservice/structure_importers/__init__.pyc in get_structure_tuple(fileobject, fileformat)
     55     elif fileformat == 'castep':
     56         import ase.io.castep
---> 57         asestructure = ase.io.castep.read_castep_cell(fileobject)
     58         return tuple_from_ase(asestructure)
     59     elif fileformat == 'qe-inp':

/home/pizzi/.local/lib/python2.7/site-packages/ase/io/castep.pyc in read_castep_cell(fd, index)
    599                     else:
    600                         block_lines.append(lines[l-1].strip())
--> 601                 calc.__setattr__(block_name, block_lines)
    602                 # raise UserWarning
    603         else:

AttributeError: 'NoneType' object has no attribute 'BS_KPOINT_LIST'

Action: reimplement a simple parser just for the cell and the atomic positions.

giovannipizzi commented 4 years ago

Moving to tools-barebone repository, and closing here