1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23 """Module for the target function for handling all types of structural superimpositions."""
24
25
26 from copy import deepcopy
27
28
29 from lib.structure.statistics import atomic_rmsd
30 from lib.structure.superimpose import fit_to_mean
31
32
34 """Class for finding the optimal pivot point for motions between the given models."""
35
37 """Set up the class for pivot point optimisation for an ensemble of structures.
38
39 @keyword models: The list of models to use. If set to None, then all models will be used.
40 @type models: list of int or None
41 @keyword coord: The array of molecular coordinates. The first dimension corresponds to the model, the second the atom, the third the coordinate.
42 @type coord: rank-3 numpy array
43 """
44
45
46 self.models = models
47 self.coord = coord
48
49
50 self.orig_coord = deepcopy(coord)
51
52
53 - def func(self, params):
54 """Target function for the optimisation of the motional pivot point from an ensemble of structures.
55
56 @param params: The parameter vector from the optimisation algorithm.
57 @type params: list
58 @return: The target function value defined as the combined RMSD value.
59 @rtype: float
60 """
61
62
63 T, R, pivot = fit_to_mean(models=self.models, coord=self.coord, centroid=params, verbosity=0)
64
65
66 val = atomic_rmsd(self.coord)
67
68
69 self.coord = deepcopy(self.orig_coord)
70
71
72 return val
73