remove-water 0¶

Query¶

import mdtraj as md
import numpy as np

def remove_water(traj_file,top_file):
  """
  This function removes solvent from loaded trajectory traj_file and topology in top_file to return the new trajctory
  """
  [insert]
  return new_traj

Output¶

import mdtraj as md
import numpy as np

def remove_water(traj_file,top_file):
  """
  This function removes solvent from loaded trajectory traj_file and topology in top_file to return the new trajctory
  """
  traj = md.load(traj_file,top=top_file)
  top = traj.topology
  water_indices = top.select('water')
  new_traj = traj.atom_slice(np.setdiff1d(np.arange(traj.n_atoms),water_indices))
  return new_traj

Evaluate¶

Go to Google Form