Skip to content

Commit

Permalink
Change everything to LGPL
Browse files Browse the repository at this point in the history
  • Loading branch information
rmcgibbo committed Oct 26, 2013
1 parent 64d1091 commit b79cb57
Show file tree
Hide file tree
Showing 82 changed files with 2,938 additions and 2,400 deletions.
1,130 changes: 479 additions & 651 deletions LICENSE

Large diffs are not rendered by default.

34 changes: 21 additions & 13 deletions MDTraj/__init__.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,26 @@
# Copyright 2012 mdtraj developers
##############################################################################
# MDTraj: A Python Library for Loading, Saving, and Manipulating
# Molecular Dynamics Trajectories.
# Copyright 2012-2013 Stanford University and the Authors
#
# This file is part of mdtraj
# Authors: Robert McGibbon
# Contributors:
#
# mdtraj is free software: you can redistribute it and/or modify it under the
# terms of the GNU General Public License as published by the Free Software
# Foundation, either version 3 of the License, or (at your option) any later
# version.
# MDTraj is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as
# published by the Free Software Foundation, either version 2.1
# of the License, or (at your option) any later version.
#
# mdtraj is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
# A PARTICULAR PURPOSE. See the GNU General Public License for more details.
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU General Public License along with
# mdtraj. If not, see http://www.gnu.org/licenses/.
# You should have received a copy of the GNU Lesser General Public
# License along with Foobar. If not, see <http://www.gnu.org/licenses/>.
##############################################################################


"""The mdtraj package contains tools for loading and saving molecular dynamics
trajectories in a variety of formats, including Gromacs XTC & TRR, CHARMM/NAMD
DCD, AMBER BINPOS, PDB, and HDF5.
Expand Down Expand Up @@ -43,12 +51,12 @@ def test(label='full', verbose=2):
Identifies the tests to run. The fast tests take about 10 seconds,
and the full test suite takes about two minutes (as of this writing).
verbose : int, optional
Verbosity value for test outputs, in the range 1-10. Default is 2.
Verbosity value for test outputs, in the range 1-10. Default is 2.
"""
import mdtraj
from mdtraj.testing.nosetester import MDTrajTester
tester = MDTrajTester(mdtraj)
return tester.test(label=label, verbose=verbose, extra_argv=('--exe',))
# prevent nose from discovering this function, or otherwise when its run
# the test suite in an infinite loop
test.__test__ = False
test.__test__ = False
35 changes: 21 additions & 14 deletions MDTraj/arc.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,25 @@
# Copyright 2013-present mdtraj developers
##############################################################################
# MDTraj: A Python Library for Loading, Saving, and Manipulating
# Molecular Dynamics Trajectories.
# Copyright 2012-2013 Stanford University and the Authors
#
# This file is part of mdtraj
# Authors: Lee-Ping Wang
# Contributors: Robert McGibbon
#
# mdtraj is free software: you can redistribute it and/or modify it under the
# terms of the GNU General Public License as published by the Free Software
# Foundation, either version 3 of the License, or (at your option) any later
# version.
# MDTraj is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as
# published by the Free Software Foundation, either version 2.1
# of the License, or (at your option) any later version.
#
# mdtraj is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
# A PARTICULAR PURPOSE. See the GNU General Public License for more details.
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU General Public License along with
# mdtraj. If not, see http://www.gnu.org/licenses/.
# You should have received a copy of the GNU Lesser General Public
# License along with Foobar. If not, see <http://www.gnu.org/licenses/>.
##############################################################################


##############################################################################
# Imports
Expand Down Expand Up @@ -160,7 +167,7 @@ def _read(self):
line = self._fh.readline()
if line == '':
raise _EOF()

self._n_atoms = int(line.split()[0])
self._line_counter += 1

Expand All @@ -181,9 +188,9 @@ def write(self, xyz):
Parameters
----------
xyz : np.ndarray, shape=(n_frames, n_atoms, 3)
The cartesian coordinates of the atoms to write.
The cartesian coordinates of the atoms to write.
"""

raise RuntimeError('write() is not available for .arc files')

29 changes: 18 additions & 11 deletions MDTraj/binpos/binpos.pyx
Original file line number Diff line number Diff line change
@@ -1,19 +1,26 @@
# cython: c_string_type=str, c_string_encoding=ascii
# Copyright 2012 mdtraj developers
##############################################################################
# MDTraj: A Python Library for Loading, Saving, and Manipulating
# Molecular Dynamics Trajectories.
# Copyright 2012-2013 Stanford University and the Authors
#
# This file is part of mdtraj
# Authors: Robert McGibbon
# Contributors:
#
# mdtraj is free software: you can redistribute it and/or modify it under the
# terms of the GNU General Public License as published by the Free Software
# Foundation, either version 3 of the License, or (at your option) any later
# version.
# MDTraj is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as
# published by the Free Software Foundation, either version 2.1
# of the License, or (at your option) any later version.
#
# mdtraj is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
# A PARTICULAR PURPOSE. See the GNU General Public License for more details.
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU General Public License along with
# mdtraj. If not, see http://www.gnu.org/licenses/.
# You should have received a copy of the GNU Lesser General Public
# License along with Foobar. If not, see <http://www.gnu.org/licenses/>.
##############################################################################


###############################################################################
# Imports
Expand Down
41 changes: 24 additions & 17 deletions MDTraj/compatibility.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,25 @@
# Copyright 2012-present mdtraj developers
##############################################################################
# MDTraj: A Python Library for Loading, Saving, and Manipulating
# Molecular Dynamics Trajectories.
# Copyright 2012-2013 Stanford University and the Authors
#
# This file is part of mdtraj
# Authors: Robert McGibbon, Kyle A. Beauchamp
# Contributors:
#
# mdtraj is free software: you can redistribute it and/or modify it under the
# terms of the GNU General Public License as published by the Free Software
# Foundation, either version 3 of the License, or (at your option) any later
# version.
# MDTraj is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as
# published by the Free Software Foundation, either version 2.1
# of the License, or (at your option) any later version.
#
# mdtraj is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
# A PARTICULAR PURPOSE. See the GNU General Public License for more details.
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU General Public License along with
# mdtraj. If not, see http://www.gnu.org/licenses/.
# You should have received a copy of the GNU Lesser General Public
# License along with Foobar. If not, see <http://www.gnu.org/licenses/>.
##############################################################################

"""Compatibility loader for MSMBuilder2 "LH5" trajectory format.
To load .lh5 trajectory files produced by MSMBuilder2, you can import this
Expand Down Expand Up @@ -45,6 +52,7 @@
from __future__ import print_function, division
import numpy as np

from mdtraj import Trajectory, Topology
import mdtraj.pdb.element
import mdtraj.trajectory
from mdtraj.utils import import_
Expand Down Expand Up @@ -92,7 +100,7 @@ def load_legacy_hdf(filename, stride=1, frame=None, chunk=50000,
trajectory : md.Trajectory
The resulting trajectory, as an md.Trajectory object.
"""
from mdtraj import Trajectory

def _convert_from_lossy_integers(X, precision=1000):
"""Implementation of the lossy compression used in Gromacs XTC using
the pytables library. Convert 16 bit integers into 32 bit floats."""
Expand Down Expand Up @@ -201,26 +209,25 @@ def _convert_to_lossy_integers(X, precision):
data_dict["ChainID"] = top.chainID.values
data_dict["ResidueID"] = top.resSeq.values + 1
data_dict["XYZList"] = _convert_to_lossy_integers(traj.xyz, DEFAULT_PRECISION)

atom_dict = {}
atom_dict["AtomID"] = tables.Int64Atom()
atom_dict["AtomNames"] = tables.StringAtom(itemsize=4)
atom_dict["ResidueNames"] = tables.StringAtom(itemsize=4)
atom_dict["ChainID"] = tables.StringAtom(itemsize=1)
atom_dict["ResidueID"] = tables.Int64Atom()
atom_dict["XYZList"] = tables.Int16Atom()

file_handle = tables.File(filename, 'w')

for key, val in iteritems(data_dict):
node = file_handle.createCArray(where='/', name=key, atom=atom_dict[key], shape=val.shape, filters=COMPRESSION)
node[:] = val[:]

file_handle.close()


def _topology_from_arrays(AtomID, AtomNames, ChainID, ResidueID, ResidueNames):
from mdtraj import Topology
topology = Topology()

# assert that the ChainID is just an array of empty strings, which appears
Expand Down Expand Up @@ -254,4 +261,4 @@ def _topology_from_arrays(AtomID, AtomNames, ChainID, ResidueID, ResidueNames):


# register this reader with mdtraj!
#mdtraj.trajectory._LoaderRegistry['.lh5'] = load_legacy_hdf
mdtraj.trajectory._LoaderRegistry['.lh5'] = load_legacy_hdf
35 changes: 21 additions & 14 deletions MDTraj/dcd/dcd.pyx
Original file line number Diff line number Diff line change
@@ -1,19 +1,26 @@
# cython: c_string_type=str, c_string_encoding=ascii
# Copyright 2013 mdtraj developers
##############################################################################
# MDTraj: A Python Library for Loading, Saving, and Manipulating
# Molecular Dynamics Trajectories.
# Copyright 2012-2013 Stanford University and the Authors
#
# This file is part of mdtraj
# Authors: Robert McGibbon
# Contributors:
#
# mdtraj is free software: you can redistribute it and/or modify it under the
# terms of the GNU General Public License as published by the Free Software
# Foundation, either version 3 of the License, or (at your option) any later
# version.
# MDTraj is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as
# published by the Free Software Foundation, either version 2.1
# of the License, or (at your option) any later version.
#
# mdtraj is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
# A PARTICULAR PURPOSE. See the GNU General Public License for more details.
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU General Public License along with
# mdtraj. If not, see http://www.gnu.org/licenses/.
# You should have received a copy of the GNU Lesser General Public
# License along with Foobar. If not, see <http://www.gnu.org/licenses/>.
##############################################################################


##############################################################################
# Imports
Expand Down Expand Up @@ -60,7 +67,7 @@ cdef ERROR_MESSAGES = {

cdef class DCDTrajectoryFile:
"""DCDTrajectoryFile(filename, mode='r', force_overwrite=True)
Interface for reading and writing to a CHARMM/NAMD DCD file.
This is a file-like object, that both reading or writing depending
on the `mode` flag. It implements the context manager protocol,
Expand Down Expand Up @@ -189,7 +196,7 @@ cdef class DCDTrajectoryFile:

def read(self, n_frames=None, stride=None, atom_indices=None):
"""read(n_frames=None, stride=None, atom_indices=None)
Read the data from a DCD file
Parameters
Expand Down Expand Up @@ -306,7 +313,7 @@ cdef class DCDTrajectoryFile:

def write(self, xyz, cell_lengths=None, cell_angles=None):
"""write(xyz, cell_lengths=None, cell_angles=None)
Write one or more frames of data to the DCD file
Parameters
Expand Down
8 changes: 4 additions & 4 deletions MDTraj/dcd/dcdlib.pxd
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
cdef extern from "include/dcdplugin.h":
ctypedef struct dcdhandle:
pass

dcdhandle* open_dcd_read(char *path, char *filetype, int *natoms, int* nsets)
int read_next_timestep(dcdhandle *v, int natoms, molfile_timestep_t *ts)
void close_file_read(dcdhandle *v)

dcdhandle* open_dcd_write(char *path, char *filetype, int natoms)
int write_timestep(dcdhandle *v, molfile_timestep_t *ts)
void close_file_write(dcdhandle *v)


cdef extern from "include/molfile_plugin.h":
ctypedef struct molfile_timestep_t:
float *coords # coordinates of all atoms, arranged xyzxyzxyz
Expand Down
27 changes: 16 additions & 11 deletions MDTraj/geometry/__init__.py
Original file line number Diff line number Diff line change
@@ -1,20 +1,25 @@
# This file is part of MDTraj.
##############################################################################
# MDTraj: A Python Library for Loading, Saving, and Manipulating
# Molecular Dynamics Trajectories.
# Copyright 2012-2013 Stanford University and the Authors
#
# Copyright 2013 Stanford University
# Authors: Robert McGibbon
# Contributors: Kyle A. Beauchamp
#
# MDTraj is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# MDTraj is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as
# published by the Free Software Foundation, either version 2.1
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
# You should have received a copy of the GNU Lesser General Public
# License along with Foobar. If not, see <http://www.gnu.org/licenses/>.
##############################################################################

from __future__ import print_function, division

__all__ = ['compute_distances', 'compute_angles', 'compute_dihedrals']
Expand Down
22 changes: 22 additions & 0 deletions MDTraj/geometry/alignment.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,25 @@
##############################################################################
# MDTraj: A Python Library for Loading, Saving, and Manipulating
# Molecular Dynamics Trajectories.
# Copyright 2012-2013 Stanford University and the Authors
#
# Authors: Kyle A. Beachamp
# Contributors: Robert McGibbon
#
# MDTraj is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as
# published by the Free Software Foundation, either version 2.1
# of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with Foobar. If not, see <http://www.gnu.org/licenses/>.
##############################################################################

"""
Here, we have implemented RMSD calculation using both Kabsch algorithm and
via the quaterion-based characteristic polynomial. Both are implemented
Expand Down
Loading

0 comments on commit b79cb57

Please sign in to comment.