-
Notifications
You must be signed in to change notification settings - Fork 0
/
catalytic-water.py
23 lines (18 loc) · 1.02 KB
/
catalytic-water.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import MDAnalysis as mda
def load_trajectory(dcd_file, prmtop_file):
universe = mda.Universe(prmtop_file, dcd_file)
return universe
def save_selection(trajectory, selection, output_prefix):
for i, ts in enumerate(trajectory.trajectory[::10]):
frame_number = i * 2
selected_atoms = trajectory.select_atoms(selection)
output_file = f"{output_prefix}_{frame_number}.pdb"
selected_atoms.write(output_file)
print(f"Saved selection for frame {frame_number} to {output_file}")
# Example usage:
dcd_file = "../wt-cov-complex-1000ns-rep.dcd"
prmtop_file = "../new-wt-cov-complex-solv.prmtop"
output_prefix = "selected_atoms"
selection = "protein or (resname ROH 0GB 3GB COV or (same resid as ((((type OW and (around 3.5 resid 495 and name OE1)) or (type OW and (around 3.5 resid 495 and name OE2))) and (type OW and (around 4.5 resid 289 and name C1))))))" # Example selection, modify as needed
trajectory = load_trajectory(dcd_file, prmtop_file)
save_selection(trajectory, selection, output_prefix)