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

LAMMPS improvements trunk #1011

Closed
wants to merge 3 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 12 additions & 7 deletions openff/interchange/components/mdconfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,7 @@ def write_lammps_input(
self,
interchange: "Interchange",
input_file: str = "run.in",
data_file: str = "out.lmp",
) -> None:
"""Write a LAMMPS input file for running single-point energies."""
# TODO: Get constrained angles
Expand Down Expand Up @@ -338,14 +339,19 @@ def _get_coeffs_of_constrained_bonds_and_angles(
vdw_cutoff = round(self.vdw_cutoff.m_as(unit.angstrom), 4)
coul_cutoff = round(self.coul_cutoff.m_as(unit.angstrom), 4)

if self.coul_method == _PME:
lmp.write(f"pair_style lj/cut/coul/long {vdw_cutoff} {coul_cutoff}\n")
elif self.coul_method == "cutoff":
lmp.write(f"pair_style lj/cut/coul/cut {vdw_cutoff} {coul_cutoff}\n")
if self.vdw_method == "pme" and self.coul_method == "pme":
lmp.write("pair_style lj/long/coul/long")
elif self.vdw_method == "cutoff":
if self.coul_method == _PME:
lmp.write("pair_style lj/cut/coul/long")
elif self.coul_method == "cutoff":
lmp.write("pair_style lj/cut/coul/cut")
else:
raise UnsupportedExportError(
f"Unsupported electrostatics method {self.coul_method}",
"Unsupported nonbonded methods found: "
f"{self.coul_method=}, {self.vdw_method=}",
)
lmp.write(f" {vdw_cutoff} {coul_cutoff}\n")

if self.mixing_rule == "lorentz-berthelot":
lmp.write("pair_modify mix arithmetic tail yes\n\n")
Expand All @@ -355,8 +361,7 @@ def _get_coeffs_of_constrained_bonds_and_angles(
raise UnsupportedExportError(
f"Mixing rule {self.mixing_rule} not supported",
)

lmp.write("read_data out.lmp\n\n")
lmp.write(f"read_data {data_file}\n\n")
lmp.write(
"thermo_style custom ebond eangle edihed eimp epair evdwl ecoul elong etail pe\n\n",
)
Expand Down
Loading