Skip to content

Commit

Permalink
Merge pull request #18 from atomec-project/fix_docs_in_init
Browse files Browse the repository at this point in the history
Fix docstring errors in `__init__.py`
  • Loading branch information
timcallow committed Jun 28, 2021
2 parents ffabc8e + 0bb7c75 commit 73efb2f
Showing 1 changed file with 16 additions and 24 deletions.
40 changes: 16 additions & 24 deletions atoMEC/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@


class Atom:
"""
r"""
The Atom class defines the main atom object containing the key information about the
atomic species, temperature, density etc
Expand All @@ -26,7 +26,7 @@ class Atom:
The radius of the Wigner-Seitz sphere, defined as 0.5*a_i,
where a_i is the average inter-atomic distance
density : float, optional
The mass density of the material in g cm^-3
The mass density of the material in :math:`\mathrm{g\ cm}^{-3}`
charge : int, optional
The overall net charge
units_temp : str, optional
Expand All @@ -37,28 +37,6 @@ class Atom:
The units of density, currently only "g/cm3" is supported
write_output : bool, optional
Whether to print atomic information, defaults True
Attributes
----------
species : str
The chemical symbol for the atomic species
temp : float
The electronic temperature in hartree
radius : float
The radius of the Wigner-Seitz sphere, defined as 0.5*a_i,
where a_i is the average inter-atomic distance
density : float
The mass density of the material in g cm^-3
charge : int, optional
The overall net charge
at_chrg : int
The atomic number Z
at_mass : float
The atomic mass
nele : int
The total electron number
info : str
Information about the atom
"""

def __init__(
Expand Down Expand Up @@ -104,6 +82,7 @@ def __init__(

@property
def species(self):
"""str: the chemical symbol for the atomic species"""
return self._species

@species.setter
Expand All @@ -112,16 +91,19 @@ def species(self, species):

@property
def at_chrg(self):
"""int: the atomic charge Z"""
chrg = self.species.atomic_number
config.Z = chrg
return chrg

@property
def at_mass(self):
"""float: the atomic mass (in a.u.)"""
return self.species.atomic_weight

@property
def units_temp(self):
"""str: the units of temperature"""
return self._units_temp

@units_temp.setter
Expand All @@ -130,6 +112,7 @@ def units_temp(self, units_temp):

@property
def temp(self):
"""float: the electronic temperature in Hartree"""
return self._temp

@temp.setter
Expand All @@ -140,6 +123,7 @@ def temp(self, temp):

@property
def charge(self):
"""int: the net charge of the atom"""
return self._charge

@charge.setter
Expand All @@ -148,10 +132,13 @@ def charge(self, charge):

@property
def nele(self):
"""int: the number of electrons in the atom, given by the
sum of :obj:`at_chrg` and :obj:`charge`"""
return self.at_chrg + self._charge

@property
def units_radius(self):
"""str: the units of the atomic radius"""
return self._units_radius

@units_radius.setter
Expand All @@ -160,6 +147,7 @@ def units_radius(self, units_radius):

@property
def units_density(self):
"""str: the units of the atomic density"""
return self._units_density

@units_density.setter
Expand All @@ -168,6 +156,8 @@ def units_density(self, units_density):

@property
def radius(self):
r"""float: radius of the Wigner-Seitz sphere, defined as :math:`a_i /2`,
where :math:`a_i` is the average inter-atomic distance"""
return self._radius

@radius.setter
Expand All @@ -179,6 +169,7 @@ def radius(self, radius):

@property
def density(self):
r"""float: the mass density of the material in units :math:`\mathrm{g\ cm}^{-3}`"""
return self._density

@density.setter
Expand All @@ -190,5 +181,6 @@ def density(self, density):

@property
def info(self):
"""str: formatted information about the :obj:`Atom`'s attributes"""
# write output info
return writeoutput.write_atomic_data(self)

0 comments on commit 73efb2f

Please sign in to comment.