-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Shyue Ping Ong
committed
Jul 25, 2023
1 parent
d9aa80e
commit d91050e
Showing
3 changed files
with
40 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
"""Calculators for materials properties.""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,24 @@ | ||
""" | ||
Define basic API. | ||
""" | ||
"""Define basic API.""" | ||
from __future__ import annotations | ||
|
||
import abc | ||
from typing import TYPE_CHECKING | ||
|
||
if TYPE_CHECKING: | ||
from pymatgen.core import Structure | ||
|
||
from pymatgen.core import Structure | ||
|
||
class PropCalc(abc.ABCMeta): | ||
""" | ||
API for a property calculator. | ||
""" | ||
"""API for a property calculator.""" | ||
|
||
@abc.abstractmethod | ||
def calc(self, structure: Structure) -> dict: | ||
pass | ||
""" | ||
All PropCalc should implement a calc method that takes in a pymatgen structure and returns a dict. Note that | ||
the method can return more than one property. | ||
Args: | ||
structure: Pymatgen structure. | ||
Returns: {"prop name": value} | ||
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,32 @@ | ||
""" | ||
Phonon properties | ||
""" | ||
"""Phonon properties.""" | ||
from __future__ import annotations | ||
|
||
from ase.calculators.calculator import Calculator | ||
from typing import TYPE_CHECKING | ||
|
||
from .base import PropCalc | ||
|
||
if TYPE_CHECKING: | ||
from ase.calculators.calculator import Calculator | ||
|
||
|
||
class PhononCalc(PropCalc): | ||
""" | ||
Calculator for phonon properties. | ||
""" | ||
"""Calculator for phonon properties.""" | ||
|
||
def __init__(self, calculator: Calculator): | ||
""" | ||
Args: | ||
calculator: ASE Calculator to use. | ||
""" | ||
self.calculator = calculator | ||
|
||
def calc(self, structure) -> dict: | ||
pass | ||
""" | ||
All PropCalc should implement a calc method that takes in a pymatgen structure and returns a dict. Note that | ||
the method can return more than one property. | ||
Args: | ||
structure: Pymatgen structure. | ||
Returns: {"prop name": value} | ||
""" | ||
return {} |