Unverified Commit fd44d285 authored by Matt Thompson's avatar Matt Thompson Committed by GitHub
Browse files

Allow multiple registrations of the same atom type if definitions identical (#4531)

* Allow multiple registrations of the same atom type if definitions identical

* Different short-circuiting logic
parent 5d407c94
......@@ -436,6 +436,10 @@ class ForceField(object):
"""Register a new atom type."""
name = parameters['name']
if name in self._atomTypes:
# allow multiple registrations of the same atom type provided the definitions are identical
existing = self._atomTypes[name]
if existing.atomClass == parameters['class'] and existing.mass == float(parameters['mass']) and existing.element.symbol == parameters['element']:
return
raise ValueError('Found multiple definitions for atom type: '+name)
atomClass = parameters['class']
mass = _convertParameterToNumber(parameters['mass'])
......
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