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

Fix pip install command in fine_tuning.ipynb #208

Merged
merged 3 commits into from
Oct 16, 2024
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
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ default_install_hook_types: [pre-commit, commit-msg]

repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.6.5
rev: v0.6.9
hooks:
- id: ruff
args: [--fix]
Expand All @@ -13,7 +13,7 @@ repos:
types_or: [python, jupyter]

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
rev: v5.0.0
hooks:
- id: check-case-conflict
- id: check-symlinks
Expand Down Expand Up @@ -48,7 +48,7 @@ repos:
- svelte

- repo: https://github.com/pre-commit/mirrors-eslint
rev: v9.10.0
rev: v9.12.0
hooks:
- id: eslint
types: [file]
Expand Down
6 changes: 1 addition & 5 deletions chgnet/graph/converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -273,11 +273,7 @@ def set_isolated_atom_response(
"""Set the graph converter's response to isolated atom graph
Args:
on_isolated_atoms ('ignore' | 'warn' | 'error'): how to handle Structures
with isolated atoms.
Default = 'error'.

Returns:
None
with isolated atoms. Default = 'error'.
"""
self.on_isolated_atoms = on_isolated_atoms

Expand Down
12 changes: 6 additions & 6 deletions chgnet/model/dynamics.py
Original file line number Diff line number Diff line change
Expand Up @@ -814,9 +814,6 @@ def fit(
verbose (bool): Whether to print the output of the ASE optimizer.
Default = False
**kwargs: Additional parameters for the optimizer.

Returns:
Bulk Modulus (float)
"""
if isinstance(atoms, Atoms):
atoms = AseAtomsAdaptor.get_structure(atoms)
Expand Down Expand Up @@ -848,15 +845,18 @@ def fit(
self.bm.fit()
self.fitted = True

def get_bulk_modulus(self, unit: str = "eV/A^3") -> float:
def get_bulk_modulus(self, unit: Literal["eV/A^3", "GPa"] = "eV/A^3") -> float:
"""Get the bulk modulus of from the fitted Birch-Murnaghan equation of state.

Args:
unit (str): The unit of bulk modulus. Can be "eV/A^3" or "GPa"
Default = "eV/A^3"

Returns:
Bulk Modulus (float)
float: Bulk Modulus

Raises:
ValueError: If the equation of state is not fitted.
"""
if self.fitted is False:
raise ValueError(
Expand All @@ -866,7 +866,7 @@ def get_bulk_modulus(self, unit: str = "eV/A^3") -> float:
return self.bm.b0
if unit == "GPa":
return self.bm.b0_GPa
raise NotImplementedError("unit has to be eV/A^3 or GPa")
raise ValueError("unit has to be eV/A^3 or GPa")

def get_compressibility(self, unit: str = "A^3/eV") -> float:
"""Get the bulk modulus of from the fitted Birch-Murnaghan equation of state.
Expand Down
2 changes: 1 addition & 1 deletion examples/fine_tuning.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
" from chgnet.model import CHGNet\n",
"except ImportError:\n",
" # install CHGNet (only needed on Google Colab or if you didn't install CHGNet yet)\n",
" !pip install chgnet."
" !pip install chgnet"
]
},
{
Expand Down