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

Changes for lammps integration #367

Draft
wants to merge 29 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
dcc175b
first changes in lammps integration
agoscinski Jun 28, 2021
e5bff59
removed default march; removed empty emplace_backs() in sph exp; get_…
agoscinski Jun 28, 2021
15ee393
added atom tags information to structure manager lammps; usage of ato…
agoscinski Jun 29, 2021
31db529
small cleanup
agoscinski Jun 29, 2021
3212124
fix some simple compile errors; checked representation in example
agoscinski Jul 1, 2021
a95b712
add debug cout in krr
agoscinski Aug 12, 2021
dbb2a91
debug cout; make neighbourlist public for easily debugable purposes
agoscinski Aug 12, 2021
76f3f79
remove debug couts; switch lammps to full neighbourlist
agoscinski Aug 14, 2021
993a82f
changed rascal model format to more consistently contain cpp format o…
agoscinski Aug 13, 2021
5402dce
add debug couts
agoscinski Aug 14, 2021
9f230d8
add h2 model and data; and half neighbourlist code
agoscinski Aug 14, 2021
1a579d2
start fix for ghost atom positions
agoscinski Aug 14, 2021
c9d74c9
fix positions of ghost atoms
agoscinski Aug 15, 2021
ab0eaf0
second fix ghost positions; add cell information to structure manager…
agoscinski Aug 15, 2021
6e7668c
added get_cell_volume
agoscinski Aug 15, 2021
b476069
remove assert, which is wrong for domain decomposition; renaming; com…
agoscinski Aug 16, 2021
5d86ab9
fix typo
agoscinski Aug 16, 2021
29ecd0a
add debug prints
agoscinski Aug 19, 2021
fc63944
change representation name to hashed value because of segmentation fault
agoscinski Aug 19, 2021
3c14377
add draft for format changes for storing and loading representation a…
agoscinski Aug 19, 2021
0d59adc
remove debug prints
agoscinski Aug 23, 2021
a753e54
stable h2 and h128 tested
agoscinski Aug 26, 2021
d19213a
make CPU information easier to grep
agoscinski Aug 27, 2021
d1de43e
atom type is now also accesed by atom tag and not cluster index fixin…
agoscinski Aug 27, 2021
a60b193
compute_sparse_kernel_gradients supports both storage types of partia…
agoscinski Sep 1, 2021
86a312e
imporve doc of get_atom_j
agoscinski Sep 1, 2021
8ebfe0c
add TODO
agoscinski Sep 1, 2021
a33ff8e
Download wigxjpf from a github mirror instead of http://fy.chalmers.s…
Luthaf Jun 13, 2022
879cb59
add cpp information to rascal model json
agoscinski Aug 24, 2021
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
10 changes: 5 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,9 @@ option(BUILD_SANDBOX "If on, builds the sandbox" OFF)

set(INSTALL_PATH "" CACHE STRING "Path to install the libraries")

SET(TYPE_ARCHITECTURE "native" CACHE STRING
"Choose the type of architecture to compile to in release mode."
)
#SET(TYPE_ARCHITECTURE "native" CACHE STRING
# "Choose the type of architecture to compile to in release mode."
#)

########## COMPILATION FLAGS ##########
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Weffc++ -Wno-non-virtual-dtor")
Expand All @@ -93,8 +93,8 @@ if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR

# Add -march=${TYPE_ARCHITECTURE} (-march=native by default) to the release
# build flags
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -march=${TYPE_ARCHITECTURE}")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -march=${TYPE_ARCHITECTURE}")
#set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -march=${TYPE_ARCHITECTURE}")
#set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -march=${TYPE_ARCHITECTURE}")

set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO} -march=${TYPE_ARCHITECTURE}")
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -march=${TYPE_ARCHITECTURE}")
Expand Down
15 changes: 14 additions & 1 deletion bindings/rascal/models/kernels.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,11 +105,24 @@ def _get_init_params(self):
init_params.update(**self._kwargs)
return init_params

# I think not needed
def _set_data(self, data):
super()._set_data(data)
# allows to load deprecated models
if "cpp_kernel" in data.keys():
self._kernel = self._kernel.from_dict(data["cpp_kernel"])
else:
print(
"WARNING: a deprecated model was loaded. Key 'cpp_kernel' "
"was not found in model. Please dump and reload the model "
"to update it. The model parameters will not change, only "
"the format."
)

def _get_data(self):
return super()._get_data()
data = super()._get_data()
data.update(cpp_kernel=self._kernel.to_dict())
return data

def __call__(self, X, Y=None, grad=(False, False), compute_neg_stress=False):
"""
Expand Down
10 changes: 8 additions & 2 deletions bindings/rascal/models/krr.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@ def predict_stress(self, managers, KNM=None):

if KNM is None:
rep = self.kernel._representation
# TODO(alex) check if weights need shape (1,-1), but it should not really matter
neg_stress = compute_sparse_kernel_neg_stress(
rep,
self.kernel._kernel,
Expand All @@ -209,8 +210,13 @@ def predict_stress(self, managers, KNM=None):

return -neg_stress

def get_weights(self):
return self.weights
@property
def weights(self):
return self._weights

@weights.setter
def weights(self, weights):
self._weights = weights.reshape(-1)

def _get_init_params(self):
init_params = dict(
Expand Down
16 changes: 15 additions & 1 deletion bindings/rascal/representations/spherical_covariants.py
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,20 @@ def _get_init_params(self):

def _set_data(self, data):
super()._set_data(data)
# allows to load deprecated models
if "cpp_representation" in data.keys():
self._representation = self._representation.from_dict(
data["cpp_representation"]
)
else:
print(
"WARNING: a deprecated model was loaded. Key "
"'cpp_representation' was not found in model. Please dump and "
"reload the model to update it. The model parameters will not "
"change, only the format."
)

def _get_data(self):
return super()._get_data()
data = super()._get_data()
data.update(cpp_representation=self._representation.to_dict())
return data
16 changes: 15 additions & 1 deletion bindings/rascal/representations/spherical_expansion.py
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,20 @@ def _get_init_params(self):

def _set_data(self, data):
super()._set_data(data)
# allows to load deprecated models
if "cpp_representation" in data.keys():
self._representation = self._representation.from_dict(
data["cpp_representation"]
)
else:
print(
"WARNING: a deprecated model was loaded. Key "
"'cpp_representation' was not found in model. Please dump and "
"reload the model to update it. The model parameters will not "
"change, only the format."
)

def _get_data(self):
return super()._get_data()
data = super()._get_data()
data.update(cpp_representation=self._representation.to_dict())
return data
17 changes: 16 additions & 1 deletion bindings/rascal/representations/spherical_invariants.py
Original file line number Diff line number Diff line change
Expand Up @@ -475,8 +475,23 @@ def _get_init_params(self):
]
return init_params

# a cpp readable dict/json is dumped into "data" of the representation dict/json
def _set_data(self, data):
super()._set_data(data)
# allows to load deprecated models
if "cpp_representation" in data.keys():
self._representation = self._representation.from_dict(
data["cpp_representation"]
)
else:
print(
"WARNING: a deprecated model was loaded. Key "
"'cpp_representation' was not found in model. Please dump and "
"reload the model to update it. The model parameters will not "
"change, only the format."
)

def _get_data(self):
return super()._get_data()
data = super()._get_data()
data.update(cpp_representation=self._representation.to_dict())
return data
2 changes: 1 addition & 1 deletion cmake/wigxjpf.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
set(SOURCE_DIR "${_wigxjpf_external_dir}/${package}")

download_external_project(wigxjpf
URL "http://fy.chalmers.se/subatom/wigxjpf/wigxjpf-${_wigxjpf_version}.tar.gz"
URL "https://github.com/lab-cosmo/wigxjpf/archive/refs/tags/${_wigxjpf_version}.tar.gz"
BACKEND NONE
THIRD_PARTY_SRC_DIR ${_wigxjpf_external_dir}
BUILD_COMMAND "make -C ${SOURCE_DIR}"
Expand Down
Loading