Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed to run Command line interface tutorial. #319

Closed
hongyi-zhao opened this issue Jul 30, 2024 · 9 comments · Fixed by #320 or #321
Closed

Failed to run Command line interface tutorial. #319

hongyi-zhao opened this issue Jul 30, 2024 · 9 comments · Fixed by #320 or #321

Comments

@hongyi-zhao
Copy link
Contributor

I try to run the Command line interface tutorial step-by-step according to the document. But failed at the following steps:

(datasci) werner@x13dai-t:~/Public/repo/github.com/JaGeo/Create_inputs_example/Basis_0$ lobsterpy description --json description.json
usage: lobsterpy [-h]
                 {create-inputs,createinputs,description,description-quality,plot-automatic,plot-auto,automatic-plot,automaticplot,auto-plot,autoplot,plot-automatic-ia,plot-auto-ia,automatic-plot-ia,automaticplotia,autoplotia,auto-plot-ia,plot-dos,plotdos,plot-icohp-distance,ploticohpdistance,plot}
                 ...
lobsterpy: error: unrecognized arguments: --json description.json

(datasci) werner@x13dai-t:~/Public/repo/github.com/JaGeo/Create_inputs_example/Basis_0$ lobsterpy calc-description --potcar-symbols "Na_pv Cl" --bvacomp --doscomp --calcqualityjson calc_quality_description.json
usage: lobsterpy [-h]
                 {create-inputs,createinputs,description,description-quality,plot-automatic,plot-auto,automatic-plot,automaticplot,auto-plot,autoplot,plot-automatic-ia,plot-auto-ia,automatic-plot-ia,automaticplotia,autoplotia,auto-plot-ia,plot-dos,plotdos,plot-icohp-distance,ploticohpdistance,plot}
                 ...
lobsterpy: error: argument action: invalid choice: 'calc-description' (choose from 'create-inputs', 'createinputs', 'description', 'description-quality', 'plot-automatic', 'plot-auto', 'automatic-plot', 'automaticplot', 'auto-plot', 'autoplot', 'plot-automatic-ia', 'plot-auto-ia', 'automatic-plot-ia', 'automaticplotia', 'autoplotia', 'auto-plot-ia', 'plot-dos', 'plotdos', 'plot-icohp-distance', 'ploticohpdistance', 'plot')
(datasci) werner@x13dai-t:~/Public/repo/github.com/JaGeo/Create_inputs_example/Basis_0$ lobsterpy automatic-plot --title 'Automatic COHP plot' --save-plot COHP.png
/home/werner/.pyenv/versions/datasci/lib/python3.11/site-packages/spglib/spglib.py:115: DeprecationWarning: dict interface (SpglibDataset['equivalent_atoms']) is deprecated.Use attribute interface ({self.__class__.__name__}.{key}) instead
  warnings.warn(
/home/werner/.pyenv/versions/datasci/lib/python3.11/site-packages/spglib/spglib.py:115: DeprecationWarning: dict interface (SpglibDataset['international']) is deprecated.Use attribute interface ({self.__class__.__name__}.{key}) instead
  warnings.warn(
/home/werner/Public/repo/github.com/materialsproject/pymatgen.git/src/pymatgen/io/lobster/outputs.py:391: UserWarning: Please consider using the new Lobster version. See www.cohp.de.
  warnings.warn("Please consider using the new Lobster version. See www.cohp.de.")
Traceback (most recent call last):
  File "/home/werner/.pyenv/versions/datasci/bin/lobsterpy", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/home/werner/Public/repo/github.com/JaGeo/LobsterPy.git/src/lobsterpy/cli.py", line 33, in main
    run(args)
  File "/home/werner/Public/repo/github.com/JaGeo/LobsterPy.git/src/lobsterpy/cli.py", line 782, in run
    analyse = Analysis(
              ^^^^^^^^^
  File "/home/werner/Public/repo/github.com/JaGeo/LobsterPy.git/src/lobsterpy/cohp/analyze.py", line 163, in __init__
    self.setup_env()
  File "/home/werner/Public/repo/github.com/JaGeo/LobsterPy.git/src/lobsterpy/cohp/analyze.py", line 229, in setup_env
    raise err
  File "/home/werner/Public/repo/github.com/JaGeo/LobsterPy.git/src/lobsterpy/cohp/analyze.py", line 205, in setup_env
    self.chemenv = LobsterNeighbors(
                   ^^^^^^^^^^^^^^^^^
  File "/home/werner/Public/repo/github.com/materialsproject/pymatgen.git/src/pymatgen/io/lobster/lobsterenv.py", line 121, in __init__
    self.ICOHP = Icohplist(are_coops=are_coops, are_cobis=are_cobis, filename=filename_icohp)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/werner/Public/repo/github.com/materialsproject/pymatgen.git/src/pymatgen/io/lobster/outputs.py", line 442, in __init__
    length = float(line[3])
             ^^^^^^^^^^^^^^
ValueError: could not convert string to float: 'for'

Do you have any tips and hints for fixing these problems?

Regards,
Zhao

@naik-aakash
Copy link
Collaborator

naik-aakash commented Jul 31, 2024

Hi @hongyi-zhao , Thanks for raising this issue.

I have fixed the tutorial snippet now in the docs. Somehow I overlooked to update the commands in the CLI tutorials. Sorry for the inconvenience. The correct command to get description is lobsterpy description --file-json description.json

Command to get calculation quality description would be lobsterpy description-quality --potcar-symbols "Na_pv Cl" --bvacomp --doscomp --file-calc-quality-json calc_quality_description.json

There are shorthand notations for acceptable arguments as well, which should be accessible from --help for each of this commands

lobsterpy description --help

lobsterpy description-quality --help

And regarding the failing lobsterpy automatic-plot --title 'Automatic ICOHP plot' --integrated --save-plot ICOHP.png command, can you try running this command in a directory which has lobster calculation files for example https://github.com/JaGeo/LobsterPy/tree/main/examples/NaCl_comp_range

It worked fine for me in here.

@hongyi-zhao
Copy link
Contributor Author

Still failed, as shown below:

(datasci) werner@x13dai-t:~/Public/repo/github.com/JaGeo/Create_inputs_example/Basis_0$ lobsterpy description --file-json description.json
/home/werner/.pyenv/versions/datasci/lib/python3.11/site-packages/spglib/spglib.py:115: DeprecationWarning: dict interface (SpglibDataset['equivalent_atoms']) is deprecated.Use attribute interface ({self.__class__.__name__}.{key}) instead
  warnings.warn(
/home/werner/.pyenv/versions/datasci/lib/python3.11/site-packages/spglib/spglib.py:115: DeprecationWarning: dict interface (SpglibDataset['international']) is deprecated.Use attribute interface ({self.__class__.__name__}.{key}) instead
  warnings.warn(
/home/werner/Public/repo/github.com/materialsproject/pymatgen.git/src/pymatgen/io/lobster/outputs.py:391: UserWarning: Please consider using the new Lobster version. See www.cohp.de.
  warnings.warn("Please consider using the new Lobster version. See www.cohp.de.")
Traceback (most recent call last):
  File "/home/werner/.pyenv/versions/datasci/bin/lobsterpy", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/home/werner/Public/repo/github.com/JaGeo/LobsterPy.git/src/lobsterpy/cli.py", line 33, in main
    run(args)
  File "/home/werner/Public/repo/github.com/JaGeo/LobsterPy.git/src/lobsterpy/cli.py", line 782, in run
    analyse = Analysis(
              ^^^^^^^^^
  File "/home/werner/Public/repo/github.com/JaGeo/LobsterPy.git/src/lobsterpy/cohp/analyze.py", line 163, in __init__
    self.setup_env()
  File "/home/werner/Public/repo/github.com/JaGeo/LobsterPy.git/src/lobsterpy/cohp/analyze.py", line 229, in setup_env
    raise err
  File "/home/werner/Public/repo/github.com/JaGeo/LobsterPy.git/src/lobsterpy/cohp/analyze.py", line 205, in setup_env
    self.chemenv = LobsterNeighbors(
                   ^^^^^^^^^^^^^^^^^
  File "/home/werner/Public/repo/github.com/materialsproject/pymatgen.git/src/pymatgen/io/lobster/lobsterenv.py", line 121, in __init__
    self.ICOHP = Icohplist(are_coops=are_coops, are_cobis=are_cobis, filename=filename_icohp)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/werner/Public/repo/github.com/materialsproject/pymatgen.git/src/pymatgen/io/lobster/outputs.py", line 442, in __init__
    length = float(line[3])
             ^^^^^^^^^^^^^^
ValueError: could not convert string to float: 'for'
(datasci) werner@x13dai-t:~/Public/repo/github.com/JaGeo/Create_inputs_example/Basis_0$ lobsterpy description-quality --potcar-symbols "Na_pv Cl" --bvacomp --doscomp --file-calc-quality-json calc_quality_description.json
Traceback (most recent call last):
  File "/home/werner/.pyenv/versions/datasci/bin/lobsterpy", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/home/werner/Public/repo/github.com/JaGeo/LobsterPy.git/src/lobsterpy/cli.py", line 33, in main
    run(args)
  File "/home/werner/Public/repo/github.com/JaGeo/LobsterPy.git/src/lobsterpy/cli.py", line 1077, in run
    dos_files = get_file_paths(
                ^^^^^^^^^^^^^^^
  File "/home/werner/Public/repo/github.com/JaGeo/LobsterPy.git/src/lobsterpy/featurize/utils.py", line 70, in get_file_paths
    raise Exception(f"Files {missing_files} not found in {lobster_path.name}.")
Exception: Files ['DOSCAR.LSO.lobster'] not found in Basis_0.
(datasci) werner@x13dai-t:~/Public/repo/github.com/JaGeo/Create_inputs_example/Basis_0$ pip list|grep lobs
lobsterpy                     0.4.6                   /home/werner/Public/repo/github.com/JaGeo/LobsterPy.git

@naik-aakash naik-aakash reopened this Jul 31, 2024
@naik-aakash
Copy link
Collaborator

Ops I see, just pushing a fix in few minutes.

@naik-aakash
Copy link
Collaborator

naik-aakash commented Jul 31, 2024

Hi @hongyi-zhao , the issue with exception should also be fixed via PR #321 . I am not able to reproduce the error you encounter for "lobsterpy description --file-json description.json", even with latest pymatgen version.

Can you try to run the same command on any of the example lobster calculation files provided on the repo?

@naik-aakash
Copy link
Collaborator

Hi @hongyi-zhao , I suspect you are now using LOBSTER 5.1 ? In this case, pymatgen needs to be updated to deal with ICOHP/ ICOBI / ICOOP files as I see in the changelog of 5.1.0, these file outputs have been updated.

image

I would suggest try using LOBSTER 5.0 or lower. As adding support to 5.1 might take time if output file format is changed, parsers need to be updated and I do not know, how much of a change it is at this point. Will try to have a look at them soon.

Also, currently not all features of LOBSTER 5.0 is supported via pymatgen/lobsterpy. See #170, this is on our todo. We will then add 5.1.0 support when working on it.

@JaGeo
Copy link
Owner

JaGeo commented Jul 31, 2024

@hongyi-zhao If you need it now, you are surely also invited to fix the input/output methods in pymatgen. We will try to get it done after the summer, likely.

@hongyi-zhao
Copy link
Contributor Author

hongyi-zhao commented Jul 31, 2024

Hi @hongyi-zhao , I suspect you are now using LOBSTER 5.1 ?

Yes.

werner@x13dai-t:~$ lobster
LOBSTER v5.1.0 (g++ 9.3.0)
Copyright (C) 2024 by Chair of Solid-State and Quantum Chemistry, RWTH Aachen.
All rights reserved. Contributions by S. Maintz, V. L. Deringer, M. Esser, R. Nelson, C. Ertural, P. C. Mueller, M. Pauls, L. Sann, D. Schnieders, A. L. Tchougreeff, and R. Dronskowski
starting on host x13dai-t on 2024-07-31 at 15:12:19 CST using 96 threads
detecting used PAW program...
ERROR: could not determine which program was used for the quantum-chemical calculation.
ERROR: Make sure all required files are in the working directory and are not empty.

Also, currently not all features of LOBSTER 5.0 is supported via pymatgen/lobsterpy. See #170, this is on our todo. We will then add 5.1.0 support when working on it.

I wonder if there is a more elegant way to implement the interface to minimize the heavy workload caused by changes in the original program version.

@hongyi-zhao
Copy link
Contributor Author

hongyi-zhao commented Jul 31, 2024

So far, I've successfully run most of the commands shown in the tutorial. However, there are still some issues as follows:

  1. I followed the steps in the tutorial exactly, but I noticed that the results of the following two commands are not the same as shown in the tutorial:
(datasci) werner@x13dai-t:~/Public/repo/github.com/JaGeo/Create_inputs_example/Basis_0$ lobsterpy description --file-json description.json
/home/werner/.pyenv/versions/3.11.1/envs/datasci/lib/python3.11/site-packages/spglib/spglib.py:115: DeprecationWarning: dict interface (SpglibDataset['equivalent_atoms']) is deprecated.Use attribute interface ({self.__class__.__name__}.{key}) instead
  warnings.warn(
/home/werner/.pyenv/versions/3.11.1/envs/datasci/lib/python3.11/site-packages/spglib/spglib.py:115: DeprecationWarning: dict interface (SpglibDataset['international']) is deprecated.Use attribute interface ({self.__class__.__name__}.{key}) instead
  warnings.warn(
/home/werner/Public/repo/github.com/JaGeo/LobsterPy.git/src/lobsterpy/cohp/analyze.py:870: UserWarning: The bonding, antibonding integral/percent values are numerical estimate. These values are sensitive to COHPstartEnergy parameter. If COHPstartEnergy value does not cover entire range of VASP calculations then absolute value of ICOHP_sum might not be equivalent to (bonding- antibonding) integral values.
  ) = self._integrate_antbdstates_below_efermi(cohp, start=self.start)
The compound CdF2 has 1 symmetry-independent cation(s) with relevant cation-anion interactions: Cd1.
Cd1 has a cubic (CN=8) coordination environment. It has 8 Cd-F (mean ICOHP: -0.62 eV, 27.743 percent antibonding interaction below EFermi) bonds.

(datasci) werner@x13dai-t:~/Public/repo/github.com/JaGeo/Create_inputs_example/Basis_0$ jq < description.json 
{
  "formula": "CdF2",
  "max_considered_bond_length": 5.98538,
  "limit_icohp": [
    -1.7976931348623157e+308,
    -0.062174
  ],
  "number_of_considered_ions": 1,
  "sites": {
    "0": {
      "env": "C:8",
      "bonds": {
        "F": {
          "ICOHP_mean": "-0.62",
          "ICOHP_sum": "-4.97",
          "has_antibdg_states_below_Efermi": true,
          "number_of_bonds": 8,
          "bonding": {
            "integral": 8.1,
            "perc": 0.72257
          },
          "antibonding": {
            "integral": 3.11,
            "perc": 0.27743
          }
        }
      },
      "ion": "Cd",
      "charge": 1.57,
      "relevant_bonds": [
        "29",
        "30",
        "33",
        "40",
        "53",
        "60",
        "63",
        "64"
      ]
    }
  },
  "type_charges": "Mulliken"
}

(datasci) werner@x13dai-t:~/Public/repo/github.com/JaGeo/Create_inputs_example/Basis_0$ lobsterpy description-quality --potcar-symbols "Na_pv Cl" --bvacomp --doscomp --file-calc-quality-json calc_quality_description.json
/home/werner/Public/repo/github.com/materialsproject/pymatgen.git/src/pymatgen/io/vasp/outputs.py:160: UserWarning: Float overflow (*******) encountered in vasprun
  warnings.warn("Float overflow (*******) encountered in vasprun")
/home/werner/Public/repo/github.com/JaGeo/LobsterPy.git/src/lobsterpy/cli.py:1085: UserWarning: Consider using DOSCAR.LSO.lobster, as non LSO DOS from LOBSTER can have negative DOS values
  quality_dict = Analysis.get_lobster_calc_quality_summary(
/home/werner/Public/repo/github.com/JaGeo/LobsterPy.git/src/lobsterpy/cli.py:1085: UserWarning: Input DOS files have very few points in the energy interval and thus comparisons will not be reliable. Please rerun the calculations with higher number of DOS points. Set NEDOS and COHPSteps tags to >= 2000 in VASP and LOBSTER calculations, respectively.
  quality_dict = Analysis.get_lobster_calc_quality_summary(
The LOBSTER calculation used minimal basis. The absolute and total charge spilling for the calculation is 0.65 and 0.0 %, respectively. The projected wave function is completely orthonormalized as no bandOverlaps.lobster file is generated during the LOBSTER run. The atomic charge signs from Mulliken population analysis agree with the bond valence analysis. The atomic charge signs from Loewdin population analysis agree with the bond valence analysis. The Tanimoto index from DOS comparisons in the energy range between -5, 0 eV for s, d, p, summed orbitals are: 0.7137, 0.6449, 0.3208, 0.4766.

(datasci) werner@x13dai-t:~/Public/repo/github.com/JaGeo/Create_inputs_example/Basis_0$ jq < calc_quality_description.json
{
  "minimal_basis": true,
  "charge_spilling": {
    "abs_charge_spilling": 0.65,
    "abs_total_spilling": 0
  },
  "band_overlaps_analysis": {
    "file_exists": false,
    "limit_maxDeviation": null,
    "has_good_quality_maxDeviation": true,
    "max_deviation": null,
    "percent_kpoints_abv_limit": null
  },
  "charge_comparisons": {
    "bva_mulliken_agree": true,
    "bva_loewdin_agree": true
  },
  "dos_comparisons": {
    "tanimoto_orb_s": 0.7137,
    "tanimoto_orb_d": 0.6449,
    "tanimoto_orb_p": 0.3208,
    "tanimoto_summed": 0.4766,
    "e_range": [
      -5,
      0
    ],
    "n_bins": 56
  }
}
  1. The following command still fails:
(datasci) werner@x13dai-t:~/Public/repo/github.com/JaGeo/Create_inputs_example/Basis_0$ lobsterpy plot-dos --summedspins
Traceback (most recent call last):
  File "/home/werner/.pyenv/versions/datasci/bin/lobsterpy", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/home/werner/Public/repo/github.com/JaGeo/LobsterPy.git/src/lobsterpy/cli.py", line 33, in main
    run(args)
  File "/home/werner/Public/repo/github.com/JaGeo/LobsterPy.git/src/lobsterpy/cli.py", line 1114, in run
    req_files = get_file_paths(path_to_lobster_calc=Path(os.getcwd()), requested_files=["structure", "doscar"])
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/werner/Public/repo/github.com/JaGeo/LobsterPy.git/src/lobsterpy/featurize/utils.py", line 70, in get_file_paths
    raise Exception(f"Files {missing_files} not found in {lobster_path.name}.")
Exception: Files ['DOSCAR.LSO.lobster'] not found in Basis_0.

The lobster version to do the above test is shown below:

$ module list 

Currently Loaded Modules:
  1) lmod   2) lobster/5.0.0

@JaGeo
Copy link
Owner

JaGeo commented Jul 31, 2024

@hongyi-zhao thank you for reporting this to us. I hope we can check it out soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants