Skip to content

Navigation Menu

Sign in
Sign up

CaviTracer - Optimization - #2241

Open
MatthewLicht wants to merge 16 commits into
prody:main from
MatthewLicht:ct_dev
Open

CaviTracer - Optimization #2241
MatthewLicht wants to merge 16 commits into
prody:main from
MatthewLicht:ct_dev

Conversation

@MatthewLicht

@MatthewLicht MatthewLicht commented Jun 26, 2026

Copy link
Copy Markdown

I modified the sphere_fit, delete_simplices3d ,delete_section, surface_layer, and dijkstra functions in the ChannelCalculator Class for faster processing. Additionally, calcChannelsMultipleFrames uses multiprocessing Pool for parallel processing.

to test the code
from prody import *

Tests:
(1) Single PDB:
from prody import *
p = parsePDB('1tqn').select('protein')
calcChannels(p, output_path='test1.pdb')

(2) Multi-PDB:
from prody import *
p = parsePDB('multi.pdb').select('protein') (e.g. '2L6X')
calcChannelsMultipleFrames(p, output_path='mm_test_1', max_proc=2)

(3) DCD file:
from prody import *
PDBfile = 'structure.pdb'
DCDfile = 'trajectory.dcd'
atoms = parsePDB(PDBfile)
dcd = Trajectory(DCDfile)
dcd.link(atoms)
dcd.setCoords(atoms)
calcChannelsMultipleFrames(atoms, dcd, output_path='mm_test_2',max_proc=2)

(4) Multiple AtomGroups:
from prody import *
pdbs = [list of pdb files]
ags = [parsePDB(pdb) for pdb in pdbs ]
calcChannelsMultipleAtomGroups(ags)

...culated for all relevant tetrahedra in the vector, rather than a for loop
karolamik13 self-requested a review June 26, 2026 20:50
Comment thread prody/proteins/channels.py Outdated
from prody import LOGGER, SETTINGS, PY3K
from prody.atomic import AtomGroup, Atom, Atomic, Selection, Select
from prody.atomic import flags, sliceAtomicData
from prody.dynamics.nma import NMA

@jamesmkrieger jamesmkrieger Jul 1, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is this added?



def calcChannels(atoms, output_path=None, separate=False, start_point=None, r1=3, r2=1.25, min_depth=10, bottleneck=1, sparsity=15):
def calcChannels(atoms, r1=3, r2=1.25, min_depth=10, bottleneck=1, sparsity=15, start_point=None, **kwargs):

@jamesmkrieger jamesmkrieger Jul 1, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

make sure these changes don't conflict with #2240

Comment thread prody/proteins/channels.py Outdated
checkCoords(coords)
except TypeError:
raise TypeError('coords must be an object with `getCoords` method')
raise TypeError('coords must be an object with `getCoords` method')

@jamesmkrieger jamesmkrieger Jul 1, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this error seems wrong. The getCoords function is being used instead of the objects method so numpy arrays should be supported too

Comment thread prody/proteins/channels.py Outdated

filenames = kwargs.pop('filenames',[None]*len(traj))
if max_proc == 1:
results = [_frame_worker((atoms,frame.getCoords(),kwargs,i,filenames[i])) for i, frame in enumerate(traj)]

@jamesmkrieger jamesmkrieger Jul 1, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

make lines shorter so more readable. Break it across lines e.g. at for

Comment thread prody/proteins/channels.py Outdated
if max_proc == 1:
results = [_frame_worker((atoms,frame.getCoords(),kwargs,i,filenames[i])) for i, frame in enumerate(traj)]
else:
tasks = ((atoms,frame.getCoords(),kwargs,i,filenames[i]) for i, frame in enumerate(traj))

@jamesmkrieger jamesmkrieger Jul 1, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

break this line too

Comment thread prody/proteins/channels.py Outdated
results = _run_with_pool(_frame_worker,tasks,max_proc,chunksize,'fork')
except (OSError, EOFError):
try:
results = _run_with_pool(_frame_worker,tasks,max_proc,chunksize,'spawn')

@jamesmkrieger jamesmkrieger Jul 1, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

break line after ( and again before ) is a standard way that could help here

@jamesmkrieger jamesmkrieger left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks generally reasonable to me but I don't know enough about what's supposed to happen to comment on details

Copy link
Copy Markdown
Contributor

@MatthewLicht Can we close this pull request since @briza81 included (your; I guess) speed improvements in #2249? Or should we keep it and include several more things?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@jamesmkrieger jamesmkrieger jamesmkrieger approved these changes
@karolamik13 karolamik13 Awaiting requested review from karolamik13

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /