From 4345a98f4b8836ee875295af2ae4ed15373ed520 Mon Sep 17 00:00:00 2001 From: naik-aakash Date: Wed, 21 Feb 2024 11:11:10 +0100 Subject: [PATCH 1/5] fix example code block for automatic cobi anaylsis --- docs/tutorial/tutorial.ipynb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/tutorial/tutorial.ipynb b/docs/tutorial/tutorial.ipynb index a65b32bc..99eac9c2 100644 --- a/docs/tutorial/tutorial.ipynb +++ b/docs/tutorial/tutorial.ipynb @@ -196,8 +196,8 @@ "```python\n", "analyse = Analysis(\n", " path_to_poscar=directory / \"POSCAR.gz\",\n", - " path_to_icohplist=directory / \"ICOHPLIST.lobster.gz\",\n", - " path_to_cohpcar=directory / \"COHPCAR.lobster.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", " which_bonds=\"cation-anion\",\n", " are_cobis=True,\n", From f7df19b5149c5c8461e718edab4654a055113aa9 Mon Sep 17 00:00:00 2001 From: naik-aakash Date: Wed, 21 Feb 2024 11:11:38 +0100 Subject: [PATCH 2/5] add note about tutorial > juypter notebook --- docs/tutorial/index.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/tutorial/index.rst b/docs/tutorial/index.rst index a339fca8..b22f1a14 100644 --- a/docs/tutorial/index.rst +++ b/docs/tutorial/index.rst @@ -19,6 +19,8 @@ This tutorial will demonstrate how to use the LobsterPy package using example co 4. Use featurizers to extract the LOBSTER bonding analysis data as features for the ML studies 5. Get automatic analysis results and plots using command line utilities +**Note**: The following tutorial is jupyter Notebook, you can download it and execute locally. Please ignore the code blocks which have `remove-cell` tags. You can see these cell tags using `View -> Cell Toolbar -> Tags` (These code blocks are hidden in rendered docs to keep it consistent with example files paths you will use.) + .. toctree:: :maxdepth: 2 From 2d72b9204cc6cdae033d5e14fb9f62e0f909ed5a Mon Sep 17 00:00:00 2001 From: naik-aakash Date: Wed, 21 Feb 2024 14:29:22 +0100 Subject: [PATCH 3/5] adapt LobsterEnv usage to breaking change --- lobsterpy/cohp/analyze.py | 21 +++++++++++---------- lobsterpy/featurize/batch.py | 2 +- lobsterpy/structuregraph/graph.py | 12 ++++++------ 3 files changed, 18 insertions(+), 17 deletions(-) diff --git a/lobsterpy/cohp/analyze.py b/lobsterpy/cohp/analyze.py index 8b3cdb0a..6a702b36 100644 --- a/lobsterpy/cohp/analyze.py +++ b/lobsterpy/cohp/analyze.py @@ -172,11 +172,12 @@ def setup_env(self): if self.which_bonds == "cation-anion": try: self.chemenv = LobsterNeighbors( - filename_ICOHP=self.path_to_icohplist, + filename_icohp=self.path_to_icohplist, structure=Structure.from_file(self.path_to_poscar), additional_condition=1, - perc_strength_ICOHP=self.cutoff_icohp, - filename_CHARGE=self.path_to_charge, + perc_strength_icohp=self.cutoff_icohp, + filename_charge=self.path_to_charge, + valences=None, valences_from_charges=True, adapt_extremum_to_add_cond=True, are_cobis=self.are_cobis, @@ -197,11 +198,11 @@ def setup_env(self): elif self.which_bonds == "all": # raise ValueError("only cation anion bonds implemented so far") self.chemenv = LobsterNeighbors( - filename_ICOHP=self.path_to_icohplist, + filename_icohp=self.path_to_icohplist, structure=Structure.from_file(self.path_to_poscar), additional_condition=0, - perc_strength_ICOHP=self.cutoff_icohp, - filename_CHARGE=self.path_to_charge, + perc_strength_icohp=self.cutoff_icohp, + filename_charge=self.path_to_charge, valences_from_charges=True, adapt_extremum_to_add_cond=True, are_cobis=self.are_cobis, @@ -301,8 +302,8 @@ def get_information_all_bonds(self, summed_spins: bool = True): for anion in self.anion_types: # get labels and summed cohp objects labels, summedcohps = self.chemenv.get_info_cohps_to_neighbors( - self.path_to_cohpcar, - [ice], + path_to_cohpcar=self.path_to_cohpcar, + isites=[ice], summed_spin_channels=summed_spins, per_bond=False, only_bonds_to=[str(anion)], @@ -341,8 +342,8 @@ def get_information_all_bonds(self, summed_spins: bool = True): for element in self.elements: # get labels and summed cohp objects labels, summedcohps = self.chemenv.get_info_cohps_to_neighbors( - self.path_to_cohpcar, - [ice], + path_to_cohpcar=self.path_to_cohpcar, + isites=[ice], onlycation_isites=False, summed_spin_channels=summed_spins, per_bond=False, diff --git a/lobsterpy/featurize/batch.py b/lobsterpy/featurize/batch.py index 3c572ecd..f602b65d 100644 --- a/lobsterpy/featurize/batch.py +++ b/lobsterpy/featurize/batch.py @@ -534,7 +534,7 @@ def _get_fp_similarity( """ Calculate the similarity index (dot product) of two fingerprints. - :param fp1 The 1st CoxxFingerprint object + :param fp1: The 1st CoxxFingerprint object :param fp2: The 2nd CoxxFingerprint object :param col: The item in the fingerprints (0:energies,1: coxxs) to take the dot product of (default is 1) :param pt: The index of the point that the dot product is to be taken (default is All) diff --git a/lobsterpy/structuregraph/graph.py b/lobsterpy/structuregraph/graph.py index 191bd75b..734ede29 100644 --- a/lobsterpy/structuregraph/graph.py +++ b/lobsterpy/structuregraph/graph.py @@ -104,11 +104,11 @@ def get_decorated_sg(self): if self.add_additional_data_sg: chemenvlobster = LobsterNeighbors( are_coops=False, - filename_ICOHP=self.path_to_icohplist, - perc_strength_ICOHP=self.cutoff_icohp, + filename_icohp=self.path_to_icohplist, + perc_strength_icohp=self.cutoff_icohp, structure=Structure.from_file(self.path_to_poscar), additional_condition=self.additional_condition, - filename_CHARGE=self.path_to_charge, + filename_charge=self.path_to_charge, add_additional_data_sg=self.add_additional_data_sg, filename_blist_sg1=self.path_to_icobilist, id_blist_sg1="ICOBI", @@ -121,11 +121,11 @@ def get_decorated_sg(self): else: chemenvlobster = LobsterNeighbors( are_coops=False, - filename_ICOHP=self.path_to_icohplist, - perc_strength_ICOHP=self.cutoff_icohp, + filename_icohp=self.path_to_icohplist, + perc_strength_icohp=self.cutoff_icohp, structure=Structure.from_file(self.path_to_poscar), additional_condition=self.additional_condition, - filename_CHARGE=self.path_to_charge, + filename_charge=self.path_to_charge, add_additional_data_sg=self.add_additional_data_sg, valences_from_charges=True, adapt_extremum_to_add_cond=True, From 7e879d8932213c44ea1a53012d61b284ac497131 Mon Sep 17 00:00:00 2001 From: naik-aakash Date: Fri, 23 Feb 2024 08:49:40 +0100 Subject: [PATCH 4/5] Revert "adapt LobsterEnv usage to breaking change" This reverts commit 2d72b9204cc6cdae033d5e14fb9f62e0f909ed5a. --- lobsterpy/cohp/analyze.py | 21 ++++++++++----------- lobsterpy/featurize/batch.py | 2 +- lobsterpy/structuregraph/graph.py | 12 ++++++------ 3 files changed, 17 insertions(+), 18 deletions(-) diff --git a/lobsterpy/cohp/analyze.py b/lobsterpy/cohp/analyze.py index 6a702b36..8b3cdb0a 100644 --- a/lobsterpy/cohp/analyze.py +++ b/lobsterpy/cohp/analyze.py @@ -172,12 +172,11 @@ def setup_env(self): if self.which_bonds == "cation-anion": try: self.chemenv = LobsterNeighbors( - filename_icohp=self.path_to_icohplist, + filename_ICOHP=self.path_to_icohplist, structure=Structure.from_file(self.path_to_poscar), additional_condition=1, - perc_strength_icohp=self.cutoff_icohp, - filename_charge=self.path_to_charge, - valences=None, + perc_strength_ICOHP=self.cutoff_icohp, + filename_CHARGE=self.path_to_charge, valences_from_charges=True, adapt_extremum_to_add_cond=True, are_cobis=self.are_cobis, @@ -198,11 +197,11 @@ def setup_env(self): elif self.which_bonds == "all": # raise ValueError("only cation anion bonds implemented so far") self.chemenv = LobsterNeighbors( - filename_icohp=self.path_to_icohplist, + filename_ICOHP=self.path_to_icohplist, structure=Structure.from_file(self.path_to_poscar), additional_condition=0, - perc_strength_icohp=self.cutoff_icohp, - filename_charge=self.path_to_charge, + perc_strength_ICOHP=self.cutoff_icohp, + filename_CHARGE=self.path_to_charge, valences_from_charges=True, adapt_extremum_to_add_cond=True, are_cobis=self.are_cobis, @@ -302,8 +301,8 @@ def get_information_all_bonds(self, summed_spins: bool = True): for anion in self.anion_types: # get labels and summed cohp objects labels, summedcohps = self.chemenv.get_info_cohps_to_neighbors( - path_to_cohpcar=self.path_to_cohpcar, - isites=[ice], + self.path_to_cohpcar, + [ice], summed_spin_channels=summed_spins, per_bond=False, only_bonds_to=[str(anion)], @@ -342,8 +341,8 @@ def get_information_all_bonds(self, summed_spins: bool = True): for element in self.elements: # get labels and summed cohp objects labels, summedcohps = self.chemenv.get_info_cohps_to_neighbors( - path_to_cohpcar=self.path_to_cohpcar, - isites=[ice], + self.path_to_cohpcar, + [ice], onlycation_isites=False, summed_spin_channels=summed_spins, per_bond=False, diff --git a/lobsterpy/featurize/batch.py b/lobsterpy/featurize/batch.py index f602b65d..3c572ecd 100644 --- a/lobsterpy/featurize/batch.py +++ b/lobsterpy/featurize/batch.py @@ -534,7 +534,7 @@ def _get_fp_similarity( """ Calculate the similarity index (dot product) of two fingerprints. - :param fp1: The 1st CoxxFingerprint object + :param fp1 The 1st CoxxFingerprint object :param fp2: The 2nd CoxxFingerprint object :param col: The item in the fingerprints (0:energies,1: coxxs) to take the dot product of (default is 1) :param pt: The index of the point that the dot product is to be taken (default is All) diff --git a/lobsterpy/structuregraph/graph.py b/lobsterpy/structuregraph/graph.py index 734ede29..191bd75b 100644 --- a/lobsterpy/structuregraph/graph.py +++ b/lobsterpy/structuregraph/graph.py @@ -104,11 +104,11 @@ def get_decorated_sg(self): if self.add_additional_data_sg: chemenvlobster = LobsterNeighbors( are_coops=False, - filename_icohp=self.path_to_icohplist, - perc_strength_icohp=self.cutoff_icohp, + filename_ICOHP=self.path_to_icohplist, + perc_strength_ICOHP=self.cutoff_icohp, structure=Structure.from_file(self.path_to_poscar), additional_condition=self.additional_condition, - filename_charge=self.path_to_charge, + filename_CHARGE=self.path_to_charge, add_additional_data_sg=self.add_additional_data_sg, filename_blist_sg1=self.path_to_icobilist, id_blist_sg1="ICOBI", @@ -121,11 +121,11 @@ def get_decorated_sg(self): else: chemenvlobster = LobsterNeighbors( are_coops=False, - filename_icohp=self.path_to_icohplist, - perc_strength_icohp=self.cutoff_icohp, + filename_ICOHP=self.path_to_icohplist, + perc_strength_ICOHP=self.cutoff_icohp, structure=Structure.from_file(self.path_to_poscar), additional_condition=self.additional_condition, - filename_charge=self.path_to_charge, + filename_CHARGE=self.path_to_charge, add_additional_data_sg=self.add_additional_data_sg, valences_from_charges=True, adapt_extremum_to_add_cond=True, From 55aceb416fb837db28ba9f17883bd45180411a1f Mon Sep 17 00:00:00 2001 From: naik-aakash Date: Fri, 23 Feb 2024 08:57:35 +0100 Subject: [PATCH 5/5] pin pymatgen version --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index f0f0e290..99b53d19 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -28,7 +28,7 @@ classifiers = [ ] requires-python = ">=3.9,<3.12" dependencies = [ - "pymatgen>=2023.9.10", + "pymatgen>=2023.9.10, <2024.2.8", "numpy", "typing", ]