Skip to content

Commit 8b1eace

Browse files
author
Martin D. Weinberg
committed
Improve the behavior and flow for reading coefficient cache on restart
1 parent 52f969d commit 8b1eace

File tree

1 file changed

+14
-6
lines changed

1 file changed

+14
-6
lines changed

src/SphericalBasis.cc

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1657,18 +1657,26 @@ void SphericalBasis::determine_acceleration_and_potential(void)
16571657

16581658
// This should suffice for both CPU and GPU
16591659
if (FIX_L0) {
1660-
// Save the monopole coefficients on the first evaluation
1660+
// Save the monopole coefficients on the first evaluation or read
1661+
// from the restart cache
16611662
if (C0.size() == 0) {
16621663
bool okay = true;
16631664
// Attempt to read backup coefficients from file
16641665
if (restart) {
16651666
read_FIXL0_restart_data();
1667+
// No coefficients read from file??
1668+
if (C0.size() == 0) {
1669+
if (myid==0) {
1670+
std::cout << "---- SphericalBasis: WARNING: could not read FIX_L0"
1671+
<< " restart data from file!" << endl;
1672+
throw std::runtime_error("SphericalBasis: FIX_L0 restart read error");
1673+
}
1674+
}
16661675
}
1667-
// If not read from file on restart, save current coefficients
1668-
if (C0.size() == 0) {
1669-
C0 = *expcoef[0];
1670-
write_FIXL0_restart_data();
1671-
}
1676+
// If not read from file on restart, cache the current
1677+
// coefficients
1678+
C0 = *expcoef[0];
1679+
write_FIXL0_restart_data();
16721680
}
16731681
// Copy the saved coefficients to the active array
16741682
else *expcoef[0] = C0;

0 commit comments

Comments
 (0)