def from_tprfile(tprfile, index_file=None): """ Load atoms from a compiled tpr file. Args: tprile (str): Filename of the tpr file index_file (opt.): Index file that should be loaded alongside. Returns: AtomSubset: All atoms in tprfile """ tpr = TPXReader(tprfile) if index_file is not None: indices = load_indices(index_file) else: indices = None return Atoms(tpr.atoms, indices=indices, charges=tpr.charge, masses=tpr.mass).subset()
def from_grofile(grofile, index_file=None): """ Load atoms from a GROMACS coordinate file. Args: grofile (str): Filename of the grofile index_file (str, optional): Filename of the gromacs indexfile Returns: AtomSubset: All atoms in grofile """ indices = None if index_file is not None: indices = load_indices(index_file) t = np.genfromtxt(grofile, skip_header=2, delimiter=(5, 5, 5), dtype='U8', autostrip=True, skip_footer=1) return Atoms(t, indices).subset()