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

Redefined functions relating to collective diffusion coefficient and reduced ionic condictivity. #3

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 7 additions & 13 deletions examples/lattice_mc_examples.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,7 @@
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"collapsed": true
},
"metadata": {},
"outputs": [],
"source": [
"import lattice_mc\n",
Expand All @@ -45,9 +43,7 @@
{
"cell_type": "code",
"execution_count": 2,
"metadata": {
"collapsed": true
},
"metadata": {},
"outputs": [],
"source": [
"# Global variables controlling simulation parallelisation and convergence.\n",
Expand All @@ -64,9 +60,7 @@
{
"cell_type": "code",
"execution_count": 3,
"metadata": {
"collapsed": true
},
"metadata": {},
"outputs": [],
"source": [
"# define temperature scale\n",
Expand Down Expand Up @@ -131,7 +125,7 @@
"| correlation factor | $f$ | `Simulation.tracer_correlation` | \n",
"| collective correlation factor | $f_\\mathrm{I}$ | `Simulation.collective_correlation` |\n",
"| tracer diffusion coefficient | $D^*$ | `Simulation.tracer_diffusion_coefficient` |\n",
"| “jump” diffusion coefficient | $D_\\mathrm{J}$ | `Simulation.collective_diffusion_coefficient` |\n",
"| “jump” diffusion coefficient | $D_\\mathrm{J}$ | `Simulation.collective_diffusion_coefficient_per_atom` |\n",
"| average site occupations | occ($\\alpha$) | `Simulation.average_site_occupations` |"
]
},
Expand All @@ -157,7 +151,7 @@
"print( \"f = {}\".format( s.tracer_correlation ) )\n",
"print( \"f_I = {}\".format( s.collective_correlation ) )\n",
"print( \"D* = {:.3e}\".format( s.tracer_diffusion_coefficient ) )\n",
"print( \"D_J = {:.3e}\".format( s.collective_diffusion_coefficient ) )\n",
"print( \"D_J = {:.3e}\".format( s.collective_diffusion_coefficient_per_atom ) )\n",
"# Simulation.average_site_occupations returns a dictionary\n",
"for k, v in s.average_site_occupations.items():\n",
" print( \"occ({}) = {:f}\".format( k, v ) )"
Expand All @@ -184,7 +178,7 @@
"source": [
"def simulation_wrapper(_):\n",
" s = run_simulation()\n",
" return s.tracer_correlation, s.collective_correlation, s.tracer_diffusion_coefficient, s.collective_diffusion_coefficient"
" return s.tracer_correlation, s.collective_correlation, s.tracer_diffusion_coefficient, s.collective_diffusion_coefficient_per_atom"
]
},
{
Expand Down Expand Up @@ -951,7 +945,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.1"
"version": "3.7.4"
}
},
"nbformat": 4,
Expand Down
28 changes: 24 additions & 4 deletions lattice_mc/simulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -273,13 +273,15 @@ def collective_correlation( self ):
@property
def collective_diffusion_coefficient( self ):
"""
Returns the collective or "jump" diffusion coefficient, D_J.
Returns the collective or "jump" diffusion coefficient multiplied by the number of atoms,
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is potentially misleading. This method returns the collective diffusion coefficient, which is equal to the "jump" diffusion coefficient multiplied by the number of atoms, D_J * N.

( D_J * number_of_atoms).

Args:
None

Returns:
(Float): The collective diffusion coefficient, D_J.
(Float): the collective or "jump" diffusion coefficient multiplied by the number of
atoms, ( D_J * number_of_atoms).
Comment on lines +283 to +284
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also needs changing here.

"""
if self.has_run:
return self.atoms.collective_dr_squared() / ( 6.0 * self.lattice.time )
Expand All @@ -289,18 +291,36 @@ def collective_diffusion_coefficient( self ):
@property
def collective_diffusion_coefficient_per_atom( self ):
"""
The collective diffusion coefficient per atom. D_J / n_atoms.
Returns the collective or "jump" diffusion coefficient, D_J.
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is incorrect. Returns the collective diffusion coefficient per atom, which is equal to the "jump" diffusion coefficient.


Args:
None

Returns:
(Float): The collective diffusion coefficient per atom, D_J / n_atoms.
(Float): The collective diffusion coefficient, D_J.
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Inconsistent. The collective diffusion coefficient is D_J * N_atoms.

"""
if self.has_run:
return self.collective_diffusion_coefficient / float( self.number_of_atoms )
else:
return None

@property
def reduced_ionic_conductivity( self ):
"""
Returns the reduced ionic conductivity, \u03C3\' ( D_J * ( number_of_atoms /
number_of_sites ) ).

Args:
None

Returns:
(Float): The reduced ionic conductivity, \u03C3\' ( D_J * ( number_of_atoms /
number_of_sites )).
"""
if self.has_run:
return self.atoms.collective_diffusion_coefficient_per_atom * float( self.number_of_atoms / self.number_of_sites )
else:
return None

@property
def average_site_occupations( self ):
Expand Down