Skip to content

Commit

Permalink
Some minor edits.
Browse files Browse the repository at this point in the history
  • Loading branch information
Shyue Ping Ong committed Jul 25, 2023
1 parent d9aa80e commit d91050e
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 16 deletions.
1 change: 1 addition & 0 deletions matcalc/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"""Calculators for materials properties."""
25 changes: 17 additions & 8 deletions matcalc/base.py
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}
"""
30 changes: 22 additions & 8 deletions matcalc/phonon.py
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 {}

0 comments on commit d91050e

Please sign in to comment.