Skip to content

Commit

Permalink
Make utility functions partially visible.
Browse files Browse the repository at this point in the history
  • Loading branch information
lohedges committed Oct 31, 2024
1 parent 067091a commit 6969b2b
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 9 deletions.
4 changes: 3 additions & 1 deletion src/somd2/_utils/_ghosts.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
# along with SOMD2. If not, see <http://www.gnu.org/licenses/>.
#####################################################################

__all__ = ["boresch"]

from sire.system import System as _System
from sire.legacy.System import System as _LegacySystem

Expand All @@ -32,7 +34,7 @@
from . import _lam_sym


def _boresch(system, k_hard=100, k_soft=5, optimise_angles=True):
def boresch(system, k_hard=100, k_soft=5, optimise_angles=True):
"""
Apply Boresch modifications to ghost atom bonded terms to avoid non-physical
coupling between the ghost atoms and the physical region.
Expand Down
6 changes: 4 additions & 2 deletions src/somd2/_utils/_somd1.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,16 @@
# along with SOMD2. If not, see <http://www.gnu.org/licenses/>.
#####################################################################

__all__ = ["make_compatible", "apply_pert"]

from sire.system import System as _System
from sire.legacy.System import System as _LegacySystem

import sire.legacy.MM as _SireMM
import sire.legacy.Mol as _SireMol


def _make_compatible(system):
def make_compatible(system):
"""
Makes a perturbation SOMD1 compatible.
Expand Down Expand Up @@ -547,7 +549,7 @@ def _make_compatible(system):
return system


def _apply_pert(system, pert_file):
def apply_pert(system, pert_file):
"""
Helper function to apply a perturbation to a reference system.
Expand Down
12 changes: 6 additions & 6 deletions src/somd2/runner/_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,9 @@ def __init__(self, system, config):
f"Applying perturbation to reference system: {self._config.pert_file}"
)
try:
from .._utils._somd1 import _apply_pert
from .._utils._somd1 import apply_pert

self._system = _apply_pert(self._system, self._config.pert_file)
self._system = apply_pert(self._system, self._config.pert_file)
except Exception as e:
raise IOError(f"Unable to apply perturbation to reference system: {e}")

Expand All @@ -114,12 +114,12 @@ def __init__(self, system, config):

# We're running in SOMD1 compatibility mode.
if self._config.somd1_compatibility:
from .._utils._somd1 import _make_compatible
from .._utils._somd1 import make_compatible

# First, try to make the perturbation SOMD1 compatible.

_logger.info("Applying SOMD1 perturbation compatibility.")
self._system = _make_compatible(self._system)
self._system = make_compatible(self._system)
self._system = _sr.morph.link_to_reference(self._system)

# Next, swap the water topology so that it is in AMBER format.
Expand Down Expand Up @@ -163,9 +163,9 @@ def __init__(self, system, config):
# Apply Boresch modifications to bonded terms involving ghost atoms to
# avoid spurious couplings to the physical system at the end states.
else:
from .._utils._ghosts import _boresch
from .._utils._ghosts import boresch

self._system = _boresch(self._system)
self._system = boresch(self._system)

# Check for a periodic space.
self._has_space = self._check_space()
Expand Down

0 comments on commit 6969b2b

Please sign in to comment.