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

Fix docstring errors in __init__.py #18

Merged
merged 2 commits into from
Jun 28, 2021
Merged
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
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:`0.5*a_i`,
timcallow marked this conversation as resolved.
Show resolved Hide resolved
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):
"""float: the mass density of the material in units :math:`\mathrm{g\ cm}^{-3}`"""
timcallow marked this conversation as resolved.
Show resolved Hide resolved
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)