• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

CCPBioSim / CodeEntropy / 13726590978

07 Mar 2025 06:07PM UTC coverage: 1.726%. First build
13726590978

push

github

web-flow
Merge pull request #45 from CCPBioSim/39-implement-ci-pipeline-pre-commit-hooks

Implement CI pipeline pre-commit hooks

27 of 1135 new or added lines in 23 files covered. (2.38%)

53 of 3071 relevant lines covered (1.73%)

0.05 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/CodeEntropy/PoseidonHelper.py
1
import logging
×
NEW
2
import sys
×
NEW
3
from datetime import datetime
×
4

5
# from CodeEntropy.poseidon.analysis.EECalculation import processEE
6
# from CodeEntropy.poseidon.analysis.helper import memoryInfo, weightingPopulation
7
# from CodeEntropy.poseidon.analysis.populateClasses import classPopulation
NEW
8
from CodeEntropy.poseidon.extractData.dihedrals import calculateDihedrals
×
NEW
9
from CodeEntropy.poseidon.extractData.forceTorques import calculateFTMatrix
×
10

11
# # Energy is not needed
12
# from CodeEntropy.poseidon.extractData.readFiles import populateEnergy, UAEnergyGroup
NEW
13
from CodeEntropy.poseidon.extractData.HBRAD import HBCalc, UALevelRAD, distCutoffNc
×
14
from CodeEntropy.poseidon.extractData.mainClass import clearClass
×
NEW
15
from CodeEntropy.poseidon.extractData.nearestNonlike2 import (
×
16
    getShellAssignment,
17
    moleculePositionRankingRAD,
18
)
19

20
# from CodeEntropy.poseidon.extractData.outputFiles import moleculeObjectPopulation
NEW
21
from CodeEntropy.poseidon.extractData.readFiles import (  # populateTopology,
×
22
    getCoordsForces,
23
    getDistArray,
24
)
25

26

NEW
27
def frame_iteration(
×
28
    container,
29
    all_data,
30
    dimensions,
31
    startTime,
32
    verbosePrint,
33
    waterTuple,
34
    cutShell,
35
    excludedResnames,
36
    frame,
37
):
38
    clearClass(all_data)
×
39
    print(f"frame = {frame}")
×
40

NEW
41
    all_data, dimensions = getCoordsForces(
×
42
        container, all_data, dimensions, frame, startTime, verbosePrint
43
    )
44
    # # Energy is not needed
45
    # populateEnergy(container, all_data,
46
    #         dimensions, frame, startTime, verbosePrint)
47
    # UAEnergyGroup(all_data)
48

49
    calculateDihedrals(all_data, dimensions)
×
NEW
50
    verbosePrint("DIH")
×
51
    verbosePrint(datetime.now() - startTime)
×
52
    sys.stdout.flush()
×
53

54
    traj = container.trajectory[frame]
×
55
    neighbour_coords = None
×
56
    neighbour_coords = traj.positions
×
57

58
    max_cutoff = 10
×
59
    for x in range(0, len(all_data)):
×
60
        atom = all_data[x]
×
61
        # start nearest array from solutes
62
        if atom.resname not in waterTuple:
×
NEW
63
            getDistArray(
×
64
                atom,
65
                all_data,
66
                traj,
67
                max_cutoff,
68
                dimensions,
69
                neighbour_coords,
70
                startTime,
71
                verbosePrint,
72
            )
73
            # find nearest array for solute neighbours that are solvent
74
            for nearDist in atom.nearest_all_atom_array[0:20]:
×
75
                neighbour = all_data[nearDist[0]]
×
NEW
76
                if (
×
77
                    neighbour.resname in waterTuple
78
                    and neighbour.nearest_all_atom_array is None
79
                ):
NEW
80
                    getDistArray(
×
81
                        neighbour,
82
                        all_data,
83
                        traj,
84
                        max_cutoff,
85
                        dimensions,
86
                        neighbour_coords,
87
                        startTime,
88
                        verbosePrint,
89
                    )
90
                # find solvent neighbours neighbours nearest array
NEW
91
                if neighbour.nearest_all_atom_array is not None:
×
92
                    for nearDist2 in neighbour.nearest_all_atom_array[0:20]:
×
93
                        neighbour2 = all_data[nearDist2[0]]
×
NEW
94
                        if (
×
95
                            neighbour2.resname in waterTuple
96
                            and neighbour2.nearest_all_atom_array is None
97
                        ):
NEW
98
                            getDistArray(
×
99
                                neighbour2,
100
                                all_data,
101
                                traj,
102
                                max_cutoff,
103
                                dimensions,
104
                                neighbour_coords,
105
                                startTime,
106
                                verbosePrint,
107
                            )
108
                        else:
109
                            continue
×
110
                else:
111
                    continue
×
112
        else:
113
            continue
×
NEW
114
    verbosePrint("NEAREST ARRAYS")
×
115
    verbosePrint(datetime.now() - startTime)
×
116
    sys.stdout.flush()
×
117

NEW
118
    if cutShell is not None:
×
119
        # Used for fixed cut-off coordination shells
120
        try:
×
121
            cutoff_dist = float(cutShell)
×
122
            distCutoffNc(all_data, dimensions, cutoff_dist)
×
123
            # #don't know what this is it is not defined anywhere
124
            # NcPairs(all_data, dimensions)
NEW
125
            verbosePrint("distCutoffNc")
×
126
            verbosePrint(datetime.now() - startTime)
×
NEW
127
            sys.stdout.flush()
×
128
        except ValueError:
×
NEW
129
            logging.error("Cutoff distance needs to be a float")
×
130

NEW
131
    if cutShell is None:
×
132
        UALevelRAD(all_data, dimensions)
×
NEW
133
        verbosePrint("RAD")
×
134
        verbosePrint(datetime.now() - startTime)
×
135

136
    # if inputType != 'pdb':
137
    HBCalc(all_data, waterTuple, dimensions)
×
NEW
138
    verbosePrint("HB")
×
139
    verbosePrint(datetime.now() - startTime)
×
NEW
140
    sys.stdout.flush()
×
141

NEW
142
    getShellAssignment(all_data, excludedResnames, dimensions, startTime, verbosePrint)
×
NEW
143
    verbosePrint("PROX")
×
144
    verbosePrint(datetime.now() - startTime)
×
145
    sys.stdout.flush()
×
146

147
    # if (force is not None):
148
    calculateFTMatrix(all_data, dimensions)
×
NEW
149
    verbosePrint("FTMATRIX")
×
150
    verbosePrint(datetime.now() - startTime)
×
151
    sys.stdout.flush()
×
152

153
    moleculePositionRankingRAD(all_data, waterTuple, dimensions)
×
NEW
154
    verbosePrint("ORIENTS")
×
155
    verbosePrint(datetime.now() - startTime)
×
156
    sys.stdout.flush()
×
157

NEW
158
    """
×
159
    if iterations == 1:
160
        verbosePrint('Generating .pdb file for frame %s' % (frame+1))
161
        pdbGenerate(all_data, ('frame_%s' % (frame+1)), dimensions)
162
    """
163
    # print(all_data, frame, dimensions)
164
    return (all_data, frame, dimensions)
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc