Skip to content

Commit

Permalink
Add missing orbitals
Browse files Browse the repository at this point in the history
Updated method of generating charge states in classes_orbtials.py: Atom.assign_charge
Fixes Issue #20
  • Loading branch information
DanPorter committed Sep 4, 2024
1 parent 02100e5 commit d6d2cac
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 8 deletions.
11 changes: 7 additions & 4 deletions Dans_Diffraction/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@
Diamond
2017
Version 3.2.2
Last updated: 29/07/24
Version 3.2.3
Last updated: 04/09/24
Version History:
02/03/18 1.0 Version History started.
Expand Down Expand Up @@ -78,6 +78,7 @@
15/05/24 3.2.0 Added "save" and "load" methods to structure factor calculation, improved powder for large calculations
20/05/24 3.2.1 Added pyproject.toml file for installation, including dansdiffraction script
29/07/24 3.2.2 Fix for issue #19 in multiple_scattering code, other minor improvements
04/09/24 3.2.3 Updated method of generating charge states in classes_orbtials.py, Thanks Seonghun!
Acknoledgements:
2018 Thanks to Hepesu for help with Python3 support and ideas about breaking up calculations
Expand All @@ -100,6 +101,8 @@
Jan 2024 Thanks to Carmelo Prestipino for adding search_distance and plot_distance
May 2024 Thanks to Innbig for spotting some errors in large liquid crystal powder patterns
May 2024 Thanks to paul-cares pointing out a silly spelling error in the title!
Aug 2024 Thanks to Seonghun for pointing out the error with charge states in Hf
Aug 2024 Thanks to MaxPelly for spell checks in examples
-----------------------------------------------------------------------------
Copyright 2024 Diamond Light Source Ltd.
Expand Down Expand Up @@ -149,8 +152,8 @@
from .functions_crystallography import readcif


__version__ = '3.2.2'
__date__ = '29/07/24'
__version__ = '3.2.3'
__date__ = '04/09/24'


# Build
Expand Down
22 changes: 18 additions & 4 deletions Dans_Diffraction/classes_orbitals.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,13 @@
Diamond
2020
Version 1.0.0
Last updated: 12/07/20
Version 1.1.0
Last updated: 04/09/24
Version History:
09/05/20 0.1.0 Version History started.
12/07/20 1.0.0 Program functional, performed some testing
04/09/24 1.1.0 Added missing orbitals in Atom.assign_charge
@author: DGPorter
"""
Expand All @@ -50,7 +51,7 @@
from . import functions_general as fg
from . import functions_crystallography as fc

__version__ = '1.0.0'
__version__ = '1.1.0'

OXIDATION_FILE = os.path.join(fc.datadir, 'Element_OxidationStates.txt')

Expand Down Expand Up @@ -307,7 +308,20 @@ def assign_charge(self, charge):
self.charge = charge
intcharge = np.floor(charge)
deccharge = charge % 1
self.orbitals = [Orbital(s) for s in fc.orbital_configuration(self.element_symbol, intcharge)]
# self.orbitals = [Orbital(s) for s in fc.orbital_configuration(self.element_symbol, intcharge)]
# # add empty orbitals
# for n, orbital in enumerate(self.orbitals[:-1]):
# next_orbital = orbital.next_orbital(fill=0) # empty orbital
# if next_orbital not in self.orbitals:
# self.orbitals.insert(n + 1, next_orbital)
neutral_orbitals = [Orbital(s) for s in fc.orbital_configuration(self.element_symbol, 0)]
charge_orbitals = [Orbital(s) for s in fc.orbital_configuration(self.element_symbol, intcharge)]
# add missing orbitals
for n, orbital in enumerate(neutral_orbitals):
if orbital not in charge_orbitals:
orbital.fill = 0
charge_orbitals.insert(n, orbital)
self.orbitals = charge_orbitals
if deccharge > 0:
self.orbitals[-1].remove_electron(deccharge)

Expand Down

0 comments on commit d6d2cac

Please sign in to comment.