Skip to content

Commit d3e0160

Browse files
millet-brewjanosh
andauthored
Fix pip install command in fine_tuning.ipynb (#208)
* Update fine_tuning.ipynb * fix wrong Returns: section in EquationOfState.fit doc str * change EquationOfState.get_bulk_modulus exception type on bad unit to ValueError --------- Co-authored-by: Janosh Riebesell <janosh.riebesell@gmail.com>
1 parent 4b0c566 commit d3e0160

File tree

4 files changed

+11
-15
lines changed

4 files changed

+11
-15
lines changed

.pre-commit-config.yaml

+3-3
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ default_install_hook_types: [pre-commit, commit-msg]
44

55
repos:
66
- repo: https://github.com/astral-sh/ruff-pre-commit
7-
rev: v0.6.5
7+
rev: v0.6.9
88
hooks:
99
- id: ruff
1010
args: [--fix]
@@ -13,7 +13,7 @@ repos:
1313
types_or: [python, jupyter]
1414

1515
- repo: https://github.com/pre-commit/pre-commit-hooks
16-
rev: v4.6.0
16+
rev: v5.0.0
1717
hooks:
1818
- id: check-case-conflict
1919
- id: check-symlinks
@@ -48,7 +48,7 @@ repos:
4848
- svelte
4949

5050
- repo: https://github.com/pre-commit/mirrors-eslint
51-
rev: v9.10.0
51+
rev: v9.12.0
5252
hooks:
5353
- id: eslint
5454
types: [file]

chgnet/graph/converter.py

+1-5
Original file line numberDiff line numberDiff line change
@@ -273,11 +273,7 @@ def set_isolated_atom_response(
273273
"""Set the graph converter's response to isolated atom graph
274274
Args:
275275
on_isolated_atoms ('ignore' | 'warn' | 'error'): how to handle Structures
276-
with isolated atoms.
277-
Default = 'error'.
278-
279-
Returns:
280-
None
276+
with isolated atoms. Default = 'error'.
281277
"""
282278
self.on_isolated_atoms = on_isolated_atoms
283279

chgnet/model/dynamics.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -814,9 +814,6 @@ def fit(
814814
verbose (bool): Whether to print the output of the ASE optimizer.
815815
Default = False
816816
**kwargs: Additional parameters for the optimizer.
817-
818-
Returns:
819-
Bulk Modulus (float)
820817
"""
821818
if isinstance(atoms, Atoms):
822819
atoms = AseAtomsAdaptor.get_structure(atoms)
@@ -848,15 +845,18 @@ def fit(
848845
self.bm.fit()
849846
self.fitted = True
850847

851-
def get_bulk_modulus(self, unit: str = "eV/A^3") -> float:
848+
def get_bulk_modulus(self, unit: Literal["eV/A^3", "GPa"] = "eV/A^3") -> float:
852849
"""Get the bulk modulus of from the fitted Birch-Murnaghan equation of state.
853850
854851
Args:
855852
unit (str): The unit of bulk modulus. Can be "eV/A^3" or "GPa"
856853
Default = "eV/A^3"
857854
858855
Returns:
859-
Bulk Modulus (float)
856+
float: Bulk Modulus
857+
858+
Raises:
859+
ValueError: If the equation of state is not fitted.
860860
"""
861861
if self.fitted is False:
862862
raise ValueError(
@@ -866,7 +866,7 @@ def get_bulk_modulus(self, unit: str = "eV/A^3") -> float:
866866
return self.bm.b0
867867
if unit == "GPa":
868868
return self.bm.b0_GPa
869-
raise NotImplementedError("unit has to be eV/A^3 or GPa")
869+
raise ValueError("unit has to be eV/A^3 or GPa")
870870

871871
def get_compressibility(self, unit: str = "A^3/eV") -> float:
872872
"""Get the bulk modulus of from the fitted Birch-Murnaghan equation of state.

examples/fine_tuning.ipynb

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
" from chgnet.model import CHGNet\n",
2020
"except ImportError:\n",
2121
" # install CHGNet (only needed on Google Colab or if you didn't install CHGNet yet)\n",
22-
" !pip install chgnet."
22+
" !pip install chgnet"
2323
]
2424
},
2525
{

0 commit comments

Comments
 (0)