Révision a5d76bfb modules/dos_input.py

b/modules/dos_input.py
265 265

  
266 266

  
267 267
def get_pbc_cell():
268
    from ase.atoms import Cell
268 269
    err_msg = "'pbc_cell' must be either 3 vectors of size 3 or False."
269 270
    pbc_cell_str = dos_inp.get('Global', 'pbc_cell', fallback="False")
270 271
    if pbc_cell_str.lower() in turn_false_answers:
......
279 280
            err_msg = "The volume of the defined cell is 0"
280 281
            logger.error(err_msg)
281 282
            raise ValueError(err_msg)
282
        return pbc_cell
283
        return Cell(pbc_cell)
283 284

  
284 285

  
285 286
def get_subm_script():
......
871 872
                            inp_vars['special_atoms'])
872 873
        if inp_vars['code'] == 'vasp' and np.linalg.det(atms.cell) == 0.0 \
873 874
                and inp_vars['pbc_cell'] is False:
874
            err_msg = "When running calculations with 'VASP', the PBC cell" \
875
            err_msg = "When running calculations with 'VASP', the PBC cell " \
875 876
                      "should be provided either implicitely inside " \
876 877
                      "'molec_file' or by setting the 'pbc_cell' option."
877 878
            logger.error(err_msg)
878 879
            raise ValueError(err_msg)
879
        elif np.allclose(inp_vars['pbc_cell'], atms.cell):
880
        elif inp_vars['pbc_cell'] is False and np.linalg.det(atms.cell) != 0.0:
881
            inp_vars['pbc_cell'] = atms.cell
882
            logger.info(f"Obtained pbc_cell from '{inp_vars['molec_file']}' "
883
                        f"file.")
884
        elif (atms.cell != 0).any() and not np.allclose(inp_vars['pbc_cell'],
885
                                                        atms.cell):
880 886
            logger.warning("'molec_file' has an implicit cell defined "
881
                           f"different than 'pbc_cell' ('molec_file'="
882
                           f"{atms.cell}, 'pbc_cell'= {inp_vars['pbc_cell']}). "
883
                           f"'pbc_cell' value will be used.")
887
                           f"different than 'pbc_cell'.\n"
888
                           f"'molec_file' = {atms.cell}.\n"
889
                           f"'pbc_cell' = {inp_vars['pbc_cell']}).\n"
890
                           "'pbc_cell' value will be used.")
884 891

  
885 892
        # Facultative options (Default/Fallback value present)
886 893
        inp_vars['num_conformers'] = get_num_conformers()
......
905 912
        inp_vars['molec_ctrs'] = get_molec_ctrs()
906 913

  
907 914
        # Checks for PBC
915
        # Checks for PBC
908 916
        atms = adapt_format('ase', inp_vars['surf_file'],
909 917
                            inp_vars['special_atoms'])
910 918
        if inp_vars['code'] == 'vasp' and np.linalg.det(atms.cell) == 0.0 \
911 919
                and inp_vars['pbc_cell'] is False:
912
            err_msg = "When running calculations with 'VASP', the PBC cell" \
920
            err_msg = "When running calculations with 'VASP', the PBC cell " \
913 921
                      "should be provided either implicitely inside " \
914
                      "'molec_file' or by setting the 'pbc_cell' option."
922
                      "'surf_file' or by setting the 'pbc_cell' option."
915 923
            logger.error(err_msg)
916 924
            raise ValueError(err_msg)
917
        elif np.allclose(inp_vars['pbc_cell'], atms.cell):
918
            logger.warning("'molec_file' has an implicit cell defined, "
919
                           "different than 'pbc_cell' ('molec_file'="
920
                           f"{atms.cell}, 'pbc_cell'={inp_vars['pbc_cell']}). "
925
        elif inp_vars['pbc_cell'] is False and np.linalg.det(atms.cell) != 0.0:
926
            inp_vars['pbc_cell'] = atms.cell
927
            logger.info(f"Obtained pbc_cell from '{inp_vars['surf_file']}' "
928
                        f"file.")
929
        elif (atms.cell != 0).any() and not np.allclose(inp_vars['pbc_cell'],
930
                                                        atms.cell):
931
            logger.warning("'surf_file' has an implicit cell defined "
932
                           f"different than 'pbc_cell'.\n"
933
                           f"'surf_file' = {atms.cell}.\n"
934
                           f"'pbc_cell' = {inp_vars['pbc_cell']}).\n"
921 935
                           "'pbc_cell' value will be used.")
922 936

  
923 937
        # Facultative options (Default value present)

Formats disponibles : Unified diff