Coverage for cvpack/base_radius_of_gyration.py: 100%

12 statements  

« prev     ^ index     » next       coverage.py v7.5.1, created at 2024-05-09 16:14 +0000

1""" 

2.. class:: BaseRadiusOfGyration 

3 :platform: Linux, MacOS, Windows 

4 :synopsis: Base class for the radius of gyration of an atom group 

5 

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

7 

8""" 

9 

10import typing as t 

11 

12import openmm 

13 

14from .collective_variable import CollectiveVariable 

15 

16 

17class BaseRadiusOfGyration(CollectiveVariable, openmm.CustomCentroidBondForce): 

18 """ 

19 Abstract class for the radius of gyration of a group of `n` atoms. 

20 """ 

21 

22 def __init__( 

23 self, 

24 num_groups: int, 

25 expression: str, 

26 group: t.Sequence[int], 

27 pbc: bool = False, 

28 weighByMass: bool = False, 

29 ) -> None: 

30 super().__init__(num_groups, expression) 

31 for atom in group: 

32 self.addGroup([atom]) 

33 if weighByMass: 

34 self.addGroup(group) 

35 else: 

36 self.addGroup(group, [1] * len(group)) 

37 self.setUsesPeriodicBoundaryConditions(pbc)