Skip to content

Commit

Permalink
fixed molden pbc exporter to not float except for 1- and 2-d crystals
Browse files Browse the repository at this point in the history
  • Loading branch information
evaleev committed May 6, 2020
1 parent 43631f7 commit 7a9ef4b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
3 changes: 3 additions & 0 deletions CHANGES
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@

Following is a brief summary of changes made in each release of Libint.

- 2019-xx-yy: 2.7.0-beta.6
- Molden PBC exporter works for 1 and 2 dimensional crystals

- 2019-04-02: 2.7.0-beta.5
- made usable as a CMake subproject
- the deprecated autotools build harness has been removed from the exported library; CMake is the only way to build exported libs
Expand Down
11 changes: 8 additions & 3 deletions include/libint2/lcao/molden.h
Original file line number Diff line number Diff line change
Expand Up @@ -385,9 +385,14 @@ class PBCExport: public Export{
const double a = cell_axes_[0].norm();
const double b = cell_axes_[1].norm();
const double c = cell_axes_[2].norm();
const double alpha = std::acos(cell_axes_[1].dot(cell_axes_[2]) / (b * c));
const double beta = std::acos(cell_axes_[0].dot(cell_axes_[2]) / (a * c));
const double gamma = std::acos(cell_axes_[0].dot(cell_axes_[1]) / (a * b));
const double eps = std::sqrt(std::numeric_limits<double>::epsilon());
const bool nonzero_a = a >= eps;
const bool nonzero_b = b >= eps;
const bool nonzero_c = c >= eps;
static constexpr double right_angle = M_PI / 4;
const double alpha = nonzero_b && nonzero_c ? std::acos(cell_axes_[1].dot(cell_axes_[2]) / (b * c)) : right_angle;
const double beta = nonzero_a && nonzero_c ? std::acos(cell_axes_[0].dot(cell_axes_[2]) / (a * c)) : right_angle;
const double gamma = nonzero_a && nonzero_b ? std::acos(cell_axes_[0].dot(cell_axes_[1]) / (a * b)) : right_angle;
const double radian_to_degree = 180 / M_PI;
os << std::setw(12) << a * bohr_to_angstrom()
<< std::setw(12) << b * bohr_to_angstrom()
Expand Down

0 comments on commit 7a9ef4b

Please sign in to comment.