From abfecabc8729261ca212b28b28362dd2a9cf77d9 Mon Sep 17 00:00:00 2001 From: Kamal Choudhary Date: Mon, 5 Jul 2021 21:34:57 -0400 Subject: [PATCH] Develop (#183) * 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. --- jarvis/__init__.py | 2 +- jarvis/analysis/defects/vacancy.py | 34 ++ jarvis/analysis/stm/tersoff_hamann.py | 235 +++++++++--- jarvis/core/atoms.py | 204 +++++----- jarvis/core/graphs.py | 2 +- jarvis/core/image.py | 4 +- jarvis/core/specie.py | 14 + jarvis/db/figshare.py | 43 ++- jarvis/io/vasp/inputs.py | 12 + jarvis/io/zeopp/__init__.py | 1 + jarvis/io/zeopp/inputs.py | 38 ++ .../analysis/defects/test_vacancy.py | 3 +- .../tests/testfiles/analysis/stm/test_stm.py | 12 +- jarvis/tests/testfiles/core/1000000.cif | 363 ++++++++++++++++++ jarvis/tests/testfiles/core/test_atoms.py | 9 + jarvis/tests/testfiles/core/test_specie.py | 2 + jarvis/tests/testfiles/io/vasp/test_inputs.py | 5 + setup.py | 2 +- 18 files changed, 836 insertions(+), 149 deletions(-) create mode 100644 jarvis/io/zeopp/__init__.py create mode 100644 jarvis/io/zeopp/inputs.py create mode 100644 jarvis/tests/testfiles/core/1000000.cif diff --git a/jarvis/__init__.py b/jarvis/__init__.py index 053fd7b4..279ec322 100644 --- a/jarvis/__init__.py +++ b/jarvis/__init__.py @@ -1,2 +1,2 @@ """Version number.""" -__version__ = "2021.06.18" +__version__ = "2021.07.04" diff --git a/jarvis/analysis/defects/vacancy.py b/jarvis/analysis/defects/vacancy.py index c922b7c3..c910fab9 100644 --- a/jarvis/analysis/defects/vacancy.py +++ b/jarvis/analysis/defects/vacancy.py @@ -4,6 +4,8 @@ from jarvis.analysis.structure.spacegroup import Spacegroup3D from jarvis.core.utils import rand_select from jarvis.core.atoms import Atoms +# import numpy as np +import random class Vacancy(object): @@ -102,6 +104,38 @@ def __repr__(self, indent=2): return pprint.pformat(self.to_dict(), indent=indent) +def generate_random_defects(n_vacs=10, atoms=None, element=None, seed=123): + """Generate random defects for an element.""" + # natoms = atoms.num_atoms + atoms = atoms.to_dict() + elements = atoms["elements"] + if element is None: + element = elements[0] + coords = atoms["coords"] + lattice_mat = atoms["lattice_mat"] + # ids = np.arange(natoms) + new_elements = [] + new_coords = [] + options = [] + for ii, i in enumerate(elements): + if i == element: + options.append(ii) + random.seed(seed) + random.shuffle(options) + to_delete = options[0:n_vacs] + for ii, i in enumerate(elements): + if ii not in to_delete: + new_elements.append(i) + new_coords.append(coords[ii]) + new_atoms = Atoms( + coords=new_coords, + lattice_mat=lattice_mat, + elements=new_elements, + cartesian=False, + ) + return new_atoms + + """ if __name__ == "__main__": from jarvis.io.vasp.inputs import Poscar diff --git a/jarvis/analysis/stm/tersoff_hamann.py b/jarvis/analysis/stm/tersoff_hamann.py index 271c34c8..bb5374c9 100644 --- a/jarvis/analysis/stm/tersoff_hamann.py +++ b/jarvis/analysis/stm/tersoff_hamann.py @@ -4,13 +4,30 @@ from jarvis.io.vasp.outputs import Chgcar import numpy as np import matplotlib.transforms as mtransforms +import scipy +from jarvis.core.image import Image class TersoffHamannSTM(object): """Generate constant height and constant current STM images.""" def __init__( - self, chg_name="PARCHG", min_size=50.0, skew=True, zcut=None, extend=0 + self, + chg_name="PARCHG", + min_size=50.0, + height_tol=2, + zcut=None, + use_interpolated=True, + crop_from_center=False, + crop_mult=3, + min_pixel=288, + interp_step=1.0, + skew=True, + extend=0, + ft_image_path=None, + ft_image_zoom_factor=5, + dpi=240, + cmap="gray", ): """Initialize class with pathe of PARCHG and other input params.""" # In original paper, extend used as 1 @@ -23,6 +40,10 @@ def __init__( tmp = chgcar.chg[-1] * volume chg = tmp.reshape(self.dim[::-1]).T self.chg = chg + self.cmap = cmap + self.ft_image_path = ft_image_path + self.ft_image_zoom_factor = ft_image_zoom_factor + self.height_tol = height_tol self.a = self.atoms.lattice.a self.b = self.atoms.lattice.b self.c = self.atoms.lattice.c @@ -37,48 +58,120 @@ def __init__( elif i < -0.5: i = i + 1 z_frac_coords_moved.append(i) + self.crop_mult = crop_mult + self.crop_from_center = crop_from_center + if self.crop_from_center: + min_size = min_size * self.crop_mult + self.min_size = min_size self.zmaxp = max(np.array(z_frac_coords_moved) * self.c) rep_x = int(min_size / self.a) + self.extend rep_y = int(min_size / self.b) + self.extend self.repeat = [rep_x, rep_y] self.scell = self.atoms.make_supercell_matrix([rep_x, rep_y, 1]) - def constant_height(self, tol=2, filename="testh.png"): + self.use_interpolated = use_interpolated + self.interp_step = interp_step + + self.min_pixel = min_pixel + self.dpi = dpi + + def constant_height( + self, + filename="testh.png", + ): """Get iso-height image.""" + tol = self.height_tol if not self.zcut: self.zcut = int((self.zmaxp + tol) / self.c * self.nz) + # print("zcut", self.zcut, self.repeat) + info = {} + img_ext = np.tile(self.chg[:, :, self.zcut], self.repeat) - exts = (0, self.a * self.repeat[0], 0, self.b * (self.repeat[1] - 1)) - plt.close() - fig, ax = plt.subplots() - plt.xticks([]) - plt.yticks([]) - if self.skew: - tmp = 90 - self.atoms.lattice.angles[2] + if not self.use_interpolated: + exts = ( + 0, + self.a * self.repeat[0], + 0, + self.b * (self.repeat[1] - 1), + ) + plt.close() + fig, ax = plt.subplots() + plt.xticks([]) + plt.yticks([]) + if self.skew: + tmp = 90 - self.atoms.lattice.angles[2] + else: + tmp = 0 + data = self.get_plot( + ax, + img_ext, + exts, + mtransforms.Affine2D().skew_deg(tmp, 0), + ) + info["data"] = data + info["img_ext"] = img_ext + fig.subplots_adjust(bottom=0, top=1, left=0.0, right=1) + plt.savefig( + filename, dpi=self.dpi + ) # , bbox_inches="tight", pad_inches=0.0, dpi=240) + plt.close() else: - tmp = 0 - data = self.get_plot( - ax, - img_ext, - exts, - mtransforms.Affine2D().skew_deg(tmp, 0), - ) - info = {} - info["img_ext"] = img_ext - info["data"] = data + img_ext = self.get_interpolated_data(img_data=img_ext) + # print ('img_ext',img_ext) + plt.close() + # fig, ax = plt.subplots() + plt.imshow(img_ext, interpolation="none", cmap=self.cmap) + # ax.set_aspect('equal') + plt.axis("off") + plt.savefig(filename, dpi=self.dpi) + + plt.close() + + plt.gca().set_axis_off() + plt.subplots_adjust( + top=1, bottom=0, right=1, left=0, hspace=0, wspace=0 + ) + plt.margins(0, 0) + plt.gca().xaxis.set_major_locator(plt.NullLocator()) + plt.gca().yaxis.set_major_locator(plt.NullLocator()) + # print ('img_ext',img_ext) + plt.close() + info["scell"] = self.scell info["zcut"] = self.zcut - fig.subplots_adjust(bottom=0, top=1, left=0.0, right=1) - plt.savefig( - filename - ) # , bbox_inches="tight", pad_inches=0.0, dpi=240) - plt.close() + info["img_ext"] = img_ext + if self.crop_from_center: + im = Image.from_file(filename) + p_x = int(self.min_pixel / self.crop_mult) + # print('shape',im.values.shape,p_x) + im = Image.crop_from_center( + image_path=filename, target_left=p_x, target_right=p_x + ) + info["img_ext"] = im + plt.imshow(im, cmap=self.cmap) + plt.tight_layout() + plt.axis("off") + plt.savefig(filename, dpi=self.dpi) + plt.close() + if self.ft_image_path is not None: + im = Image.from_file(filename).fourier_transform2D( + zoom_factor=self.ft_image_zoom_factor + ) + im.save(self.ft_image_path) return info - def constant_current(self, tol=2, pc=None, ext=0.15, filename="testc.png"): + def constant_current( + self, + pc=None, + ext=0.15, + filename="testc.png", + use_interpolated=True, + ): """Return the constant-current cut the charge density.""" zmax_ind = int(self.zmaxp / self.c * self.nz) + 1 + info = {} + tol = self.height_tol # Find what z value is near the current, and take avergae if not self.zcut: self.zcut = int((self.zmaxp + tol) / self.c * self.nz) @@ -98,26 +191,53 @@ def constant_current(self, tol=2, pc=None, ext=0.15, filename="testc.png"): # height of iso-current img = np.argmin(np.abs(self.chg[:, :, zcut_min:zcut_max] - c), axis=2) img_ext = np.tile(img, self.repeat[::-1]) + self.zcut - zext - fig, ax = plt.subplots() - exts = (0, self.a * self.repeat[0], 0, self.b * (self.repeat[1] - 1)) - plt.xticks([]) - plt.yticks([]) - if self.skew: - tmp = 90 - self.atoms.lattice.angles[2] + if not use_interpolated: + fig, ax = plt.subplots() + exts = ( + 0, + self.a * self.repeat[0], + 0, + self.b * (self.repeat[1] - 1), + ) + plt.xticks([]) + plt.yticks([]) + if self.skew: + tmp = 90 - self.atoms.lattice.angles[2] + else: + tmp = 0 + + data = self.get_plot( + ax, + img_ext, + exts, + mtransforms.Affine2D().skew_deg(tmp, 0), + ) + info["data"] = data + info["img_ext"] = img_ext + plt.savefig(filename, dpi=self.dpi) + plt.close() else: - tmp = 0 + img_ext = self.get_interpolated_data(img_data=img_ext) + plt.close() + # fig, ax = plt.subplots() + plt.imshow(img_ext, interpolation="none", cmap=self.cmap) + # ax.set_aspect('equal') + plt.axis("off") + plt.savefig(filename, dpi=self.dpi) + plt.close() + if self.crop_from_center: + im = Image.from_file(filename) + + p_x = int(self.min_pixel / self.crop_mult) + # print('shape',im.values.shape,p_x) + im = Image.crop_from_center( + image_path=filename, target_left=p_x, target_right=p_x + ) + plt.imshow(im, cmap=self.cmap) + plt.axis("off") + plt.savefig(filename, dpi=self.dpi) + plt.close() - data = self.get_plot( - ax, - img_ext, - exts, - mtransforms.Affine2D().skew_deg(tmp, 0), - ) - plt.savefig(filename) - plt.close() - info = {} - info["img_ext"] = img_ext - info["data"] = data info["scell"] = self.scell info["zcut"] = self.zcut return info @@ -148,6 +268,35 @@ def get_plot(self, ax, Z, extent, transform): print("min Z and maxZ", np.min(Z), np.max(Z)) return data + def get_interpolated_data(self, img_data=[]): + """Get interpolated data after moving pixels.""" + x = [] + y = [] + zz = [] + xy = [] + step = self.interp_step + atoms = self.atoms + for i in range(img_data.shape[0]): + for j in range(img_data.shape[1]): + z = img_data[i][j] + xyz = i * atoms.lattice_mat[0] + j * atoms.lattice_mat[1] + x.append(xyz[0]) + y.append(xyz[1]) + zz.append(z) + xy.append([xyz[0], xyz[1]]) + + grid_x, grid_y = np.mgrid[ + min(x) : max(x) : step, min(y) : max(y) : step + ] + # stepx=(max(x)-min(x))/bins + # stepy=(max(y)-min(y))/bins + # grid_x, grid_y = np.mgrid[min(x):max(x):stepx, min(y):max(y):stepy] + interp = scipy.interpolate.griddata(xy, zz, (grid_x, grid_y)).T + # plt.scatter(x, y, 1, zz) + # plt.savefig("ok.png") + # plt.close() + return interp + """ if __name__ == "__main__": diff --git a/jarvis/core/atoms.py b/jarvis/core/atoms.py index a88498f9..d7b5b0d5 100644 --- a/jarvis/core/atoms.py +++ b/jarvis/core/atoms.py @@ -20,7 +20,37 @@ class Atoms(object): - """Generate Atoms python object.""" + """ + Generate Atoms python object. + + >>> box = [[2.715, 2.715, 0], [0, 2.715, 2.715], [2.715, 0, 2.715]] + >>> coords = [[0, 0, 0], [0.25, 0.2, 0.25]] + >>> elements = ["Si", "Si"] + >>> Si = Atoms(lattice_mat=box, coords=coords, elements=elements) + >>> print(round(Si.volume,2)) + 40.03 + >>> Si.composition + {'Si': 2} + >>> round(Si.density,2) + 2.33 + >>> round(Si.packing_fraction,2) + 0.28 + >>> Si.atomic_numbers + [14, 14] + >>> Si.num_atoms + 2 + >>> Si.frac_coords[0][0] + 0 + >>> Si.cart_coords[0][0] + 0.0 + >>> coords = [[0, 0, 0], [1.3575 , 1.22175, 1.22175]] + >>> round(Si.density,2) + 2.33 + >>> Si.spacegroup() + 'C2/m (12)' + >>> Si.pymatgen_converter()!={} + True + """ def __init__( self, @@ -35,34 +65,6 @@ def __init__( Create atomic structure. Requires lattice, coordinates, atom type information. - - >>> box = [[2.715, 2.715, 0], [0, 2.715, 2.715], [2.715, 0, 2.715]] - >>> coords = [[0, 0, 0], [0.25, 0.2, 0.25]] - >>> elements = ["Si", "Si"] - >>> Si = Atoms(lattice_mat=box, coords=coords, elements=elements) - >>> print(round(Si.volume,2)) - 40.03 - >>> Si.composition - {'Si': 2} - >>> round(Si.density,2) - 2.33 - >>> round(Si.packing_fraction,2) - 0.28 - >>> Si.atomic_numbers - [14, 14] - >>> Si.num_atoms - 2 - >>> Si.frac_coords[0][0] - 0 - >>> Si.cart_coords[0][0] - 0.0 - >>> coords = [[0, 0, 0], [1.3575 , 1.22175, 1.22175]] - >>> round(Si.density,2) - 2.33 - >>> Si.spacegroup() - 'C2/m (12)' - >>> Si.pymatgen_converter()!={} - True """ self.lattice_mat = np.array(lattice_mat) self.show_props = show_props @@ -176,6 +178,60 @@ def write_cif( ) f.close() + @staticmethod + def read_with_cif2cell(filename="1000000.cif", get_primitive_atoms=False): + """Use cif2cell package to read cif files.""" + # https://pypi.org/project/cif2cell/ + # tested on version 2.0.0a3 + try: + new_file, fname = tempfile.mkstemp(text=True) + cmd = ( + "cif2cell " + + filename + + " -p vasp --vasp-cartesian-positions --vca -o " + + fname + ) + os.system(cmd) + + except Exception as exp: + print(exp) + pass + f = open(fname, "r") + text = f.read().splitlines() + f.close() + os.close(new_file) + elements = text[0].split("Species order:")[1].split() + scale = float(text[1]) + lattice_mat = [] + lattice_mat.append([float(i) for i in text[2].split()]) + lattice_mat.append([float(i) for i in text[3].split()]) + lattice_mat.append([float(i) for i in text[4].split()]) + lattice_mat = scale * np.array(lattice_mat) + uniq_elements = elements + element_count = np.array([int(i) for i in text[5].split()]) + elements = [] + for i, ii in enumerate(element_count): + for j in range(ii): + elements.append(uniq_elements[i]) + cartesian = True + if "d" in text[6] or "D" in text[6]: + cartesian = False + # print ('cartesian poscar=',cartesian,text[7]) + num_atoms = int(np.sum(element_count)) + coords = [] + for i in range(num_atoms): + coords.append([float(i) for i in text[7 + i].split()[0:3]]) + coords = np.array(coords) + atoms = Atoms( + lattice_mat=lattice_mat, + coords=coords, + elements=elements, + cartesian=cartesian, + ) + if get_primitive_atoms: + atoms = atoms.get_primitive_atoms + return atoms + @staticmethod def from_cif( filename="atoms.cif", @@ -190,6 +246,25 @@ def from_cif( # cif file with multiple blocks # _atom_site_U_iso, instead of fractn_x, cartn_x # with non-zero _atom_site_attached_hydrogens + try: + + if use_cif2cell: + # https://pypi.org/project/cif2cell/ + # tested on version 2.0.0a3 + if from_string != "": + new_file, filename = tempfile.mkstemp(text=True) + f = open(filename, "w") + f.write(from_string) + f.close() + atoms = Atoms.read_with_cif2cell( + filename=filename, get_primitive_atoms=get_primitive_atoms + ) + + return atoms + except Exception as exp: + print(exp) + pass + if from_string == "": f = open(filename, "r") lines = f.read().splitlines() @@ -337,70 +412,6 @@ def from_cif( tmp[occupancy_index].split("(")[0] ).is_integer() ): - tmp = " -p vasp --vasp-cartesian-positions --vca -o " - try: - - if use_cif2cell: - # https://pypi.org/project/cif2cell/ - # tested on version 2.0.0a3 - try: - new_file, fname = tempfile.mkstemp() - cmd = "cif2cell " + filename + tmp + fname - os.system(cmd) - except Exception as exp: - print(exp) - f = open(fname, "r") - text = f.read().splitlines() - f.close() - elements = ( - text[0].split("Species order:")[1].split() - ) - scale = float(text[1]) - lattice_mat = [] - lattice_mat.append( - [float(i) for i in text[2].split()] - ) - lattice_mat.append( - [float(i) for i in text[3].split()] - ) - lattice_mat.append( - [float(i) for i in text[4].split()] - ) - lattice_mat = scale * np.array(lattice_mat) - uniq_elements = elements - element_count = np.array( - [int(i) for i in text[5].split()] - ) - elements = [] - for i, ii in enumerate(element_count): - for j in range(ii): - elements.append(uniq_elements[i]) - cartesian = True - if "d" in text[6] or "D" in text[6]: - cartesian = False - # print ('cartesian poscar=',cartesian,text[7]) - num_atoms = int(np.sum(element_count)) - coords = [] - for i in range(num_atoms): - coords.append( - [ - float(i) - for i in text[7 + i].split()[0:3] - ] - ) - coords = np.array(coords) - atoms = Atoms( - lattice_mat=lattice_mat, - coords=coords, - elements=elements, - cartesian=cartesian, - ) - if get_primitive_atoms: - atoms = atoms.get_primitive_atoms - return atoms - - except Exception as exp: - print(exp) raise ValueError( "Fractional occupancy is not supported.", float(tmp[occupancy_index].split("(")[0]), @@ -1601,6 +1612,13 @@ def crop_square(atoms=None, csize=10): """ if __name__ == "__main__": + x=Atoms.from_cif('1000000.cif') + f=open('1000000.cif','r') + lines=f.read() + f.close() + x=Atoms.from_cif(from_string=lines) + print (x) + print (x.num_atoms) box = [[2.715, 2.715, 0], [0, 2.715, 2.715], [2.715, 0, 2.715]] coords = [[0, 0, 0], [0.25, 0.25, 0.25]] elements = ["Si", "Si"] diff --git a/jarvis/core/graphs.py b/jarvis/core/graphs.py index 8df8d660..ce0b3a92 100644 --- a/jarvis/core/graphs.py +++ b/jarvis/core/graphs.py @@ -65,7 +65,7 @@ def nearest_neighbor_edges( attempt = 0 # print ('cutoff=',all_neighbors) if min_nbrs < max_neighbors: - print("extending cutoff radius!", attempt, cutoff, id) + # print("extending cutoff radius!", attempt, cutoff, id) lat = atoms.lattice if cutoff < max(lat.a, lat.b, lat.c): r_cut = max(lat.a, lat.b, lat.c) diff --git a/jarvis/core/image.py b/jarvis/core/image.py index bd22b71e..d5ae53c8 100644 --- a/jarvis/core/image.py +++ b/jarvis/core/image.py @@ -123,12 +123,12 @@ def crop_square(self, size=None): return Image(values=img_cropped) - def save(self, filename): + def save(self, filename, interpolation="nearest"): """Save an image.""" # if size is None: # from matplotlib import pyplot as plt - plt.imshow(self.values, interpolation="nearest") + plt.imshow(self.values, interpolation=interpolation) plt.savefig(filename) plt.close() diff --git a/jarvis/core/specie.py b/jarvis/core/specie.py index cd7fb065..5ffb6d0a 100644 --- a/jarvis/core/specie.py +++ b/jarvis/core/specie.py @@ -471,6 +471,20 @@ def get_feats_hot_encoded(feature_names=keys, filename="feats_encoded.json"): return new_dat +x, y, z = get_specie_data() +info_z = {} +for i, j in y.items(): + info_z[j["Z"]] = i + + +def atomic_numbers_to_symbols(numbers=[1, 2, 3, 4]): + """Convert atomic number array to atomic symbols.""" + symbs = [] + for i in numbers: + symbs.append(info_z[i]) + return symbs + + # get_digitized_feats_hot_encoded() """ if __name__ == "__main__": diff --git a/jarvis/db/figshare.py b/jarvis/db/figshare.py index ce2ccdbf..f8d04c71 100644 --- a/jarvis/db/figshare.py +++ b/jarvis/db/figshare.py @@ -18,6 +18,9 @@ from tqdm import tqdm import matplotlib.image as mpimg from jarvis.analysis.stm.tersoff_hamann import TersoffHamannSTM +import matplotlib.pyplot as plt + +plt.switch_backend("agg") def get_db_info(): @@ -49,6 +52,7 @@ def get_db_info(): "Obtaining JARVIS-FF 2k ...", "https://www.nature.com/articles/s41524-020-00440-1", ], + # https://doi.org/10.6084/m9.figshare.14213522 "mp_3d_2020": [ "https://ndownloader.figshare.com/files/26791259", "all_mp.json", @@ -61,54 +65,85 @@ def get_db_info(): "Obtaining MEGNET-3D CFID dataset 69k...", "https://pubs.acs.org/doi/10.1021/acs.chemmater.9b01294", ], + # https://doi.org/10.6084/m9.figshare.14177630 "megnet2": [ "https://ndownloader.figshare.com/files/28332741", "megnet-mp-2019-04-01.json", "Obtaining MEGNET-3D CFID dataset 133k...", "https://pubs.acs.org/doi/10.1021/acs.chemmater.9b01294", ], + # https://doi.org/10.6084/m9.figshare.14745435 "edos_pdos": [ "https://ndownloader.figshare.com/files/28501764", "edos-up_pdos-elast_interp-6-19-2021.json", "Interpolated electronic total dos spin-up dataset 48k...", "https://www.nature.com/articles/s41524-020-00440-1", ], + # https://doi.org/10.6084/m9.figshare.14745327 "mp_3d": [ "https://ndownloader.figshare.com/files/24979850", "CFID_mp_desc_data_84k.json", "Obtaining Materials Project-3D CFID dataset 84k...", "https://doi.org/10.1063/1.4812323", ], + # https://doi.org/10.6084/m9.figshare.13054247 "oqmd_3d": [ "https://ndownloader.figshare.com/files/24981170", "CFID_OQMD_460k.json", "Obtaining OQMD-3D CFID dataset 460k...", "https://www.nature.com/articles/npjcompumats201510", ], + # https://doi.org/10.6084/m9.figshare.13055333 "oqmd_3d_no_cfid": [ "https://ndownloader.figshare.com/files/26790182", "all_oqmd.json", "Obtaining OQMD-3D dataset 800k...", "https://www.nature.com/articles/npjcompumats201510", ], + # https://doi.org/10.6084/m9.figshare.14206169 "twod_matpd": [ "https://ndownloader.figshare.com/files/26789006", "twodmatpd.json", "Obtaining 2DMatPedia dataset 6k...", "https://www.nature.com/articles/s41597-019-0097-3", ], + # https://doi.org/10.6084/m9.figshare.14205083 "polymer_genome": [ "https://ndownloader.figshare.com/files/26809907", "pgnome.json", "Obtaining Polymer genome 1k...", "https://www.nature.com/articles/sdata201612", ], + # https://doi.org/10.6084/m9.figshare.14213603 + "qm9_std_jctc": [ + "https://ndownloader.figshare.com/files/28715319", + "qm9_std_jctc.json", + "Obtaining QM9 standardized dataset 130k," + + "From https://doi.org/10.1021/acs.jctc.7b00577,+", + "https://www.nature.com/articles/sdata201422", + ], + "qm9_dgl": [ + "https://ndownloader.figshare.com/files/28541196", + "qm9_dgl.json", + "Obtaining QM9 dataset 130k, from DGL...", + "https://www.nature.com/articles/sdata201422", + ], + # https://doi.org/10.6084/m9.figshare.14827584 + # Use qm9_std_jctc instaed + "cod": [ + "https://ndownloader.figshare.com/files/28715301", + "cod_db.json", + "Obtaining COD dataset 431k", + "https://doi.org/10.1107/S1600576720016532", + ], + # https://doi.org/10.6084/m9.figshare.14912820.v1 "qm9": [ "https://ndownloader.figshare.com/files/27627596", "qm9_data_cfid.json", "Obtaining QM9 dataset 134k...", "https://www.nature.com/articles/sdata201422", ], + # Use qm9_std_jctc instaed "qe_tb": [ "https://ndownloader.figshare.com/files/TODO", "jqe_tb_folder.json", @@ -121,36 +156,42 @@ def get_db_info(): "Obtaining OMDB dataset 12.5k...", "https://doi.org/10.1002/qute.201900023", ], + # https://doi.org/10.6084/m9.figshare.14812050 "qmof": [ "https://ndownloader.figshare.com/files/28501740", "qmof_db.json", "Obtaining QMOF dataset 18k...", "https://www.cell.com/matter/fulltext/S2590-2385(21)00070-9", ], + # https://doi.org/10.6084/m9.figshare.14812044 "c2db": [ - "https://ndownloader.figshare.com/files/28501722", + "https://ndownloader.figshare.com/files/28682010", "c2db_atoms.json", "Obtaining C2DB dataset 3.5k...", "https://iopscience.iop.org/article/10.1088/2053-1583/aacfc1", ], + # https://doi.org/10.6084/m9.figshare.14812038 "aflow2": [ "https://ndownloader.figshare.com/files/25453265", "CFID_AFLOW2.json", "Obtaining AFLOW-2 CFID dataset 400k...", "https://doi.org/10.1016/j.commatsci.2012.02.005", ], + # https://doi.org/10.6084/m9.figshare.13215308 "arXiv": [ "https://ndownloader.figshare.com/files/26804795", "arXivdataset.json", "Obtaining arXiv dataset 1.8 million...", "https://www.kaggle.com/Cornell-University/arxiv", ], + # https://doi.org/10.6084/m9.figshare.14211860 "cord19": [ "https://ndownloader.figshare.com/files/26804798", "cord19.json", "Obtaining CORD19 dataset 223k...", "https://github.com/usnistgov/cord19-cdcs-nist", ], + # https://doi.org/10.6084/m9.figshare.14211857 "raw_files": [ "https://ndownloader.figshare.com/files/25295732", "figshare_data-10-28-2020.json", diff --git a/jarvis/io/vasp/inputs.py b/jarvis/io/vasp/inputs.py index 6ab957ba..8a84bddf 100644 --- a/jarvis/io/vasp/inputs.py +++ b/jarvis/io/vasp/inputs.py @@ -421,6 +421,18 @@ def __init__( msg = "Number of elements not same as potcar_strings" raise ValueError(msg) + @staticmethod + def from_atoms(atoms=None, pot_type=None): + """Obtain POTCAR for atoms object.""" + new_symb = [] + for i in atoms.elements: + if i not in new_symb: + new_symb.append(i) + if pot_type is None: + pot_type = "POT_GGA_PAW_PBE" + potcar = Potcar(elements=new_symb, pot_type=pot_type) + return potcar + @classmethod def from_dict(self, d={}): """Build class from a dictionary.""" diff --git a/jarvis/io/zeopp/__init__.py b/jarvis/io/zeopp/__init__.py new file mode 100644 index 00000000..1a7e0392 --- /dev/null +++ b/jarvis/io/zeopp/__init__.py @@ -0,0 +1 @@ +"""Module to run zeo++ package.""" diff --git a/jarvis/io/zeopp/inputs.py b/jarvis/io/zeopp/inputs.py new file mode 100644 index 00000000..56e18bb7 --- /dev/null +++ b/jarvis/io/zeopp/inputs.py @@ -0,0 +1,38 @@ +"""Module to run zeo++ package.""" +import os +import tempfile + + +def get_porosity(atoms=None, network_cmd="./network", output_file=None): + """Gete pore diameters using zeo++.""" + new_file, filename = tempfile.mkstemp() + filename = filename + ".cif" + atoms.write_cif(filename) + if output_file is None: + new_file, filename1 = tempfile.mkstemp() + output_file = filename1 + cmd = network_cmd + " -ha -res " + output_file + " " + filename + os.system(cmd) + f = open(output_file, "r") + lines = f.read().splitlines() + f.close() + largest_included_sphere = lines[0].split()[1] + largest_free_sphere = lines[0].split()[2] + largest_included_sphere_along_free_sphere_path = lines[0].split()[3] + return ( + largest_included_sphere, + largest_free_sphere, + largest_included_sphere_along_free_sphere_path, + ) + + +""" +if __name__ == "__main__": + from jarvis.db.figshare import get_jid_data + from jarvis.core.atoms import Atoms + + a = Atoms.from_dict(get_jid_data(jid="JVASP-667")["atoms"]) + cmd = "/home/knc6/Software/zeopp/zeo++-0.3/network" + x, y, z = get_porosity(atoms=a, network_cmd=cmd) + print(x, y, z) +""" diff --git a/jarvis/tests/testfiles/analysis/defects/test_vacancy.py b/jarvis/tests/testfiles/analysis/defects/test_vacancy.py index bdb4e368..bbbdf230 100644 --- a/jarvis/tests/testfiles/analysis/defects/test_vacancy.py +++ b/jarvis/tests/testfiles/analysis/defects/test_vacancy.py @@ -1,4 +1,4 @@ -from jarvis.analysis.defects.vacancy import Vacancy +from jarvis.analysis.defects.vacancy import Vacancy, generate_random_defects from jarvis.core.atoms import Atoms from jarvis.io.vasp.inputs import Poscar import os @@ -21,6 +21,7 @@ def test_vacancy(): len(vacs), Atoms.from_dict(vacs[0].to_dict()["defect_structure"]).num_atoms, ) == (1, 53) + x = generate_random_defects(atoms=Si.make_supercell([2, 2, 2]), n_vacs=2) def test_2d(): diff --git a/jarvis/tests/testfiles/analysis/stm/test_stm.py b/jarvis/tests/testfiles/analysis/stm/test_stm.py index 7cfa9e2b..053e3ca7 100644 --- a/jarvis/tests/testfiles/analysis/stm/test_stm.py +++ b/jarvis/tests/testfiles/analysis/stm/test_stm.py @@ -11,23 +11,23 @@ def test_th_stm(): plt.switch_backend("agg") - TH_STM1 = TersoffHamannSTM(chg_name=name) - byte_io = BytesIO() - t1 = TH_STM1.constant_height(filename=byte_io) + TH_STM1 = TersoffHamannSTM(chg_name=name, min_size=5) + # byte_io = BytesIO() + # t1 = TH_STM1.constant_height(filename=byte_io) t1 = TH_STM1.constant_height(filename="test.png") im = Image.from_file("test.png") plt.imshow( - im.fourier_transform2D(use_crop=True, zoom_factor=50) + im.fourier_transform2D(use_crop=True, zoom_factor=10) .rotate(angle=0) .black_and_white(threshold=0.05) .values, cmap="Greys", ) - p = byte_io.getvalue() # .decode('UTF-8') + # p = byte_io.getvalue() # .decode('UTF-8') # print ('p',p) t1 = TH_STM1.constant_height() - TH_STM2 = TersoffHamannSTM(chg_name=name) + TH_STM2 = TersoffHamannSTM(chg_name=name, min_size=5) t2 = TH_STM2.constant_current() t2 = TH_STM2.constant_current(pc=5) from jarvis.db.figshare import make_stm_from_prev_parchg diff --git a/jarvis/tests/testfiles/core/1000000.cif b/jarvis/tests/testfiles/core/1000000.cif new file mode 100644 index 00000000..77edad6e --- /dev/null +++ b/jarvis/tests/testfiles/core/1000000.cif @@ -0,0 +1,363 @@ +#------------------------------------------------------------------------------ +#$Date: 2016-02-18 17:37:37 +0200 (Thu, 18 Feb 2016) $ +#$Revision: 176729 $ +#$URL: svn://www.crystallography.net/cod/cif/1/00/00/1000000.cif $ +#------------------------------------------------------------------------------ +# +# This file is available in the Crystallography Open Database (COD), +# http://www.crystallography.net/. The original data for this entry +# were provided by IUCr Journals, http://journals.iucr.org/. +# +# The file may be used within the scientific community so long as +# proper attribution is given to the journal article from which the +# data were obtained. +# +data_1000000 +loop_ +_publ_author_name +'Phan Thanh, S.' +'Marrot, J.' +'Renaudin, J.' +'Maisonneuve, V.' +_publ_section_title +; +[H~3~N(CH~2~)~5~NH~3~].AlP~2~O~8~H, a one-dimensional aluminophosphate +; +_journal_issue 9 +_journal_name_full 'Acta Crystallographica, Section C' +_journal_page_first 1073 +_journal_page_last 1074 +_journal_paper_doi 10.1107/S0108270100008532 +_journal_volume 56 +_journal_year 2000 +_chemical_formula_moiety '(C5 H16 N2 )[AlHP2 O8 ]' +_chemical_formula_sum 'C5 H17 Al N2 O8 P2' +_chemical_formula_weight 322.13 +_space_group_IT_number 14 +_symmetry_cell_setting monoclinic +_symmetry_space_group_name_Hall '-P 2yn' +_symmetry_space_group_name_H-M 'P 1 21/n 1' +_audit_creation_method SHELXL-97 +_cell_angle_alpha 90.00 +_cell_angle_beta 95.1470(10) +_cell_angle_gamma 90.00 +_cell_formula_units_Z 4 +_cell_length_a 7.8783(2) +_cell_length_b 10.46890(10) +_cell_length_c 16.0680(4) +_cell_measurement_reflns_used 5007 +_cell_measurement_temperature 296(2) +_cell_measurement_theta_max 29.83 +_cell_measurement_theta_min 2.32 +_cell_volume 1319.90(5) +_computing_cell_refinement SMART +_computing_data_collection 'SMART (Siemens, 1996a)' +_computing_data_reduction 'SHELXTL96 (Siemens, 1996b)' +_computing_molecular_graphics 'DIAMOND (Bergerhoff, 1996)' +_computing_publication_material SHELXTL +_computing_structure_refinement 'SHELXL93 (Sheldrick, 1993)' +_computing_structure_solution 'SHELXS86 (Sheldrick, 1990)' +_diffrn_ambient_temperature 296(2) +_diffrn_measurement_device 'Siemens SMART diffractometer' +_diffrn_measurement_method '\w scans' +_diffrn_radiation_monochromator graphite +_diffrn_radiation_source 'fine-focus sealed tube' +_diffrn_radiation_type MoK\a +_diffrn_radiation_wavelength .71073 +_diffrn_reflns_av_R_equivalents .0383 +_diffrn_reflns_av_sigmaI/netI .0532 +_diffrn_reflns_limit_h_max 10 +_diffrn_reflns_limit_h_min -10 +_diffrn_reflns_limit_k_max 13 +_diffrn_reflns_limit_k_min -14 +_diffrn_reflns_limit_l_max 9 +_diffrn_reflns_limit_l_min -21 +_diffrn_reflns_number 8939 +_diffrn_reflns_theta_max 29.83 +_diffrn_reflns_theta_min 2.32 +_exptl_absorpt_coefficient_mu .429 +_exptl_absorpt_correction_T_max .978 +_exptl_absorpt_correction_T_min .844 +_exptl_absorpt_correction_type semi-empirical +_exptl_absorpt_process_details 'SADABS (Sheldrick, 1996)' +_exptl_crystal_colour colorless +_exptl_crystal_density_diffrn 1.621 +_exptl_crystal_density_meas ? +_exptl_crystal_description parallelepiped +_exptl_crystal_F_000 672 +_exptl_crystal_size_max .12 +_exptl_crystal_size_mid .06 +_exptl_crystal_size_min .05 +_refine_diff_density_max 1.357 +_refine_diff_density_min -.604 +_refine_ls_extinction_coef .013(8) +_refine_ls_extinction_method 'SHELXL93 (Sheldrick, 1993)' +_refine_ls_goodness_of_fit_all 1.055 +_refine_ls_goodness_of_fit_ref 1.080 +_refine_ls_hydrogen_treatment constr +_refine_ls_matrix_type full +_refine_ls_number_parameters 167 +_refine_ls_number_reflns 2521 +_refine_ls_number_restraints 4 +_refine_ls_restrained_S_all 1.370 +_refine_ls_restrained_S_obs 1.096 +_refine_ls_R_factor_all .1073 +_refine_ls_R_factor_gt .0584 +_refine_ls_shift/esd_mean .000 +_refine_ls_shift/su_max <0.001 +_refine_ls_structure_factor_coef Fsqd +_refine_ls_weighting_details +'w = 1/[\s^2^(Fo^2^)+(0.0573P)^2^+3.0698P] where P=(Fo^2^+2Fc^2^)/3' +_refine_ls_weighting_scheme calc +_refine_ls_wR_factor_all .2069 +_refine_ls_wR_factor_ref .1362 +_reflns_number_gt 1901 +_reflns_number_total 3421 +_reflns_threshold_expression I>2\s(I) +_cod_duplicate_entry 2011331 +_cod_data_source_file gs1096.cif +_cod_depositor_comments +; +The following automatic conversions were performed: +'_symmetry_cell_setting' value 'Monoclinic' changed to 'monoclinic' +according to '/home/saulius/struct/CIF-dictionaries/cif_core.dic' +dictionary named 'cif_core.dic' version 2.4.1 from 2010-06-29. + +Automatic conversion script +Id: cif_fix_enum 1527 2010-12-29 10:47:43Z saulius + +The following automatic conversions were performed: + +'_refine_ls_weighting_scheme' value 'calc w = +1/[\s^2^(Fo^2^)+(0.0573P)^2^+3.0698P] where P=(Fo^2^+2Fc^2^)/3' was +changed to 'calc'. New tag '_refine_ls_weighting_details' was +created. The value of the new tag was set to 'w = +1/[\s^2^(Fo^2^)+(0.0573P)^2^+3.0698P] where P=(Fo^2^+2Fc^2^)/3'. + +Automatic conversion script +Id: cif_fix_values 3143 2015-03-26 13:38:13Z robertas +; +_cod_original_sg_symbol_H-M P2(1)/n +_cod_database_code 1000000 +loop_ +_symmetry_equiv_pos_as_xyz +'x, y, z' +'-x+1/2, y+1/2, -z+1/2' +'-x, -y, -z' +'x-1/2, -y-1/2, z-1/2' +loop_ +_atom_site_aniso_label +_atom_site_aniso_U_11 +_atom_site_aniso_U_22 +_atom_site_aniso_U_33 +_atom_site_aniso_U_12 +_atom_site_aniso_U_13 +_atom_site_aniso_U_23 +P1 .0276(5) .0230(5) .0341(6) .0016(4) .0063(4) .0016(4) +P2 .0259(5) .0418(6) .0193(5) -.0018(4) .0019(4) -.0034(4) +Al1 .0218(6) .0289(6) .0233(6) .0004(4) .0024(4) -.0027(4) +O1 .041(2) .048(2) .0262(15) .0047(14) .0096(12) -.0020(13) +O2 .036(2) .0285(15) .049(2) .0033(12) .0141(13) -.0019(13) +O3 .0279(15) .049(2) .037(2) -.0003(13) -.0009(12) -.0117(13) +O4 .042(2) .060(2) .039(2) -.019(2) .0100(14) -.016(2) +O5 .036(2) .046(2) .047(2) .0153(14) -.0034(14) -.0090(14) +O6 .055(2) .032(2) .056(2) -.0010(14) .022(2) .0116(14) +O7 .060(2) .073(2) .024(2) .015(2) .0098(14) .0063(15) +O8 .045(2) .036(2) .038(2) -.0117(14) .0052(13) -.0015(13) +N1 .067(3) .030(2) .037(2) -.006(2) .016(2) -.003(2) +C1 .080(4) .070(4) .080(5) .012(3) .000(4) -.026(3) +C2 .073(4) .123(7) .067(4) -.002(4) .008(3) -.005(4) +C3 .097(6) .158(10) .077(5) -.056(6) .015(4) -.002(6) +C4 .169(13) .130(10) .153(12) -.019(9) -.024(10) .010(8) +C5 .099(6) .134(7) .063(4) -.075(5) .004(4) -.007(4) +N2 .041(2) .052(2) .039(2) -.002(2) .006(2) .012(2) +loop_ +_atom_site_label +_atom_site_fract_x +_atom_site_fract_y +_atom_site_fract_z +_atom_site_U_iso_or_equiv +_atom_site_thermal_displace_type +_atom_site_calc_flag +_atom_site_refinement_flags +_atom_site_occupancy +_atom_site_type_symbol +P1 .55909(13) .78402(9) .02396(7) .0280(3) Uani d . 1 P +P2 .09646(13) 1.05563(11) .13485(6) .0290(3) Uani d . 1 P +Al1 .24723(13) .95928(11) -.02995(7) .0246(4) Uani d . 1 Al +O1 .1684(4) .9724(3) .0667(2) .0379(7) Uani d . 1 O +O2 .6564(4) .7078(3) -.0386(2) .0373(7) Uani d . 1 O +H2 .7123 .7571 -.0649 .056 Uiso calc R 1 H +O3 .0882(4) .9116(3) -.1048(2) .0381(7) Uani d . 1 O +O4 .1982(4) 1.1793(3) .1459(2) .0467(9) Uani d . 1 O +O5 .4005(4) .8408(3) -.0252(2) .0435(8) Uani d . 1 O +O6 .5116(4) .6993(3) .0927(2) .0466(8) Uani d . 1 O +O7 .1067(5) .9814(4) .2149(2) .0521(9) Uani d . 1 O +O8 .6701(4) .8956(3) .0585(2) .0398(8) Uani d . 1 O +N1 .5653(6) .4525(4) .1464(2) .0438(10) Uani d . 1 N +H1A .4934 .4053 .1133 .066 Uiso calc R 1 H +H1B .5704 .5309 .1254 .066 Uiso calc R 1 H +H1C .5288 .4565 .1972 .066 Uiso calc R 1 H +C1 .7372(9) .3936(7) .1518(5) .077(2) Uani d D 1 C +H1D .7840 .4038 .0984 .092 Uiso calc R 1 H +H1E .7258 .3028 .1618 .092 Uiso calc R 1 H +C2 .8618(10) .4488(8) .2194(5) .088(2) Uani d D 1 C +H2A .8225 .4271 .2732 .105 Uiso calc R 1 H +H2B .9709 .4071 .2162 .105 Uiso calc R 1 H +C3 .8903(13) .5913(9) .2175(5) .110(3) Uani d D 1 C +H3A .7912 .6290 .2395 .132 Uiso calc R 1 H +H3B .9855 .6077 .2587 .132 Uiso calc R 1 H +C4 .9232(15) .6711(14) .1428(8) .153(5) Uani d D 1 C +H4A .8502 .6411 .0950 .184 Uiso calc R 1 H +H4B .8917 .7587 .1534 .184 Uiso calc R 1 H +C5 1.1025(11) .6688(10) .1213(5) .099(3) Uani d D 1 C +H5A 1.1363 .5802 .1162 .118 Uiso calc R 1 H +H5B 1.1062 .7081 .0669 .118 Uiso calc R 1 H +N2 1.2290(5) .7318(4) .1793(3) .0439(9) Uani d . 1 N +H2C 1.3301 .7296 .1586 .066 Uiso calc R 1 H +H2D 1.2357 .6916 .2283 .066 Uiso calc R 1 H +H2E 1.1984 .8127 .1863 .066 Uiso calc R 1 H +loop_ +_atom_type_symbol +_atom_type_description +_atom_type_scat_dispersion_real +_atom_type_scat_dispersion_imag +_atom_type_scat_source +C C .0033 .0016 'International Tables Vol C Tables 4.2.6.8 and 6.1.1.4' +H H .0000 .0000 'International Tables Vol C Tables 4.2.6.8 and 6.1.1.4' +N N .0061 .0033 'International Tables Vol C Tables 4.2.6.8 and 6.1.1.4' +O O .0106 .0060 'International Tables Vol C Tables 4.2.6.8 and 6.1.1.4' +Al Al .0645 .0514 'International Tables Vol C Tables 4.2.6.8 and 6.1.1.4' +P P .1023 .0942 'International Tables Vol C Tables 4.2.6.8 and 6.1.1.4' +loop_ +_geom_angle_atom_site_label_1 +_geom_angle_atom_site_label_2 +_geom_angle_atom_site_label_3 +_geom_angle_site_symmetry_1 +_geom_angle_site_symmetry_3 +_geom_angle +_geom_angle_publ_flag +O6 P1 O8 . . 111.0(2) ? +O6 P1 O5 . . 111.4(2) ? +O8 P1 O5 . . 107.6(2) ? +O6 P1 O2 . . 110.4(2) ? +O8 P1 O2 . . 109.3(2) ? +O5 P1 O2 . . 107.1(2) ? +O7 P2 O4 . . 110.6(2) ? +O7 P2 O3 . 3_575 111.3(2) ? +O4 P2 O3 . 3_575 108.8(2) ? +O7 P2 O1 . . 108.7(2) ? +O4 P2 O1 . . 109.8(2) ? +O3 P2 O1 3_575 . 107.6(2) ? +O5 Al1 O1 . . 108.9(2) ? +O5 Al1 O8 . 3_675 111.3(2) ? +O1 Al1 O8 . 3_675 110.0(2) ? +O5 Al1 O3 . . 106.4(2) ? +O1 Al1 O3 . . 110.6(2) ? +O8 Al1 O3 3_675 . 109.6(2) ? +P2 O1 Al1 . . 149.8(2) ? +P1 O2 H2 . . 109.47(12) ? +P2 O3 Al1 3_575 . 139.7(2) ? +P1 O5 Al1 . . 146.4(2) ? +P1 O8 Al1 . 3_675 142.0(2) ? +C1 N1 H1A . . 109.5(3) ? +C1 N1 H1B . . 109.5(4) ? +H1A N1 H1B . . 109.5 ? +C1 N1 H1C . . 109.5(3) ? +H1A N1 H1C . . 109.5 ? +H1B N1 H1C . . 109.5 ? +N1 C1 C2 . . 114.5(5) y +N1 C1 H1D . . 108.6(4) ? +C2 C1 H1D . . 108.6(4) ? +N1 C1 H1E . . 108.6(3) ? +C2 C1 H1E . . 108.6(5) ? +H1D C1 H1E . . 107.6 ? +C3 C2 C1 . . 116.8(7) y +C3 C2 H2A . . 108.1(5) ? +C1 C2 H2A . . 108.1(5) ? +C3 C2 H2B . . 108.1(5) ? +C1 C2 H2B . . 108.1(4) ? +H2A C2 H2B . . 107.3 ? +C4 C3 C2 . . 127.0(9) y +C4 C3 H3A . . 105.6(7) ? +C2 C3 H3A . . 105.6(5) ? +C4 C3 H3B . . 105.6(6) ? +C2 C3 H3B . . 105.6(5) ? +H3A C3 H3B . . 106.1 ? +C5 C4 C3 . . 114.4(9) y +C5 C4 H4A . . 108.7(7) ? +C3 C4 H4A . . 108.7(7) ? +C5 C4 H4B . . 108.7(7) ? +C3 C4 H4B . . 108.7(7) ? +H4A C4 H4B . . 107.6 ? +N2 C5 C4 . . 117.0(9) y +N2 C5 H5A . . 108.0(5) ? +C4 C5 H5A . . 108.0(7) ? +N2 C5 H5B . . 108.0(4) ? +C4 C5 H5B . . 108.0(6) ? +H5A C5 H5B . . 107.3 ? +C5 N2 H2C . . 109.5(4) ? +C5 N2 H2D . . 109.5(4) ? +H2C N2 H2D . . 109.5 ? +C5 N2 H2E . . 109.5(5) ? +H2C N2 H2E . . 109.5 ? +H2D N2 H2E . . 109.5 ? +loop_ +_geom_bond_atom_site_label_1 +_geom_bond_atom_site_label_2 +_geom_bond_site_symmetry_2 +_geom_bond_distance +_geom_bond_publ_flag +P1 O6 . 1.490(3) y +P1 O8 . 1.533(3) y +P1 O5 . 1.537(3) y +P1 O2 . 1.539(3) y +P2 O7 . 1.499(3) y +P2 O4 . 1.525(3) y +P2 O3 3_575 1.530(3) y +P2 O1 . 1.546(3) y +Al1 O5 . 1.727(3) y +Al1 O1 . 1.729(3) y +Al1 O8 3_675 1.731(3) y +Al1 O3 . 1.731(3) y +O2 H2 . .82 ? +O3 P2 3_575 1.530(3) ? +O8 Al1 3_675 1.731(3) ? +N1 C1 . 1.483(8) y +N1 H1A . .89 ? +N1 H1B . .89 ? +N1 H1C . .89 ? +C1 C2 . 1.512(8) y +C1 H1D . .97 ? +C1 H1E . .97 ? +C2 C3 . 1.509(9) y +C2 H2A . .97 ? +C2 H2B . .97 ? +C3 C4 . 1.503(9) y +C3 H3A . .97 ? +C3 H3B . .97 ? +C4 C5 . 1.484(9) y +C4 H4A . .97 ? +C4 H4B . .97 ? +C5 N2 . 1.459(8) y +C5 H5A . .97 ? +C5 H5B . .97 ? +N2 H2C . .89 ? +N2 H2D . .89 ? +N2 H2E . .89 ? +loop_ +_geom_hbond_atom_site_label_D +_geom_hbond_atom_site_label_H +_geom_hbond_atom_site_label_A +_geom_hbond_site_symmetry_A +_geom_hbond_distance_DH +_geom_hbond_distance_HA +_geom_hbond_distance_DA +_geom_hbond_angle_DHA +O2 H2 O4 3_675 .82 1.67 2.457(4) 159.1 +N1 H1A O2 3_665 .89 2.00 2.885(5) 176.6 +N1 H1B O6 . .89 1.89 2.745(5) 161.8 +N1 H1C O7 2_545 .89 1.86 2.727(5) 162.8 +N2 H2C O6 1_655 .89 1.88 2.750(5) 164.8 +N2 H2D O4 2_645 .89 2.05 2.869(5) 153.3 +N2 H2E O7 1_655 .89 1.98 2.861(6) 170.9 diff --git a/jarvis/tests/testfiles/core/test_atoms.py b/jarvis/tests/testfiles/core/test_atoms.py index 1ae98dfb..dfeb4bb4 100644 --- a/jarvis/tests/testfiles/core/test_atoms.py +++ b/jarvis/tests/testfiles/core/test_atoms.py @@ -62,6 +62,10 @@ os.path.dirname(__file__), "exp_000034.cif", ) +cif_example5 = os.path.join( + os.path.dirname(__file__), + "1000000.cif", +) def test_from_cif(): @@ -69,6 +73,11 @@ def test_from_cif(): a = Atoms.from_cif(cif_example2) a = Atoms.from_cif(cif_example3) a = Atoms.from_cif(cif_example4) + a = Atoms.from_cif(cif_example5) + f = open(cif_example, "r") + lines = f.read() + f.close() + x = Atoms.from_cif(from_string=lines) def test_basic_atoms(): diff --git a/jarvis/tests/testfiles/core/test_specie.py b/jarvis/tests/testfiles/core/test_specie.py index fa878dc3..ac8783f3 100644 --- a/jarvis/tests/testfiles/core/test_specie.py +++ b/jarvis/tests/testfiles/core/test_specie.py @@ -3,6 +3,7 @@ get_feats_hot_encoded, get_digitized_feats_hot_encoded, get_specie_data, + atomic_numbers_to_symbols ) @@ -18,3 +19,4 @@ def test_sp(): dat = get_feats_hot_encoded() fat = get_digitized_feats_hot_encoded() x, y, z = get_specie_data() + x=atomic_numbers_to_symbols() diff --git a/jarvis/tests/testfiles/io/vasp/test_inputs.py b/jarvis/tests/testfiles/io/vasp/test_inputs.py index b225745e..80d04f6d 100644 --- a/jarvis/tests/testfiles/io/vasp/test_inputs.py +++ b/jarvis/tests/testfiles/io/vasp/test_inputs.py @@ -137,6 +137,11 @@ def test_inputs(): fd = Potcar.from_dict(td) print(pot) pot.write_file(filename) + box = [[2.715, 2.715, 0], [0, 2.715, 2.715], [2.715, 0, 2.715]] + coords = [[0, 0, 0], [0.25, 0.25, 0.25]] + elements = ["Xe", "Xe"] + xe = Atoms(lattice_mat=box, coords=coords, elements=elements) + p = Potcar.from_atoms(atoms=xe) def test_kpoints(): diff --git a/setup.py b/setup.py index 4f4a2ff5..9ab27469 100644 --- a/setup.py +++ b/setup.py @@ -11,7 +11,7 @@ setup( name="jarvis-tools", - version="2021.06.18", + version="2021.07.04", long_description=long_d, install_requires=[ "numpy>=1.19.5",