Skip to content

Commit e59b7c5

Browse files
author
Roberto Di Remigio
committed
PEDRA fuzz solved. Same number of tesserae as DALTON are now obtained.
The problem was in the formation of the inertia tensor, used in rotating the cavity to standard orientation
1 parent 558fb4b commit e59b7c5

File tree

3 files changed

+18
-10
lines changed

3 files changed

+18
-10
lines changed

src/cavity/GePolCavity.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,10 @@ void GePolCavity::build(int maxts, int maxsph, int maxvert)
9797
double * ze = zv.data();
9898

9999
double * rin = radii_scratch.data();
100-
double * masses = molecule_.masses().data();
100+
double * mass = new double[molecule_.nAtoms()];
101+
for (int i = 0; i < molecule_.nAtoms(); ++i) {
102+
mass[i] = molecule_.masses(i);
103+
}
101104

102105
addedSpheres = 0;
103106
// Number of generators and generators of the point group
@@ -110,7 +113,7 @@ void GePolCavity::build(int maxts, int maxsph, int maxvert)
110113
generatecavity_cpp(&maxts, &maxsph, &maxvert,
111114
xtscor, ytscor, ztscor, ar, xsphcor, ysphcor, zsphcor, rsph,
112115
&nts, &ntsirr, &nSpheres_, &addedSpheres,
113-
xe, ye, ze, rin, masses,
116+
xe, ye, ze, rin, mass,
114117
&averageArea, &probeRadius, &minimalRadius,
115118
&nr_gen, &gen1, &gen2, &gen3);
116119

@@ -198,6 +201,7 @@ void GePolCavity::build(int maxts, int maxsph, int maxvert)
198201
delete[] ysphcor;
199202
delete[] zsphcor;
200203
delete[] rsph;
204+
delete[] mass;
201205

202206
built = true;
203207
}

src/pedra/pedra_cavity.F90

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,7 @@ subroutine polyhedra(intsph,vert,centr,newsph,icav1,icav2,xval,yval, &
370370
geom = 0.0d0
371371

372372
do i = 1, nesfp
373-
mass(i) = masses(i) !rin(i)
373+
mass(i) = masses(i)
374374
geom(i,1) = xe(i)
375375
geom(i,2) = ye(i)
376376
geom(i,3) = ze(i)
@@ -2275,7 +2275,8 @@ subroutine pcmtns(vmat, geom, amass, katom)
22752275
#include "pcm_pcm.h"
22762276

22772277
integer(kind=regint_k), intent(in) :: katom
2278-
real(kind=dp), intent(in) :: geom(katom, 3), amass(katom)
2278+
real(kind=dp), intent(inout) :: geom(katom, 3)
2279+
real(kind=dp), intent(in) :: amass(katom)
22792280
real(kind=dp), intent(inout) :: vmat(3, 3)
22802281

22812282
real(kind=dp) :: eigval(3), eigvec(3, 3), tinert(3, 3)
@@ -2285,28 +2286,27 @@ subroutine pcmtns(vmat, geom, amass, katom)
22852286
integer(kind=regint_k) :: i, j, k, jax, nmax
22862287
integer(kind=regint_k) :: nopax, nshift
22872288
real(kind=dp) :: com(3), total_mass
2288-
real(kind=dp) :: local_geom(katom, 3)
2289-
22902289
real(kind=dp) :: dij
22912290

22922291
iax = [1, 2, 3, 3, 2, 1]
22932292

22942293
angmom = [1.0d0, 1.0d0, 1.0d0]
22952294

22962295
! Calculate center-of-mass (com) and translate
2297-
total_mass = sum(amass)
2296+
total_mass = sum(amass)
22982297
do i = 1, 3
2298+
com(i) = 0.0_dp
22992299
do j = 1, katom
23002300
com(i) = com(i) + geom(j, i) * amass(j)
23012301
end do
23022302
com(i) = com(i) / total_mass
23032303
end do
2304-
! Translation
2304+
! Translation to COM
23052305
do i = 1, katom
2306-
local_geom(i, :) = geom(i, :) - com(:)
2306+
geom(i, :) = geom(i, :) - com(:)
23072307
end do
23082308

2309-
call wlkdin(local_geom, amass, nesfp, angmom, tinert, omegad, eigval, eigvec, .true., planar, linear)
2309+
call wlkdin(geom, amass, nesfp, angmom, tinert, omegad, eigval, eigvec, .true., planar, linear)
23102310

23112311
do i = 1, 3
23122312
do j = 1, 3

src/utils/Molecule.hpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,10 +78,14 @@ class Molecule {
7878

7979
int nAtoms() { return nAtoms_; }
8080
Eigen::VectorXd charges() { return charges_; }
81+
double charges(int i) { return charges_(i); }
8182
Eigen::VectorXd masses() { return masses_; }
83+
double masses(int i) { return masses_(i); }
8284
Eigen::Matrix3Xd geometry() { return geometry_; }
8385
std::vector<Atom> atoms() { return atoms_; }
86+
Atom atoms(int i) const { return atoms_[i]; }
8487
std::vector<Sphere> spheres() const { return spheres_; }
88+
Sphere spheres(int i) const { return spheres_[i]; }
8589

8690
rotorType rotor();
8791
rotorType findRotorType();

0 commit comments

Comments
 (0)