Exemplo n.º 1
0
    def potential(self, potential_filename):
        """
        Execute view_potential() or list_potential() in order to see the pre-defined potential files

        Args:
            potential_filename:

        Returns:

        """
        if sys.version_info.major == 2:
            stringtypes = (str, unicode)
        else:
            stringtypes = str
        if isinstance(potential_filename, stringtypes):
            if '.lmp' in potential_filename:
                potential_filename = potential_filename.split('.lmp')[0]
            potential_db = LammpsPotentialFile()
            potential = potential_db.find_by_name(potential_filename)
        elif isinstance(potential_filename, pd.DataFrame):
            potential = potential_filename
        else:
            raise TypeError(
                'Potentials have to be strings or pandas dataframes.')
        self.input.potential.df = potential
        for val in ["units", "atom_style", "dimension"]:
            v = self.input.potential[val]
            if v is not None:
                self.input.control[val] = v
        self.input.potential.remove_structure_block()
Exemplo n.º 2
0
    def potential(self, potential_filename):
        """
        Execute view_potential() or list_potential() in order to see the pre-defined potential files

        Args:
            potential_filename:

        Returns:

        """
        stringtypes = str
        if isinstance(potential_filename, stringtypes):
            if ".lmp" in potential_filename:
                potential_filename = potential_filename.split(".lmp")[0]
            potential_db = LammpsPotentialFile()
            potential = potential_db.find_by_name(potential_filename)
        elif isinstance(potential_filename, pd.DataFrame):
            potential = potential_filename
        else:
            raise TypeError(
                "Potentials have to be strings or pandas dataframes.")
        self.input.potential.df = potential
        for val in ["units", "atom_style", "dimension"]:
            v = self.input.potential[val]
            if v is not None:
                self.input.control[val] = v
                if val == "units" and v != "metal":
                    warnings.warn(
                        "WARNING: Non-'metal' units are not fully supported. Your calculation should run OK, but "
                        "results may not be saved in pyiron units.")
        self.input.potential.remove_structure_block()
Exemplo n.º 3
0
class TestOpenKimPotential(unittest.TestCase):
    def setUp(self):
        self.kim = LammpsPotentialFile()
        self.potential_path = os.path.join(
            os.path.dirname(os.path.abspath(__file__)),
            '../../static/lammps/potentials')

    def test_find(self):
        Fe_lst = ['Fe_C_Becquart_eam', 'Fe_C_Hepburn_Ackland_eam']

        self.assertEqual(sorted(list(self.kim.find("Fe")['Name'])),
                         sorted(Fe_lst))
        AlMg_lst = ['Al_Mg_Mendelev_eam']
        self.assertEqual(sorted(list(self.kim.find({"Al", "Mg"})['Name'])),
                         AlMg_lst)

    def test_pythonic_functions(self):
        self.assertEqual(list(self.kim.find("Fe")['Name']),
                         list(self.kim["Fe"].list()['Name']))
        self.assertEqual(list(self.kim.find("Fe")['Name']),
                         list(self.kim.Fe.list()['Name']))
        self.assertEqual(list(self.kim.find({"Al", "Mg"})['Name']),
                         list(self.kim["Al"]["Mg"].list()['Name']))
        self.assertEqual(list(self.kim.find({"Al", "Mg"})['Name']),
                         list(self.kim.Mg.Al.list()['Name']))
Exemplo n.º 4
0
    def view_potentials(self):
        """
        List all interatomic potentials for the current atomistic sturcture including all potential parameters.

        To quickly get only the names of the potentials you can use: self.potentials_list()

        Returns:
            pandas.Dataframe: Dataframe including all potential parameters.
        """
        from pyiron.lammps.potential import LammpsPotentialFile
        if not self.structure:
            raise ValueError('No structure set.')
        list_of_elements = set(self.structure.get_chemical_symbols())
        list_of_potentials = LammpsPotentialFile().find(list_of_elements)
        if list_of_potentials is not None:
            return list_of_potentials
        else:
            raise TypeError('No potentials found for this kind of structure: ', str(list_of_elements))
Exemplo n.º 5
0
 def inspect_emperical_potentials():
     return LammpsPotentialFile()
Exemplo n.º 6
0
 def setUpClass(cls):
     cls.kim = LammpsPotentialFile()
     cls.potential_path = os.path.join(
         os.path.dirname(os.path.abspath(__file__)),
         '../../static/lammps/potentials')
Exemplo n.º 7
0
 def setUp(self):
     self.kim = LammpsPotentialFile()
     self.potential_path = os.path.join(
         os.path.dirname(os.path.abspath(__file__)),
         '../../static/lammps/potentials')