Skip to content

Commit

Permalink
cleaning up the condition checking if ntor and nfp are coprime
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewgiuliani committed Apr 22, 2024
1 parent 4ae7c54 commit c91431f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
3 changes: 1 addition & 2 deletions src/simsopt/geo/curvexyzfouriersymmetries.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,7 @@ def __init__(self, quadpoints, order, nfp, stellsym, ntor=1, **kwargs):
pure = lambda dofs, points: jaxXYZFourierSymmetriescurve_pure(
dofs, points, order, nfp, stellsym, ntor)

nfp_true = nfp // gcd(nfp, ntor)
if nfp != nfp_true:
if gcd(ntor, nfp) != 1:
raise Exception('nfp and ntor must be coprime')

self.order = order
Expand Down
3 changes: 1 addition & 2 deletions tests/geo/test_curve.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,8 +213,7 @@ def test_nonstellsym(self):
self.subtest_nonstellsym(nfp, ntor)

def subtest_nonstellsym(self, nfp, ntor):
nfp_true = nfp // gcd(ntor, nfp)
if nfp_true != nfp:
if gcd(ntor, nfp) != 1:
return

# this test checks that you can obtain a stellarator symmetric magnetic field from two non-stellarator symmetric
Expand Down

0 comments on commit c91431f

Please sign in to comment.