Skip to content

Commit 161b060

Browse files
CopilotThe9Cat
andauthored
Guard FlatDisk and CBDisk computeAccel against R=0 at coefficient center
Agent-Logs-Url: https://github.com/EXP-code/EXP/sessions/5de301ef-07d4-4d2c-8595-cf3fe1b35194 Co-authored-by: The9Cat <25960766+The9Cat@users.noreply.github.com>
1 parent 7ad2ccd commit 161b060

1 file changed

Lines changed: 12 additions & 4 deletions

File tree

expui/BiorthBasis.cc

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2584,8 +2584,12 @@ namespace BasisClasses
25842584
zpot *= -G;
25852585
ppot *= -G;
25862586

2587-
double potx = rpot*x/R - ppot*y/R;
2588-
double poty = rpot*y/R + ppot*x/R;
2587+
double potx = 0.0;
2588+
double poty = 0.0;
2589+
if (R > 0.0) {
2590+
potx = rpot*x/R - ppot*y/R;
2591+
poty = rpot*y/R + ppot*x/R;
2592+
}
25892593

25902594
acc << potx, poty, zpot;
25912595
}
@@ -3354,8 +3358,12 @@ namespace BasisClasses
33543358
rpot *= -G;
33553359
ppot *= -G;
33563360

3357-
double potx = rpot*x/R - ppot*y/R;
3358-
double poty = rpot*y/R + ppot*x/R;
3361+
double potx = 0.0;
3362+
double poty = 0.0;
3363+
if (R > 0.0) {
3364+
potx = rpot*x/R - ppot*y/R;
3365+
poty = rpot*y/R + ppot*x/R;
3366+
}
33593367

33603368
acc << potx, poty, zpot;
33613369
}

0 commit comments

Comments
 (0)