Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chemspecies update #130

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

tjjarvinen
Copy link
Collaborator

@tjjarvinen tjjarvinen commented Nov 3, 2024

This is update to ChemicalSpecies.

  • Change info field to name field and make it represent 4 characters
  • Add function atomic_name to access the new name field if given, else return atomic_symbol
  • Added masses for isotopes
  • Added symbol X to valid input. Gives weightless particle with atomic number zero

The idea with atomic_name is to represent PDB file format defines atom name columns (13-16). While element_symbol represents element columns (77-78)

  1. element_symbol always gives the symbol of the element
  2. atomic_symbol adds isotope information if given
  3. atomic_name defaults to atomic_symbol, but overwrites it with atomic_name if species has that information.

This works now

julia> ChemicalSpecies(:C)
C

julia> ChemicalSpecies(:C12)
C12

julia> ChemicalSpecies(:C; atomic_name=:MyC)
C

julia> ChemicalSpecies(:C13; atomic_name=:MyC)
C13

julia> ChemicalSpecies(:X)
X

Comparisons

The basic idea is that if no isotope or name information is given, then that ChemicalSpecies works as a general atom with that atomic number.

atomic_name on the other hand is used to distinguish atoms with same type of atoms.

# true
ChemicalSpecies(:C13) == ChemicalSpecies(:C)

# false
ChemicalSpecies(:C12) == ChemicalSpecies(:C13)

# true
ChemicalSpecies(:C; atomic_name=:MyC) == ChemicalSpecies(:C)

# true
ChemicalSpecies(:C12; atomic_name=:MyC) == ChemicalSpecies(:C12)

# false
ChemicalSpecies(:C; atomic_name=:MyC) == ChemicalSpecies(:C12)

# true
ChemicalSpecies(:C12; atomic_name=:MyC) == ChemicalSpecies(:C)

# true
ChemicalSpecies(:C; atomic_name=:MyC) == ChemicalSpecies(:C12; atomic_name=:MyC)

So basically, you can create a potential using ChemicalSpecies(:C). Users can then mark their systems with isotopes or atomic names, for some additional information and the potential that uses "the general carbon" works with them.

masses

julia> mass(ChemicalSpecies(:C))
12.011 u

julia> mass(ChemicalSpecies(:C12))
12.0 u

julia> mass(ChemicalSpecies(:C13))
13.003354835340001 u

julia> mass(ChemicalSpecies(:C; atomic_name=:MyC))
12.011 u

julia> mass(ChemicalSpecies(:C13; atomic_name=:MyC))
13.003354835340001 u

julia> mass(ChemicalSpecies(:X))
0.0 u

@mfherbst @cortner

@rashidrafeek
Copy link
Contributor

just a suggestion: atomic_name seems to imply the name is a property of the atom itself instead of an identifier (which seems to be the case here). Wouldn't just atom_name be better which also matches the PDB defintion?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants