Loading...
Searching...
No Matches
ASE.h
Go to the documentation of this file.
1/*
2** This file is part of eOn.
3**
4** SPDX-License-Identifier: BSD-3-Clause
5**
6** Copyright (c) 2010--present, eOn Development Team
7** All rights reserved.
8**
9** Repo:
10** https://github.com/TheochemUI/eOn
11*/
12#pragma once
13
14#include "eon/Potential.h"
15#include <pybind11/pybind11.h>
16
17namespace py = pybind11;
18
19class ASE : public Potential {
20
21private:
22 size_t counter{0};
23 py::module_ py_module; // Member to store the Python module
24 py::object calculator; // Member to store the ASE calculator object
25 py::object _calculate; // Member to store the Python function to calculate
26 // forces and energy
27
28public:
29 ASE(const Parameters &a_params);
30 virtual ~ASE() {
31 QUILL_LOG_INFO(eonc::log::get(), "[ASE] called potential {} times",
32 counter);
33 }
34
35 void force(long nAtoms, const double *R, const int *atomicNrs, double *F,
36 double *U, double *variance, const double *box) override;
37 [[nodiscard]] bool isThreadSafe() const noexcept override { return false; }
40 [[nodiscard]] bool needsPerImageInstance() const noexcept override {
41 return true;
42 }
43};
bool needsPerImageInstance() const noexcept override
ASE calculators are independent objects.
Definition ASE.h:40
virtual ~ASE()
Definition ASE.h:30
py::object calculator
Definition ASE.h:24
void force(long nAtoms, const double *R, const int *atomicNrs, double *F, double *U, double *variance, const double *box) override
Definition ASE.cpp:64
py::module_ py_module
Definition ASE.h:23
ASE(const Parameters &a_params)
Definition ASE.cpp:26
bool isThreadSafe() const noexcept override
Whether this potential's force() can be called from multiple threads on the SAME instance.
Definition ASE.h:37
size_t counter
Definition ASE.h:22
py::object _calculate
Definition ASE.h:25
Potential(PotType a_ptype)
Definition Potential.h:35
quill::Logger * get() noexcept
Get or create the default "combi" logger.
Definition EonLogger.h:44