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

Add new functions/methods to featurize module #330

Draft
wants to merge 96 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 77 commits
Commits
Show all changes
96 commits
Select commit Hold shift + click to select a range
328f315
add new utils functions to featurize module
naik-aakash Sep 10, 2024
51a7bdd
attempt to fix coverage files missing in CI
naik-aakash Sep 10, 2024
2804eb8
revert workflow changes
naik-aakash Sep 10, 2024
2085d3e
update artifacts version in CI
naik-aakash Sep 10, 2024
67d6d97
Merge branch 'JaGeo:main' into update_featurizers
naik-aakash Sep 11, 2024
6a3f177
add method to get unique atom pair ICOHPs (option to scale by reduced…
naik-aakash Sep 11, 2024
b29aa97
add batch unique bonds df method
naik-aakash Sep 11, 2024
6b7a15e
Merge branch 'JaGeo:main' into update_featurizers
naik-aakash Sep 11, 2024
a8f9399
Merge branch 'JaGeo:main' into update_featurizers
naik-aakash Sep 16, 2024
272ad66
include unique atom pair bond stats
naik-aakash Sep 16, 2024
3823d08
include unique atom pair bond stats
naik-aakash Sep 16, 2024
d15200a
scaled with / instead of *
naik-aakash Sep 16, 2024
fd2d9ba
update ref test durations file
naik-aakash Sep 16, 2024
030af3c
add rm_weighted_icohps args to batch featu
naik-aakash Sep 16, 2024
e834c2e
add tests for core, utils and batch
naik-aakash Sep 16, 2024
1d5aefd
Merge branch 'JaGeo:main' into update_featurizers
naik-aakash Oct 1, 2024
832d7f2
Merge branch 'main' into update_featurizers
naik-aakash Oct 18, 2024
be85afa
pre-commit auto-fixes
pre-commit-ci[bot] Oct 18, 2024
c0e0feb
Merge branch 'JaGeo:main' into update_featurizers
naik-aakash Oct 26, 2024
fcdc986
update pytest durations file
naik-aakash Oct 26, 2024
8640bda
remove unique bonds featurizers > redundant
naik-aakash Oct 26, 2024
c9441d0
remove redundant tests
naik-aakash Oct 26, 2024
e8cb3d7
update test durations for new tests
naik-aakash Oct 26, 2024
3f6a718
add BWDF computation featurizer
naik-aakash Oct 26, 2024
d6fdc9b
add tests for BWDF featurizer
naik-aakash Oct 26, 2024
ff6be02
reduce test splits
naik-aakash Oct 26, 2024
60b3a93
add option to get site based bwdf
naik-aakash Oct 28, 2024
a116be5
Merge branch 'JaGeo:main' into update_featurizers
naik-aakash Oct 29, 2024
2149508
fix BWDF implementation
naik-aakash Oct 30, 2024
aac8567
fix test
naik-aakash Oct 30, 2024
c79a750
add option to get bwdf for specific label and none normalization
naik-aakash Oct 30, 2024
82204dd
add test for label bwdf
naik-aakash Oct 30, 2024
388c15d
Merge branch 'JaGeo:main' into update_featurizers
naik-aakash Nov 5, 2024
0ff13ff
Merge branch 'JaGeo:main' into update_featurizers
naik-aakash Nov 18, 2024
d5ccf32
add option to normalize with EIN
naik-aakash Nov 21, 2024
619cf2c
minor refactor to reduce code repetition and remove commented lines
naik-aakash Nov 24, 2024
23758cc
tweak test to refactored outputs
naik-aakash Nov 24, 2024
0efa7d0
Merge branch 'JaGeo:main' into update_featurizers
naik-aakash Nov 24, 2024
085393e
add bwdf dist stats
naik-aakash Nov 25, 2024
2a6e5f9
update test to accomate noise exclusion
naik-aakash Nov 25, 2024
53f2b54
add counts norm
naik-aakash Nov 26, 2024
fa21a80
adapt test
naik-aakash Nov 26, 2024
758bb33
fix EIN normalization
naik-aakash Nov 27, 2024
008c584
handle zerodevision errors on EIN norm
naik-aakash Dec 2, 2024
e09ddd3
include tests in lint
naik-aakash Dec 2, 2024
a5b10ad
update bwdf tests
naik-aakash Dec 2, 2024
7761328
add missing doc-strings
naik-aakash Dec 2, 2024
35749d2
pre-commit auto-fixes
pre-commit-ci[bot] Dec 2, 2024
e5976b1
exclude test data from pre-commit
naik-aakash Dec 2, 2024
0a67fd0
add tests
naik-aakash Dec 2, 2024
cf5fb8e
rename method for getting bwdf stats
naik-aakash Dec 2, 2024
b259744
add icoxx feat exception test
naik-aakash Dec 2, 2024
8926ddf
Merge branch 'JaGeo:main' into update_featurizers
naik-aakash Dec 3, 2024
4cc548d
pre-commit auto-fixes
pre-commit-ci[bot] Dec 3, 2024
2736782
address pre-commit remapping warning
naik-aakash Dec 3, 2024
52757bc
fix linting
naik-aakash Dec 3, 2024
51effde
tackle incorrect icoxxlist trans vectors
naik-aakash Dec 4, 2024
90df179
update tests
naik-aakash Dec 4, 2024
30a7805
rename variables for clarity
naik-aakash Dec 5, 2024
2b70cb2
accept suggestion
naik-aakash Dec 6, 2024
7aa750a
move CoxxFingerprint to featurize.utils
naik-aakash Dec 6, 2024
78e5569
replace POSCAR.gz with CONTCAR.gz
naik-aakash Dec 6, 2024
bc9a163
change default structure file read to CONTCAR
naik-aakash Dec 6, 2024
b057c53
adapt tests to default structure file name change
naik-aakash Dec 6, 2024
9fc6381
replace POSCAR with CONTCAR
naik-aakash Dec 6, 2024
294848b
replace POSCAR with CONTCAR in examples
naik-aakash Dec 6, 2024
7097dd5
adapt tutorials to match the change
naik-aakash Dec 6, 2024
c60e7b5
change structure default in cli.py from POSCAR to CONTCAR
naik-aakash Dec 6, 2024
8358ae8
remove ein norm and unique option
naik-aakash Dec 6, 2024
04a3223
remove debug print
naik-aakash Dec 6, 2024
5dace1b
revise tests
naik-aakash Dec 6, 2024
c04a42c
use np.isclose for numerical comparisons
naik-aakash Dec 6, 2024
0c3ca4e
final numerical comparisons fix
naik-aakash Dec 7, 2024
8ac99ab
accomodate minor changes in expected results due to numerical prec is…
naik-aakash Dec 7, 2024
9657efe
fix [0,0,0] rev trans being left out, refactor code a bit for clarity
naik-aakash Dec 8, 2024
68ad785
update test
naik-aakash Dec 8, 2024
40710ef
update tests
naik-aakash Dec 8, 2024
4c37cec
fix number of bins, include wasserstein distance to rdf
naik-aakash Dec 10, 2024
9b82fe6
update tests
naik-aakash Dec 10, 2024
f1f9dca
Added FeaturizeIcoxxlist method that returns BWDF values sorted by di…
kaueltzen Dec 10, 2024
772f77f
Added FeaturizeIcoxxlist method that returns distances sorted by BWDF…
kaueltzen Dec 10, 2024
e879b3e
Changed error handling, added tests.
kaueltzen Dec 10, 2024
4cbfad0
Added test case with pos. and neg. BWDF values, some refactoring and …
kaueltzen Dec 11, 2024
2517fed
Moved exception testing
kaueltzen Dec 11, 2024
528b414
Refactoring and started to add sorted feats into batch
kaueltzen Dec 11, 2024
cfd891f
remove EXE002
naik-aakash Dec 11, 2024
6736817
fix doc-string formatting
naik-aakash Dec 11, 2024
b272d6a
adapt test to reflect lastest change
naik-aakash Dec 11, 2024
e90a660
filter encoding warnings of pymatgen>monty update (new release of pym…
naik-aakash Dec 11, 2024
307bae0
Added more core tests
kaueltzen Dec 11, 2024
2d40372
Added sorting featurizers to batch.py, started adding batch tests.
kaueltzen Dec 12, 2024
8782b93
More batch tests
kaueltzen Dec 12, 2024
3dcc1f5
Batch test fix
kaueltzen Dec 12, 2024
18f63a0
Added batch exception test for sorting featurizer
kaueltzen Dec 12, 2024
7a9947e
accept suggestion
naik-aakash Dec 12, 2024
77a4fbc
accept suggestion
naik-aakash Dec 12, 2024
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
4 changes: 2 additions & 2 deletions .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
fail-fast: false
matrix:
python-version: ["3.10", "3.11", "3.12"]
split: [1, 2, 3, 4, 5, 6]
split: [1, 2, 3, 4, 5]


steps:
Expand Down Expand Up @@ -67,7 +67,7 @@ jobs:
MPLBACKEND: Agg # non-interactive backend for matplotlib
run: |
micromamba activate lobpy
pytest --cov=lobsterpy --cov-report term-missing --cov-append --splits 6 --group ${{ matrix.split }} -vv --durations-path ./tests/test_data/.pytest-split-durations
pytest --cov=lobsterpy --cov-report term-missing --cov-append --splits 5 --group ${{ matrix.split }} -vv --durations-path ./tests/test_data/.pytest-split-durations

- name: Upload coverage
if: matrix.python-version == '3.10'
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
exclude: ^(docs|examples|tests|.github)
exclude: ^(docs|examples|.github|tests/test_data)

ci:
autoupdate_schedule: monthly
Expand Down
2 changes: 1 addition & 1 deletion docs/tutorial/commandlineinterface.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Creating input files


With LobsterPy, these intricate details are handled with a single command. We need the standard VASP input files, i.e.
``INCAR, KPOINTS, POTCAR and POSCAR`` in the calculation directory. Once you have these files, one needs to run the following command:
``INCAR, KPOINTS, POTCAR and CONTCAR`` in the calculation directory. Once you have these files, one needs to run the following command:

``lobsterpy create-inputs``

Expand Down
22 changes: 10 additions & 12 deletions docs/tutorial/tutorial.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@
"source": [
"# Initialize Analysis object\n",
"analyse = Analysis(\n",
" path_to_poscar=directory / \"POSCAR.gz\",\n",
" path_to_poscar=directory / \"CONTCAR.gz\",\n",
" path_to_icohplist=directory / \"ICOHPLIST.lobster.gz\",\n",
" path_to_cohpcar=directory / \"COHPCAR.lobster.gz\",\n",
" path_to_charge=directory / \"CHARGE.lobster.gz\",\n",
Expand Down Expand Up @@ -195,7 +195,7 @@
"\n",
"```python\n",
"analyse = Analysis(\n",
" path_to_poscar=directory / \"POSCAR.gz\",\n",
" path_to_poscar=directory / \"CONTCAR.gz\",\n",
" path_to_icohplist=directory / \"ICOBILIST.lobster.gz\",\n",
" path_to_cohpcar=directory / \"COBICAR.lobster.gz\",\n",
" path_to_charge=directory / \"CHARGE.lobster.gz\",\n",
Expand Down Expand Up @@ -232,7 +232,7 @@
"outputs": [],
"source": [
"analyse = Analysis(\n",
" path_to_poscar=directory / \"POSCAR.gz\",\n",
" path_to_poscar=directory / \"CONTCAR.gz\",\n",
" path_to_icohplist=directory / \"ICOHPLIST.lobster.gz\",\n",
" path_to_cohpcar=directory / \"COHPCAR.lobster.gz\",\n",
" path_to_charge=directory / \"CHARGE.lobster.gz\",\n",
Expand Down Expand Up @@ -358,7 +358,7 @@
"source": [
"# Get calculation quality summary dict\n",
"calc_quality_K3Sb = Analysis.get_lobster_calc_quality_summary(\n",
" path_to_poscar=directory / \"POSCAR.gz\",\n",
" path_to_poscar=directory / \"CONTCAR.gz\",\n",
" path_to_charge=directory / \"CHARGE.lobster.gz\",\n",
" path_to_lobsterin=directory / \"lobsterin.gz\",\n",
" path_to_lobsterout=directory / \"lobsterout.gz\",\n",
Expand Down Expand Up @@ -557,7 +557,7 @@
"# Load Lobster DOS\n",
"directory = Path(\".\") / \"..\" / \"..\" / \"tests\" / \"test_data\" / \"NaCl_comp_range\"\n",
"dos = Doscar(doscar=directory / 'DOSCAR.lobster.gz',\n",
" structure_file=directory / 'POSCAR.gz')"
" structure_file=directory / 'CONTCAR.gz')"
]
},
{
Expand All @@ -569,7 +569,7 @@
"# Load Lobster DOS (Change this cell block type to Code when executing locally)\n",
"directory = Path(\"LobsterPy\") / \"tests\" / \"test_data\" / \"NaCl_comp_range\"\n",
"dos = Doscar(doscar=directory / 'DOSCAR.lobster.gz',\n",
" structure_file=directory / 'POSCAR.gz')\n",
" structure_file=directory / 'CONTCAR.gz')\n",
"```"
]
},
Expand All @@ -585,9 +585,7 @@
"cell_type": "code",
"execution_count": null,
"id": "a271f2f0",
"metadata": {
"scrolled": false
},
"metadata": {},
"outputs": [],
"source": [
"style.use('default') # Complete reset the matplotlib figure style\n",
Expand Down Expand Up @@ -658,7 +656,7 @@
"outputs": [],
"source": [
"graph_NaCl_all = LobsterGraph(\n",
" path_to_poscar=directory / \"POSCAR.gz\",\n",
" path_to_poscar=directory / \"CONTCAR.gz\",\n",
" path_to_charge=directory / \"CHARGE.lobster.gz\",\n",
" path_to_cohpcar=directory / \"COHPCAR.lobster.gz\",\n",
" path_to_icohplist=directory / \"ICOHPLIST.lobster.gz\",\n",
Expand All @@ -679,7 +677,7 @@
"```python\n",
"#### (Change this cell block type to Code or copy it from here when executing locally)\n",
"graph_NaCl_all = LobsterGraph(\n",
" path_to_poscar=directory / \"POSCAR.gz\",\n",
" path_to_poscar=directory / \"CONTCAR.gz\",\n",
" path_to_charge=directory / \"CHARGE.lobster.gz\",\n",
" path_to_cohpcar=directory / \"COHPCAR.lobster.gz\",\n",
" path_to_icohplist=directory / \"ICOHPLIST.lobster.gz\",\n",
Expand Down Expand Up @@ -1067,7 +1065,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.12.4"
"version": "3.10.14"
},
"widgets": {
"application/vnd.jupyter.widget-state+json": {
Expand Down
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion examples/example_script_NaCl.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

# Setup analysis dict
analyse = Analysis(
path_to_poscar=os.path.join(directory, "POSCAR"),
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"),
Expand Down
2 changes: 1 addition & 1 deletion examples/example_script_NaCl_Structure_graph.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from lobsterpy.structuregraph.graph import LobsterGraph

graph_NaCl_all = LobsterGraph(
path_to_poscar="./NaCl_comp_range/POSCAR.gz",
path_to_poscar="./NaCl_comp_range/CONTCAR.gz",
path_to_charge="./NaCl_comp_range/CHARGE.lobster.gz",
path_to_cohpcar="./NaCl_comp_range/COHPCAR.lobster.gz",
path_to_icohplist="./NaCl_comp_range/ICOHPLIST.lobster.gz",
Expand Down
2 changes: 1 addition & 1 deletion examples/example_script_NaCl_all.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

# Setup analysis dict
analyse = Analysis(
path_to_poscar=os.path.join(directory, "POSCAR"),
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"),
Expand Down
2 changes: 1 addition & 1 deletion examples/example_script_NaCl_orbitalwise.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

# Setup analysis dict
analyse = Analysis(
path_to_poscar=os.path.join(directory, "POSCAR"),
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"),
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ ignore = [
"RUF012", # Disable checks for mutable class args. This is a non-problem.
"SIM105", # Use contextlib.suppress(OSError) instead of try-except-pass
"SIM114", # Combine `if` branches using logical `or` operator
"TCH002", # Move third-party import into a type-checking block
"TC002", # Move third-party import into a type-checking block
]
pydocstyle.convention = "google"

Expand Down
12 changes: 6 additions & 6 deletions src/lobsterpy/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,10 @@ def get_parser() -> argparse.ArgumentParser:
structure_file.add_argument(
"-fstruct",
"--file-structure",
default="POSCAR",
default="CONTCAR",
dest="structure",
type=Path,
help='path to structure file. Default is "POSCAR". '
help='path to structure file. Default is "CONTCAR". '
'Can also read "POSCAR.lobster" file or any '
'suitable file format supported by pymatgen "Structure.from_file" method.',
)
Expand Down Expand Up @@ -561,7 +561,7 @@ def get_parser() -> argparse.ArgumentParser:
],
help=(
"Deliver a text description of the LOBSTER calc quality analysis. "
"Mandatory required files: POSCAR, POTCAR, lobsterout, lobsterin. "
"Mandatory required files: CONTCAR, POTCAR, lobsterout, lobsterin. "
"Optional files (BVA comparison): CHARGE.lobster, "
"(DOS comparison): DOSCAR.lobster/ DOSCAR.LSO.lobster, Vasprun.xml."
),
Expand Down Expand Up @@ -874,14 +874,14 @@ def run(args):
)
options = {"are_cobis": False, "are_coops": False}

struture_filename = get_file_paths(path_to_lobster_calc=Path(os.getcwd()), requested_files=["structure"]).get(
structure_filename = get_file_paths(path_to_lobster_calc=Path(os.getcwd()), requested_files=["structure"]).get(
"structure"
)

completecohp = CompleteCohp.from_file(
fmt="LOBSTER",
filename=filename,
structure_file=struture_filename,
structure_file=structure_filename,
**options,
)
if args.multi_cobis:
Expand Down Expand Up @@ -963,7 +963,7 @@ def run(args):

# Check for .gz files exist for default values and update accordingly
default_files = {
"structure": "POSCAR",
"structure": "CONTCAR",
"potcar": "POTCAR",
"incar": "INCAR",
}
Expand Down
2 changes: 1 addition & 1 deletion src/lobsterpy/featurize/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@

"""This package provides the modules for featurzing Lobster data ready for ML studies."""

from .utils import get_file_paths, get_structure_path
from .utils import get_electronegativities, get_file_paths, get_reduced_mass, get_structure_path, sort_dict_by_value
Loading
Loading