Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
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
18 changes: 6 additions & 12 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
30 changes: 25 additions & 5 deletions lattice_mc/simulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -271,23 +271,25 @@ def collective_correlation( self ):
return None

@property
def reduced_ionic_conductivity( self ):
def collective_diffusion_coefficient( self ):
"""
Returns the reduced ionic conductivity, \u03C3\' ( D_J * n_natoms).
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 reduced ionic conductivity, \u03C3\' ( D_J * n_natoms).
(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 )
else:
return None

@property
def collective_diffusion_coefficient( self ):
def collective_diffusion_coefficient_per_atom( self ):
"""
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.


Expand All @@ -298,7 +300,25 @@ def collective_diffusion_coefficient( self ):
(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.reduced_ionic_conductivity / float( self.number_of_atoms )
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

Expand Down