Author: bugman
Date: Tue Oct 21 13:52:10 2014
New Revision: 26322
URL: http://svn.gna.org/viewcvs/relax?rev=26322&view=rev
Log:
Created the Periodic_table.has_element() method for the lib.periodic_table
module.
This is used to simply check if a given symbol exists as an atom in the
periodic table.
Modified:
trunk/lib/periodic_table.py
Modified: trunk/lib/periodic_table.py
URL:
http://svn.gna.org/viewcvs/relax/trunk/lib/periodic_table.py?rev=26322&r1=26321&r2=26322&view=diff
==============================================================================
--- trunk/lib/periodic_table.py (original)
+++ trunk/lib/periodic_table.py Tue Oct 21 13:52:10 2014
@@ -295,6 +295,25 @@
return isotope.gyromagnetic_ratio
+ def has_element(self, symbol=None):
+ """Check if the periodic table contains an atom for the give symbol.
+
+ @keyword symbol: The atomic symbol.
+ @type symbol: str
+ @return: True if the symbol is in the periodic table, False
otherwise.
+ @rtype: bool
+ """
+
+ # Process the symbol.
+ symbol = process_symbol(symbol)
+
+ # Check.
+ if symbol in self:
+ return True
+ else:
+ return False
+
+
def lookup_symbol(self, atomic_number=None):
"""Return the atomic symbol corresponding to the atomic number Z.
_______________________________________________
relax (http://www.nmr-relax.com)
This is the relax-commits mailing list
[email protected]
To unsubscribe from this list, get a password
reminder, or change your subscription options,
visit the list information page at
https://mail.gna.org/listinfo/relax-commits