featomic-torch 0.6.2__py3-none-win_amd64.whl → 0.7.0__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/_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/calculator.hpp +8 -8
- 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 +1 -1
- 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/calculator.hpp +8 -8
- 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 +1 -1
- 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/calculator.hpp +8 -8
- 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 +1 -1
- 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/calculator.hpp +8 -8
- 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 +1 -1
- 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/calculator.hpp +8 -8
- 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 +1 -1
- 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/calculator.hpp +8 -8
- 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 +1 -1
- 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/calculator.hpp +8 -8
- 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 +5 -1
- featomic/torch/torch-2.7/lib/cmake/featomic_torch/featomic_torch-targets.cmake +1 -1
- featomic/torch/torch-2.7/lib/featomic_torch.lib +0 -0
- {featomic_torch-0.6.2.dist-info → featomic_torch-0.7.0.dist-info}/METADATA +2 -1
- {featomic_torch-0.6.2.dist-info → featomic_torch-0.7.0.dist-info}/RECORD +58 -58
- {featomic_torch-0.6.2.dist-info → featomic_torch-0.7.0.dist-info}/WHEEL +0 -0
- {featomic_torch-0.6.2.dist-info → featomic_torch-0.7.0.dist-info}/licenses/AUTHORS +0 -0
- {featomic_torch-0.6.2.dist-info → featomic_torch-0.7.0.dist-info}/licenses/LICENSE +0 -0
- {featomic_torch-0.6.2.dist-info → featomic_torch-0.7.0.dist-info}/top_level.txt +0 -0
featomic/torch/_c_lib.py
CHANGED
|
@@ -5,6 +5,7 @@ import sys
|
|
|
5
5
|
from collections import namedtuple
|
|
6
6
|
|
|
7
7
|
import metatensor.torch
|
|
8
|
+
import metatomic.torch
|
|
8
9
|
import torch
|
|
9
10
|
|
|
10
11
|
import featomic
|
|
@@ -128,9 +129,10 @@ def _check_dll(path):
|
|
|
128
129
|
|
|
129
130
|
|
|
130
131
|
def _load_library():
|
|
131
|
-
# Load
|
|
132
|
-
#
|
|
132
|
+
# Load shared library for dependencies in the process first, to ensure the
|
|
133
|
+
# featomic_torch shared library can find them
|
|
133
134
|
metatensor.torch._c_lib._load_library()
|
|
135
|
+
metatomic.torch._c_lib._load_library()
|
|
134
136
|
|
|
135
137
|
featomic._c_lib._get_library()
|
|
136
138
|
|
|
@@ -2,9 +2,7 @@ from typing import List, Optional, Union
|
|
|
2
2
|
|
|
3
3
|
import torch
|
|
4
4
|
from metatensor.torch import Labels, TensorMap
|
|
5
|
-
from
|
|
6
|
-
|
|
7
|
-
from .system import System
|
|
5
|
+
from metatomic.torch import NeighborListOptions, System
|
|
8
6
|
|
|
9
7
|
|
|
10
8
|
CalculatorHolder = torch.classes.featomic.CalculatorHolder
|
featomic/torch/system.py
CHANGED
|
@@ -2,7 +2,7 @@ from typing import List, Optional, Sequence, overload
|
|
|
2
2
|
|
|
3
3
|
import numpy as np
|
|
4
4
|
import torch
|
|
5
|
-
from
|
|
5
|
+
from metatomic.torch import System
|
|
6
6
|
|
|
7
7
|
import featomic
|
|
8
8
|
|
|
@@ -31,9 +31,9 @@ def systems_to_torch(
|
|
|
31
31
|
cell_requires_grad=None,
|
|
32
32
|
) -> List[System]:
|
|
33
33
|
"""
|
|
34
|
-
Convert a arbitrary system to
|
|
35
|
-
:py:class:`
|
|
36
|
-
|
|
34
|
+
Convert a arbitrary system to :py:class:`metatomic.torch.System`, putting all the
|
|
35
|
+
data in :py:class:`torch.Tensor` and making the overall object compatible with
|
|
36
|
+
TorchScript.
|
|
37
37
|
|
|
38
38
|
:param system: any system supported by featomic. If this is an iterable of system,
|
|
39
39
|
this function converts them all and returns a list of converted systems.
|
|
Binary file
|
|
@@ -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
|
|
102
|
+
/// Run a calculation for the given `systems` using the given options.
|
|
103
103
|
metatensor_torch::TorchTensorMap compute(
|
|
104
|
-
std::vector<
|
|
104
|
+
std::vector<metatomic_torch::System> systems,
|
|
105
105
|
TorchCalculatorOptions options = {}
|
|
106
106
|
);
|
|
107
107
|
|
|
@@ -124,7 +124,7 @@ private:
|
|
|
124
124
|
///
|
|
125
125
|
/// `forward_gradients` controls which gradients are left inside the TensorMap.
|
|
126
126
|
metatensor_torch::TorchTensorMap FEATOMIC_TORCH_EXPORT register_autograd(
|
|
127
|
-
std::vector<
|
|
127
|
+
std::vector<metatomic_torch::System> systems,
|
|
128
128
|
metatensor_torch::TorchTensorMap precomputed,
|
|
129
129
|
std::vector<std::string> forward_gradients
|
|
130
130
|
);
|
|
@@ -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.0")
|
|
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.0" 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.0")
|
|
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.7)
|
|
8
|
+
set(REQUIRED_METATENSOR_TORCH_VERSION 0.7.6)
|
|
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.1.2)
|
|
@@ -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
|
|
@@ -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
|
|
102
|
+
/// Run a calculation for the given `systems` using the given options.
|
|
103
103
|
metatensor_torch::TorchTensorMap compute(
|
|
104
|
-
std::vector<
|
|
104
|
+
std::vector<metatomic_torch::System> systems,
|
|
105
105
|
TorchCalculatorOptions options = {}
|
|
106
106
|
);
|
|
107
107
|
|
|
@@ -124,7 +124,7 @@ private:
|
|
|
124
124
|
///
|
|
125
125
|
/// `forward_gradients` controls which gradients are left inside the TensorMap.
|
|
126
126
|
metatensor_torch::TorchTensorMap FEATOMIC_TORCH_EXPORT register_autograd(
|
|
127
|
-
std::vector<
|
|
127
|
+
std::vector<metatomic_torch::System> systems,
|
|
128
128
|
metatensor_torch::TorchTensorMap precomputed,
|
|
129
129
|
std::vector<std::string> forward_gradients
|
|
130
130
|
);
|
|
@@ -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.0")
|
|
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.0" 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.0")
|
|
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.7)
|
|
8
|
+
set(REQUIRED_METATENSOR_TORCH_VERSION 0.7.6)
|
|
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.2.2)
|
|
@@ -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
|
|
@@ -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
|
|
102
|
+
/// Run a calculation for the given `systems` using the given options.
|
|
103
103
|
metatensor_torch::TorchTensorMap compute(
|
|
104
|
-
std::vector<
|
|
104
|
+
std::vector<metatomic_torch::System> systems,
|
|
105
105
|
TorchCalculatorOptions options = {}
|
|
106
106
|
);
|
|
107
107
|
|
|
@@ -124,7 +124,7 @@ private:
|
|
|
124
124
|
///
|
|
125
125
|
/// `forward_gradients` controls which gradients are left inside the TensorMap.
|
|
126
126
|
metatensor_torch::TorchTensorMap FEATOMIC_TORCH_EXPORT register_autograd(
|
|
127
|
-
std::vector<
|
|
127
|
+
std::vector<metatomic_torch::System> systems,
|
|
128
128
|
metatensor_torch::TorchTensorMap precomputed,
|
|
129
129
|
std::vector<std::string> forward_gradients
|
|
130
130
|
);
|
|
@@ -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.0")
|
|
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.0" 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.0")
|
|
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.7)
|
|
8
|
+
set(REQUIRED_METATENSOR_TORCH_VERSION 0.7.6)
|
|
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.3.1)
|
|
@@ -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
|
|
@@ -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
|
|
102
|
+
/// Run a calculation for the given `systems` using the given options.
|
|
103
103
|
metatensor_torch::TorchTensorMap compute(
|
|
104
|
-
std::vector<
|
|
104
|
+
std::vector<metatomic_torch::System> systems,
|
|
105
105
|
TorchCalculatorOptions options = {}
|
|
106
106
|
);
|
|
107
107
|
|
|
@@ -124,7 +124,7 @@ private:
|
|
|
124
124
|
///
|
|
125
125
|
/// `forward_gradients` controls which gradients are left inside the TensorMap.
|
|
126
126
|
metatensor_torch::TorchTensorMap FEATOMIC_TORCH_EXPORT register_autograd(
|
|
127
|
-
std::vector<
|
|
127
|
+
std::vector<metatomic_torch::System> systems,
|
|
128
128
|
metatensor_torch::TorchTensorMap precomputed,
|
|
129
129
|
std::vector<std::string> forward_gradients
|
|
130
130
|
);
|
|
@@ -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.0")
|
|
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.0" 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.0")
|
|
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.7)
|
|
8
|
+
set(REQUIRED_METATENSOR_TORCH_VERSION 0.7.6)
|
|
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)
|
|
@@ -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
|