Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove custom action methods #1699

Merged
merged 3 commits into from
Jan 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions hoomd/custom/custom_operation.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,9 +216,6 @@ def __init__(self, trigger, *args, **kwargs):
key: value.update_cls(self.__class__)
for key, value in self._export_dict.items()
}
# Wrap action act method with operation appropriate one.
wrapping_method = getattr(self, self._operation_func).__func__
setattr(wrapping_method, "__doc__", self._action.act.__doc__)

def __dir__(self):
"""Expose all attributes for dynamic querying in notebooks and IDEs."""
Expand Down
31 changes: 0 additions & 31 deletions hoomd/md/pytest/test_hdf5.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,37 +88,6 @@ def test_write(create_md_sim, tmp_path):
assert np.allclose(fh[key], kinetic_energy_list)


def test_write_method(create_md_sim, tmp_path):
filename = tmp_path / "temporary_test_file.h5"

sim = create_md_sim
thermo = hoomd.md.compute.ThermodynamicQuantities(filter=hoomd.filter.All())
sim.operations.computes.append(thermo)

logger = hoomd.logging.Logger(["scalar", "particle", "sequence"])
logger.add(thermo)

# Writer should never run on its own.
hdf5_writer = hoomd.write.HDF5Log(filename=filename,
trigger=hoomd.trigger.Periodic(100),
mode='w',
logger=logger)
sim.operations.writers.append(hdf5_writer)

kinetic_energy_list = []
for _ in range(5):
sim.run(1)
kinetic_energy_list.append(thermo.kinetic_energy)
hdf5_writer.write()

hdf5_writer.flush()

if sim.device.communicator.rank == 0:
key = 'hoomd-data/md/compute/ThermodynamicQuantities/kinetic_energy'
with h5py.File(filename, mode='r') as fh:
assert np.allclose(fh[key], kinetic_energy_list)


def test_mode(tmp_path, create_md_sim):
logger = hoomd.logging.Logger(categories=['scalar'])
sim = create_md_sim
Expand Down
12 changes: 0 additions & 12 deletions hoomd/tune/custom_tuner.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ def act(self, timestep):

from hoomd.custom import (CustomOperation, _InternalCustomOperation, Action)
from hoomd.operation import Tuner
import warnings


class _TunerProperty:
Expand Down Expand Up @@ -72,14 +71,3 @@ class _InternalCustomTuner(_InternalCustomOperation, Tuner):
_cpp_list_name = 'tuners'
_cpp_class_name = 'PythonTuner'
_operation_func = "tune"

def tune(self, timestep):
return self._action.act(timestep)
"""
.. deprecated:: 4.5.0

Use `Simulation` to call the operation.
"""
warnings.warn(
"`_InternalCustomTuner.tune` is deprecated,"
"use `Simulation` to call the operation.", FutureWarning)
12 changes: 0 additions & 12 deletions hoomd/update/custom_updater.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ def act(self, timestep):

from hoomd.custom import (CustomOperation, _InternalCustomOperation, Action)
from hoomd.operation import Updater
import warnings


class _UpdaterProperty:
Expand Down Expand Up @@ -71,14 +70,3 @@ class _InternalCustomUpdater(_InternalCustomOperation, Updater):
_cpp_list_name = 'updaters'
_cpp_class_name = 'PythonUpdater'
_operation_func = "update"

def update(self, timestep):
return self._action.act(timestep)
"""
.. deprecated:: 4.5.0

Use `Simulation` to call the operation.
"""
warnings.warn(
"`_InternalCustomUpdater.update` is deprecated,"
"use `Simulation` to call the operation.", FutureWarning)
12 changes: 0 additions & 12 deletions hoomd/write/custom_writer.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ def act(self, timestep):

from hoomd.custom import (CustomOperation, _InternalCustomOperation, Action)
from hoomd.operation import Writer
import warnings


class _WriterProperty:
Expand Down Expand Up @@ -72,14 +71,3 @@ class _InternalCustomWriter(_InternalCustomOperation, Writer):
_cpp_list_name = 'analyzers'
_cpp_class_name = 'PythonAnalyzer'
_operation_func = "write"

def write(self, timestep):
return self._action.act(timestep)
"""
.. deprecated:: 4.5.0

Use `Simulation` to call the operation.
"""
warnings.warn(
"`_InternalCustomWriter.write` is deprecated,"
"use `Simulation` to call the operation.", FutureWarning)
26 changes: 0 additions & 26 deletions hoomd/write/hdf5.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@

from hoomd.write.custom_writer import _InternalCustomWriter
from hoomd.data.parameterdicts import ParameterDict
import warnings

try:
import h5py
Expand Down Expand Up @@ -332,30 +331,5 @@ class HDF5Log(_InternalCustomWriter):
_internal_class = _HDF5LogInternal
_wrap_methods = ("flush",)

def write(self, timestep=None):
"""Write out data to the HDF5 file.

Writes out a frame at the current timestep from the composed logger.

Warning:
This may not be able to write out quantities which require the
pressure tensor, rotational kinetic energy, or external field
virial.

.. rubric:: Example:

.. code-block:: python

hdf5_writer.write()

.. deprecated:: 4.5.0

Use `Simulation` to call the operation.
"""
warnings.warn(
"`HDF5Log.writer` is deprecated,"
"use `Simulation` to call the operation.", FutureWarning)
self._action.act(timestep)


__all__ = ["HDF5Log"]
14 changes: 14 additions & 0 deletions sphinx-doc/migrating.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,20 @@
Migrating to the latest version
===============================

Migrating to HOOMD v5
---------------------

Removed functionalities
^^^^^^^^^^^^^^^^^^^^^^^

HOOMD-blue v5 removes functionalities deprecated in v4.x releases:

* ``_InternalCustomUpdater.update``
* ``_InternalCustomTuner.tune``
* ``_InternalCustomWriter.write``
* ``HDF5Log.write``


Migrating to HOOMD v4
---------------------

Expand Down