Skip to content

Commit

Permalink
Develop (#185)
Browse files Browse the repository at this point in the history
* Image augmentation.

* Augment images.

* Augment images.

* Specie update.

* Add Latt2D, STM image (b-1) fix, image augmentation fix.

* Add Latt2D, STM image (b-1) fix, image augmentation fix.

* Update conf.py

* Update conf.py

* Multi-output graph bacthing.

* Add EDOS dataset.

* Temp.

* Add circuit maker.

* Add circuit maker.

* NELECT update.

* Version update, more DBs added.

* Fix CHGCAR vasp.

* Added volumetric reshape for CHGCAR.

* Tmp

* Tershoff Hamman update, specie update.

* Add crop from center in STM.

* Add Fourier transfor in STM.

* Update STM pytest.

* Add DPI to STM.

* Zeo++ added, Atoms cif update, STM update, random vacancy maker added.

* Atoms tempfile fix, Potcar from atoms module added.

* Test for docs.

* C2DB link update, docs Atoms update.

* C2DB link update, docs Atoms update.

* Version update, COD DB, QM9 JCTC DB added.

* Compostion bug fix, elemental descriptor added.
  • Loading branch information
knc6 authored Jul 6, 2021
1 parent abfecab commit d2dfe56
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 4 deletions.
2 changes: 1 addition & 1 deletion jarvis/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
"""Version number."""
__version__ = "2021.07.04"
__version__ = "2021.07.05"
14 changes: 14 additions & 0 deletions jarvis/ai/descriptors/elemental.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
"""Module to get elemnt fraction based array for a formula."""
# Maximum upto 103 elements
import numpy as np
from jarvis.core.composition import Composition
from jarvis.core.specie import Specie


def get_element_fraction_desc(formula="SiO2", max_nelements=103):
x = np.zeros(max_nelements)
fracs = Composition.from_string(formula).atomic_fraction
for i, j in fracs.items():
# -1 because python array srats from 0
x[Specie(i).Z - 1] = j
return x
7 changes: 5 additions & 2 deletions jarvis/core/composition.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,11 +113,14 @@ def reduced_formula(self):
Z[i] = reduced[i]
for specie, count in Z.items():
if float(count).is_integer():
form = form + specie + str(int(count))
if count == 1:
form = form + specie
else:
form = form + specie + str(int(count))
else:
form = form + specie + str(count)

return form.replace("1", "")
return form # .replace("1", "")

@property
def formula(self):
Expand Down
2 changes: 2 additions & 0 deletions jarvis/tests/testfiles/ai/test_desc.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from jarvis.ai.descriptors.cfid import CFID
from jarvis.ai.descriptors.coulomb import coulomb_matrix
from jarvis.ai.descriptors.elemental import get_element_fraction_desc
from jarvis.core.atoms import Atoms


Expand Down Expand Up @@ -3141,6 +3142,7 @@ def test_desc():
z = coulomb_matrix(Si)
assert len(z) == 100
assert round(z[0], 2) == round(281.62894609, 2)
get_element_fraction_desc()


# test_desc()
3 changes: 2 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

setup(
name="jarvis-tools",
version="2021.07.04",
version="2021.07.05",
long_description=long_d,
install_requires=[
"numpy>=1.19.5",
Expand Down Expand Up @@ -70,6 +70,7 @@
packages=find_packages(),
# long_description=open(os.path.join(os.path.dirname(__file__), "README.rst")).read(),
classifiers=[

"Programming Language :: Python :: 3.6",
"Development Status :: 4 - Beta",
"Intended Audience :: Science/Research",
Expand Down

0 comments on commit d2dfe56

Please sign in to comment.