featomic-torch 0.6.2__py3-none-win_amd64.whl → 0.7.1__py3-none-win_amd64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- featomic/torch/_build_versions.py +1 -1
- featomic/torch/_c_lib.py +4 -2
- featomic/torch/calculator_base.py +1 -3
- featomic/torch/system.py +4 -4
- featomic/torch/torch-2.1/bin/featomic_torch.dll +0 -0
- featomic/torch/torch-2.1/include/featomic/torch/autograd.hpp +1 -1
- featomic/torch/torch-2.1/include/featomic/torch/calculator.hpp +11 -11
- featomic/torch/torch-2.1/include/featomic/torch/system.hpp +5 -5
- featomic/torch/torch-2.1/lib/cmake/featomic_torch/featomic_torch-config-version.cmake +3 -3
- featomic/torch/torch-2.1/lib/cmake/featomic_torch/featomic_torch-config.cmake +5 -1
- featomic/torch/torch-2.1/lib/cmake/featomic_torch/featomic_torch-targets.cmake +2 -2
- featomic/torch/torch-2.1/lib/featomic_torch.lib +0 -0
- featomic/torch/torch-2.2/bin/featomic_torch.dll +0 -0
- featomic/torch/torch-2.2/include/featomic/torch/autograd.hpp +1 -1
- featomic/torch/torch-2.2/include/featomic/torch/calculator.hpp +11 -11
- featomic/torch/torch-2.2/include/featomic/torch/system.hpp +5 -5
- featomic/torch/torch-2.2/lib/cmake/featomic_torch/featomic_torch-config-version.cmake +3 -3
- featomic/torch/torch-2.2/lib/cmake/featomic_torch/featomic_torch-config.cmake +5 -1
- featomic/torch/torch-2.2/lib/cmake/featomic_torch/featomic_torch-targets.cmake +2 -2
- featomic/torch/torch-2.2/lib/featomic_torch.lib +0 -0
- featomic/torch/torch-2.3/bin/featomic_torch.dll +0 -0
- featomic/torch/torch-2.3/include/featomic/torch/autograd.hpp +1 -1
- featomic/torch/torch-2.3/include/featomic/torch/calculator.hpp +11 -11
- featomic/torch/torch-2.3/include/featomic/torch/system.hpp +5 -5
- featomic/torch/torch-2.3/lib/cmake/featomic_torch/featomic_torch-config-version.cmake +3 -3
- featomic/torch/torch-2.3/lib/cmake/featomic_torch/featomic_torch-config.cmake +5 -1
- featomic/torch/torch-2.3/lib/cmake/featomic_torch/featomic_torch-targets.cmake +2 -2
- featomic/torch/torch-2.3/lib/featomic_torch.lib +0 -0
- featomic/torch/torch-2.4/bin/featomic_torch.dll +0 -0
- featomic/torch/torch-2.4/include/featomic/torch/autograd.hpp +1 -1
- featomic/torch/torch-2.4/include/featomic/torch/calculator.hpp +11 -11
- featomic/torch/torch-2.4/include/featomic/torch/system.hpp +5 -5
- featomic/torch/torch-2.4/lib/cmake/featomic_torch/featomic_torch-config-version.cmake +3 -3
- featomic/torch/torch-2.4/lib/cmake/featomic_torch/featomic_torch-config.cmake +5 -1
- featomic/torch/torch-2.4/lib/cmake/featomic_torch/featomic_torch-targets.cmake +2 -2
- featomic/torch/torch-2.4/lib/featomic_torch.lib +0 -0
- featomic/torch/torch-2.5/bin/featomic_torch.dll +0 -0
- featomic/torch/torch-2.5/include/featomic/torch/autograd.hpp +1 -1
- featomic/torch/torch-2.5/include/featomic/torch/calculator.hpp +11 -11
- featomic/torch/torch-2.5/include/featomic/torch/system.hpp +5 -5
- featomic/torch/torch-2.5/lib/cmake/featomic_torch/featomic_torch-config-version.cmake +3 -3
- featomic/torch/torch-2.5/lib/cmake/featomic_torch/featomic_torch-config.cmake +5 -1
- featomic/torch/torch-2.5/lib/cmake/featomic_torch/featomic_torch-targets.cmake +2 -2
- featomic/torch/torch-2.5/lib/featomic_torch.lib +0 -0
- featomic/torch/torch-2.6/bin/featomic_torch.dll +0 -0
- featomic/torch/torch-2.6/include/featomic/torch/autograd.hpp +1 -1
- featomic/torch/torch-2.6/include/featomic/torch/calculator.hpp +11 -11
- featomic/torch/torch-2.6/include/featomic/torch/system.hpp +5 -5
- featomic/torch/torch-2.6/lib/cmake/featomic_torch/featomic_torch-config-version.cmake +3 -3
- featomic/torch/torch-2.6/lib/cmake/featomic_torch/featomic_torch-config.cmake +5 -1
- featomic/torch/torch-2.6/lib/cmake/featomic_torch/featomic_torch-targets.cmake +2 -2
- featomic/torch/torch-2.6/lib/featomic_torch.lib +0 -0
- featomic/torch/torch-2.7/bin/featomic_torch.dll +0 -0
- featomic/torch/torch-2.7/include/featomic/torch/autograd.hpp +1 -1
- featomic/torch/torch-2.7/include/featomic/torch/calculator.hpp +11 -11
- featomic/torch/torch-2.7/include/featomic/torch/system.hpp +5 -5
- featomic/torch/torch-2.7/lib/cmake/featomic_torch/featomic_torch-config-version.cmake +3 -3
- featomic/torch/torch-2.7/lib/cmake/featomic_torch/featomic_torch-config.cmake +6 -2
- featomic/torch/torch-2.7/lib/cmake/featomic_torch/featomic_torch-targets.cmake +2 -2
- featomic/torch/torch-2.7/lib/featomic_torch.lib +0 -0
- featomic/torch/torch-2.8/bin/featomic_torch.dll +0 -0
- featomic/torch/torch-2.8/include/featomic/torch/autograd.hpp +58 -0
- featomic/torch/torch-2.8/include/featomic/torch/calculator.hpp +134 -0
- featomic/torch/torch-2.8/include/featomic/torch/exports.h +43 -0
- featomic/torch/torch-2.8/include/featomic/torch/system.hpp +112 -0
- featomic/torch/torch-2.8/include/featomic/torch.hpp +10 -0
- featomic/torch/torch-2.8/lib/cmake/featomic_torch/featomic_torch-config-version.cmake +85 -0
- featomic/torch/torch-2.8/lib/cmake/featomic_torch/featomic_torch-config.cmake +32 -0
- featomic/torch/torch-2.8/lib/cmake/featomic_torch/featomic_torch-targets-release.cmake +19 -0
- featomic/torch/torch-2.8/lib/cmake/featomic_torch/featomic_torch-targets.cmake +108 -0
- featomic/torch/torch-2.8/lib/featomic_torch.lib +0 -0
- {featomic_torch-0.6.2.dist-info → featomic_torch-0.7.1.dist-info}/METADATA +5 -4
- featomic_torch-0.7.1.dist-info/RECORD +102 -0
- {featomic_torch-0.6.2.dist-info → featomic_torch-0.7.1.dist-info}/WHEEL +1 -1
- featomic_torch-0.6.2.dist-info/RECORD +0 -91
- {featomic_torch-0.6.2.dist-info → featomic_torch-0.7.1.dist-info}/licenses/AUTHORS +0 -0
- {featomic_torch-0.6.2.dist-info → featomic_torch-0.7.1.dist-info}/licenses/LICENSE +0 -0
- {featomic_torch-0.6.2.dist-info → featomic_torch-0.7.1.dist-info}/top_level.txt +0 -0
|
@@ -10,13 +10,13 @@
|
|
|
10
10
|
# The variable CVF_VERSION must be set before calling configure_file().
|
|
11
11
|
|
|
12
12
|
|
|
13
|
-
set(PACKAGE_VERSION "0.
|
|
13
|
+
set(PACKAGE_VERSION "0.7.1")
|
|
14
14
|
|
|
15
15
|
if(PACKAGE_VERSION VERSION_LESS PACKAGE_FIND_VERSION)
|
|
16
16
|
set(PACKAGE_VERSION_COMPATIBLE FALSE)
|
|
17
17
|
else()
|
|
18
18
|
|
|
19
|
-
if("0.
|
|
19
|
+
if("0.7.1" MATCHES "^([0-9]+)\\.([0-9]+)")
|
|
20
20
|
set(CVF_VERSION_MAJOR "${CMAKE_MATCH_1}")
|
|
21
21
|
set(CVF_VERSION_MINOR "${CMAKE_MATCH_2}")
|
|
22
22
|
|
|
@@ -27,7 +27,7 @@ else()
|
|
|
27
27
|
string(REGEX REPLACE "^0+" "" CVF_VERSION_MINOR "${CVF_VERSION_MINOR}")
|
|
28
28
|
endif()
|
|
29
29
|
else()
|
|
30
|
-
set(CVF_VERSION_MAJOR "0.
|
|
30
|
+
set(CVF_VERSION_MAJOR "0.7.1")
|
|
31
31
|
set(CVF_VERSION_MINOR "")
|
|
32
32
|
endif()
|
|
33
33
|
|
|
@@ -5,9 +5,13 @@ set(REQUIRED_FEATOMIC_VERSION 0.6)
|
|
|
5
5
|
find_package(featomic ${REQUIRED_FEATOMIC_VERSION} CONFIG REQUIRED)
|
|
6
6
|
|
|
7
7
|
# use the same version for metatensor_torch as the main CMakeLists.txt
|
|
8
|
-
set(REQUIRED_METATENSOR_TORCH_VERSION 0.
|
|
8
|
+
set(REQUIRED_METATENSOR_TORCH_VERSION 0.8.0)
|
|
9
9
|
find_package(metatensor_torch ${REQUIRED_METATENSOR_TORCH_VERSION} CONFIG REQUIRED)
|
|
10
10
|
|
|
11
|
+
# use the same version for metatomic_torch as the main CMakeLists.txt
|
|
12
|
+
set(REQUIRED_METATOMIC_TORCH_VERSION 0.1)
|
|
13
|
+
find_package(metatomic_torch ${REQUIRED_METATOMIC_TORCH_VERSION} CONFIG REQUIRED)
|
|
14
|
+
|
|
11
15
|
# We can only load metatensorfeatomic_torch with the same minor version of Torch
|
|
12
16
|
# that was used to compile it (and is stored in BUILD_TORCH_VERSION)
|
|
13
17
|
set(BUILD_TORCH_VERSION 2.4.1)
|
|
@@ -7,7 +7,7 @@ if(CMAKE_VERSION VERSION_LESS "2.8.12")
|
|
|
7
7
|
message(FATAL_ERROR "CMake >= 2.8.12 required")
|
|
8
8
|
endif()
|
|
9
9
|
cmake_policy(PUSH)
|
|
10
|
-
cmake_policy(VERSION 2.8.12...3.
|
|
10
|
+
cmake_policy(VERSION 2.8.12...3.31)
|
|
11
11
|
#----------------------------------------------------------------
|
|
12
12
|
# Generated CMake target import file.
|
|
13
13
|
#----------------------------------------------------------------
|
|
@@ -61,7 +61,7 @@ add_library(featomic_torch SHARED IMPORTED)
|
|
|
61
61
|
set_target_properties(featomic_torch PROPERTIES
|
|
62
62
|
INTERFACE_COMPILE_FEATURES "cxx_std_17"
|
|
63
63
|
INTERFACE_INCLUDE_DIRECTORIES "${_IMPORT_PREFIX}/include"
|
|
64
|
-
INTERFACE_LINK_LIBRARIES "torch;metatensor_torch;featomic::shared"
|
|
64
|
+
INTERFACE_LINK_LIBRARIES "torch;metatomic_torch;metatensor_torch;featomic::shared"
|
|
65
65
|
)
|
|
66
66
|
|
|
67
67
|
# Load information for each installed configuration.
|
|
Binary file
|
|
Binary file
|
|
@@ -41,7 +41,7 @@ public:
|
|
|
41
41
|
torch::Tensor all_positions,
|
|
42
42
|
torch::Tensor all_cells,
|
|
43
43
|
torch::IValue systems_start,
|
|
44
|
-
metatensor_torch::
|
|
44
|
+
metatensor_torch::TensorBlock block
|
|
45
45
|
);
|
|
46
46
|
|
|
47
47
|
/// Backward step: get the gradients of some quantity `A` w.r.t. the outputs
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
|
|
6
6
|
#include <featomic.hpp>
|
|
7
7
|
#include <metatensor/torch.hpp>
|
|
8
|
-
#include <
|
|
8
|
+
#include <metatomic/torch.hpp>
|
|
9
9
|
|
|
10
10
|
#include "featomic/torch/exports.h"
|
|
11
11
|
|
|
@@ -61,12 +61,12 @@ public:
|
|
|
61
61
|
void set_selected_keys(torch::IValue selection);
|
|
62
62
|
|
|
63
63
|
/// which gradients to keep in the output of a calculation
|
|
64
|
-
std::vector<std::string> gradients
|
|
64
|
+
std::vector<std::string> gradients;
|
|
65
65
|
|
|
66
66
|
private:
|
|
67
|
-
torch::IValue selected_samples_
|
|
68
|
-
torch::IValue selected_properties_
|
|
69
|
-
torch::IValue selected_keys_
|
|
67
|
+
torch::IValue selected_samples_;
|
|
68
|
+
torch::IValue selected_properties_;
|
|
69
|
+
torch::IValue selected_keys_;
|
|
70
70
|
};
|
|
71
71
|
|
|
72
72
|
/// Custom class holder to store, serialize and load featomic calculators
|
|
@@ -99,9 +99,9 @@ public:
|
|
|
99
99
|
return calculator_.cutoffs();
|
|
100
100
|
}
|
|
101
101
|
|
|
102
|
-
/// Run a calculation for the given `systems` using the given options
|
|
103
|
-
metatensor_torch::
|
|
104
|
-
std::vector<
|
|
102
|
+
/// Run a calculation for the given `systems` using the given options.
|
|
103
|
+
metatensor_torch::TensorMap compute(
|
|
104
|
+
std::vector<metatomic_torch::System> systems,
|
|
105
105
|
TorchCalculatorOptions options = {}
|
|
106
106
|
);
|
|
107
107
|
|
|
@@ -123,9 +123,9 @@ private:
|
|
|
123
123
|
/// contain `"cell"` gradients.
|
|
124
124
|
///
|
|
125
125
|
/// `forward_gradients` controls which gradients are left inside the TensorMap.
|
|
126
|
-
metatensor_torch::
|
|
127
|
-
std::vector<
|
|
128
|
-
metatensor_torch::
|
|
126
|
+
metatensor_torch::TensorMap FEATOMIC_TORCH_EXPORT register_autograd(
|
|
127
|
+
std::vector<metatomic_torch::System> systems,
|
|
128
|
+
metatensor_torch::TensorMap precomputed,
|
|
129
129
|
std::vector<std::string> forward_gradients
|
|
130
130
|
);
|
|
131
131
|
|
|
@@ -7,21 +7,21 @@
|
|
|
7
7
|
#include <torch/script.h>
|
|
8
8
|
|
|
9
9
|
#include <featomic.hpp>
|
|
10
|
-
#include <
|
|
10
|
+
#include <metatomic/torch.hpp>
|
|
11
11
|
|
|
12
12
|
#include "featomic/torch/exports.h"
|
|
13
13
|
|
|
14
14
|
namespace featomic_torch {
|
|
15
15
|
|
|
16
|
-
/// Implementation of `featomic::System` using `
|
|
16
|
+
/// Implementation of `featomic::System` using `metatomic_torch::System` as
|
|
17
17
|
/// backing memory for all the data.
|
|
18
18
|
///
|
|
19
19
|
/// This can either be used with the Rust neighbor list implementation; or a set
|
|
20
20
|
/// of pre-computed neighbor lists can be added to the system.
|
|
21
21
|
class FEATOMIC_TORCH_EXPORT SystemAdapter final: public featomic::System {
|
|
22
22
|
public:
|
|
23
|
-
/// Create a `SystemAdapter` wrapping an existing `
|
|
24
|
-
SystemAdapter(
|
|
23
|
+
/// Create a `SystemAdapter` wrapping an existing `metatomic_torch::System`
|
|
24
|
+
SystemAdapter(metatomic_torch::System system);
|
|
25
25
|
|
|
26
26
|
~SystemAdapter() override = default;
|
|
27
27
|
|
|
@@ -84,7 +84,7 @@ public:
|
|
|
84
84
|
|
|
85
85
|
private:
|
|
86
86
|
// the origin of all the data
|
|
87
|
-
|
|
87
|
+
metatomic_torch::System system_;
|
|
88
88
|
|
|
89
89
|
/// atomic types tensor, contiguous and on CPU
|
|
90
90
|
torch::Tensor types_;
|
|
@@ -10,13 +10,13 @@
|
|
|
10
10
|
# The variable CVF_VERSION must be set before calling configure_file().
|
|
11
11
|
|
|
12
12
|
|
|
13
|
-
set(PACKAGE_VERSION "0.
|
|
13
|
+
set(PACKAGE_VERSION "0.7.1")
|
|
14
14
|
|
|
15
15
|
if(PACKAGE_VERSION VERSION_LESS PACKAGE_FIND_VERSION)
|
|
16
16
|
set(PACKAGE_VERSION_COMPATIBLE FALSE)
|
|
17
17
|
else()
|
|
18
18
|
|
|
19
|
-
if("0.
|
|
19
|
+
if("0.7.1" MATCHES "^([0-9]+)\\.([0-9]+)")
|
|
20
20
|
set(CVF_VERSION_MAJOR "${CMAKE_MATCH_1}")
|
|
21
21
|
set(CVF_VERSION_MINOR "${CMAKE_MATCH_2}")
|
|
22
22
|
|
|
@@ -27,7 +27,7 @@ else()
|
|
|
27
27
|
string(REGEX REPLACE "^0+" "" CVF_VERSION_MINOR "${CVF_VERSION_MINOR}")
|
|
28
28
|
endif()
|
|
29
29
|
else()
|
|
30
|
-
set(CVF_VERSION_MAJOR "0.
|
|
30
|
+
set(CVF_VERSION_MAJOR "0.7.1")
|
|
31
31
|
set(CVF_VERSION_MINOR "")
|
|
32
32
|
endif()
|
|
33
33
|
|
|
@@ -5,9 +5,13 @@ set(REQUIRED_FEATOMIC_VERSION 0.6)
|
|
|
5
5
|
find_package(featomic ${REQUIRED_FEATOMIC_VERSION} CONFIG REQUIRED)
|
|
6
6
|
|
|
7
7
|
# use the same version for metatensor_torch as the main CMakeLists.txt
|
|
8
|
-
set(REQUIRED_METATENSOR_TORCH_VERSION 0.
|
|
8
|
+
set(REQUIRED_METATENSOR_TORCH_VERSION 0.8.0)
|
|
9
9
|
find_package(metatensor_torch ${REQUIRED_METATENSOR_TORCH_VERSION} CONFIG REQUIRED)
|
|
10
10
|
|
|
11
|
+
# use the same version for metatomic_torch as the main CMakeLists.txt
|
|
12
|
+
set(REQUIRED_METATOMIC_TORCH_VERSION 0.1)
|
|
13
|
+
find_package(metatomic_torch ${REQUIRED_METATOMIC_TORCH_VERSION} CONFIG REQUIRED)
|
|
14
|
+
|
|
11
15
|
# We can only load metatensorfeatomic_torch with the same minor version of Torch
|
|
12
16
|
# that was used to compile it (and is stored in BUILD_TORCH_VERSION)
|
|
13
17
|
set(BUILD_TORCH_VERSION 2.5.1)
|
|
@@ -7,7 +7,7 @@ if(CMAKE_VERSION VERSION_LESS "2.8.12")
|
|
|
7
7
|
message(FATAL_ERROR "CMake >= 2.8.12 required")
|
|
8
8
|
endif()
|
|
9
9
|
cmake_policy(PUSH)
|
|
10
|
-
cmake_policy(VERSION 2.8.12...3.
|
|
10
|
+
cmake_policy(VERSION 2.8.12...3.31)
|
|
11
11
|
#----------------------------------------------------------------
|
|
12
12
|
# Generated CMake target import file.
|
|
13
13
|
#----------------------------------------------------------------
|
|
@@ -61,7 +61,7 @@ add_library(featomic_torch SHARED IMPORTED)
|
|
|
61
61
|
set_target_properties(featomic_torch PROPERTIES
|
|
62
62
|
INTERFACE_COMPILE_FEATURES "cxx_std_17"
|
|
63
63
|
INTERFACE_INCLUDE_DIRECTORIES "${_IMPORT_PREFIX}/include"
|
|
64
|
-
INTERFACE_LINK_LIBRARIES "torch;metatensor_torch;featomic::shared"
|
|
64
|
+
INTERFACE_LINK_LIBRARIES "torch;metatomic_torch;metatensor_torch;featomic::shared"
|
|
65
65
|
)
|
|
66
66
|
|
|
67
67
|
# Load information for each installed configuration.
|
|
Binary file
|
|
Binary file
|
|
@@ -41,7 +41,7 @@ public:
|
|
|
41
41
|
torch::Tensor all_positions,
|
|
42
42
|
torch::Tensor all_cells,
|
|
43
43
|
torch::IValue systems_start,
|
|
44
|
-
metatensor_torch::
|
|
44
|
+
metatensor_torch::TensorBlock block
|
|
45
45
|
);
|
|
46
46
|
|
|
47
47
|
/// Backward step: get the gradients of some quantity `A` w.r.t. the outputs
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
|
|
6
6
|
#include <featomic.hpp>
|
|
7
7
|
#include <metatensor/torch.hpp>
|
|
8
|
-
#include <
|
|
8
|
+
#include <metatomic/torch.hpp>
|
|
9
9
|
|
|
10
10
|
#include "featomic/torch/exports.h"
|
|
11
11
|
|
|
@@ -61,12 +61,12 @@ public:
|
|
|
61
61
|
void set_selected_keys(torch::IValue selection);
|
|
62
62
|
|
|
63
63
|
/// which gradients to keep in the output of a calculation
|
|
64
|
-
std::vector<std::string> gradients
|
|
64
|
+
std::vector<std::string> gradients;
|
|
65
65
|
|
|
66
66
|
private:
|
|
67
|
-
torch::IValue selected_samples_
|
|
68
|
-
torch::IValue selected_properties_
|
|
69
|
-
torch::IValue selected_keys_
|
|
67
|
+
torch::IValue selected_samples_;
|
|
68
|
+
torch::IValue selected_properties_;
|
|
69
|
+
torch::IValue selected_keys_;
|
|
70
70
|
};
|
|
71
71
|
|
|
72
72
|
/// Custom class holder to store, serialize and load featomic calculators
|
|
@@ -99,9 +99,9 @@ public:
|
|
|
99
99
|
return calculator_.cutoffs();
|
|
100
100
|
}
|
|
101
101
|
|
|
102
|
-
/// Run a calculation for the given `systems` using the given options
|
|
103
|
-
metatensor_torch::
|
|
104
|
-
std::vector<
|
|
102
|
+
/// Run a calculation for the given `systems` using the given options.
|
|
103
|
+
metatensor_torch::TensorMap compute(
|
|
104
|
+
std::vector<metatomic_torch::System> systems,
|
|
105
105
|
TorchCalculatorOptions options = {}
|
|
106
106
|
);
|
|
107
107
|
|
|
@@ -123,9 +123,9 @@ private:
|
|
|
123
123
|
/// contain `"cell"` gradients.
|
|
124
124
|
///
|
|
125
125
|
/// `forward_gradients` controls which gradients are left inside the TensorMap.
|
|
126
|
-
metatensor_torch::
|
|
127
|
-
std::vector<
|
|
128
|
-
metatensor_torch::
|
|
126
|
+
metatensor_torch::TensorMap FEATOMIC_TORCH_EXPORT register_autograd(
|
|
127
|
+
std::vector<metatomic_torch::System> systems,
|
|
128
|
+
metatensor_torch::TensorMap precomputed,
|
|
129
129
|
std::vector<std::string> forward_gradients
|
|
130
130
|
);
|
|
131
131
|
|
|
@@ -7,21 +7,21 @@
|
|
|
7
7
|
#include <torch/script.h>
|
|
8
8
|
|
|
9
9
|
#include <featomic.hpp>
|
|
10
|
-
#include <
|
|
10
|
+
#include <metatomic/torch.hpp>
|
|
11
11
|
|
|
12
12
|
#include "featomic/torch/exports.h"
|
|
13
13
|
|
|
14
14
|
namespace featomic_torch {
|
|
15
15
|
|
|
16
|
-
/// Implementation of `featomic::System` using `
|
|
16
|
+
/// Implementation of `featomic::System` using `metatomic_torch::System` as
|
|
17
17
|
/// backing memory for all the data.
|
|
18
18
|
///
|
|
19
19
|
/// This can either be used with the Rust neighbor list implementation; or a set
|
|
20
20
|
/// of pre-computed neighbor lists can be added to the system.
|
|
21
21
|
class FEATOMIC_TORCH_EXPORT SystemAdapter final: public featomic::System {
|
|
22
22
|
public:
|
|
23
|
-
/// Create a `SystemAdapter` wrapping an existing `
|
|
24
|
-
SystemAdapter(
|
|
23
|
+
/// Create a `SystemAdapter` wrapping an existing `metatomic_torch::System`
|
|
24
|
+
SystemAdapter(metatomic_torch::System system);
|
|
25
25
|
|
|
26
26
|
~SystemAdapter() override = default;
|
|
27
27
|
|
|
@@ -84,7 +84,7 @@ public:
|
|
|
84
84
|
|
|
85
85
|
private:
|
|
86
86
|
// the origin of all the data
|
|
87
|
-
|
|
87
|
+
metatomic_torch::System system_;
|
|
88
88
|
|
|
89
89
|
/// atomic types tensor, contiguous and on CPU
|
|
90
90
|
torch::Tensor types_;
|
|
@@ -10,13 +10,13 @@
|
|
|
10
10
|
# The variable CVF_VERSION must be set before calling configure_file().
|
|
11
11
|
|
|
12
12
|
|
|
13
|
-
set(PACKAGE_VERSION "0.
|
|
13
|
+
set(PACKAGE_VERSION "0.7.1")
|
|
14
14
|
|
|
15
15
|
if(PACKAGE_VERSION VERSION_LESS PACKAGE_FIND_VERSION)
|
|
16
16
|
set(PACKAGE_VERSION_COMPATIBLE FALSE)
|
|
17
17
|
else()
|
|
18
18
|
|
|
19
|
-
if("0.
|
|
19
|
+
if("0.7.1" MATCHES "^([0-9]+)\\.([0-9]+)")
|
|
20
20
|
set(CVF_VERSION_MAJOR "${CMAKE_MATCH_1}")
|
|
21
21
|
set(CVF_VERSION_MINOR "${CMAKE_MATCH_2}")
|
|
22
22
|
|
|
@@ -27,7 +27,7 @@ else()
|
|
|
27
27
|
string(REGEX REPLACE "^0+" "" CVF_VERSION_MINOR "${CVF_VERSION_MINOR}")
|
|
28
28
|
endif()
|
|
29
29
|
else()
|
|
30
|
-
set(CVF_VERSION_MAJOR "0.
|
|
30
|
+
set(CVF_VERSION_MAJOR "0.7.1")
|
|
31
31
|
set(CVF_VERSION_MINOR "")
|
|
32
32
|
endif()
|
|
33
33
|
|
|
@@ -5,9 +5,13 @@ set(REQUIRED_FEATOMIC_VERSION 0.6)
|
|
|
5
5
|
find_package(featomic ${REQUIRED_FEATOMIC_VERSION} CONFIG REQUIRED)
|
|
6
6
|
|
|
7
7
|
# use the same version for metatensor_torch as the main CMakeLists.txt
|
|
8
|
-
set(REQUIRED_METATENSOR_TORCH_VERSION 0.
|
|
8
|
+
set(REQUIRED_METATENSOR_TORCH_VERSION 0.8.0)
|
|
9
9
|
find_package(metatensor_torch ${REQUIRED_METATENSOR_TORCH_VERSION} CONFIG REQUIRED)
|
|
10
10
|
|
|
11
|
+
# use the same version for metatomic_torch as the main CMakeLists.txt
|
|
12
|
+
set(REQUIRED_METATOMIC_TORCH_VERSION 0.1)
|
|
13
|
+
find_package(metatomic_torch ${REQUIRED_METATOMIC_TORCH_VERSION} CONFIG REQUIRED)
|
|
14
|
+
|
|
11
15
|
# We can only load metatensorfeatomic_torch with the same minor version of Torch
|
|
12
16
|
# that was used to compile it (and is stored in BUILD_TORCH_VERSION)
|
|
13
17
|
set(BUILD_TORCH_VERSION 2.6.0)
|
|
@@ -7,7 +7,7 @@ if(CMAKE_VERSION VERSION_LESS "2.8.12")
|
|
|
7
7
|
message(FATAL_ERROR "CMake >= 2.8.12 required")
|
|
8
8
|
endif()
|
|
9
9
|
cmake_policy(PUSH)
|
|
10
|
-
cmake_policy(VERSION 2.8.12...3.
|
|
10
|
+
cmake_policy(VERSION 2.8.12...3.31)
|
|
11
11
|
#----------------------------------------------------------------
|
|
12
12
|
# Generated CMake target import file.
|
|
13
13
|
#----------------------------------------------------------------
|
|
@@ -61,7 +61,7 @@ add_library(featomic_torch SHARED IMPORTED)
|
|
|
61
61
|
set_target_properties(featomic_torch PROPERTIES
|
|
62
62
|
INTERFACE_COMPILE_FEATURES "cxx_std_17"
|
|
63
63
|
INTERFACE_INCLUDE_DIRECTORIES "${_IMPORT_PREFIX}/include"
|
|
64
|
-
INTERFACE_LINK_LIBRARIES "torch;metatensor_torch;featomic::shared"
|
|
64
|
+
INTERFACE_LINK_LIBRARIES "torch;metatomic_torch;metatensor_torch;featomic::shared"
|
|
65
65
|
)
|
|
66
66
|
|
|
67
67
|
# Load information for each installed configuration.
|
|
Binary file
|
|
Binary file
|
|
@@ -41,7 +41,7 @@ public:
|
|
|
41
41
|
torch::Tensor all_positions,
|
|
42
42
|
torch::Tensor all_cells,
|
|
43
43
|
torch::IValue systems_start,
|
|
44
|
-
metatensor_torch::
|
|
44
|
+
metatensor_torch::TensorBlock block
|
|
45
45
|
);
|
|
46
46
|
|
|
47
47
|
/// Backward step: get the gradients of some quantity `A` w.r.t. the outputs
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
|
|
6
6
|
#include <featomic.hpp>
|
|
7
7
|
#include <metatensor/torch.hpp>
|
|
8
|
-
#include <
|
|
8
|
+
#include <metatomic/torch.hpp>
|
|
9
9
|
|
|
10
10
|
#include "featomic/torch/exports.h"
|
|
11
11
|
|
|
@@ -61,12 +61,12 @@ public:
|
|
|
61
61
|
void set_selected_keys(torch::IValue selection);
|
|
62
62
|
|
|
63
63
|
/// which gradients to keep in the output of a calculation
|
|
64
|
-
std::vector<std::string> gradients
|
|
64
|
+
std::vector<std::string> gradients;
|
|
65
65
|
|
|
66
66
|
private:
|
|
67
|
-
torch::IValue selected_samples_
|
|
68
|
-
torch::IValue selected_properties_
|
|
69
|
-
torch::IValue selected_keys_
|
|
67
|
+
torch::IValue selected_samples_;
|
|
68
|
+
torch::IValue selected_properties_;
|
|
69
|
+
torch::IValue selected_keys_;
|
|
70
70
|
};
|
|
71
71
|
|
|
72
72
|
/// Custom class holder to store, serialize and load featomic calculators
|
|
@@ -99,9 +99,9 @@ public:
|
|
|
99
99
|
return calculator_.cutoffs();
|
|
100
100
|
}
|
|
101
101
|
|
|
102
|
-
/// Run a calculation for the given `systems` using the given options
|
|
103
|
-
metatensor_torch::
|
|
104
|
-
std::vector<
|
|
102
|
+
/// Run a calculation for the given `systems` using the given options.
|
|
103
|
+
metatensor_torch::TensorMap compute(
|
|
104
|
+
std::vector<metatomic_torch::System> systems,
|
|
105
105
|
TorchCalculatorOptions options = {}
|
|
106
106
|
);
|
|
107
107
|
|
|
@@ -123,9 +123,9 @@ private:
|
|
|
123
123
|
/// contain `"cell"` gradients.
|
|
124
124
|
///
|
|
125
125
|
/// `forward_gradients` controls which gradients are left inside the TensorMap.
|
|
126
|
-
metatensor_torch::
|
|
127
|
-
std::vector<
|
|
128
|
-
metatensor_torch::
|
|
126
|
+
metatensor_torch::TensorMap FEATOMIC_TORCH_EXPORT register_autograd(
|
|
127
|
+
std::vector<metatomic_torch::System> systems,
|
|
128
|
+
metatensor_torch::TensorMap precomputed,
|
|
129
129
|
std::vector<std::string> forward_gradients
|
|
130
130
|
);
|
|
131
131
|
|
|
@@ -7,21 +7,21 @@
|
|
|
7
7
|
#include <torch/script.h>
|
|
8
8
|
|
|
9
9
|
#include <featomic.hpp>
|
|
10
|
-
#include <
|
|
10
|
+
#include <metatomic/torch.hpp>
|
|
11
11
|
|
|
12
12
|
#include "featomic/torch/exports.h"
|
|
13
13
|
|
|
14
14
|
namespace featomic_torch {
|
|
15
15
|
|
|
16
|
-
/// Implementation of `featomic::System` using `
|
|
16
|
+
/// Implementation of `featomic::System` using `metatomic_torch::System` as
|
|
17
17
|
/// backing memory for all the data.
|
|
18
18
|
///
|
|
19
19
|
/// This can either be used with the Rust neighbor list implementation; or a set
|
|
20
20
|
/// of pre-computed neighbor lists can be added to the system.
|
|
21
21
|
class FEATOMIC_TORCH_EXPORT SystemAdapter final: public featomic::System {
|
|
22
22
|
public:
|
|
23
|
-
/// Create a `SystemAdapter` wrapping an existing `
|
|
24
|
-
SystemAdapter(
|
|
23
|
+
/// Create a `SystemAdapter` wrapping an existing `metatomic_torch::System`
|
|
24
|
+
SystemAdapter(metatomic_torch::System system);
|
|
25
25
|
|
|
26
26
|
~SystemAdapter() override = default;
|
|
27
27
|
|
|
@@ -84,7 +84,7 @@ public:
|
|
|
84
84
|
|
|
85
85
|
private:
|
|
86
86
|
// the origin of all the data
|
|
87
|
-
|
|
87
|
+
metatomic_torch::System system_;
|
|
88
88
|
|
|
89
89
|
/// atomic types tensor, contiguous and on CPU
|
|
90
90
|
torch::Tensor types_;
|
|
@@ -10,13 +10,13 @@
|
|
|
10
10
|
# The variable CVF_VERSION must be set before calling configure_file().
|
|
11
11
|
|
|
12
12
|
|
|
13
|
-
set(PACKAGE_VERSION "0.
|
|
13
|
+
set(PACKAGE_VERSION "0.7.1")
|
|
14
14
|
|
|
15
15
|
if(PACKAGE_VERSION VERSION_LESS PACKAGE_FIND_VERSION)
|
|
16
16
|
set(PACKAGE_VERSION_COMPATIBLE FALSE)
|
|
17
17
|
else()
|
|
18
18
|
|
|
19
|
-
if("0.
|
|
19
|
+
if("0.7.1" MATCHES "^([0-9]+)\\.([0-9]+)")
|
|
20
20
|
set(CVF_VERSION_MAJOR "${CMAKE_MATCH_1}")
|
|
21
21
|
set(CVF_VERSION_MINOR "${CMAKE_MATCH_2}")
|
|
22
22
|
|
|
@@ -27,7 +27,7 @@ else()
|
|
|
27
27
|
string(REGEX REPLACE "^0+" "" CVF_VERSION_MINOR "${CVF_VERSION_MINOR}")
|
|
28
28
|
endif()
|
|
29
29
|
else()
|
|
30
|
-
set(CVF_VERSION_MAJOR "0.
|
|
30
|
+
set(CVF_VERSION_MAJOR "0.7.1")
|
|
31
31
|
set(CVF_VERSION_MINOR "")
|
|
32
32
|
endif()
|
|
33
33
|
|
|
@@ -5,12 +5,16 @@ set(REQUIRED_FEATOMIC_VERSION 0.6)
|
|
|
5
5
|
find_package(featomic ${REQUIRED_FEATOMIC_VERSION} CONFIG REQUIRED)
|
|
6
6
|
|
|
7
7
|
# use the same version for metatensor_torch as the main CMakeLists.txt
|
|
8
|
-
set(REQUIRED_METATENSOR_TORCH_VERSION 0.
|
|
8
|
+
set(REQUIRED_METATENSOR_TORCH_VERSION 0.8.0)
|
|
9
9
|
find_package(metatensor_torch ${REQUIRED_METATENSOR_TORCH_VERSION} CONFIG REQUIRED)
|
|
10
10
|
|
|
11
|
+
# use the same version for metatomic_torch as the main CMakeLists.txt
|
|
12
|
+
set(REQUIRED_METATOMIC_TORCH_VERSION 0.1)
|
|
13
|
+
find_package(metatomic_torch ${REQUIRED_METATOMIC_TORCH_VERSION} CONFIG REQUIRED)
|
|
14
|
+
|
|
11
15
|
# We can only load metatensorfeatomic_torch with the same minor version of Torch
|
|
12
16
|
# that was used to compile it (and is stored in BUILD_TORCH_VERSION)
|
|
13
|
-
set(BUILD_TORCH_VERSION 2.7.
|
|
17
|
+
set(BUILD_TORCH_VERSION 2.7.1)
|
|
14
18
|
set(BUILD_TORCH_MAJOR 2)
|
|
15
19
|
set(BUILD_TORCH_MINOR 7)
|
|
16
20
|
|
|
@@ -7,7 +7,7 @@ if(CMAKE_VERSION VERSION_LESS "2.8.12")
|
|
|
7
7
|
message(FATAL_ERROR "CMake >= 2.8.12 required")
|
|
8
8
|
endif()
|
|
9
9
|
cmake_policy(PUSH)
|
|
10
|
-
cmake_policy(VERSION 2.8.12...3.
|
|
10
|
+
cmake_policy(VERSION 2.8.12...3.31)
|
|
11
11
|
#----------------------------------------------------------------
|
|
12
12
|
# Generated CMake target import file.
|
|
13
13
|
#----------------------------------------------------------------
|
|
@@ -61,7 +61,7 @@ add_library(featomic_torch SHARED IMPORTED)
|
|
|
61
61
|
set_target_properties(featomic_torch PROPERTIES
|
|
62
62
|
INTERFACE_COMPILE_FEATURES "cxx_std_17"
|
|
63
63
|
INTERFACE_INCLUDE_DIRECTORIES "${_IMPORT_PREFIX}/include"
|
|
64
|
-
INTERFACE_LINK_LIBRARIES "torch;metatensor_torch;featomic::shared"
|
|
64
|
+
INTERFACE_LINK_LIBRARIES "torch;metatomic_torch;metatensor_torch;featomic::shared"
|
|
65
65
|
)
|
|
66
66
|
|
|
67
67
|
# Load information for each installed configuration.
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
// IWYU pragma: private; include "featomic/torch.hpp"
|
|
2
|
+
|
|
3
|
+
#ifndef FEATOMIC_TORCH_AUTOGRAD_HPP
|
|
4
|
+
#define FEATOMIC_TORCH_AUTOGRAD_HPP
|
|
5
|
+
|
|
6
|
+
#include <ATen/core/ivalue.h>
|
|
7
|
+
#include <torch/autograd.h>
|
|
8
|
+
|
|
9
|
+
#include <metatensor/torch.hpp>
|
|
10
|
+
|
|
11
|
+
#include "featomic/torch/exports.h"
|
|
12
|
+
|
|
13
|
+
namespace featomic_torch {
|
|
14
|
+
|
|
15
|
+
/// Custom torch::autograd::Function integrating featomic with torch autograd.
|
|
16
|
+
///
|
|
17
|
+
/// This is a bit more complex than your typical autograd because there is some
|
|
18
|
+
/// impedance mismatch between featomic and torch. Most of it should be taken
|
|
19
|
+
/// care of by the `compute` function below.
|
|
20
|
+
class FEATOMIC_TORCH_EXPORT FeatomicAutograd: public torch::autograd::Function<FeatomicAutograd> {
|
|
21
|
+
public:
|
|
22
|
+
/// Register a pseudo node in Torch's computational graph going from
|
|
23
|
+
/// `all_positions` and `all_cell` to the values in `block`; using the
|
|
24
|
+
/// pre-computed gradients in `block`.
|
|
25
|
+
///
|
|
26
|
+
/// If `all_positions.requires_grad` is True, `block` must have a
|
|
27
|
+
/// `"positions"` gradient; and `systems_start` should contain the index of
|
|
28
|
+
/// the first atom of each system in `all_positions`.
|
|
29
|
+
///
|
|
30
|
+
/// If `all_cells.requires_grad` is True, `block` must have a `"cell"`
|
|
31
|
+
/// gradient, and the block samples must contain a `"stucture"` dimension.
|
|
32
|
+
///
|
|
33
|
+
/// This function returns a vector with one element corresponding to
|
|
34
|
+
/// `block.values`, which should be left unused. It is only there to make
|
|
35
|
+
/// sure torch registers a `grad_fn` for the tensors stored inside the
|
|
36
|
+
/// TensorBlock (the values in the TensorBlock are references to the ones
|
|
37
|
+
/// returned by this function, so when a `grad_fn` is added to one, it is
|
|
38
|
+
/// also added to the other).
|
|
39
|
+
static std::vector<torch::Tensor> forward(
|
|
40
|
+
torch::autograd::AutogradContext *ctx,
|
|
41
|
+
torch::Tensor all_positions,
|
|
42
|
+
torch::Tensor all_cells,
|
|
43
|
+
torch::IValue systems_start,
|
|
44
|
+
metatensor_torch::TensorBlock block
|
|
45
|
+
);
|
|
46
|
+
|
|
47
|
+
/// Backward step: get the gradients of some quantity `A` w.r.t. the outputs
|
|
48
|
+
/// of `forward`; and compute the gradients of the same quantity `A` w.r.t.
|
|
49
|
+
/// the inputs of `forward` (i.e. cell and positions).
|
|
50
|
+
static std::vector<torch::Tensor> backward(
|
|
51
|
+
torch::autograd::AutogradContext *ctx,
|
|
52
|
+
std::vector<torch::Tensor> grad_outputs
|
|
53
|
+
);
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
#endif
|