From 2a80fc156c48a16dc795d619c7503c2384ca6039 Mon Sep 17 00:00:00 2001 From: David Grote Date: Mon, 16 Nov 2020 11:54:25 -0800 Subject: Update picmi constants to match the values in PhysConst (#1483) * Update picmi constants to match the values in PhysConst * In picmi, use string q_e for charge instead of float with charge_state = +-1 * Updated benchmarks of picmi tests --- Python/pywarpx/picmi.py | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'Python/pywarpx/picmi.py') diff --git a/Python/pywarpx/picmi.py b/Python/pywarpx/picmi.py index 7e7fbd9d4..aaf1ec98d 100644 --- a/Python/pywarpx/picmi.py +++ b/Python/pywarpx/picmi.py @@ -21,11 +21,12 @@ class constants: # --- Put the constants in their own namespace # --- Values from WarpXConst.H c = 299792458. - ep0 = 8.854187817e-12 - mu0 = 1.2566370614359173e-06 - q_e = 1.602176462e-19 - m_e = 9.10938291e-31 - m_p = 1.6726231e-27 + ep0 = 8.8541878128e-12 + mu0 = 1.25663706212e-06 + q_e = 1.602176634e-19 + m_e = 9.1093837015e-31 + m_p = 1.67262192369e-27 + hbar = 1.054571817e-34 class Species(picmistandard.PICMI_Species): @@ -45,7 +46,12 @@ class Species(picmistandard.PICMI_Species): if self.mass is None: self.mass = 'm_p' else: if self.charge is None and self.charge_state is not None: - self.charge = self.charge_state*constants.q_e + if self.charge_state == +1.: + self.charge = 'q_e' + elif self.charge_state == -1.: + self.charge = '-q_e' + else: + self.charge = self.charge_state*constants.q_e # Match a string of the format '#nXx', with the '#n' optional isotope number. m = re.match('(?P#[\d+])*(?P[A-Za-z]+)', self.particle_type) if m is not None: -- cgit v1.2.3