Beispiel #1
0
 def change_masses(self, new_masses, mass_dictionary):
     # Change the masses of the species stored, using the new_masses dictionary
     # if any of the elements are in the mass_dictionary then use that mass instead
     if not self.program_mass_dictionary:
         # We only want to do this once - remember the program masses as a dictionary
         if self.debug:
             print("Setting program mass dictionary")
         for symbol,mass in zip(self.species,self.masses_per_type):
             element = cleanup_symbol(symbol)
             self.program_mass_dictionary[element] = mass
     if self.debug:
         print("changing masses", self.program_mass_dictionary)
     self.masses = []
     self.masses_per_type = []
     for symbol in self.species:
         # the element name may be appended with a digit or an underscore
         element = cleanup_symbol(symbol)
         mass = new_masses[element]
         if element in mass_dictionary:
             mass = mass_dictionary[element]
         self.masses_per_type.append(mass)
     # end for symbol
     self.masses = [ self.masses_per_type[atype] for atype in self.atom_type_list ]
     if self.debug:
         print("new masses", self.masses)
     return
Beispiel #2
0
 def mass_dictionary(self):
     dictionary = {}
     for symbol,mass in zip(self.species,self.masses_per_type):
         # the element name may be appended with a digit or an underscore
         element = cleanup_symbol(symbol)
         dictionary[element] = mass
     if self.debug:
         print("new mass_dictionary", dictionary)
     return dictionary
Beispiel #3
0
 def set_element_names(self, element_names):
     self.element_names = []
     for el in element_names:
         el = cleanup_symbol(el)
         self.element_names.append(el)
     return
Beispiel #4
0
 def getSpecies(self):
     return [ cleanup_symbol(el) for el in self.species ]