Skip to content

Commit

Permalink
Restructure python bindings, add more core bindings and tests
Browse files Browse the repository at this point in the history
  • Loading branch information
peterspackman committed Jan 20, 2025
1 parent ebe4930 commit 863fc5b
Show file tree
Hide file tree
Showing 10 changed files with 922 additions and 21 deletions.
7 changes: 5 additions & 2 deletions include/occ/core/elastic_tensor.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,15 @@ class ElasticTensor {
double
average_poisson_ratio(AveragingScheme avg = AveragingScheme::Hill) const;

Mat6 voigt_s() const;
Mat6 voigt_c() const;
const Mat6 &voigt_s() const;
const Mat6 &voigt_c() const;

double component(int i, int j, int k, int l) const;
double &component(int i, int j, int k, int l);

inline double *data() { return &m_components[0][0][0][0]; }
inline double const *data() const { return &m_components[0][0][0][0]; }

private:
Mat6 m_c;
Mat6 m_s;
Expand Down
4 changes: 2 additions & 2 deletions src/core/elastic_tensor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -231,9 +231,9 @@ double ElasticTensor::average_poisson_ratio(AveragingScheme avg) const {
return (3 * K - 2 * G) / (2 * (3 * K + G));
}

Mat6 ElasticTensor::voigt_s() const { return m_s; }
const Mat6 &ElasticTensor::voigt_s() const { return m_s; }

Mat6 ElasticTensor::voigt_c() const { return m_c; }
const Mat6 &ElasticTensor::voigt_c() const { return m_c; }

double ElasticTensor::component(int i, int j, int k, int l) const {
return m_components[i][j][k][l];
Expand Down
5 changes: 5 additions & 0 deletions src/core/point_group.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,11 @@ SymOp SymOp::inversion() {
return SymOp(transformation);
}

SymOp SymOp::identity() {
Mat4 transformation = Mat4::Identity();
return SymOp(transformation);
}

bool is_valid_symop(const SymOp &op, Eigen::Ref<const Mat3N> positions) {
auto nc = op.apply(positions);
const size_t N = positions.cols();
Expand Down
12 changes: 8 additions & 4 deletions src/occpy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
import site
import warnings
from ._occpy import setup_logging, set_data_directory, set_num_threads
from ._occpy.core import Atom, Element, Molecule, Dimer
from ._occpy.crystal import Crystal
from ._occpy.qm import AOBasis, HartreeFock, Shell, Wavefunction
from ._occpy.dft import DFT
from .core import Atom, Element, Molecule, Dimer
from .crystal import Crystal
from .qm import AOBasis, HartreeFock, Shell, Wavefunction
from .dft import DFT

# Set up logging first
setup_logging(0)
Expand All @@ -24,12 +24,16 @@
"Atom",
"AOBasis",
"calculate_crystal_growth_energies",
"core",
"crystal",
"Crystal",
"dft",
"DFT",
"Dimer",
"Element",
"HartreeFock",
"Molecule",
"qm",
"set_data_directory",
"set_num_threads",
"setup_logging",
Expand Down
1 change: 1 addition & 0 deletions src/occpy/core/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from .._occpy.core import *
1 change: 1 addition & 0 deletions src/occpy/crystal/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from .._occpy.crystal import *
1 change: 1 addition & 0 deletions src/occpy/dft/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from .._occpy.dft import *
1 change: 1 addition & 0 deletions src/occpy/qm/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from .._occpy.qm import *
Loading

0 comments on commit 863fc5b

Please sign in to comment.