<commit_before>#! /usr/bin/env python
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
#
# Copyright © 2017 <NAME> <<EMAIL>>
#
# Distributed under terms of the MIT license.

"""Series of functions for manipulating data from MD trajectories."""

import logging
from pathlib import Path

import gsd.hoomd

from ..StepSize import GenerateStepSeries
from ..TimeDep import TimeDepMany

logger = logging.getLogger('motion')


def compute_motion(filename: Path, outdir: Path=None):
    """Compute the translations and rotations of every molecule."""
    with gsd.hoomd.open(str(filename), 'rb') as src:
        num_steps = src[-1].configuration.step
        step_iter = GenerateStepSeries(num_steps+1,
                                       num_linear=100,
                                       gen_steps=1000,
                                       max_gen=1000)
        if outdir:
            outfile = outdir / filename.name
        else:
            outfile = filename
        outfile.with_suffix('.hdf5')
        dynamics = TimeDepMany(outfile)
        curr_step = 0
        for frame in src:
            if curr_step == frame.configuration.step:
                dynamics.append(frame,
                                step_iter.get_index(), curr_step)
                curr_step = step_iter.next()
            elif curr_step > frame.configuration.step:
                logger.warning(
                    'Frame step index missing for current frame, skipping' +<commit_msg>Revert number of steps between key frames to previous<commit_after>#! /usr/bin/env python
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
#
# Copyright © 2017 <NAME> <<EMAIL>>
#
# Distributed under terms of the MIT license.

"""Series of functions for manipulating data from MD trajectories."""

import logging
from pathlib import Path

import gsd.hoomd

from ..StepSize import GenerateStepSeries
from ..TimeDep import TimeDepMany

logger = logging.getLogger('motion')


def compute_motion(filename: Path, outdir: Path=None):
    """Compute the translations and rotations of every molecule."""
    with gsd.hoomd.open(str(filename), 'rb') as src:
        num_steps = src[-1].configuration.step
        step_iter = GenerateStepSeries(num_steps+1,
                                       num_linear=100,
                                       gen_steps=20000,
                                       max_gen=1000)
        if outdir:
            outfile = outdir / filename.name
        else:
            outfile = filename
        outfile.with_suffix('.hdf5')
        dynamics = TimeDepMany(outfile)
        curr_step = 0
        for frame in src:
            if curr_step == frame.configuration.step:
                dynamics.append(frame,
                                step_iter.get_index(), curr_step)
                curr_step = step_iter.next()
            elif curr_step > frame.configuration.step:
                logger.warning(
                    'Frame step index missing for current frame, skipping' +
{'fraction_non_alphanumeric': 0.0910010111223458, 'fraction_numerical': 0.014492753623188406, 'mean_word_length': 1.9126594700686947, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6249136', 'n_tokens_mistral': 834, 'n_tokens_neox': 777, 'n_words': 222}