particle icon indicating copy to clipboard operation
particle copied to clipboard

Template for how to create user-defined particles

Open eduardo-rodrigues opened this issue 6 years ago • 2 comments

Add a template file for how to create, and use, user-defined particles. This is basically what is already being done in the DecayLanguage package.

eduardo-rodrigues avatar Apr 03 '19 10:04 eduardo-rodrigues

@henryiii, I will get to this soon. Where would you put such a template, say a file TEMPLATE_UserDefinedParticles.fwf?

eduardo-rodrigues avatar May 09 '19 06:05 eduardo-rodrigues

This has been rather low priority but I should come back to it soon. For now let me add some info on how to create user-defined particles on the fly:

>>> # A Particle instance the simplest possible. Contains basically no info
>>> p = Particle.empty()
>>> p
<Particle: name="Unknown", pdgid=0, mass=None>
>>>
>>> # Use a random PDG ID and a name
>>> # The fact that the PDG ID is random means that one should not expect any useful info from related functions
>>> # such as is_meson, has_bottom, etc.
>>> # (A meaningful PDG ID encodes internal quantum numbers and other info) 
>>> p2 = Particle(9912345, 'MyPentaquark')
>>> p2
<Particle: name="MyPentaquark", pdgid=9912345, mass=None>
>>>
>>> # Get fancier and create a particle with various bits of info
>>> p3 = Particle(pdgid=9221132,pdg_name='Theta',three_charge=3,latex_name='\Theta^{+}')
>>> p3
<Particle: name="Theta", pdgid=9221132, mass=None>
>>>
>>> print(p.describe())
Name: Unknown
>>>
>>> print(p2.describe())  # J=2 is an example of something effectively encoded in the PDG ID.
>>> # For a pentaquarl that's clearly meaningless since a pentaquark is a baryon, hence half-integer spin
Name: MyPentaquark   ID: 9912345      Latex: $Unknown$
Mass  = None
Width = None
Q (charge)        = None    J (total angular) = 2.0      P (space parity) = None
C (charge parity) = None    I (isospin)       = None     G (G-parity)     = None
    Antiparticle name: MyPentaquark (antiparticle status: Same)
>>>
>>> print(p3.describe())
Name: Theta          ID: 9221132      Latex: $\Theta^{+}$
Mass  = None
Width = None
Q (charge)        = +       J (total angular) = 0.5      P (space parity) = None
C (charge parity) = None    I (isospin)       = None     G (G-parity)     = None
    SpinType: SpinType.NonDefined
    Antiparticle name: Theta (antiparticle status: Same)

This is a placeholder and I should put this kind of information in a better place such as the README ;-).

eduardo-rodrigues avatar Nov 06 '20 17:11 eduardo-rodrigues