Coverage for openxps/bounds/circular.py: 100%

7 statements  

« prev     ^ index     » next       coverage.py v7.11.3, created at 2025-11-13 22:08 +0000

1""" 

2Circular boundary condition. 

3 

4.. module:: openxps.bounds.circular 

5 :platform: Linux, MacOS, Windows 

6 :synopsis: Circular boundary condition 

7 

8.. classauthor:: Charlles Abreu <craabreu@gmail.com> 

9 

10""" 

11 

12import numpy as np 

13from openmm import unit as mmunit 

14 

15from .periodic import PeriodicBounds 

16 

17 

18class CircularBounds(PeriodicBounds): 

19 """ 

20 A circular boundary condition equivalent to PeriodicBounds(-π, π, radians). 

21 

22 This is a convenience class for the common case of a periodic boundary condition 

23 spanning from -π to π radians, which corresponds to a full circle. 

24 

25 Parameters 

26 ---------- 

27 lower, upper, unit 

28 Optional arguments for internal use (e.g., during deserialization). 

29 If not provided, defaults to -π, π, radians respectively. 

30 

31 Example 

32 ------- 

33 >>> import openxps as xps 

34 >>> bounds = xps.bounds.CircularBounds() 

35 >>> bounds.lower == -3.141592653589793 

36 True 

37 >>> bounds.upper == 3.141592653589793 

38 True 

39 >>> bounds.unit == xps.bounds.CircularBounds().unit 

40 True 

41 """ 

42 

43 def __init__(self, *_) -> None: 

44 super().__init__(-np.pi, np.pi, mmunit.radians) 

45 

46 

47CircularBounds.registerTag("!openxps.bounds.CircularBounds")