openmopac / mopac

Molecular Orbital PACkage
http://openmopac.net
GNU Lesser General Public License v3.0
111 stars 31 forks source link

Fix translation vector summation cutoffs #186

Closed godotalgorithm closed 7 months ago

godotalgorithm commented 7 months ago

MOPAC needs to sum over translation vectors when evaluating matrix elements and interactions between atoms in the central unit cell and neighboring unit cells. The cutoffs for this summation were previously determined without checking to see how well atoms were packed into the central unit cell, and poorly packed atoms can invalidate this choice of cutoffs and cause silent errors in periodic calculations. This PR now accounts for the packing of atoms in determining the cutoffs, and also adds a new error if the packing is found to be highly inefficient.

MOPAC does not repack atoms internally, so shifting atomic coordinates by multiples of translation vectors can have an effect on the cost of a MOPAC calculation even if the crystal structures are equivalent. The lowest costs occur for atoms that are tightly packed to fit within a single unit cell of the crystal. There was some consideration to add internal shifting of atoms to pack the central unit cell before starting a periodic calculation, but this would be very difficult to incorporate with MOPAC's existing bookkeeping.

Status

codecov[bot] commented 7 months ago

Codecov Report

Attention: 10 lines in your changes are missing coverage. Please review.

Comparison is base (c03b75b) 66.81% compared to head (f620ee0) 66.81%.

Files Patch % Lines
src/moldat.F90 76.19% 10 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #186 +/- ## ======================================= Coverage 66.81% 66.81% ======================================= Files 331 332 +1 Lines 74024 74071 +47 ======================================= + Hits 49458 49493 +35 - Misses 24566 24578 +12 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.