GithubHelp home page GithubHelp logo

asche1 / pycrystalfield Goto Github PK

View Code? Open in Web Editor NEW
49.0 49.0 18.0 56.96 MB

Code to calculate the crystal field Hamiltonian of magnetic ions.

License: GNU General Public License v3.0

Jupyter Notebook 98.74% Python 1.16% TeX 0.03% PLSQL 0.08%

pycrystalfield's People

Contributors

asche1 avatar drjbarker avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pycrystalfield's Issues

Accounting for ionic interactions via the molecular field

Hi @asche1 and @drjbarker,

My research has immensely benefited from your PyCrystalField program. Thank you so much for this wonderful CEF fitting program.

Currently, the PyCrystalField program has a general Hamiltonian with the CEF and Zeeman terms. I wish to suggest a feature of including the molecular field in the general Hamiltonian. The molecular field accounts for the ionic interactions within a mean-field framework.

In my master's thesis project, I implemented this feature by modifying the PyCrystalField program. I have briefly described the general Hamiltonian, and thus physical observables, in light of the molecular field in my master's thesis, see pages 15 - 16. To check that this feature works, I have tested it with CeAgSb2. The magnetization and susceptibility were accurately reproduced, see pages 20-21 of my master's thesis.

Also, the molecular field feature has been incredible in my research studies, leading to two peer-reviewed publications: CeCd3As3 and CeCd3P3 and CeCd0.67As2.

Please let me know if this new feature is something you would like to incorporate. If so, I am glad to hear your suggestions on what's next whether by way of creating a pull request.

Regarding Data Size

Hi, I wonder if my data size is different, what kind of adjustment should I make to the code? Thanks!

Error running the code

Hi, I am trying to calculating CF eigenvalues of NdAlO3 system for Nd+3 ions. However, I am getting the error as following. Tried changing names of Nd+3, Nd etc for the central ion but couldn't succeed.
63c35d7b08e57b0a14c6ed4ef335635

Would really appreciate your help. Providing my cif file as well.

`
data_global
_audit_creation_date 04/01/2023
_audit_creation_method "FullProf Suite"

PROCESSING SUMMARY (IUCr Office Use Only)

_journal_data_validation_number ?

_journal_date_recd_electronic ?
_journal_date_to_coeditor ?
_journal_date_from_coeditor ?
_journal_date_accepted ?
_journal_date_printers_first ?
_journal_date_printers_final ?
_journal_date_proofs_out ?
_journal_date_proofs_in ?
_journal_coeditor_name ?
_journal_coeditor_code ?
_journal_coeditor_notes
; ?
;
_journal_techeditor_code ?
_journal_techeditor_notes
; ?
;
_journal_coden_ASTM ?
_journal_name_full ?
_journal_year ?
_journal_volume ?
_journal_issue ?
_journal_page_first ?
_journal_page_last ?
_journal_paper_category ?
_journal_suppl_publ_number ?
_journal_suppl_publ_pages ?

_publ_contact_author_name ? # Name of author for correspondence
_publ_contact_author_address # Address of author for correspondence
; ?
;
_publ_contact_author_email ?
_publ_contact_author_fax ?
_publ_contact_author_phone ?

_publ_contact_letter
; ?
;

_publ_requested_journal ?
_publ_requested_coeditor_name ?
_publ_requested_category ?

loop_
_publ_manuscript_incl_extra_item
_publ_manuscript_incl_extra_info
_publ_manuscript_incl_extra_defn

Name Explanation Standard?

------ ----------- ---------

'_pd_proc_ls_prof_cR_factor' 'Prof. R-factor CORRECTED for background' no
'_pd_proc_ls_prof_cwR_factor' 'wProf.R-factor CORRECTED for background' no
'_pd_proc_ls_prof_cwR_expected' 'wProf.Expected CORRECTED for background' no
'_pd_proc_ls_prof_chi2' 'Chi-square for all considered points' no
'_pd_proc_ls_prof_echi2' 'Chi-2 for points with Bragg contribution' no

_publ_section_title
; ' La_0%'
;
_publ_section_title_footnote
;
;

loop_
_publ_author_name
_publ_author_footnote
_publ_author_address
? #<--'Last name, first name'
; ?
;
; ?
;

_publ_section_synopsis
; ?
;
_publ_section_abstract
; ?
;
_publ_section_comment
; ?
;
_publ_section_exptl_prep # Details of the preparation of the sample(s)
# should be given here.
; ?
;
_publ_section_exptl_refinement
; ?
;
_publ_section_references
; ?
;
_publ_section_figure_captions
; ?
;
_publ_section_acknowledgements
; ?
;

data_Rhombohedral

_chemical_name_systematic
; ?
;
_chemical_name_common ?
_chemical_formula_moiety ?
_chemical_formula_structural ?
_chemical_formula_analytical ?
_chemical_formula_iupac ?
_chemical_formula_sum ?
_chemical_formula_weight ?
_chemical_melting_point ?
_chemical_compound_source ? # for minerals and
# natural products

loop_
_atom_type_symbol
_atom_type_scat_Cromer_Mann_a1
_atom_type_scat_Cromer_Mann_b1
_atom_type_scat_Cromer_Mann_a2
_atom_type_scat_Cromer_Mann_b2
_atom_type_scat_Cromer_Mann_a3
_atom_type_scat_Cromer_Mann_b3
_atom_type_scat_Cromer_Mann_a4
_atom_type_scat_Cromer_Mann_b4
_atom_type_scat_Cromer_Mann_c
_atom_type_scat_dispersion_real
_atom_type_scat_dispersion_imag
_atom_type_scat_source
nd+3 21.96100 2.52722 19.93390 0.19924 12.12000 14.17830
1.51031 30.87170 1.47588 -3.43100 10.93300
International_Tables_for_Crystallography_Vol.C(1991)_Tables_6.1.1.4_and_6.1.1.5
al+3 4.17448 1.93816 3.38760 4.14553 1.20296 0.22875
0.52814 8.28524 0.70679 0.20400 0.24600
International_Tables_for_Crystallography_Vol.C(1991)_Tables_6.1.1.4_and_6.1.1.5
o-2 4.75800 7.83100 3.63700 30.05000 0.00000 0.00000
0.00000 0.00000 1.59400 0.04700 0.03200
International_Tables_for_Crystallography_Vol.C(1991)_Tables_6.1.1.4_and_6.1.1.5

_symmetry_cell_setting Trigonal
_symmetry_space_group_name_H-M 'R -3 c'
_symmetry_space_group_name_Hall '-R 3 2"c'

loop_
_symmetry_equiv_pos_as_xyz
'x,y,z'
'-y,x-y,z'
'-x+y,-x,z'
'-y,-x,z+1/2'
'-x+y,y,z+1/2'
'x,x-y,z+1/2'
'-x,-y,-z'
'y,-x+y,-z'
'x-y,x,-z'
'y,x,-z+1/2'
'x-y,-y,-z+1/2'
'-x,-x+y,-z+1/2'
'x+2/3,y+1/3,z+1/3'
'-y+2/3,x-y+1/3,z+1/3'
'-x+y+2/3,-x+1/3,z+1/3'
'-y+2/3,-x+1/3,z+5/6'
'-x+y+2/3,y+1/3,z+5/6'
'x+2/3,x-y+1/3,z+5/6'
'-x+2/3,-y+1/3,-z+1/3'
'y+2/3,-x+y+1/3,-z+1/3'
'x-y+2/3,x+1/3,-z+1/3'
'y+2/3,x+1/3,-z+5/6'
'x-y+2/3,-y+1/3,-z+5/6'
'-x+2/3,-x+y+1/3,-z+5/6'
'x+1/3,y+2/3,z+2/3'
'-y+1/3,x-y+2/3,z+2/3'
'-x+y+1/3,-x+2/3,z+2/3'
'-y+1/3,-x+2/3,z+1/6'
'-x+y+1/3,y+2/3,z+1/6'
'x+1/3,x-y+2/3,z+1/6'
'-x+1/3,-y+2/3,-z+2/3'
'y+1/3,-x+y+2/3,-z+2/3'
'x-y+1/3,x+2/3,-z+2/3'
'y+1/3,x+2/3,-z+1/6'
'x-y+1/3,-y+2/3,-z+1/6'
'-x+1/3,-x+y+2/3,-z+1/6'

_cell_length_a 5.31595(20)
_cell_length_b 5.31595(20)
_cell_length_c 12.9269(7)
_cell_angle_alpha 90.0000
_cell_angle_beta 90.0000
_cell_angle_gamma 120.000
_cell_volume 316.36(2)
_cell_formula_units_Z ?
_cell_measurement_temperature ?
_cell_special_details
; ?
;

_pd_spec_size_axial ? # perpendicular to
# equatorial plane
_pd_spec_size_equat ? # parallel to
# scattering vector
# in transmission
_pd_spec_size_thick ? # parallel to
# scattering vector
# in reflection

_pd_spec_mounting # This field should be
# used to give details of the
# container.
; ?
;
_pd_spec_mount_mode ? # options are 'reflection'
# or 'transmission'
_pd_spec_shape ? # options are 'cylinder'
# 'flat_sheet' or 'irregular'
_pd_char_particle_morphology ?
_pd_char_colour ? # use ICDD colour descriptions

_pd_prep_cool_rate ?
_pd_prep_pressure ?
_pd_prep_temperature ?

_exptl_absorpt_coefficient_mu ?
_exptl_absorpt_correction_type ?
_exptl_absorpt_process_details ?
_exptl_absorpt_correction_T_min ?
_exptl_absorpt_correction_T_max ?

_exptl_special_details
; ?
;

_pd_instr_location
; ?
;
_pd_calibration_special_details # description of the method used
# to calibrate the instrument
; ?
;

_diffrn_ambient_temperature ?
_diffrn_source ? # Put here: 'rotating-anode X-ray tube' or similar
_diffrn_radiation_type 'X-ray'
_diffrn_source_target ? # Put here the chemical symbol of the anode

_diffrn_radiation_monochromator ?
_diffrn_measurement_device_type ?
_diffrn_measurement_method ?
_diffrn_detector_area_resol_mean ?
_diffrn_detector ?
_diffrn_detector_type ? # make or model of detector
_pd_meas_scan_method ? # options are 'step', 'cont',
# 'tof', 'fixed' or
# 'disp' (= dispersive)
_pd_meas_special_details
; ?
;

_pd_meas_number_of_points 4410
_pd_meas_2theta_range_min 10.12231
_pd_meas_2theta_range_max 100.00002
_pd_meas_2theta_range_inc 0.020391

_refine_special_details
; ?
;

_pd_proc_ls_special_details
; ?
;

_pd_proc_ls_profile_function ?
_pd_proc_ls_background_function ?
_pd_proc_ls_pref_orient_corr
; ?
;

_pd_proc_ls_prof_R_factor 10.1703
_pd_proc_ls_prof_wR_factor 13.7360
_pd_proc_ls_prof_wR_expected 12.2391

_pd_proc_ls_prof_cR_factor 26.3022
_pd_proc_ls_prof_cwR_factor 24.4074
_pd_proc_ls_prof_cwR_expected 21.7474

_pd_proc_ls_prof_chi2 1.2596
_pd_proc_ls_prof_echi2 1.2367

_refine_ls_R_I_factor 5.1999
_refine_ls_number_reflns 90
_refine_ls_number_parameters 16
_refine_ls_number_restraints 0

_pd_proc_2theta_range_min 10.1860
_pd_proc_2theta_range_max 100.0637
_pd_proc_2theta_range_inc 0.020391
_pd_proc_wavelength 1.540560

_pd_block_diffractogram_id ? # The id used for the block containing
# the powder pattern profile (section 11)

_pd_proc_info_excluded_regions ?
_pd_proc_info_data_reduction ?

_computing_data_collection ?
_computing_structure_solution ?
_computing_structure_refinement FULLPROF
_computing_molecular_graphics ?
_computing_publication_material ?

loop_
_atom_site_label
_atom_site_fract_x
_atom_site_fract_y
_atom_site_fract_z
_atom_site_U_iso_or_equiv
_atom_site_occupancy
_atom_site_adp_type
_atom_site_type_symbol
Nd 0.00000 0.00000 0.25000 -0.0037 1.00000 Uiso Nd+3
Al 0.00000 0.00000 0.00000 -0.0037 1.00000 Uiso Al+3
O 0.5449(16) 0.00000 0.25000 -0.0037 1.00000 Uiso O-2

_geom_special_details ?

loop_
_geom_bond_atom_site_label_1
_geom_bond_atom_site_label_2
_geom_bond_site_symmetry_1
_geom_bond_site_symmetry_2
_geom_bond_distance
_geom_bond_publ_flag
? ? ? ? ? ?

loop_
_geom_contact_atom_site_label_1
_geom_contact_atom_site_label_2
_geom_contact_distance
_geom_contact_site_symmetry_1
_geom_contact_site_symmetry_2
_geom_contact_publ_flag
? ? ? ? ? ?

loop_
_geom_angle_atom_site_label_1
_geom_angle_atom_site_label_2
_geom_angle_atom_site_label_3
_geom_angle_site_symmetry_1
_geom_angle_site_symmetry_2
_geom_angle_site_symmetry_3
_geom_angle
_geom_angle_publ_flag
? ? ? ? ? ? ? ?

loop_
_geom_torsion_atom_site_label_1
_geom_torsion_atom_site_label_2
_geom_torsion_atom_site_label_3
_geom_torsion_atom_site_label_4
_geom_torsion_site_symmetry_1
_geom_torsion_site_symmetry_2
_geom_torsion_site_symmetry_3
_geom_torsion_site_symmetry_4
_geom_torsion
_geom_torsion_publ_flag
? ? ? ? ? ? ? ? ? ?

loop_
_geom_hbond_atom_site_label_D
_geom_hbond_atom_site_label_H
_geom_hbond_atom_site_label_A
_geom_hbond_site_symmetry_D
_geom_hbond_site_symmetry_H
_geom_hbond_site_symmetry_A
_geom_hbond_distance_DH
_geom_hbond_distance_HA
_geom_hbond_distance_DA
_geom_hbond_angle_DHA
_geom_hbond_publ_flag
? ? ? ? ? ? ? ? ? ? ?

`

Thanks

Issue importing jitclass from numba

When I tried running PyCrystalField.py I got hit with an error: "cannot import name 'jitclass' from 'numba' (C:\Users\CC\AppData\Local\Programs\Python\Python37\lib\site-packages\numba_init_.py)"

I was able to fix it by following the recommendation on this website (https://128mots.com/index.php/en/2021/03/01/cannot-import-name-jitclass-from-numba-opt-conda-lib-python3-7-site-packages-numba-__init__-py/) changing "from numba import jitclass" to "from numba.experimental import jitclass"

other magnetic ions

Hello,

thanks for building this project! I have the impression that the set of magnetic ions is limited -- specifically there are only tri-valent rare-earths included. Is it possible to include support for others, e.g. Eu2+?

Thanks!

Regarding Overlapping atoms

WechatIMG2568
As shown in the screen shot. The reading CIF cannot run well with structure that contains overlapping atoms (K and Ba here).

Attached is the output and traceback

`Importing atoms
9 atoms added
.cif import complete.
No mag_ion ion listed, assuming Yb is the central ion.
Central ion: Yb3+ at [0.0, 0.0, 0.0]
AAAH! There is a super-close atom. Removing it...
Nearest ligand: Ba3+
Identified 2 Ba3+ ligands.
Found 2 fold axis about [1. 0. 0.]
No mirror planes; using [1. 0. 0.] as Z axis.

�[44m Axes for point charge model (in ABC space):
X axis = [-0.5 -1. 0. ]
Y axis = [ 0. 0. -1.]
Z axis = [1. 0. 0.] �[0m

 �[43m WARNING: there is no mirror symmetry along the Y axis, so 

�[0m �[43m we must inlcude the -m terms, and the eigenkets will be complex.�[0m

Creating a point charge model...
B_2 -2 = -0.0
B_2 -1 = -0.0
B_2 0 = 1.10592292
B_2 1 = -0.0
B_2 2 = 3.31776875
B_4 -4 = 0.0
B_4 -3 = 0.0
B_4 -2 = 0.0
B_4 -1 = 0.0
B_4 0 = 0.00114618
B_4 1 = 0.0
B_4 2 = 0.00764123
B_4 3 = 0.0
B_4 4 = 0.01337215
B_6 -6 = -0.0
B_6 -5 = -0.0
B_6 -4 = -0.0
B_6 -3 = -0.0
B_6 -2 = -0.0
B_6 -1 = -0.0
B_6 0 = 3.77e-06
B_6 1 = -0.0
B_6 2 = 3.957e-05
B_6 3 = -0.0
B_6 4 = 4.748e-05
B_6 5 = -0.0
B_6 6 = 8.705e-05
Central ion: Yb3+ at [0.0, 0.0, 0.0]
AAAH! There is a super-close atom. Removing it...
Nearest ligand: Ba3+
Identified 2 Ba3+ ligands.
Found 2 fold axis about [1. 0. 0.]
No mirror planes; using [1. 0. 0.] as Z axis.

�[44m Axes for point charge model (in ABC space):
X axis = [-0.5 -1. 0. ]
Y axis = [ 0. 0. -1.]
Z axis = [1. 0. 0.] �[0m

 �[43m WARNING: there is no mirror symmetry along the Y axis, so 

�[0m �[43m we must inlcude the -m terms, and the eigenkets will be complex.�[0m

Creating a point charge model...
B_2 -2 = -0.0
B_2 -1 = -0.0
B_2 0 = 1.10592292
B_2 1 = -0.0
B_2 2 = 3.31776875
B_4 -4 = 0.0
B_4 -3 = 0.0
B_4 -2 = 0.0
B_4 -1 = 0.0
B_4 0 = 0.00114618
B_4 1 = 0.0
B_4 2 = 0.00764123
B_4 3 = 0.0
B_4 4 = 0.01337215
B_6 -6 = -0.0
B_6 -5 = -0.0
B_6 -4 = -0.0
B_6 -3 = -0.0
B_6 -2 = -0.0
B_6 -1 = -0.0
B_6 0 = 3.77e-06
B_6 1 = -0.0
B_6 2 = 3.957e-05
B_6 3 = -0.0
B_6 4 = 4.748e-05
B_6 5 = -0.0
B_6 6 = 8.705e-05
Central ion: Yb3+ at [0.0, 0.0, 0.0]
Nearest ligand: Ba3+
Identified 2 Ba3+ ligands.
Found 2 fold axis about [1. 0. 0.]
No mirror planes; using [1. 0. 0.] as Z axis.

�[44m Axes for point charge model (in ABC space):
X axis = [-0.5 -1. 0. ]
Y axis = [ 0. 0. -1.]
Z axis = [1. 0. 0.] �[0m

 �[43m WARNING: there is no mirror symmetry along the Y axis, so 

�[0m �[43m we must inlcude the -m terms, and the eigenkets will be complex.�[0m

Creating a point charge model...
B_2 -2 = -0.0
B_2 -1 = -0.0
B_2 0 = 1.10592292
B_2 1 = -0.0
B_2 2 = 3.31776875
B_4 -4 = 0.0
B_4 -3 = 0.0
B_4 -2 = 0.0
B_4 -1 = 0.0
B_4 0 = 0.00114618
B_4 1 = 0.0
B_4 2 = 0.00764123
B_4 3 = 0.0
B_4 4 = 0.01337215
B_6 -6 = -0.0
B_6 -5 = -0.0
B_6 -4 = -0.0
B_6 -3 = -0.0
B_6 -2 = -0.0
B_6 -1 = -0.0
B_6 0 = 3.77e-06
B_6 1 = -0.0
B_6 2 = 3.957e-05
B_6 3 = -0.0
B_6 4 = 4.748e-05
B_6 5 = -0.0
B_6 6 = 8.705e-05
WARNING: more than one ligand position given...
outputting [[Ligands1, CFLevels1], [Ligands2, CFLevels2], [Ligands3, CFLevels3]]

�[0;31m---------------------------------------------------------------------------�[0m
�[0;31mValueError�[0m Traceback (most recent call last)
Cell �[0;32mIn[26], line 3�[0m
�[1;32m 1�[0m �[38;5;66;03m########### Import CIF file�[39;00m
�[0;32m----> 3�[0m YTOLig, Yb �[38;5;241m=�[39m cef�[38;5;241m.�[39mimportCIF(�[38;5;124m'�[39m�[38;5;124minput1.cif�[39m�[38;5;124m'�[39m)
�[1;32m 5�[0m �[38;5;66;03m# YTOLig, Yb = cef.importCIF('input2.cif', mag_ion='Co1',ionS=3/2,ionL=3, LS_Coupling=-22.34)�[39;00m

�[0;31mValueError�[0m: too many values to unpack (expected 2)`

`---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
Cell In[26], line 3
1 ########### Import CIF file
----> 3 YTOLig, Yb = cef.importCIF('input1.cif')
5 # YTOLig, Yb = cef.importCIF('input2.cif', mag_ion='Co1',ionS=3/2,ionL=3, LS_Coupling=-22.34)

ValueError: too many values to unpack (expected 2)`

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.