pysimm.calc module

pysimm.calc.angle(p1, p2, p3, radians=False)[source]

Finds angle between three Particle objects. Does not consider periodic boundary conditions.

Parameters:
  • p1 – pysimm.system.Particle
  • p2 – pysimm.system.Particle
  • p3 – pysimm.system.Particle
  • radians – returns value in radians if True (False)
Returns:

angle between particles

pysimm.calc.chiral_angle(a, b, c, d)[source]

Finds chiral angle between four Particle objects. Chiral angle is defined as the angle between the vector resulting from vec(a->c) X vec(a->d) and vec(a->b). Used to help define tacticity where backbone follow b’–a–b and c and d are side groups.

b’–a–b
/ c d
Parameters:
  • a – pysimm.system.Particle
  • b – pysimm.system.Particle
  • c – pysimm.system.Particle
  • d – pysimm.system.Particle
Returns:

chiral angle

pysimm.calc.distance(p1, p2)[source]

Finds distance between two Particle objects. Simply calculates length of vector between particle coordinates and does not consider periodic boundary conditions.

Parameters:
Returns:

distance between particles

pysimm.calc.find_rotation(a, b)[source]

Finds rotation vector required to align vector a and vector b

Parameters:
  • a – 3D vector [x,y,z]
  • b – 3D vector [x,y,z]
Returns:

rotation matrix

pysimm.calc.frac_free_volume(v_sp, v_void)[source]

Determines fractional free volume for a poroous system.

Parameters:
  • v_sp – specific volume
  • v_void – void volume
Returns:

fractional free volume

pysimm.calc.intersection(line1, line2)[source]

Finds intersection between two 2D lines given by two sets of points

Parameters:
  • line1 – [[x1,y1], [x2,y2]] for line 1
  • line2 – [[x1,y1], [x2,y2]] for line 2
Returns:

x,y intersection point

pysimm.calc.pbc_distance(s, p1, p2)[source]

Calculates distance between particles using PBC

Parameters:
Returns:

distance between particles

pysimm.calc.random() → x in the interval [0, 1).
pysimm.calc.rotate_vector(x, y, z, theta_x=None, theta_y=None, theta_z=None)[source]

Rotates 3d vector around x-axis, y-axis and z-axis given by user defined angles

Parameters:
  • x – x vector component
  • y – y vector component
  • z – z vector component
  • theta_x – angle to rotate vector around x axis
  • theta_y – angle to rotate vector around y axis
  • theta_z – angle to rotate vector around z axis
Returns:

new vector [x,y,z]

pysimm.calc.tacticity(s, a_tag=None, b_tag=None, c_tag=None, d_tag=None, offset=None, return_angles=True, unwrap=True, rewrap=True, skip_first=False)[source]

Determines tacticity for polymer chain. Iterates through groups of four patricles given by X_tags, using offset. This assumes equivalent atoms in each group of four are perfectly offset.

Parameters:
  • sSystem
  • a_tag – tag of first a particle
  • b_tag – tag of first b particle
  • c_tag – tag of first c particle
  • d_tag – tag of first d particle
  • offset – offset of particle tags (monomer repeat atomic count)
  • return_angles – if True return chiral angles of all monomers
  • unwrap – True to perform unwrap before calculation (REQUIRED before calculation, but not required in this
  • function)
  • rewrap – True to rewrap system after calculation
  • skip_first – True to skip first monomer (sometime chirality is poorly defined for thsi monomer)
Returns:

tacticity or tacticity, [chiral_angles]