"platforms/cuda/vscode:/vscode.git/clone" did not exist on "cb92103e443a76e65a19f8afb40f5dcd6df0477e"
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): ...@@ -436,6 +436,10 @@ class ForceField(object):
"""Register a new atom type.""" """Register a new atom type."""
name = parameters['name'] name = parameters['name']
if name in self._atomTypes: 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) raise ValueError('Found multiple definitions for atom type: '+name)
atomClass = parameters['class'] atomClass = parameters['class']
mass = _convertParameterToNumber(parameters['mass']) 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