Commit e62739d2 authored by peastman's avatar peastman
Browse files

Merge pull request #507 from swails/minor_fixes

Small fixes:
parents 0ccc5c9e 11877204
......@@ -158,10 +158,13 @@ class CharmmPsfFile(object):
title = list()
for i in range(ntitle):
title.append(psf.readline().rstrip())
# Skip the blank line
psf.readline()
# Skip all blank lines. Most of the time there is only 1, but I've seen
# a file that has 2
line = psf.readline().strip()
while not line:
line = psf.readline().strip()
# Next is the number of atoms
natom = conv(psf.readline().strip(), int, 'natom')
natom = conv(line, int, 'natom')
# Parse all of the atoms
residue_list = ResidueList()
atom_list = AtomList()
......@@ -1182,6 +1185,9 @@ class CharmmPsfFile(object):
if switchDistance >= nonbondedCutoff:
raise ValueError('switchDistance is too large compared '
'to the cutoff!')
if abs(switchDistance) != switchDistance:
# Detects negatives for both Quantity and float
raise ValueError('switchDistance must be non-negative!')
force.setUseSwitchingFunction(True)
force.setSwitchingDistance(switchDistance)
......@@ -1223,6 +1229,9 @@ class CharmmPsfFile(object):
if switchDistance >= nonbondedCutoff:
raise ValueError('switchDistance is too large compared '
'to the cutoff!')
if abs(switchDistance) != switchDistance:
# Detects negatives for both Quantity and float
raise ValueError('switchDistance must be non-negative!')
force.setUseSwitchingFunction(True)
force.setSwitchingDistance(switchDistance)
......
#!/bin/env python
"""
element.py: Used for managing elements.
......
......@@ -12,7 +12,7 @@ Copyright (c) 2014 the Authors
Author: Jason M. Swails
Contributors:
Date: April 18, 2014
Date: July 3, 2014
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
......@@ -501,7 +501,7 @@ class Angle(object):
""" See if a bond or an atom is in this angle """
if isinstance(thing, Bond):
return self.atom2 in thing and (self.atom1 in thing or
self.atom2 in thing)
self.atom3 in thing)
# Otherwise assume it's an atom
return self.atom1 is thing or self.atom2 is thing or self.atom3 is thing
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment