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

Modify where number of bond types is chosen from #561

Merged
merged 9 commits into from
Mar 22, 2022
2 changes: 1 addition & 1 deletion pyiron_atomistics/lammps/structure.py
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ def structure_bond(self):
+ " \n"
+ "{0} atom types".format(self._structure.get_number_of_species())
+ " \n"
+ "{0} bond types".format(np.max(bond_type))
+ "{0} bond types".format(np.max(np.array(bonds)[:, 2]))
+ " \n"
)

Expand Down
32 changes: 32 additions & 0 deletions tests/lammps/test_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -678,3 +678,35 @@ def test_units(self):
def setter(x):
self.job.units = x
self.assertRaises(ValueError, setter, "nonsense")

def test_bonds_input(self):
potential = pd.DataFrame({'Name': ['Morse'],
'Filename': [[]],
'Model' : ['Morse'],
'Species' : [['Al']],
'Config' : [['atom_style bond\n',
'bond_style morse\n',
'bond_coeff 1 0.1 1.5 2.0\n',
'bond_coeff 2 0.1 1.5 2.0']]})
cell = Atoms(elements=4*['Al'], positions=[[0., 0., 0.],
[0., 2., 2.],
[2., 0., 2.],
[2., 2., 0.]],
cell=4*np.eye(3))
self.job.structure = cell.repeat(2)
self.job.structure.bonds = [[1, 2, 1], [1, 3, 2]]
self.job.potential = potential
self.job.calc_static()
file_directory = os.path.join(
self.execution_path, "..", "static", "lammps_test_files"
)
self.job.restart_file_list.append(
os.path.join(file_directory, "dump.out")
)
self.job.restart_file_list.append(
os.path.join(file_directory, "log.lammps")
)
sudarsan-surendralal marked this conversation as resolved.
Show resolved Hide resolved
self.job.run(run_mode="manual")
self.job.status.collect = True
self.job.run()
sudarsan-surendralal marked this conversation as resolved.
Show resolved Hide resolved