diff options
author | 2021-01-20 14:03:54 -0800 | |
---|---|---|
committer | 2021-01-20 14:03:54 -0800 | |
commit | 8d51aa33dd30eae3bc3379586c2a3ddc2dbca120 (patch) | |
tree | f7eec23a72e51324128fe57da168537ba93c25c7 /Source/Utils/write_atomic_data_cpp.py | |
parent | db97d71171ddd0f7de1601323b26542495f719d2 (diff) | |
download | WarpX-8d51aa33dd30eae3bc3379586c2a3ddc2dbca120.tar.gz WarpX-8d51aa33dd30eae3bc3379586c2a3ddc2dbca120.tar.zst WarpX-8d51aa33dd30eae3bc3379586c2a3ddc2dbca120.zip |
SpeciesProperties: C, N, O, Cu (#1638)
* SpeciesProperties: C, N, O, Cu
Add more ionic species as pre-defined particle species.
* Cu: Add to Ionization Energies
Diffstat (limited to '')
-rw-r--r-- | Source/Utils/write_atomic_data_cpp.py | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/Source/Utils/write_atomic_data_cpp.py b/Source/Utils/write_atomic_data_cpp.py index 12cafad0c..9070b71ac 100644 --- a/Source/Utils/write_atomic_data_cpp.py +++ b/Source/Utils/write_atomic_data_cpp.py @@ -1,3 +1,5 @@ +#!/usr/bin/env python3 +# # Copyright 2019-2020 Axel Huebl, Luca Fedeli, Maxence Thevenet # # @@ -32,6 +34,7 @@ cpp_string += '// Edit dev/Source/Utils/write_atomic_data_cpp.py instead!\n' cpp_string += '#ifndef WARPX_IONIZATION_TABLE_H_\n' cpp_string += '#define WARPX_IONIZATION_TABLE_H_\n\n' cpp_string += '#include <AMReX_AmrCore.H>\n' +cpp_string += '#include <AMReX_REAL.H>\n' cpp_string += '#include <map>\n\n' # Map each element to ID in table @@ -42,8 +45,8 @@ cpp_string = cpp_string[:-1] cpp_string += ' };\n\n' # Atomic number of each species -cpp_string += 'const int nelements = ' + str(len(ion_names)) + ';\n\n' -cpp_string += 'const int ion_atomic_numbers[nelements] = {\n ' +cpp_string += 'constexpr int nelements = ' + str(len(ion_names)) + ';\n\n' +cpp_string += 'constexpr int ion_atomic_numbers[nelements] = {\n ' for count, atom_num in enumerate(ion_atom_numbers): if count%10==0 and count>0: cpp_string = cpp_string[:-2] + ',\n ' cpp_string += str(atom_num) + ', ' @@ -51,7 +54,7 @@ cpp_string = cpp_string[:-2] cpp_string += '};\n\n' # Offset of each element in table of ionization energies -cpp_string += 'const int ion_energy_offsets[nelements] = {\n ' +cpp_string += 'constexpr int ion_energy_offsets[nelements] = {\n ' for count, offset in enumerate(ion_offsets): if count%10==0 and count>0: cpp_string = cpp_string[:-2] + ',\n ' cpp_string += str(offset) + ', ' @@ -59,8 +62,8 @@ cpp_string = cpp_string[:-2] cpp_string += '};\n\n' # Table of ionization energies -cpp_string += 'const int energies_tab_length = ' + str(len(list_of_tuples)) + ';\n\n' -cpp_string += 'const amrex::Real table_ionization_energies[energies_tab_length]{' +cpp_string += 'constexpr int energies_tab_length = ' + str(len(list_of_tuples)) + ';\n\n' +cpp_string += 'constexpr amrex::Real table_ionization_energies[energies_tab_length]{' for element in ion_names: cpp_string += '\n // ' + element + '\n ' regex_command = \ @@ -68,8 +71,8 @@ for element in ion_names: %element list_of_tuples = re.findall( regex_command, text_data ) for count, energy in enumerate([x[2] for x in list_of_tuples]): - if count%7==0 and count>0: cpp_string = cpp_string[:-2] + ',\n ' - cpp_string += energy + ', ' + if count%3==0 and count>0: cpp_string = cpp_string[:-2] + ',\n ' + cpp_string += "amrex::Real(" + energy + '), ' cpp_string = cpp_string[:-1] cpp_string = cpp_string[:-1] cpp_string += '\n};\n\n' |