Skip to content

Commit

Permalink
Merge pull request #320 from pyiron/add_doc_for_potentials
Browse files Browse the repository at this point in the history
Add guide for potential installation
  • Loading branch information
jan-janssen authored Aug 17, 2024
2 parents 241febe + 72b037d commit 8c85b30
Showing 1 changed file with 32 additions and 2 deletions.
34 changes: 32 additions & 2 deletions atomistics/calculators/lammps/potential.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,34 @@
import pandas
from ase.atoms import Atoms

potential_installation = """
Potential installation guide:
1. Check whether iprpy-data is installed. If not, install it using:
`conda install -c conda-forge iprpy-data`
2. Check whether the resource path is set via:
```python
import os
print(os.environ["CONDA_PREFIX"])
```
3. If the resource path is set, you can call the potential using:
```python
from atomistics.calculators import get_potential_by_name
get_potential_by_name(
potential_name=my_potential,
resource_path=os.path.join(os.environ["CONDA_PREFIX"], "share", "iprpy"),
)
```
"""


class PotentialAbstract(object):
"""
Expand Down Expand Up @@ -124,7 +152,9 @@ def _get_potential_df(file_name_lst, resource_path):
),
},
)
raise ValueError("Was not able to locate the potential files.")
raise ValueError(
"Was not able to locate the potential files." + potential_installation
)


class LammpsPotentialFile(PotentialAbstract):
Expand Down Expand Up @@ -310,7 +340,7 @@ def get_resource_path_from_conda(
resource_path = os.path.join(env[conda_var], "share", "iprpy")
if os.path.exists(resource_path):
return resource_path
raise ValueError("No resource_path found")
raise ValueError("No resource_path found" + potential_installation)


def get_potential_dataframe(structure: Atoms, resource_path=None):
Expand Down

0 comments on commit 8c85b30

Please sign in to comment.