Add support for "Dipoles" section in molecule file

This commit is contained in:
Axel Kohlmeyer
2024-01-16 12:04:00 -05:00
parent 8076d89422
commit 87297902a3
4 changed files with 89 additions and 16 deletions

View File

@ -26,6 +26,7 @@
#include "input.h"
#include "label_map.h"
#include "math_const.h"
#include "math_extra.h"
#include "memory.h"
#include "modify.h"
#include "molecule.h"
@ -2112,6 +2113,15 @@ std::vector<Molecule *>Atom::get_molecule_by_id(const std::string &id)
void Atom::add_molecule_atom(Molecule *onemol, int iatom, int ilocal, tagint offset)
{
if (onemol->qflag && q_flag) q[ilocal] = onemol->q[iatom];
if (onemol->muflag && mu_flag) {
double r[3], rotmat[3][3];
MathExtra::quat_to_mat(onemol->quat_external, rotmat);
MathExtra::matvec(rotmat, onemol->mu[iatom], r);
mu[ilocal][0] = r[0];
mu[ilocal][1] = r[1];
mu[ilocal][2] = r[2];
mu[ilocal][3] = sqrt(r[0] * r[0] + r[1] * r[1] + r[2] * r[2]);
}
if (onemol->radiusflag && radius_flag) radius[ilocal] = onemol->radius[iatom];
if (onemol->rmassflag && rmass_flag) rmass[ilocal] = onemol->rmass[iatom];
else if (rmass_flag)