Coverage for cvpack/path/path.py: 94%
16 statements
« prev ^ index » next coverage.py v7.5.1, created at 2024-05-09 16:14 +0000
« prev ^ index » next coverage.py v7.5.1, created at 2024-05-09 16:14 +0000
1"""
2.. module:: path
3 :platform: Linux, MacOS, Windows
4 :synopsis: Specifications for Path Collective Variables
6.. classauthor:: Charlles Abreu <craabreu@gmail.com>
8"""
10from ..serialization import Serializable
13class Metric(Serializable):
14 """
15 A measure of progress or deviation with respect to a path in CV space
16 """
18 yaml_tag = "!cvpack.path.Metric"
20 def __init__(self, name: str) -> None:
21 self.name = name
23 def __repr__(self) -> str:
24 return f"{self.__class__.__name__}({self.name!r})"
26 def __eq__(self, other: object) -> bool:
27 return isinstance(other, Metric) and self.name == other.name
29 def __getstate__(self) -> dict:
30 return {"name": self.name}
32 def __setstate__(self, state: dict) -> None:
33 self.name = state["name"]
36Metric.registerTag("!cvpack.path.Metric")
39progress: Metric = Metric("progress")
40deviation: Metric = Metric("deviation")