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): ...@@ -158,10 +158,13 @@ class CharmmPsfFile(object):
title = list() title = list()
for i in range(ntitle): for i in range(ntitle):
title.append(psf.readline().rstrip()) title.append(psf.readline().rstrip())
# Skip the blank line # Skip all blank lines. Most of the time there is only 1, but I've seen
psf.readline() # a file that has 2
line = psf.readline().strip()
while not line:
line = psf.readline().strip()
# Next is the number of atoms # Next is the number of atoms
natom = conv(psf.readline().strip(), int, 'natom') natom = conv(line, int, 'natom')
# Parse all of the atoms # Parse all of the atoms
residue_list = ResidueList() residue_list = ResidueList()
atom_list = AtomList() atom_list = AtomList()
...@@ -1182,8 +1185,11 @@ class CharmmPsfFile(object): ...@@ -1182,8 +1185,11 @@ class CharmmPsfFile(object):
if switchDistance >= nonbondedCutoff: if switchDistance >= nonbondedCutoff:
raise ValueError('switchDistance is too large compared ' raise ValueError('switchDistance is too large compared '
'to the cutoff!') 'to the cutoff!')
force.setUseSwitchingFunction(True) if abs(switchDistance) != switchDistance:
force.setSwitchingDistance(switchDistance) # Detects negatives for both Quantity and float
raise ValueError('switchDistance must be non-negative!')
force.setUseSwitchingFunction(True)
force.setSwitchingDistance(switchDistance)
else: # periodic else: # periodic
# Set up box vectors (from inpcrd if available, or fall back to # Set up box vectors (from inpcrd if available, or fall back to
...@@ -1223,8 +1229,11 @@ class CharmmPsfFile(object): ...@@ -1223,8 +1229,11 @@ class CharmmPsfFile(object):
if switchDistance >= nonbondedCutoff: if switchDistance >= nonbondedCutoff:
raise ValueError('switchDistance is too large compared ' raise ValueError('switchDistance is too large compared '
'to the cutoff!') 'to the cutoff!')
force.setUseSwitchingFunction(True) if abs(switchDistance) != switchDistance:
force.setSwitchingDistance(switchDistance) # Detects negatives for both Quantity and float
raise ValueError('switchDistance must be non-negative!')
force.setUseSwitchingFunction(True)
force.setSwitchingDistance(switchDistance)
if ewaldErrorTolerance is not None: if ewaldErrorTolerance is not None:
force.setEwaldErrorTolerance(ewaldErrorTolerance) force.setEwaldErrorTolerance(ewaldErrorTolerance)
......
#!/bin/env python
""" """
element.py: Used for managing elements. element.py: Used for managing elements.
......
...@@ -12,7 +12,7 @@ Copyright (c) 2014 the Authors ...@@ -12,7 +12,7 @@ Copyright (c) 2014 the Authors
Author: Jason M. Swails Author: Jason M. Swails
Contributors: Contributors:
Date: April 18, 2014 Date: July 3, 2014
Permission is hereby granted, free of charge, to any person obtaining a Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"), copy of this software and associated documentation files (the "Software"),
...@@ -501,7 +501,7 @@ class Angle(object): ...@@ -501,7 +501,7 @@ class Angle(object):
""" See if a bond or an atom is in this angle """ """ See if a bond or an atom is in this angle """
if isinstance(thing, Bond): if isinstance(thing, Bond):
return self.atom2 in thing and (self.atom1 in thing or 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 # Otherwise assume it's an atom
return self.atom1 is thing or self.atom2 is thing or self.atom3 is thing 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