diff --git a/python/lammps/core.py b/python/lammps/core.py index 788da0116f..6eba38b1e6 100644 --- a/python/lammps/core.py +++ b/python/lammps/core.py @@ -18,12 +18,20 @@ from __future__ import print_function import os import sys -from ctypes import * # lgtm [py/polluting-import] -from os.path import dirname,abspath,join +from ctypes import CDLL, POINTER, RTLD_GLOBAL, CFUNCTYPE, py_object, byref, cast, sizeof, \ + create_string_buffer, c_int, c_int32, c_int64, c_double, c_void_p, c_char_p, pythonapi +from os.path import dirname, abspath, join from inspect import getsourcefile -from .constants import * # lgtm [py/polluting-import] -from .data import * # lgtm [py/polluting-import] +from lammps.constants import LAMMPS_AUTODETECT, LAMMPS_STRING, \ + LAMMPS_INT, LAMMPS_INT_2D, LAMMPS_DOUBLE, LAMMPS_DOUBLE_2D, LAMMPS_INT64, LAMMPS_INT64_2D, \ + LMP_STYLE_GLOBAL, LMP_STYLE_ATOM, LMP_STYLE_LOCAL, \ + LMP_TYPE_SCALAR, LMP_TYPE_VECTOR, LMP_TYPE_ARRAY, \ + LMP_SIZE_VECTOR, LMP_SIZE_ROWS, LMP_SIZE_COLS, \ + LMP_VAR_EQUAL, LMP_VAR_ATOM, LMP_VAR_VECTOR, LMP_VAR_STRING, \ + get_ctypes_int + +from lammps.data import NeighList # ------------------------------------------------------------------------- @@ -2258,7 +2266,6 @@ class lammps(object): :param caller: reference to some object passed to the callback function :type: object, optional """ - import numpy as np def callback_wrapper(caller, ntimestep, nlocal, tag_ptr, x_ptr, fext_ptr): tag = self.numpy.iarray(self.c_tagint, tag_ptr, nlocal, 1) diff --git a/python/lammps/numpy_wrapper.py b/python/lammps/numpy_wrapper.py index add4268b52..6e8c7ebcd2 100644 --- a/python/lammps/numpy_wrapper.py +++ b/python/lammps/numpy_wrapper.py @@ -18,11 +18,15 @@ from ctypes import POINTER, c_void_p, c_char_p, c_double, c_int, c_int32, c_int64, cast +from .constants import LAMMPS_AUTODETECT, LAMMPS_INT, LAMMPS_INT_2D, \ + LAMMPS_DOUBLE, LAMMPS_DOUBLE_2D, LAMMPS_INT64, LAMMPS_INT64_2D, \ + LMP_STYLE_GLOBAL, LMP_STYLE_ATOM, LMP_STYLE_LOCAL, \ + LMP_TYPE_SCALAR, LMP_TYPE_VECTOR, LMP_TYPE_ARRAY, \ + LMP_SIZE_VECTOR, LMP_SIZE_ROWS, LMP_SIZE_COLS, \ + LMP_VAR_EQUAL, LMP_VAR_ATOM, LMP_VAR_VECTOR, LMP_VAR_STRING -from .constants import * # lgtm [py/polluting-import] from .data import NeighList - class numpy_wrapper: """lammps API NumPy Wrapper diff --git a/python/lammps/pylammps.py b/python/lammps/pylammps.py index 9087305ba3..1f5a1a0db9 100644 --- a/python/lammps/pylammps.py +++ b/python/lammps/pylammps.py @@ -27,8 +27,8 @@ import sys import tempfile from collections import namedtuple -from .core import lammps -from .constants import * # lgtm [py/polluting-import] +from lammps.core import lammps +from lammps.constants import LMP_VAR_EQUAL, LMP_VAR_ATOM, LMP_VAR_VECTOR, LMP_VAR_STRING # ------------------------------------------------------------------------- diff --git a/src/ML-IAP/mliap_descriptor.cpp b/src/ML-IAP/mliap_descriptor.cpp index 34f81c3902..b8acd6329e 100644 --- a/src/ML-IAP/mliap_descriptor.cpp +++ b/src/ML-IAP/mliap_descriptor.cpp @@ -28,6 +28,7 @@ MLIAPDescriptor::MLIAPDescriptor(LAMMPS *lmp) : cutghost(nullptr), radelem(nullptr), wjelem(nullptr) { cutmax = 0.0; + allocated_elements = 0; } /* ---------------------------------------------------------------------- */ diff --git a/src/ML-IAP/mliap_descriptor_ace.cpp b/src/ML-IAP/mliap_descriptor_ace.cpp index fd059b822b..b13699193c 100644 --- a/src/ML-IAP/mliap_descriptor_ace.cpp +++ b/src/ML-IAP/mliap_descriptor_ace.cpp @@ -57,7 +57,6 @@ MLIAPDescriptorACE::MLIAPDescriptorACE(LAMMPS *_lmp, char *yacefilename) : { acemlimpl = new ACE_ML_impl; - allocated_elements = 0; //read in file with CG coefficients or c_tilde coefficients ctilde_file = yacefilename; delete acemlimpl->basis_set;