ENM Base class#22
Conversation
calculation into respective classes
docstring updates and hatch building system
JHKru
left a comment
There was a problem hiding this comment.
Hi, thanks for your extensive contributions!
They are well-thought out and structured, but for the future, feel free to size them down to multiple individual commits that are easier to handle and review on their own.
A few additional points for discussion:
- Regarding changes to the build system -> To what extent/why are these necessary? Any need to (mostly) switch away from conda here?
- You might like to squash/combine some of intermediate commits, because it is a bit difficult to follow.
For instance, in intermediate commits a Cython extension for ENM-perturbation is set up, that is not part of the overall PR, if I'm not mistaken (commit 39d2795)?
| - uses: actions/upload-artifact@v7 | ||
| with: | ||
| name: Springcraft distribution | ||
| name: release-dist |
| This is not a copy: Create a copy before modifying this matrix. | ||
| masses : None or ndarray, shape=(n,), dtype=float | ||
| The mass for each atom, `None` if no mass weighting is applied. | ||
| hessian : ndarray, shape=(n,n), dtype=float |
There was a problem hiding this comment.
If I'm not mistaken shape=(n3, n3) is expected here (Hessian).
| return join(dirname(realpath(__file__)), "data") | ||
|
|
||
|
|
||
| def load_protein_structure(pdb_id: str) -> struc.AtomArray: |
There was a problem hiding this comment.
pdb_id could be replaced with cif_id for clarity here.
| i = 0 | ||
| while self._eig_values[i] < -threshold: | ||
| i = i + 1 | ||
| n_neg = i | ||
| while self._eig_values[i] <= threshold: | ||
| i = i + 1 | ||
| n_triv = i + n_neg |
There was a problem hiding this comment.
This could be handled by regular Numpy indexing/Boolean masks, instead of directly looping through the Array.
| enm : ANM or GNM | ||
| Elastic network model; an instance of either an GNM or ANM | ||
| object. | ||
| enm : ENM |
There was a problem hiding this comment.
Could be kept it specific here and in the remainder of the file, like in the example above (eigen):
"Elastic network model; an instance of either a GNM or ANM"
Logical changes
np.linalg.pinv. Internally this method usesnp.linalg.eighto calculate the eigenvalues/-vectors and constructs the pseudo-inverse using the reciprocal eigenvalues. This change makes this calculation explicitly and stores the eigenvalues/-vectors in the process so that they can be easily reused for NMA calculations without recalculation.ENM.eigen()function.Bug fixes
coorddifference between atoms instead of callingstruc.displacementas the latter one forcesfloat32precision butfloat64is desired.Housekeeping
numpydoc lintrules as the parent project).pdbto.ciffiles for tests because RCSB will phase out the old format.to