Skip to content

Commit

Permalink
Merge pull request #229 from nlesc-nano/volume
Browse files Browse the repository at this point in the history
BUG: Fixed an issue wherein the mean pair-density was computed using lattice vectors in non-periodic calculations
  • Loading branch information
BvB93 committed Mar 30, 2021
2 parents d0da2fa + 6a6ce10 commit b6d6286
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 10 deletions.
10 changes: 2 additions & 8 deletions FOX/classes/multi_mol.py
Original file line number Diff line number Diff line change
Expand Up @@ -1333,18 +1333,12 @@ def init_rdf(
raise TypeError("cannot perform periodic calculations if the "
"molecules `lattice` is None")
lattice_ar = self.lattice if self.lattice.ndim == 2 else self.lattice[m_subset]
volume = lattice_to_volume(lattice_ar)
else:
volume = None
lattice_ar = _GetNone()
periodic_ar = np.arange(3, dtype=np.int64)

# Identify the volume occupied by the system
if self.lattice is None:
volume = None
else:
volume = lattice_to_volume(
self.lattice if self.lattice.ndim == 2 else self.lattice[m_subset]
)

# Fill the dataframe with RDF's, averaged over all conformations in this instance
n_mol = len(m_self)
for key, (i, j) in atom_pairs.items():
Expand Down
Binary file modified tests/test_files/test_lattice_2d.npy
Binary file not shown.
Binary file modified tests/test_files/test_lattice_3d.npy
Binary file not shown.
4 changes: 2 additions & 2 deletions tests/test_multi_mol.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from os.path import join
from pathlib import Path
from itertools import chain, combinations
from typing import Mapping, Any, Type, Set, Iterable, Callable
from typing import Mapping, Any, Type, Set, Sequence, Callable

import pytest
import yaml
Expand Down Expand Up @@ -202,7 +202,7 @@ def test_passes(self, kwargs: Mapping[str, Any], filename: str) -> None:
chain([None], combinations("xyz", 1), combinations("xyz", 2), combinations("xyz", 3)),
)
def test_lattice(
self, mol: MultiMolecule, periodic: None | Iterable[Literal["x", "y", "z"]]
self, mol: MultiMolecule, periodic: None | Sequence[Literal["x", "y", "z"]]
) -> None:
assert mol.lattice is not None
rdf = mol.init_rdf(periodic=periodic)
Expand Down

0 comments on commit b6d6286

Please sign in to comment.