picometer 0.1.2__tar.gz → 0.1.3__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: picometer
3
- Version: 0.1.2
3
+ Version: 0.1.3
4
4
  Summary: Precisely define and calculate measurements across multiple crystal structures
5
5
  License: MIT
6
6
  Author: Daniel Tchoń
@@ -8,7 +8,7 @@ import numpy as np
8
8
  from numpy.linalg import norm
9
9
  import pandas as pd
10
10
 
11
- from picometer.shapes import degrees_between, Line, Plane, Shape, Vector3
11
+ from picometer.shapes import degrees_between, Line, Plane, Shape, Vector3, are_synparallel
12
12
  from picometer.utility import ustr2float
13
13
 
14
14
 
@@ -183,7 +183,9 @@ class AtomSet(Shape):
183
183
  elif 4 <= len(combined) <= 6: # dihedral angle
184
184
  plane1_dir = np.cross(xyz[0] - xyz[1], xyz[2] - xyz[1])
185
185
  plane2_dir = np.cross(xyz[-3] - xyz[-2], xyz[-1] - xyz[-2])
186
- return degrees_between(plane1_dir, plane2_dir, normalize=False)
186
+ twist_dir = np.cross(plane1_dir, plane2_dir)
187
+ sign = +1 if are_synparallel(twist_dir, xyz[2] - xyz[1]) else -1
188
+ return sign * degrees_between(plane1_dir, plane2_dir, normalize=False)
187
189
  else:
188
190
  return 'Input AtomSet must contain between 3 and 6 atoms'
189
191
 
@@ -22,15 +22,27 @@ class AtomSet(Protocol):
22
22
 
23
23
 
24
24
  def are_parallel(v: Vector3, w: Vector3) -> bool:
25
+ """Check if input vectors point along the same line in any direction"""
25
26
  return 1 - abs(np.dot(v / norm(v), w / norm(w))) < 1E-8
26
27
 
27
28
 
29
+ def are_synparallel(v: Vector3, w: Vector3) -> bool:
30
+ """Check if input vectors point along the same line in the same direction"""
31
+ return 1 - np.dot(v / norm(v), w / norm(w)) < 1E-8
32
+
33
+
34
+ def are_antiparallel(v: Vector3, w: Vector3) -> bool:
35
+ """Check if input vectors point along the same line in opposite directions"""
36
+ return 1 + np.dot(v / norm(v), w / norm(w)) < 1E-8
37
+
38
+
28
39
  def are_perpendicular(v: Vector3, w: Vector3) -> bool:
40
+ """Check in input vectors are perpendicular"""
29
41
  return abs(norm(v) * norm(w) - norm(np.cross(v, w))) < 1E-8
30
42
 
31
43
 
32
44
  def versorize(v: Vector3) -> Versor3:
33
- """Normalize and choose lexicographically-larger of two possible results"""
45
+ """Normalize and choose lexicographically-larger of antiparallel v and -v"""
34
46
  assert isinstance(v, np.ndarray) and np.shape(v) == (3, )
35
47
  assert (v_norm := np.linalg.norm(v)) > 0
36
48
  neg = v[0] < 0 or (v[0] == 0 and (v[1] < 0 or (v[1] == 0 and v[2] < 0)))
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "picometer"
3
- version = "0.1.2"
3
+ version = "0.1.3"
4
4
  description = "Precisely define and calculate measurements across multiple crystal structures"
5
5
  authors = ["Daniel Tchoń"]
6
6
  license = "MIT"
@@ -33,6 +33,8 @@ branch = "master" # branch to make releas
33
33
  changelog_file = "CHANGELOG.md" # changelog file
34
34
  build_command = "pip install poetry && poetry build" # build dists
35
35
  commit_parser = "emoji" # default EmojiCommitParser
36
+ major_on_zero = true
37
+ commit_message = ":bookmark: v{version}\n\nAutomatically generated by python-semantic-release"
36
38
 
37
39
  [tool.semantic_release.branches]
38
40
  master = { publish = true } # Stable release branch (master)
File without changes
File without changes
File without changes