Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,11 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
uses: github/codeql-action/init@v4
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
Expand All @@ -62,7 +62,7 @@ jobs:
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v2
uses: github/codeql-action/autobuild@v4

# ℹ️ Command-line programs to run using the OS shell.
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
Expand All @@ -75,4 +75,4 @@ jobs:
# ./location_of_script_within_repo/buildscript.sh

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
uses: github/codeql-action/analyze@v4
13,117 changes: 13,005 additions & 112 deletions docs/tutorial/tutorial.ipynb

Large diffs are not rendered by default.

17 changes: 10 additions & 7 deletions examples/example_script_NaCl.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
import os
import warnings

from lobsterpy.cohp.analyze import Analysis
from lobsterpy.cohp.describe import Description
from lobsterpy.coxx.analyze import Analysis
from lobsterpy.coxx.describe import Description

warnings.simplefilter("once")

directory = "NaCl"

# Setup analysis dict
analyse = Analysis(
path_to_poscar=os.path.join(directory, "CONTCAR"),
path_to_icohplist=os.path.join(directory, "ICOHPLIST.lobster"),
path_to_cohpcar=os.path.join(directory, "COHPCAR.lobster"),
path_to_charge=os.path.join(directory, "CHARGE.lobster"),
analyse = Analysis.from_files(
structure_path=os.path.join(directory, "CONTCAR"),
icoxxlist_path=os.path.join(directory, "ICOHPLIST.lobster"),
coxxcar_path=os.path.join(directory, "COHPCAR.lobster"),
charge_path=os.path.join(directory, "CHARGE.lobster"),
which_bonds="cation-anion",
)
print(analyse.type_charge)
Expand Down
3 changes: 3 additions & 0 deletions examples/example_script_NaCl_Structure_graph.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import warnings
from lobsterpy.structuregraph.graph import LobsterGraph

warnings.simplefilter("once")

graph_NaCl_all = LobsterGraph(
path_to_poscar="./NaCl_comp_range/CONTCAR.gz",
path_to_charge="./NaCl_comp_range/CHARGE.lobster.gz",
Expand Down
16 changes: 9 additions & 7 deletions examples/example_script_NaCl_all.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
import os
import warnings
from lobsterpy.coxx.analyze import Analysis
from lobsterpy.coxx.describe import Description

from lobsterpy.cohp.analyze import Analysis
from lobsterpy.cohp.describe import Description
warnings.simplefilter("once")

directory = "NaCl"

# Setup analysis dict
analyse = Analysis(
path_to_poscar=os.path.join(directory, "CONTCAR"),
path_to_icohplist=os.path.join(directory, "ICOHPLIST.lobster"),
path_to_cohpcar=os.path.join(directory, "COHPCAR.lobster"),
path_to_charge=os.path.join(directory, "CHARGE.lobster"),
analyse = Analysis.from_files(
structure_path=os.path.join(directory, "CONTCAR"),
icoxxlist_path=os.path.join(directory, "ICOHPLIST.lobster"),
coxxcar_path=os.path.join(directory, "COHPCAR.lobster"),
charge_path=os.path.join(directory, "CHARGE.lobster"),
which_bonds="all",
)

Expand Down
17 changes: 10 additions & 7 deletions examples/example_script_NaCl_orbitalwise.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
import os
import warnings

from lobsterpy.cohp.analyze import Analysis
from lobsterpy.cohp.describe import Description
from lobsterpy.coxx.analyze import Analysis
from lobsterpy.coxx.describe import Description

warnings.simplefilter("once")

directory = "NaCl"

# Setup analysis dict
analyse = Analysis(
path_to_poscar=os.path.join(directory, "CONTCAR"),
path_to_icohplist=os.path.join(directory, "ICOHPLIST.lobster"),
path_to_cohpcar=os.path.join(directory, "COHPCAR.lobster"),
path_to_charge=os.path.join(directory, "CHARGE.lobster"),
analyse = Analysis.from_files(
structure_path=os.path.join(directory, "CONTCAR"),
icoxxlist_path=os.path.join(directory, "ICOHPLIST.lobster"),
coxxcar_path=os.path.join(directory, "COHPCAR.lobster"),
charge_path=os.path.join(directory, "CHARGE.lobster"),
which_bonds="all",
orbital_resolved=True,
orbital_cutoff=0.05,
Expand Down
77 changes: 15 additions & 62 deletions src/lobsterpy/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
PlainDosPlotter,
get_style_list,
)
from lobsterpy.quality import LobsterCalcQuality
from lobsterpy.utils import get_file_paths


Expand Down Expand Up @@ -381,8 +382,8 @@ def get_parser() -> argparse.ArgumentParser:
action="store_true",
help="Show integrated cohp/cobi/coop plots.",
)
# Arguments specific to lobsterpy.cohp.analyze.Analysis and
# lobsterpy.cohp.describe.Description class
# Arguments specific to lobsterpy.coxx.analyze.Analysis and
# lobsterpy.coxx.describe.Description class
auto_parent = argparse.ArgumentParser(add_help=False)
auto_group = auto_parent.add_argument_group("Adjustable automatic analysis parameters")
auto_group.add_argument(
Expand Down Expand Up @@ -941,11 +942,11 @@ def run(args):
if args.action in ["description", "plot-automatic", "plot-automatic-ia"]:
which_bonds = "all" if args.allbonds else "cation-anion"

analyse = Analysis(
path_to_poscar=args.structure,
path_to_charge=args.charge,
path_to_cohpcar=args.cohpcar,
path_to_icohplist=args.icohplist,
analyse = Analysis.from_files(
structure_path=args.structure,
charge_path=args.charge,
coxxcar_path=args.cohpcar,
icoxxlist_path=args.icohplist,
which_bonds=which_bonds,
are_coops=args.coops,
are_cobis=args.cobis,
Expand Down Expand Up @@ -1301,67 +1302,19 @@ def run(args):
raise ValueError('please use "--overwrite" if you would like to overwrite existing lobster inputs')

if args.action in ["description-quality"]:
# Check for .gz files exist for default values and update accordingly
req_files = get_file_paths(
path_to_lobster_calc=Path.cwd(), requested_files=["structure", "lobsterin", "lobsterout"]
calc_quality = LobsterCalcQuality.from_directory(
path_to_lobster_calc=Path.cwd(),
)
for arg_name in req_files:
setattr(args, arg_name, req_files[arg_name])

optional_files = {
"bandoverlaps": "bandOverlaps.lobster",
"potcar": "POTCAR",
"vasprun": "vasprun.xml",
}

for arg_name in optional_files:
file_path = getattr(args, arg_name)
if not file_path.exists():
gz_file_path = file_path.with_name(zpath(file_path.name))
if gz_file_path.exists():
setattr(args, arg_name, gz_file_path)

bva_comp = args.bvacomp

if bva_comp:
bva_files = get_file_paths(path_to_lobster_calc=Path.cwd(), requested_files=["charge"])
for arg_name in bva_files:
setattr(args, arg_name, bva_files[arg_name])

dos_comparison = args.doscomp

if dos_comparison:
if "DOSCAR.LSO.lobster" in args.doscar.name:
dos_files = get_file_paths(
path_to_lobster_calc=Path.cwd(), requested_files=["vasprun", "doscar"], use_lso_dos=True
)
else:
dos_files = get_file_paths(
path_to_lobster_calc=Path.cwd(), requested_files=["vasprun", "doscar"], use_lso_dos=False
)
for arg_name in dos_files:
setattr(args, arg_name, dos_files[arg_name])

potcar_file_path = args.potcar

quality_dict = Analysis.get_lobster_calc_quality_summary(
path_to_poscar=args.structure,
path_to_charge=args.charge,
path_to_lobsterout=args.lobsterout,
path_to_lobsterin=args.lobsterin,
path_to_potcar=None if not potcar_file_path.exists() else potcar_file_path,
potcar_symbols=args.potcarsymbols,
path_to_bandoverlaps=args.bandoverlaps,
dos_comparison=dos_comparison,
bva_comp=bva_comp,
path_to_doscar=args.doscar,
quality_dict = calc_quality.get_calculation_quality_summary(
dos_comparison=args.doscomp,
bva_comp=args.bvacomp,
e_range=args.erange,
n_bins=args.nbins,
path_to_vasprun=args.vasprun,
)

quality_text = Description.get_calc_quality_description(quality_dict)
Description.write_calc_quality_description(quality_text)
quality_text = calc_quality.describe(quality_dict)
calc_quality.print_description(quality_text)

if args.file_calc_quality_json is not None:
with open(args.file_calc_quality_json, "w") as fd:
Expand Down
4 changes: 0 additions & 4 deletions src/lobsterpy/cohp/__init__.py

This file was deleted.

10 changes: 0 additions & 10 deletions src/lobsterpy/cohp/analyze.py

This file was deleted.

13 changes: 0 additions & 13 deletions src/lobsterpy/cohp/describe.py

This file was deleted.

Loading
Loading