def test_cluster_from_file(self): self.atoms.write_file("ATOMS_test") mol_1 = Atoms.cluster_from_file("ATOMS_test") mol_2 = Atoms.cluster_from_file(os.path.join(test_dir, "ATOMS")) self.assertEqual(mol_1.formula, mol_2.formula) self.assertEqual(len(mol_1), len(mol_2)) os.remove("ATOMS_test")
def test_post_distdiff(self): feff_dict_input = FEFFDictSet.from_directory( os.path.join(PymatgenTest.TEST_FILES_DIR, "feff_dist_test")) self.assertTrue(feff_dict_input.tags == Tags.from_file( os.path.join(PymatgenTest.TEST_FILES_DIR, "feff_dist_test/feff.inp"))) self.assertTrue( str(feff_dict_input.header()) == str( Header.from_file( os.path.join(PymatgenTest.TEST_FILES_DIR, "feff_dist_test/HEADER")))) feff_dict_input.write_input("feff_dist_regen") origin_tags = Tags.from_file( os.path.join(PymatgenTest.TEST_FILES_DIR, "feff_dist_test/PARAMETERS")) output_tags = Tags.from_file( os.path.join(".", "feff_dist_regen/PARAMETERS")) origin_mole = Atoms.cluster_from_file( os.path.join(PymatgenTest.TEST_FILES_DIR, "feff_dist_test/feff.inp")) output_mole = Atoms.cluster_from_file( os.path.join(".", "feff_dist_regen/feff.inp")) original_mole_dist = np.array( origin_mole.distance_matrix[0, :]).astype(np.float64) output_mole_dist = np.array(output_mole.distance_matrix[0, :]).astype( np.float64) original_mole_shell = [x.species_string for x in origin_mole] output_mole_shell = [x.species_string for x in output_mole] self.assertTrue(np.allclose(original_mole_dist, output_mole_dist)) self.assertTrue(origin_tags == output_tags) self.assertTrue(original_mole_shell == output_mole_shell) shutil.rmtree(os.path.join(".", "feff_dist_regen"))
def test_cluster_from_file(self): self.atoms.write_file("ATOMS_test") mol_1 = Atoms.cluster_from_file("ATOMS_test") mol_2 = Atoms.cluster_from_file( os.path.join(PymatgenTest.TEST_FILES_DIR, "ATOMS")) self.assertEqual(mol_1.formula, mol_2.formula) self.assertEqual(len(mol_1), len(mol_2)) os.remove("ATOMS_test")
def test_get_string(self): header = Header.from_string(header_string) struc = header.struct central_atom = 'O' a = Atoms(struc, central_atom, radius=10.) atoms = a.get_string() self.assertEqual(atoms.splitlines()[3].split()[4], central_atom, "failed to create ATOMS string")
def test_get_string(self): header = Header.from_string(header_string) struc = header.struct central_atom = 'O' a = Atoms(struc, central_atom) atoms = a.get_string() self.assertEqual(atoms.splitlines()[3].split()[4], central_atom, "failed to create ATOMS string")
def test_postfeffset(self): self.mp_xanes.write_input(os.path.join(".", "xanes_3")) feff_dict_input = FEFFDictSet.from_directory(os.path.join(".", "xanes_3")) self.assertTrue( feff_dict_input.tags == Tags.from_file(os.path.join(".", "xanes_3/feff.inp")) ) self.assertTrue( str(feff_dict_input.header()) == str(Header.from_file(os.path.join(".", "xanes_3/HEADER"))) ) feff_dict_input.write_input("xanes_3_regen") origin_tags = Tags.from_file(os.path.join(".", "xanes_3/PARAMETERS")) output_tags = Tags.from_file(os.path.join(".", "xanes_3_regen/PARAMETERS")) origin_mole = Atoms.cluster_from_file(os.path.join(".", "xanes_3/feff.inp")) output_mole = Atoms.cluster_from_file( os.path.join(".", "xanes_3_regen/feff.inp") ) original_mole_dist = np.array(origin_mole.distance_matrix[0, :]).astype( np.float64 ) output_mole_dist = np.array(output_mole.distance_matrix[0, :]).astype( np.float64 ) original_mole_shell = [x.species_string for x in origin_mole] output_mole_shell = [x.species_string for x in output_mole] self.assertTrue(np.allclose(original_mole_dist, output_mole_dist)) self.assertTrue(origin_tags == output_tags) self.assertTrue(original_mole_shell == output_mole_shell) shutil.rmtree(os.path.join(".", "xanes_3")) shutil.rmtree(os.path.join(".", "xanes_3_regen")) reci_mp_xanes = MPXANESSet( self.absorbing_atom, self.structure, user_tag_settings={"RECIPROCAL": ""} ) reci_mp_xanes.write_input("xanes_reci") feff_reci_input = FEFFDictSet.from_directory(os.path.join(".", "xanes_reci")) self.assertTrue("RECIPROCAL" in feff_reci_input.tags) feff_reci_input.write_input("Dup_reci") self.assertTrue(os.path.exists(os.path.join(".", "Dup_reci", "HEADER"))) self.assertTrue(os.path.exists(os.path.join(".", "Dup_reci", "feff.inp"))) self.assertTrue(os.path.exists(os.path.join(".", "Dup_reci", "PARAMETERS"))) self.assertFalse(os.path.exists(os.path.join(".", "Dup_reci", "ATOMS"))) self.assertFalse(os.path.exists(os.path.join(".", "Dup_reci", "POTENTIALS"))) tags_original = Tags.from_file(os.path.join(".", "xanes_reci/feff.inp")) tags_output = Tags.from_file(os.path.join(".", "Dup_reci/feff.inp")) self.assertTrue(tags_original == tags_output) stru_orig = Structure.from_file(os.path.join(".", "xanes_reci/Co2O2.cif")) stru_reci = Structure.from_file(os.path.join(".", "Dup_reci/Co2O2.cif")) self.assertTrue(stru_orig.__eq__(stru_reci)) shutil.rmtree(os.path.join(".", "Dup_reci")) shutil.rmtree(os.path.join(".", "xanes_reci"))
def test_as_dict_and_from_dict(self): file_name = os.path.join(test_dir, 'HEADER') header = Header.from_file(file_name) struct = header.struct atoms = Atoms(struct, 'O', radius=10.) d = atoms.as_dict() atoms2 = Atoms.from_dict(d) self.assertEqual(str(atoms), str(atoms2), "Atoms failed to and from dict test")
def test_as_dict_and_from_dict(self): file_name = os.path.join(PymatgenTest.TEST_FILES_DIR, "HEADER") header = Header.from_file(file_name) struct = header.struct atoms = Atoms(struct, "O", radius=10.0) d = atoms.as_dict() atoms2 = Atoms.from_dict(d) self.assertEqual(str(atoms), str(atoms2), "Atoms failed to and from dict test")
def from_directory(input_dir): """ Read in a set of FEFF input files from a directory, which is useful when existing FEFF input needs some adjustment. """ sub_d = {} for fname, ftype in [("HEADER", Header), ("PARAMETERS", Tags)]: fullzpath = zpath(os.path.join(input_dir, fname)) sub_d[fname.lower()] = ftype.from_file(fullzpath) # Generation of FEFFDict set requires absorbing atom, need to search # the index of absorption atom in the structure according to the # distance matrix and shell species information contained in feff.inp absorber_index = [] radius = None feffinp = zpath(os.path.join(input_dir, 'feff.inp')) if "RECIPROCAL" not in sub_d["parameters"]: input_atoms = Atoms.cluster_from_file(feffinp) shell_species = np.array([x.species_string for x in input_atoms]) # First row of distance matrix represents the distance from the absorber to # the rest atoms distance_matrix = input_atoms.distance_matrix[0, :] # Get radius value from math import ceil radius = int(ceil(input_atoms.get_distance(input_atoms.index(input_atoms[0]), input_atoms.index(input_atoms[-1])))) for site_index, site in enumerate(sub_d['header'].struct): if site.specie == input_atoms[0].specie: site_atoms = Atoms(sub_d['header'].struct, absorbing_atom=site_index, radius=radius) site_distance = np.array(site_atoms.get_lines())[:, 5].astype(np.float64) site_shell_species = np.array(site_atoms.get_lines())[:, 4] shell_overlap = min(shell_species.shape[0], site_shell_species.shape[0]) if np.allclose(distance_matrix[:shell_overlap], site_distance[:shell_overlap]) and \ np.all(site_shell_species[:shell_overlap] == shell_species[:shell_overlap]): absorber_index.append(site_index) if "RECIPROCAL" in sub_d["parameters"]: absorber_index = sub_d["parameters"]["TARGET"] absorber_index[0] = int(absorber_index[0]) - 1 # Generate the input set if 'XANES' in sub_d["parameters"]: CONFIG = loadfn(os.path.join(MODULE_DIR, "MPXANESSet.yaml")) if radius is None: radius = 10 return FEFFDictSet(absorber_index[0], sub_d['header'].struct, radius=radius, config_dict=CONFIG, edge=sub_d["parameters"]["EDGE"], nkpts=1000, user_tag_settings=sub_d["parameters"])
def test_cluster_from_file(self): r = CifParser(os.path.join(test_dir, "CoO19128.cif")) structure = r.get_structures()[0] atoms = Atoms(structure, "O", 10.0) atoms.write_file("ATOMS_test") mol_1 = Atoms.cluster_from_file("ATOMS_test") mol_2 = Atoms.cluster_from_file(os.path.join(test_dir, "ATOMS")) self.assertEqual(mol_1.formula, mol_2.formula) self.assertEqual(len(mol_1), len(mol_2)) os.remove("ATOMS_test")
def test_setup(self): with cd(test_dir): with ScratchDir('.', copy_from_current_on_enter=True): f = FeffJob("hello", backup=True) f.setup() parameter = Tags.from_file('feff.inp') parameter_orig = Tags.from_file('feff.inp.orig') self.assertEqual(parameter, parameter_orig) atom = Atoms.cluster_from_file('feff.inp') atom_origin = Atoms.cluster_from_file('feff.inp.orig') self.assertEqual(atom, atom_origin)
def test_distances(self): atoms_1 = self.atoms.get_lines() distances_1 = [float(a[5]) for a in atoms_1] atoms_2 = Atoms.atoms_string_from_file(os.path.join(test_dir, "ATOMS")) atoms_2 = atoms_2.splitlines()[3:] distances_2 = [float(a.split()[5]) for a in atoms_2] np.testing.assert_allclose(distances_1, distances_2)
def test_distances(self): atoms_1 = self.atoms.get_lines() distances_1 = [float(a[5]) for a in atoms_1] atoms_2 = Atoms.atoms_string_from_file(os.path.join(test_dir, "ATOMS")) atoms_2 = atoms_2.splitlines()[3:] distances_2 = [float(a.split()[5]) for a in atoms_2] np.testing.assert_allclose(distances_1, distances_2, rtol=1e-5)
def get_snap_site_features(d): feature = [] data_filename = "lammps_snap.data" input_template = "lammps_snap_template.in" input_filename = "lammps_snap.in" dump_filename = "dump.sna" log_filename = "log.lammps" sbp.check_call(["rm", "-f", input_filename]) sbp.check_call(["rm", "-f", data_filename]) sbp.check_call(["rm", "-f", dump_filename]) sbp.check_call(["rm", "-f", log_filename]) structure = Structure.from_dict(d["structure"]) feature.append(structure[d["absorbing_atom"]].specie.number) try: mol = Molecule.from_dict(d["cluster"]) except TypeError: atoms = Atoms(structure, d["absorbing_atom"], 10.0) mol = atoms.cluster logger.info(mol.formula) lmp_data = LammpsData.from_structure(mol, [[0,25], [0,25],[0,25]], translate=False) lmp_data.write_file(data_filename) el_sorted = sorted(mol.composition, key=lambda x:x.atomic_mass) cutoff = "" weight = "" for i, e in enumerate(el_sorted): cutoff += " {}".format(float(e.atomic_radius)) weight += " {}".format(1.0) settings = { 'data_file': data_filename, 'rcutfac': 1.4, 'rfac0': 0.993630, 'twojmax': 6.0, 'cutoff': cutoff, 'weight': weight, 'dump_file': dump_filename } lmp_in = LammpsInput.from_file(input_template, settings) lmp_in.write_file(input_filename) #try: logger.info("Running LAMMPS ... ") exit_code = sbp.check_call(["./lmp_serial", "-in", input_filename]) if exit_code != 0: logger.error("lammps run failed") raise RuntimeError("lammps run failed") logger.info("Processing LAMMPS outputs ... ") lmp_run = LammpsRun(data_filename, dump_filename, log_filename) t = list(lmp_run.trajectory[0]) try: assert np.linalg.norm(t[2:5]) <= 1e-6 except AssertionError: logger.info("xyz: {}".format(t[2:5])) logger.error("assertion failed: first one not at origin") raise logger.info("# bispectrum coeffs: {}".format(len(t[5:]))) feature.extend(t[5:]) return feature
def atoms(self): """ absorber + the rest Returns: Atoms """ return Atoms(self.structure, self.absorbing_atom, self.radius)
def test_postfeffset(self): self.mp_xanes.write_input(os.path.join('.', 'xanes_3')) feff_dict_input = FEFFDictSet.from_directory(os.path.join('.', 'xanes_3')) self.assertTrue(feff_dict_input.tags == Tags.from_file(os.path.join('.', 'xanes_3/feff.inp'))) self.assertTrue(str(feff_dict_input.header()) == str(Header.from_file(os.path.join('.', 'xanes_3/HEADER')))) feff_dict_input.write_input('xanes_3_regen') origin_tags = Tags.from_file(os.path.join('.', 'xanes_3/PARAMETERS')) output_tags = Tags.from_file(os.path.join('.', 'xanes_3_regen/PARAMETERS')) origin_mole = Atoms.cluster_from_file(os.path.join('.', 'xanes_3/feff.inp')) output_mole = Atoms.cluster_from_file(os.path.join('.', 'xanes_3_regen/feff.inp')) original_mole_dist = np.array(origin_mole.distance_matrix[0, :]).astype(np.float64) output_mole_dist = np.array(output_mole.distance_matrix[0, :]).astype(np.float64) original_mole_shell = [x.species_string for x in origin_mole] output_mole_shell = [x.species_string for x in output_mole] self.assertTrue(np.allclose(original_mole_dist, output_mole_dist)) self.assertTrue(origin_tags == output_tags) self.assertTrue(original_mole_shell == output_mole_shell) shutil.rmtree(os.path.join('.', 'xanes_3')) shutil.rmtree(os.path.join('.', 'xanes_3_regen')) reci_mp_xanes = MPXANESSet(self.absorbing_atom, self.structure, user_tag_settings={"RECIPROCAL": ""}) reci_mp_xanes.write_input('xanes_reci') feff_reci_input = FEFFDictSet.from_directory(os.path.join('.', 'xanes_reci')) self.assertTrue("RECIPROCAL" in feff_reci_input.tags) feff_reci_input.write_input('Dup_reci') self.assertTrue(os.path.exists(os.path.join('.', 'Dup_reci', 'HEADER'))) self.assertTrue(os.path.exists(os.path.join('.', 'Dup_reci', 'feff.inp'))) self.assertTrue(os.path.exists(os.path.join('.', 'Dup_reci', 'PARAMETERS'))) self.assertFalse(os.path.exists(os.path.join('.', 'Dup_reci', 'ATOMS'))) self.assertFalse(os.path.exists(os.path.join('.', 'Dup_reci', 'POTENTIALS'))) tags_original = Tags.from_file(os.path.join('.', 'xanes_reci/feff.inp')) tags_output = Tags.from_file(os.path.join('.', 'Dup_reci/feff.inp')) self.assertTrue(tags_original == tags_output) stru_orig = Structure.from_file(os.path.join('.', 'xanes_reci/Co2O2.cif')) stru_reci = Structure.from_file(os.path.join('.', 'Dup_reci/Co2O2.cif')) self.assertTrue(stru_orig.__eq__(stru_reci)) shutil.rmtree(os.path.join('.', 'Dup_reci')) shutil.rmtree(os.path.join('.', 'xanes_reci'))
def test_post_distdiff(self): feff_dict_input = FEFFDictSet.from_directory(os.path.join(test_dir, 'feff_dist_test')) self.assertTrue(feff_dict_input.tags == Tags.from_file(os.path.join(test_dir, 'feff_dist_test/feff.inp'))) self.assertTrue( str(feff_dict_input.header()) == str(Header.from_file(os.path.join(test_dir, 'feff_dist_test/HEADER')))) feff_dict_input.write_input('feff_dist_regen') origin_tags = Tags.from_file(os.path.join(test_dir, 'feff_dist_test/PARAMETERS')) output_tags = Tags.from_file(os.path.join('.', 'feff_dist_regen/PARAMETERS')) origin_mole = Atoms.cluster_from_file(os.path.join(test_dir, 'feff_dist_test/feff.inp')) output_mole = Atoms.cluster_from_file(os.path.join('.', 'feff_dist_regen/feff.inp')) original_mole_dist = np.array(origin_mole.distance_matrix[0, :]).astype(np.float64) output_mole_dist = np.array(output_mole.distance_matrix[0, :]).astype(np.float64) original_mole_shell = [x.species_string for x in origin_mole] output_mole_shell = [x.species_string for x in output_mole] self.assertTrue(np.allclose(original_mole_dist, output_mole_dist)) self.assertTrue(origin_tags == output_tags) self.assertTrue(original_mole_shell == output_mole_shell) shutil.rmtree(os.path.join('.', 'feff_dist_regen'))
def run_task(self, fw_spec): calc_dir = os.getcwd() if "calc_dir" in self: calc_dir = self["calc_dir"] elif self.get("calc_loc"): calc_dir = get_calc_loc(self["calc_loc"], fw_spec["calc_locs"])["path"] logger.info("PARSING DIRECTORY: {}".format(calc_dir)) db_file = env_chk(self.get('db_file'), fw_spec) cluster_dict = None tags = Tags.from_file(filename="feff.inp") if "RECIPROCAL" not in tags: cluster_dict = Atoms.cluster_from_file("feff.inp").as_dict() doc = { "input_parameters": tags.as_dict(), "cluster": cluster_dict, "structure": self["structure"].as_dict(), "absorbing_atom": self["absorbing_atom"], "spectrum_type": self["spectrum_type"], "spectrum": np.loadtxt(os.path.join(calc_dir, self["output_file"])).tolist(), "edge": self.get("edge", None), "metadata": self.get("metadata", None), "dir_name": os.path.abspath(os.getcwd()), "last_updated": datetime.utcnow() } if not db_file: with open("feff_task.json", "w") as f: f.write(json.dumps(doc, default=DATETIME_HANDLER)) else: db = FeffCalcDb.from_db_file(db_file, admin=True) db.insert(doc) logger.info("Finished parsing the spectrum") return FWAction(stored_data={"task_id": doc.get("task_id", None)})
def run_task(self, fw_spec): calc_dir = os.getcwd() if "calc_dir" in self: calc_dir = self["calc_dir"] elif self.get("calc_loc"): calc_dir = get_calc_loc(self["calc_loc"], fw_spec["calc_locs"])["path"] logger.info("PARSING DIRECTORY: {}".format(calc_dir)) db_file = env_chk(self.get('db_file'), fw_spec) cluster_dict = None tags = Tags.from_file(filename="feff.inp") if "RECIPROCAL" not in tags: cluster_dict = Atoms.cluster_from_file("feff.inp").as_dict() doc = {"input_parameters": tags.as_dict(), "cluster": cluster_dict, "structure": self["structure"].as_dict(), "absorbing_atom": self["absorbing_atom"], "spectrum_type": self["spectrum_type"], "spectrum": np.loadtxt(os.path.join(calc_dir, self["output_file"])).tolist(), "edge": self.get("edge", None), "metadata": self.get("metadata", None), "dir_name": os.path.abspath(os.getcwd()), "last_updated": datetime.today()} if not db_file: with open("feff_task.json", "w") as f: f.write(json.dumps(doc, default=DATETIME_HANDLER)) # db insertion else: db = MMFeffDb.from_db_file(db_file, admin=True) db.insert(doc) logger.info("Finished parsing the spectrum") return FWAction(stored_data={"task_id": doc.get("task_id", None)})
) zno_structure = Structure.from_spacegroup( sg=186, lattice=zno_lattice_init, species=[Element('Zn'), Element('O')], coords=[ [1 / 3, 2 / 3, 0.00000], [1 / 3, 2 / 3, 0.37780], ], coords_are_cartesian=False, tol=1e-9, ) print(zno_structure) print(zno_structure.get_space_group_info()) out_file_name = '/home/yugin/PycharmProjects/neurons/data/src/feff.inp.new2' file_name = '/home/yugin/PycharmProjects/neurons/data/src/feff.inp.old' atoms_obj = Atoms(zno_structure, 'O', 12) pprint(atoms_obj.struct.cart_coords) pprint(atoms_obj.get_lines()) header_obj = Header(struct=zno_structure) pot_obj = Potential(zno_structure, 'O') tags_obj = Tags().from_file(filename=file_name) pprint(tags_obj.as_dict()) pot_obj.pot_string_from_file(filename=file_name) pprint(pot_obj) atoms_obj.atoms_string_from_file(filename=file_name) pprint(atoms_obj.as_dict())
def test_absorbing_atom(self): atoms_1 = Atoms(self.structure, 0, 10.0) atoms_2 = Atoms(self.structure, 2, 10.0) self.assertEqual(atoms_1.absorbing_atom, "Co") self.assertEqual(atoms_2.absorbing_atom, "O")
def setUpClass(cls): r = CifParser(os.path.join(test_dir, "CoO19128.cif")) cls.structure = r.get_structures()[0] cls.atoms = Atoms(cls.structure, "O", 10.0)
def setUp(self): feo = Structure.from_dict( {'lattice': {'a': 3.3960486211791285, 'alpha': 91.45136142952781, 'b': 3.410591877060444, 'beta': 89.27127081348024, 'c': 10.71766796897646, 'gamma': 120.14175587658389, 'matrix': [[3.39597035, -0.00828486, 0.02151698], [-1.70515997, 2.9534242, -0.04303398], [0.06812465, -0.11799566, 10.71680189]], 'volume': 107.31813123502585}, 'sites': [{'abc': [0.33497754, 0.66579918, 0.97174225], 'label': 'Fe', 'properties': {'coordination_no': 4, 'forces': [-0.01537896, -0.08731049, 0.04884326]}, 'species': [{'element': 'Fe', 'occu': 1}], 'xyz': [0.06847928463257683, 1.8489508003914767, 10.392524897825345]}, {'abc': [0.99661905, 0.00734083, 0.22366433], 'label': 'Fe', 'properties': {'coordination_no': 4, 'forces': [-0.01685376, -0.01008504, 0.05451912]}, 'species': [{'element': 'Fe', 'occu': 1}], 'xyz': [3.387208508781326, -0.0129676845693048, 2.4180946415046494]}, {'abc': [0.00338095, 0.01072178, 0.72366433], 'label': 'Fe', 'properties': {'coordination_no': 4, 'forces': [0.01716078, 0.00955327, 0.05451912]}, 'species': [{'element': 'Fe', 'occu': 1}], 'xyz': [0.04249863509042039, -0.053751296415148794, 7.754978606437029]}, {'abc': [0.66502246, 0.33082164, 0.47174225], 'label': 'Fe', 'properties': {'coordination_no': 4, 'forces': [0.08330257, -0.03033668, 0.04884326]}, 'species': [{'element': 'Fe', 'occu': 1}], 'xyz': [1.7264300141777726, 0.9158834813430974, 5.055640939524896]}, {'abc': [0.33062914, 0.66733572, 0.77744897], 'label': 'O', 'properties': {'coordination_no': 4, 'forces': [-0.07726687, -0.00523346, -0.05206924]}, 'species': [{'element': 'O', 'occu': 1}], 'xyz': [0.03785603896498114, 1.8764506445041333, 8.310162619639584]}, {'abc': [0.00312189, 0.99229908, 0.52714445], 'label': 'O', 'properties': {'coordination_no': 4, 'forces': [-0.06744419, 0.00047044, -0.05129314]}, 'species': [{'element': 'O', 'occu': 1}], 'xyz': [-1.6455152924521734, 2.8684534947950637, 5.606667232944964]}, {'abc': [0.99687811, 0.98917618, 0.02714445], 'label': 'O', 'properties': {'coordination_no': 4, 'forces': [0.03331469, 0.05864361, -0.05129314]}, 'species': [{'element': 'O', 'occu': 1}], 'xyz': [1.7005140848662161, 2.9099949452040543, 0.2697833114717219]}, {'abc': [0.66937086, 0.33670658, 0.27744897], 'label': 'O', 'properties': {'coordination_no': 4, 'forces': [0.04316575, 0.06429835, -0.05206924]}, 'species': [{'element': 'O', 'occu': 1}], 'xyz': [1.7179261258365088, 0.9561539434765862, 2.9732786612521678]}]}) atoms = Atoms(feo, 0, 10.0) self.paths = Paths(atoms, [[22, 16, 0], [250, 282, 250, 0]])
def test_atoms_from_file(self): filepath = os.path.join(test_dir, 'ATOMS') atoms = Atoms.atoms_string_from_file(filepath) self.assertEqual(atoms.splitlines()[3].split()[4], 'O', "failed to read ATOMS file")
def test_atoms_from_file(self): filepath = os.path.join(PymatgenTest.TEST_FILES_DIR, "ATOMS") atoms = Atoms.atoms_string_from_file(filepath) self.assertEqual(atoms.splitlines()[3].split()[4], "O", "failed to read ATOMS file")
def setUpClass(cls): r = CifParser(os.path.join(PymatgenTest.TEST_FILES_DIR, "CoO19128.cif")) cls.structure = r.get_structures()[0] cls.atoms = Atoms(cls.structure, "O", 10.0)
def init_atoms(self): self._atoms = Atoms( struct=self.structure, absorbing_atom=self.absorbing_atom, radius=self.cluster_size )