eOn client
Long-timescale dynamics: aKMC, NEB, parallel replica
☾
Toggle main menu visibility
Loading...
Searching...
No Matches
SocketNWChemPot.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 <memory>
16
#include <string>
17
27
class
SocketNWChemPot
:
public
Potential
{
28
public
:
29
explicit
SocketNWChemPot
(
const
Parameters
&p);
30
~SocketNWChemPot
()
override
;
31
39
void
write_nwchem_template
(
const
std::string &filename,
long
N,
40
const
std::vector<std::string> &atom_symbols);
41
59
void
force
(
long
N,
const
double
*R,
const
int
*atomicNrs,
double
*F,
60
double
*U,
double
*variance,
const
double
*box)
override
;
61
63
[[nodiscard]]
bool
requiresIsolatedMoleculeLayout
() const noexcept
override
{
64
return
true
;
65
}
66
[[nodiscard]]
bool
isThreadSafe
() const noexcept
override
{
return
false
; }
67
68
private
:
69
// --- Private Methods ---
70
void
setup_server
();
71
void
accept_connection
();
72
void
send_header
(
const
char
*msg);
73
void
recv_header
(
char
*buffer);
74
void
send_exact
(
const
void
*buffer,
size_t
n_bytes);
75
void
recv_exact
(
void
*buffer,
size_t
n_bytes);
76
77
// --- Member Variables ---
78
// Socket configuration
79
bool
unix_socket_mode
;
80
// For TCP, the host; for UNIX, the full socket path.
81
std::string
server_address
;
82
// The original name for the .nwi file.
83
std::string
unix_socket_basename
;
84
// File containing actual calculation parameters
85
std::string
nwchem_settings
;
86
int
port
,
mem_in_gb
;
87
// Generate a template input
88
bool
make_template_input
;
89
90
// Socket state
91
int
listen_fd
;
// Socket for listening
92
int
conn_fd
;
// Socket for the active connection
93
bool
is_connected
;
94
95
// --- Constants for i-PI protocol and unit conversions ---
96
static
constexpr
int
MSG_LEN
= 12;
97
// From ASE units, values for eV and Angstrom
98
static
constexpr
double
BOHR_IN_ANGSTROM
= 0.529177210903;
99
static
constexpr
double
HARTREE_IN_EV
= 27.211386245988;
100
};
Potential.h
SocketNWChemPot::setup_server
void setup_server()
Definition
SocketNWChemPot.cpp:254
SocketNWChemPot::unix_socket_basename
std::string unix_socket_basename
Definition
SocketNWChemPot.h:83
SocketNWChemPot::~SocketNWChemPot
~SocketNWChemPot() override
Definition
SocketNWChemPot.cpp:74
SocketNWChemPot::MSG_LEN
static constexpr int MSG_LEN
Definition
SocketNWChemPot.h:96
SocketNWChemPot::isThreadSafe
bool isThreadSafe() const noexcept override
Whether this potential's force() can be called from multiple threads on the SAME instance.
Definition
SocketNWChemPot.h:66
SocketNWChemPot::send_header
void send_header(const char *msg)
Definition
SocketNWChemPot.cpp:304
SocketNWChemPot::recv_exact
void recv_exact(void *buffer, size_t n_bytes)
Definition
SocketNWChemPot.cpp:331
SocketNWChemPot::port
int port
Definition
SocketNWChemPot.h:86
SocketNWChemPot::is_connected
bool is_connected
Definition
SocketNWChemPot.h:93
SocketNWChemPot::send_exact
void send_exact(const void *buffer, size_t n_bytes)
Definition
SocketNWChemPot.cpp:319
SocketNWChemPot::server_address
std::string server_address
Definition
SocketNWChemPot.h:81
SocketNWChemPot::BOHR_IN_ANGSTROM
static constexpr double BOHR_IN_ANGSTROM
Definition
SocketNWChemPot.h:98
SocketNWChemPot::recv_header
void recv_header(char *buffer)
Definition
SocketNWChemPot.cpp:310
SocketNWChemPot::HARTREE_IN_EV
static constexpr double HARTREE_IN_EV
Definition
SocketNWChemPot.h:99
SocketNWChemPot::make_template_input
bool make_template_input
Definition
SocketNWChemPot.h:88
SocketNWChemPot::conn_fd
int conn_fd
Definition
SocketNWChemPot.h:92
SocketNWChemPot::write_nwchem_template
void write_nwchem_template(const std::string &filename, long N, const std::vector< std::string > &atom_symbols)
Generates an NWChem input file (.nwi) configured to connect to this server.
Definition
SocketNWChemPot.cpp:96
SocketNWChemPot::nwchem_settings
std::string nwchem_settings
Definition
SocketNWChemPot.h:85
SocketNWChemPot::SocketNWChemPot
SocketNWChemPot(const Parameters &p)
Definition
SocketNWChemPot.cpp:32
SocketNWChemPot::unix_socket_mode
bool unix_socket_mode
Definition
SocketNWChemPot.h:79
SocketNWChemPot::listen_fd
int listen_fd
Definition
SocketNWChemPot.h:91
SocketNWChemPot::force
void force(long N, const double *R, const int *atomicNrs, double *F, double *U, double *variance, const double *box) override
The method called to compute forces and energy.
Definition
SocketNWChemPot.cpp:131
SocketNWChemPot::accept_connection
void accept_connection()
Definition
SocketNWChemPot.cpp:295
SocketNWChemPot::requiresIsolatedMoleculeLayout
bool requiresIsolatedMoleculeLayout() const noexcept override
NWChem socket SCF does not support PBC (#188).
Definition
SocketNWChemPot.h:63
SocketNWChemPot::mem_in_gb
int mem_in_gb
Definition
SocketNWChemPot.h:86
eonc::Parameters
Definition
Parameters.h:28
eonc::Potential::Potential
Potential(PotType a_ptype)
Definition
Potential.h:35
include
eon
potentials
SocketNWChem
SocketNWChemPot.h
Generated by
1.17.0
Generated by
Doxygen 1.17.0
Analytics by
Antics
provided by
TurtleTech ehf