<commit_before>/*
 * Chemharp, an efficient IO library for chemistry file formats
 * Copyright (C) 2015 <NAME>
 *
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/
*/

#include "chemharp-python.hpp"

void register_frame() {
    /* Trajectory class *******************************************************/
    py::class_<Trajectory, boost::noncopyable>("Trajectory",
            py::init<string, py::optional<string, string>>())
        .def("read_next_step", &Trajectory::read_next_step)
        .def("read_at_step", &Trajectory::read_at_step)
        .def("write_step", &Trajectory::write_step)
        .def("done", &Trajectory::done)
        .def("close", &Trajectory::close)
        .def("nsteps", &Trajectory::nsteps)
        .def("topology",
            static_cast<void (Trajectory::*)(const Topology&)>(&Trajectory::topology))
        .def("topology",
            static_cast<void (Trajectory::*)(const string&)>(&Trajectory::topology))
    ;
}
<commit_msg>Wrap the good class to Python<commit_after>/*
 * Chemharp, an efficient IO library for chemistry file formats
 * Copyright (C) 2015 <NAME>
 *
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/
*/

#include "chemharp-python.hpp"

void register_frame() {
    /* Frame class ************************************************************/
    py::class_<Frame>("Frame")
        .add_property("positions",
            py::make_function(
                static_cast<const Array3D& (Frame::*)(void) const>(&Frame::positions),
                py::return_value_policy<Array3D_convertor>()),
            static_cast<void (Frame::*)(const Array3D&)>(&Frame::positions)
            )
        .add_property("velocities",
            py::make_function(
                static_cast<const Array3D& (Frame::*)(void) const>(&Frame::velocities),
                py::return_value_policy<Array3D_convertor>()),
            static_cast<void (Frame::*)(const Array3D&)>(&Frame::positions)
            )
        .add_property("has_velocities", &Frame::has_velocities)
        .def("__len__", &Frame::natoms)
        .add_property("natoms", &Frame::natoms)
        .add_property("topology",
            py::make_function(
                static_cast<const Topology& (Frame::*)(void) const>(&Frame::topology),
                py::return_value_policy<py::copy_const_reference>()),
            static_cast<void (Frame::*)(const Topology&)>(&Frame::topology))
        .add_property("cell",
            py::make_function(
                static_cast<const UnitCell& (Frame::*)(void) const>(&Frame::cell),
                py::return_value_policy<py::copy_const_reference>()),
            static_cast<void (Frame::*)(const UnitCell&)>(&Frame::cell))
        .add_property("step",
            static_cast<size_t (Frame::*)(void) const>(&Frame::step),
            static_cast<void (Frame::*)(size_t)>(&Frame::step))
    ;
}

{'fraction_non_alphanumeric': 0.18674698795180722, 'fraction_numerical': 0.006975269499048827, 'mean_word_length': 3.252021563342318, 'pattern_counts': {'":': 0, '<': 25, '<?xml version=': 0, '>': 25, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5460517', 'n_tokens_mistral': 975, 'n_tokens_neox': 946, 'n_words': 191}