Skip to content

Commit

Permalink
updated changelog
Browse files Browse the repository at this point in the history
  • Loading branch information
jdetle committed Apr 11, 2016
2 parents 64dfdfa + d73c18a commit e27c33a
Show file tree
Hide file tree
Showing 7 changed files with 532 additions and 94 deletions.
24 changes: 22 additions & 2 deletions package/CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@ The rules for this file:
* release numbers follow "Semantic Versioning" http://semver.org

------------------------------------------------------------------------------
??/??/16 jandom, abhinavgupta94, orbeckst, kain88-de, hainm, jbarnoud, dotsdl,
jdetle
??/??/16 jandom, abhinavgupta94, orbeckst, kain88-de, hainm, jbarnoud,
dotsdl, richardjgowers, jdetle

* 0.15.0

Metadata
Expand All @@ -39,12 +40,31 @@ Fixes
* change_release now finds number and dev (Issue #776)
* test_shear_from_matrix doesn't fail for MKL builds anymore (Issue #757)
* HEADER and TITLE now appear just once in the PDB. (Issue #741) (PR #761)
* MOL2 files without substructure section can now be read (Issue #816)
* MOL2 files can be written without substructure section (Issue #816)

Changes

* PDB parsers/readers/writers replaced by permissive counterparts (Issue #777)
* Generalized contact analysis class added. (Issue #702)

Deprecations (Issue #599)

* Deprecated all `get_*` and `set_*` methods of Groups.
* Deprecation warnings for accessing atom attributes from Residue,
ResidueGroup, Segment, SegmentGroup. Will not be present or will
give per-level results.
* Deprecation warnings for accessing plural residue attributes from
Residue or Segment (will disappear), or from SegmentGroup (will give
per-Segment results).
* Deprecation warnings for accessing plural segment attributes from Segment
(will disappear).
* Deprecated Atom number, pos, centroid, universe setter
* Deprecated AtomGroup serials, write_selection
* Deprecated Residue name, id
* Deprecated Segment id, name
* Deprecated as_Universe function; not needed

02/28/16 tyler.je.reddy, kain88-de, jbarnoud, richardjgowers, orbeckst
manuel.nuno.melo, Balasubra, Saxenauts, mattihappy

Expand Down
42 changes: 24 additions & 18 deletions package/MDAnalysis/coordinates/MOL2.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ def __init__(self, filename, **kwargs):
"""Read coordinates from *filename*."""
super(MOL2Reader, self).__init__(filename, **kwargs)

self.n_atoms = None

blocks = []

with util.openany(filename) as f:
Expand Down Expand Up @@ -93,16 +95,26 @@ def parse_block(self, block):
if not len(atom_lines):
raise Exception("The mol2 (starting at line {0}) block has no atoms"
"".format(block["start_line"]))
elif self.n_atoms is None:
# First time round, remember the number of atoms
self.n_atoms = len(atom_lines)
elif len(atom_lines) != self.n_atoms:
raise ValueError(
"MOL2Reader assumes that the number of atoms remains unchanged"
" between frames; the current "
"frame has {0}, the next frame has {1} atoms"
"".format(self.n_atoms, len(atom_lines)))

if not len(bond_lines):
raise Exception("The mol2 (starting at line {0}) block has no bonds"
"".format(block["start_line"]))

coords = []
for a in atom_lines:
coords = np.zeros((self.n_atoms, 3), dtype=np.float32)
for i, a in enumerate(atom_lines):
aid, name, x, y, z, atom_type, resid, resname, charge = a.split()
x, y, z = float(x), float(y), float(z)
coords.append((x, y, z))
coords = np.array(coords, dtype=np.float32)
#x, y, z = float(x), float(y), float(z)
coords[i, :] = x, y, z

return sections, coords

def _read_next_timestep(self, ts=None):
Expand All @@ -124,16 +136,11 @@ def _read_frame(self, frame):

sections, coords = self.parse_block(block)

self.ts.data['molecule'] = sections["molecule"]
self.ts.data['substructure'] = sections["substructure"]

# check if atom number changed
if len(coords) != self.n_atoms:
raise ValueError(
"MOL2Reader assumes that the number of atoms remains unchanged"
" between frames; the current "
"frame has {0}, the next frame has {1} atoms"
"".format(self.n_atoms, len(coords)))
for sect in ['molecule', 'substructure']:
try:
self.ts.data[sect] = sections[sect]
except KeyError:
pass

self.ts.positions = np.array(coords, dtype=np.float32)
self.ts.unitcell = unitcell
Expand Down Expand Up @@ -277,10 +284,9 @@ def encode_block(self, obj):
atom_lines = "\n".join(atom_lines)

try:
substructure = ["@<TRIPOS>SUBSTRUCTURE\n"]
substructure.extend(ts.data['substructure'])
substructure = ["@<TRIPOS>SUBSTRUCTURE\n"] + ts.data['substructure']
except KeyError:
raise NotImplementedError("No MOL2 substructure type found in traj")
substructure = ""

molecule = ts.data['molecule']
check_sums = molecule[1].split()
Expand Down
Loading

0 comments on commit e27c33a

Please sign in to comment.