Skip to content

Commit

Permalink
TODO
Browse files Browse the repository at this point in the history
  • Loading branch information
jngrad committed Aug 22, 2022
1 parent 499526d commit ca9f833
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 16 deletions.
1 change: 1 addition & 0 deletions src/core/interactions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ bool long_range_interactions_sanity_checks() {
return false;
}

// TODO: remove this function
void mpi_bcast_ia_params_local(int i, int j) {
boost::mpi::broadcast(comm_cart, get_ia_param(i, j), 0);
on_short_range_ia_change();
Expand Down
4 changes: 2 additions & 2 deletions src/core/nonbonded_interactions/lj.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@
#include "lj.hpp"

#ifdef LENNARD_JONES
#include "interactions.hpp"
#include "interactions.hpp" // TODO: remove include
#include "nonbonded_interaction_data.hpp"

#include <utils/constants.hpp>
#include <utils/constants.hpp> // TODO: remove include
#include <utils/math/int_pow.hpp>

#include <algorithm>
Expand Down
1 change: 1 addition & 0 deletions src/core/nonbonded_interactions/lj.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
#include <utils/math/int_pow.hpp>
#include <utils/math/sqr.hpp>

// TODO: remove function
int lennard_jones_set_params(int part_type_a, int part_type_b, double eps,
double sig, double cut, double shift,
double offset, double min);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
* variables
*****************************************/
int max_seen_particle_type = 0;
std::vector<IA_parameters> old_nonbonded_ia_params;
std::vector<IA_parameters> old_nonbonded_ia_params; // TODO: delete
std::vector<std::shared_ptr<IA_parameters>> nonbonded_ia_params;

/** Minimal global interaction cutoff. Particles with a distance
Expand Down Expand Up @@ -230,7 +230,7 @@ double maximal_cutoff_nonbonded() {
return max_cut_nonbonded;
}

void reset_ia_params() {
void reset_ia_params() { // TODO: delete
boost::fill(old_nonbonded_ia_params, IA_parameters{});
mpi_bcast_all_ia_params();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ struct IA_parameters {
#endif
};

extern std::vector<IA_parameters> old_nonbonded_ia_params;
extern std::vector<IA_parameters> old_nonbonded_ia_params; // TODO: delete
extern std::vector<std::shared_ptr<IA_parameters>> nonbonded_ia_params;

/** Maximal particle type seen so far. */
Expand Down Expand Up @@ -323,11 +323,11 @@ IA_parameters *get_ia_param_safe(int i, int j);

/** @brief Get the state of all non-bonded interactions.
*/
std::string ia_params_get_state();
std::string ia_params_get_state(); // TODO: delete

/** @brief Set the state of all non-bonded interactions.
*/
void ia_params_set_state(std::string const &);
void ia_params_set_state(std::string const &); // TODO: delete

void mpi_realloc_ia_params_local(int new_size);

Expand All @@ -343,7 +343,7 @@ void make_particle_type_exist_local(int type);
/**
* @brief Reset all interaction parameters to their defaults.
*/
void reset_ia_params();
void reset_ia_params(); // TODO: delete

/** Check if a non-bonded interaction is defined */
inline bool checkIfInteraction(IA_parameters const &data) {
Expand Down
4 changes: 2 additions & 2 deletions src/core/nonbonded_interactions/wca.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@
#include "wca.hpp"

#ifdef WCA
#include "interactions.hpp"
#include "interactions.hpp" // TODO: remove include
#include "nonbonded_interaction_data.hpp"

#include <utils/constants.hpp>
#include <utils/constants.hpp> // TODO: remove include

#include <cmath>
#include <stdexcept>
Expand Down
1 change: 1 addition & 0 deletions src/core/nonbonded_interactions/wca.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
#include <utils/math/int_pow.hpp>
#include <utils/math/sqr.hpp>

// TODO: remove function
int wca_set_params(int part_type_a, int part_type_b, double eps, double sig);

/** Calculate WCA force factor */
Expand Down
14 changes: 8 additions & 6 deletions src/python/espressomd/interactions.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,16 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
from libcpp.string cimport string
from libcpp.string cimport string # TODO: delete include
cimport cpython.object
import collections
import collections # TODO: delete include

include "myconfig.pxi"
from . import utils
from .script_interface import ScriptObjectMap, ScriptInterfaceHelper, script_interface_register


# TODO: delete class
cdef class NonBondedInteraction:
"""
Represents an instance of a non-bonded interaction, such as Lennard-Jones.
Expand Down Expand Up @@ -206,6 +207,7 @@ cdef class NonBondedInteraction:
"Subclasses of NonBondedInteraction must define the required_keys() method.")


# TODO: rename class to NonBondedInteraction
class NewNonBondedInteraction(ScriptInterfaceHelper):
"""
Represents an instance of a non-bonded interaction, such as Lennard-Jones.
Expand Down Expand Up @@ -1647,7 +1649,7 @@ class NonBondedInteractions(ScriptInterfaceHelper):
self.call_method("insert", key=key, object=value)

def __getstate__(self):
cdef string core_state = ia_params_get_state()
cdef string core_state = ia_params_get_state() # TODO: delete line
n_types = self.call_method("get_n_types")
state = []
for i in range(n_types):
Expand All @@ -1664,14 +1666,14 @@ class NonBondedInteractions(ScriptInterfaceHelper):
obj = NonBondedInteractionHandle(_types=types, **objects)
self.call_method("insert", key=types, object=obj)

def reset(self):
def reset(self): # TODO: delete this method and uncomment _so_bind_methods
reset_ia_params()
self.call_method("reset")

@classmethod
def _restore_object(cls, so_callback, so_callback_args, state):
cdef string core_state = state["core_state"]
ia_params_set_state(core_state)
cdef string core_state = state["core_state"] # TODO: delete line
ia_params_set_state(core_state) # TODO: delete line
so = so_callback(*so_callback_args)
so.__setstate__(state)
return so
Expand Down

0 comments on commit ca9f833

Please sign in to comment.