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

Develop #317

Merged
merged 8 commits into from
Mar 31, 2024
Merged
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
2 changes: 1 addition & 1 deletion jarvis/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""Version number."""

__version__ = "2024.3.24"
__version__ = "2024.3.30"

import os

Expand Down
20 changes: 20 additions & 0 deletions jarvis/db/restapi.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Module to access or upload data in JARVIS-API."""

import requests
import pprint
import os
Expand All @@ -9,6 +10,25 @@
import json


def jarvisdft_optimade(
prefix="https://jarvis.nist.gov/optimade/jarvisdft/v1/structures/?filter=",
query="elements HAS ALL C,Si",
):
url = prefix + query
vals = []
while True:
if url is not None:
# print('url', url)
response = requests.get(url)
data = response.json()["data"]
for i in data:
vals.append(i)
url = response.json()["links"]["next"]
else:
break
return vals


class Api(object):
"""Class for handling functions for JARVIS-API."""

Expand Down
8 changes: 4 additions & 4 deletions jarvis/io/lammps/inputs.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,10 @@ def atoms_to_lammps(self, atoms, origin=(0, 0, 0)):
xhi = a + xlo
m = atoms.lattice._lat
xy = np.dot(m[1], m[0] / a)
yhi = np.sqrt(b ** 2 - xy ** 2) + ylo
yhi = np.sqrt(b**2 - xy**2) + ylo
xz = np.dot(m[2], m[0] / a)
yz = (np.dot(m[1], m[2]) - xy * xz) / (yhi - ylo)
zhi = np.sqrt(c ** 2 - xz ** 2 - yz ** 2) + zlo
zhi = np.sqrt(c**2 - xz**2 - yz**2) + zlo
rot_matrix = np.linalg.solve(
[[xhi - xlo, 0, 0], [xy, yhi - ylo, 0], [xz, yz, zhi - zlo]], m
)
Expand Down Expand Up @@ -94,7 +94,7 @@ def read_data(
filename="lammps.data",
element_order=[],
potential_file="pot.mod",
verbose=True,
verbose=False,
has_charges=True,
):
"""Read Lammps data file."""
Expand Down Expand Up @@ -179,7 +179,7 @@ def read_data(
y[j] = float((lines[i + j + 2]).split()[it + 2])
z[j] = float((lines[i + j + 2]).split()[it + 3])
coords.append([x[j], y[j], z[j]])
print(coords[-1])
# print(coords[-1])
f.close()
# print ("info",(typ),'coo',(coords),'latt',lat)
typ_sp = [str(i, "utf-8") for i in typ]
Expand Down
8 changes: 6 additions & 2 deletions jarvis/io/lammps/outputs.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
"""Function to analze LAMMPS output."""

import numpy as np
import glob
import os
from jarvis.analysis.elastic.tensor import ElasticTensor
from jarvis.io.lammps.inputs import LammpsData
from jarvis.io.phonopy.outputs import bandstructure_plot, total_dos
from jarvis.core.atoms import Atoms


Expand Down Expand Up @@ -251,6 +251,8 @@ def parse_material_calculation_folder(

with optimization, vacancy, phonon, surface etc.
"""
from jarvis.io.phonopy.outputs import bandstructure_plot, total_dos

cwd = os.getcwd()
jid_file = os.path.join(path, "JARVISFF-ID")
if os.path.exists(jid_file):
Expand Down Expand Up @@ -375,7 +377,9 @@ def parse_material_calculation_folder(
return info


def parse_full_ff_folder(path="Mishin-Ni-Al-2009.eam.alloy_nist",):
def parse_full_ff_folder(
path="Mishin-Ni-Al-2009.eam.alloy_nist",
):
"""Parse complete FF calculation folder."""
cwd = os.getcwd()
os.chdir(path)
Expand Down
2 changes: 1 addition & 1 deletion jarvis/io/qe/inputs.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def __init__(
# Download GBRV PSPs by default
if url is None:
url = (
"http://www.physics.rutgers.edu/"
"https://www.physics.rutgers.edu/"
"gbrv/all_pbesol_UPF_v1.5.tar.gz"
)
print("Please cite for PSPs:")
Expand Down
14 changes: 9 additions & 5 deletions jarvis/tasks/lammps/lammps.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,11 +142,15 @@ def phonons(
self, atoms=None, lammps_cmd="", enforce_c_size=15.0, parameters={}
):
"""Make Phonon calculation setup."""
from phonopy import Phonopy
from phonopy.file_IO import (
# parse_FORCE_CONSTANTS,
write_FORCE_CONSTANTS,
)
try:
from phonopy import Phonopy
from phonopy.file_IO import (
# parse_FORCE_CONSTANTS,
write_FORCE_CONSTANTS,
)
except Exception as exp:
print("Phonopy check", exp)
pass

bulk = atoms.phonopy_converter()

Expand Down
8 changes: 8 additions & 0 deletions jarvis/tests/testfiles/db/test_restapi.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
from jarvis.db.restapi import jarvisdft_optimade


def test_optimade():
x = jarvisdft_optimade()
print(x)
print(len(x))
assert len(x) > 1
6 changes: 3 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

setup(
name="jarvis-tools",
version="2024.3.24",
version="2024.3.30",
long_description=long_d,
install_requires=[
"numpy>=1.20.1",
Expand All @@ -24,8 +24,8 @@
"toolz>=0.9.0",
"xmltodict>=0.11.0",
"tqdm>=4.41.1",
"mkdocs-material>=9.0.5",
"markdown>=3.2.1",
# "mkdocs-material>=9.0.5",
# "markdown>=3.2.1",
# "absl-py==1.4.0",
],
package_data={
Expand Down
Loading