def next(self): num_crds_left = self.num_crds crd_per_line = self.crd_per_line crd_len = self.crd_len crds = [] f = self.file while num_crds_left > 0: line = f.next() num_on_line = min(num_crds_left, crd_per_line) last_idx = 0 for next_idx in xrange(crd_len, crd_len * (num_on_line+1), crd_len): crds.append(floatx(line[last_idx:next_idx])) last_idx = next_idx num_crds_left -= num_on_line if not self.box: return np.array(crds) line = f.next() num_on_line = len(line)/crd_len box_crds = [] last_idx = 0 for next_idx in xrange(crd_len, crd_len * (num_on_line+1), crd_len): box_crds.append(floatx(line[last_idx:next_idx])) last_idx = next_idx return np.array(crds), np.array(box_crds)
def next(self): f = self.file self.num_atoms = int(f.next()) crd_per_line = self.crd_per_line crd_len = self.crd_len crds = [] num_crds_left = 3 * self.num_atoms while num_crds_left > 0: line = f.next() num_on_line = min(num_crds_left, crd_per_line) last_idx = 0 for next_idx in xrange(crd_len, crd_len * (num_on_line+1), crd_len): crds.append(floatx(line[last_idx:next_idx])) last_idx = next_idx num_crds_left -= num_on_line if not self.dynamics and not self.box: return np.array(crds) if self.dynamics: num_crds_left = self.num_crds vel_crds = [] while num_crds_left > 0: line = f.next() num_on_line = min(num_crds_left, crd_per_line) last_idx = 0 for next_idx in xrange(crd_len, crd_len * (num_on_line+1), crd_len): vel_crds.append(floatx(line[last_idx:next_idx])) last_idx = next_idx num_crds_left -= num_on_line if not self.box: return np.array(crds), np.array(vel_crds) line = f.next() num_on_line = len(line)/crd_len box_crds = [] last_idx = 0 for next_idx in xrange(crd_len, crd_len * (num_on_line+1), crd_len): box_crds.append(floatx(line[last_idx:next_idx])) last_idx = next_idx if self.dynamics: return np.array(crds), np.array(vel_crds), np.array(box_crds) return np.array(crds), np.array(box_crds)
def next(self): f = self.file self.num_atoms = int(f.next()) crd_per_line = self.crd_per_line crd_len = self.crd_len crds = [] num_crds_left = 3 * self.num_atoms while num_crds_left > 0: line = f.next() num_on_line = min(num_crds_left, crd_per_line) last_idx = 0 for next_idx in xrange(crd_len, crd_len * (num_on_line + 1), crd_len): crds.append(floatx(line[last_idx:next_idx])) last_idx = next_idx num_crds_left -= num_on_line if not self.dynamics and not self.box: return np.array(crds) if self.dynamics: num_crds_left = self.num_crds vel_crds = [] while num_crds_left > 0: line = f.next() num_on_line = min(num_crds_left, crd_per_line) last_idx = 0 for next_idx in xrange(crd_len, crd_len * (num_on_line + 1), crd_len): vel_crds.append(floatx(line[last_idx:next_idx])) last_idx = next_idx num_crds_left -= num_on_line if not self.box: return np.array(crds), np.array(vel_crds) line = f.next() num_on_line = len(line) / crd_len box_crds = [] last_idx = 0 for next_idx in xrange(crd_len, crd_len * (num_on_line + 1), crd_len): box_crds.append(floatx(line[last_idx:next_idx])) last_idx = next_idx if self.dynamics: return np.array(crds), np.array(vel_crds), np.array(box_crds) return np.array(crds), np.array(box_crds)