Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def setUpClass(cls):
cls.file_location = os.path.dirname(os.path.abspath(__file__))
cls.project = Project(os.path.join(cls.file_location, "vasp_import_testing"))
def tearDownClass(cls):
file_location = os.path.dirname(os.path.abspath(__file__))
project = Project(os.path.join(file_location, 'structure_testing'))
ham = project.load(project.get_job_ids()[0])
ham.remove()
project.remove(enable=True)
def test_Chemical_Element_to_and_from_hdf_with_None_Parent(self):
pr = Project(os.path.join(os.path.dirname(os.path.abspath(__file__)), 'test_periodic_table'))
basis = pr.create_structure(element='Ni', bravais_basis='fcc', lattice_constant=3.7)
ham = pr.create_job(pr.job_type.Lammps, 'lammps_test_2')
test_ham = pr.create_job(pr.job_type.Lammps, 'lammps_test_2')
ham.structure = basis
ham.to_hdf()
test_ham.from_hdf()
self.assertEqual(test_ham['input/structure/species'][0], ham['input/structure/species'][0])
ham.remove()
def setUpClass(cls):
cls.file_location = os.path.dirname(os.path.abspath(__file__))
cls.project = Project(os.path.join(cls.file_location, "../static/sphinx"))
pt = PeriodicTable()
pt.add_element(parent_element="Fe", new_element="Fe_up", spin="0.5")
Fe_up = pt.element("Fe_up")
cls.basis = Atoms(
elements=[Fe_up, Fe_up],
scaled_positions=[[0.0, 0.0, 0.0], [0.5, 0.5, 0.5]],
cell=2.6 * np.eye(3),
)
cls.sphinx = cls.project.create_job("Sphinx", "job_sphinx")
cls.sphinx_band_structure = cls.project.create_job("Sphinx", "sphinx_test_bs")
cls.sphinx_2_3 = cls.project.create_job("Sphinx", "sphinx_test_2_3")
cls.sphinx_2_5 = cls.project.create_job("Sphinx", "sphinx_test_2_5")
cls.sphinx_aborted = cls.project.create_job("Sphinx", "sphinx_test_aborted")
cls.sphinx.structure = cls.basis
cls.sphinx.fix_spin_constraint = True
cls.sphinx_band_structure.structure = cls.project.create_structure("Fe", "bcc", 2.81)
def tearDownClass(cls):
cls.file_location = os.path.dirname(os.path.abspath(__file__))
project = Project(os.path.join(cls.file_location, "vasp_import_testing"))
project.remove_jobs(recursive=True)
project.remove(enable=True)
def setUpClass(cls):
cls.execution_path = os.path.dirname(os.path.abspath(__file__))
cls.project = Project(os.path.join(cls.execution_path, "table"))
def setUpClass(cls):
cls.execution_path = os.path.dirname(os.path.abspath(__file__))
cls.project = Project(os.path.join(cls.execution_path, "test_job"))
cls.job = AtomisticGenericJob(
project=ProjectHDFio(project=cls.project, file_name="test_job"),
job_name="test_job",
)
cls.job.structure = CrystalStructure(
element="Al", bravais_basis="fcc", lattice_constants=4
).repeat(4)
def tearDownClass(cls):
cls.file_location = os.path.dirname(os.path.abspath(__file__))
cls.project = Project(os.path.join(cls.file_location, "../static/sxextopt"))
cls.project.remove_jobs(recursive=True)
def tearDownClass(cls):
cls.execution_path = os.path.dirname(os.path.abspath(__file__))
project = Project(os.path.join(cls.execution_path, "test_job"))
project.remove_jobs(recursive=True)
project.remove(enable=True)
def copy(self):
"""
Copy the project object - copying just the Python object but maintaining the same pyiron path
Returns:
Project: copy of the project object
"""
new = Project(path=self.path, user=self.user, sql_query=self.sql_query)
new._filter = self._filter
new._inspect_mode = self._inspect_mode
return new