mirror of
https://github.com/rdkit/rdkit.git
synced 2026-06-03 21:44:30 +08:00
A couple additions to the extended Hueckel integration (#2955)
* add reference input/output files for yaehmop * orbital energies, overlap matrix, and hamiltonian on the C++ side * add the python wrappers for the new functions
This commit is contained in:
24
External/YAeHMOP/EHTTools.cpp
vendored
24
External/YAeHMOP/EHTTools.cpp
vendored
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// Copyright (C) 2018 Greg Landrum
|
||||
// Copyright (C) 2018-2020 Greg Landrum
|
||||
//
|
||||
#include "EHTTools.h"
|
||||
#include <GraphMol/RDKitBase.h>
|
||||
@@ -21,7 +21,8 @@ const std::string _EHTChargeMatrix = "_EHTChargeMatrix";
|
||||
// thread at a time. This mutex enforces that.
|
||||
std::mutex yaehmop_mutex;
|
||||
|
||||
bool runMol(const ROMol &mol, EHTResults &results, int confId) {
|
||||
bool runMol(const ROMol &mol, EHTResults &results, int confId,
|
||||
bool preserveHamiltonianAndOverlapMatrices) {
|
||||
std::lock_guard<std::mutex> lock(yaehmop_mutex);
|
||||
|
||||
// -----------------------------
|
||||
@@ -126,6 +127,25 @@ bool runMol(const ROMol &mol, EHTResults &results, int confId) {
|
||||
memcpy(static_cast<void *>(results.reducedOverlapPopulationMatrix.get()),
|
||||
static_cast<void *>(properties.ROP_mat), sz * sizeof(double));
|
||||
|
||||
results.orbitalEnergies = std::make_unique<double[]>(num_orbs);
|
||||
std::memcpy(static_cast<void *>(results.orbitalEnergies.get()),
|
||||
static_cast<void *>(eigenset.val), num_orbs * sizeof(double));
|
||||
|
||||
if (preserveHamiltonianAndOverlapMatrices) {
|
||||
// these need to be recalculated, because they were overwritten during the
|
||||
// calculation
|
||||
R_space_overlap_matrix(unit_cell, details, Overlap_R, num_orbs,
|
||||
tot_overlaps, orbital_lookup_table, 0);
|
||||
full_R_space_Hamiltonian(unit_cell, details, Overlap_R, Hamil_R, num_orbs,
|
||||
orbital_lookup_table, 1);
|
||||
sz = num_orbs * num_orbs * sizeof(double);
|
||||
results.hamiltonianMatrix = std::make_unique<double[]>(sz);
|
||||
std::memcpy(static_cast<void *>(results.hamiltonianMatrix.get()),
|
||||
static_cast<void *>(Hamil_R.mat), sz);
|
||||
results.overlapMatrix = std::make_unique<double[]>(sz);
|
||||
std::memcpy(static_cast<void *>(results.overlapMatrix.get()),
|
||||
static_cast<void *>(Overlap_R.mat), sz);
|
||||
}
|
||||
cleanup_memory();
|
||||
|
||||
fclose(nullfile);
|
||||
|
||||
Reference in New Issue
Block a user