def test_change_potential(self): L = PyLammps() L.file(IncludeTests.ATOMS_SETUP_FILE) # set non-bonded potential L.pair_style('lj/cut', 5.0) L.pair_coeff(1, 1, 1.0, 1.0) # set different non-bonded potential L.velocity('all create', 1.0, 54321, 'mom no rot no') # import time integration setting from include file L.file(IncludeTests.VERLET_CONFIG_FILE) L.minimize(1.0e-10, 1.0e-10, 100, 1000) L.reset_timestep(0) # set timestep counter to zero L.thermo(10) # thermo output every 10 steps L.run(100, 'post no') # continue run with different potential L.pair_style('morse', 5.0) L.pair_coeff(1, 1, 1.0, 5.0, 1.12) L.run(100)
def test_morse_potential(self): L = PyLammps() L.file(IncludeTests.ATOMS_SETUP_FILE) # set different non-bonded potential L.pair_style('morse', 5.0) L.pair_coeff(1, 1, 1.0, 5.0, 1.12) L.velocity('all create', 1.0, 54321, 'mom no rot no') # import time integration setting from include file L.file(IncludeTests.VERLET_CONFIG_FILE) L.thermo(10) # thermo output every 10 steps L.run(100)
def test_run_post_no_pre_no(self): L = PyLammps() L.file(IncludeTests.ATOMS_SETUP_FILE) # set non-bonded potential L.pair_style('lj/cut', 5.0) L.pair_coeff(1, 1, 1.0, 1.0) # set different non-bonded potential L.velocity('all create', 1.0, 54321, 'mom no rot no') # import time integration setting from include file L.file(IncludeTests.VERLET_CONFIG_FILE) L.minimize(1.0e-10, 1.0e-10, 100, 1000) L.reset_timestep(0) # set timestep counter to zero L.thermo(10) # thermo output every 10 steps L.run(100, 'post no') # don't print post run information L.run(100, 'pre no') # don't to pre-run preparation (not needed, if no change)
#!/usr/bin/env python from mpi4py import MPI from lammps import PyLammps L = PyLammps() L.file("in.melt") if MPI.COMM_WORLD.rank == 0: print("Potential energy: ", L.eval("pe")) MPI.Finalize()
def run_lammps(lammps_in: str, output: str): Lbin = PyLammps(cmdargs=["-l", output]) Lbin.file(lammps_in)
from mpi4py import MPI from lammps import PyLammps L = PyLammps() L.file('in.melt') if MPI.COMM_WORLD.rank == 0: pe = L.eval("pe") print("Potential Energy:", pe)
#!/usr/bin/env python2 # -*- coding: utf-8 -*- """ Created on Tue Jul 3 18:16:59 2018 This is usefull to perform the widom calculation @author: simon """ from lammps import PyLammps from lammps import IPyLammps L = PyLammps() Li = IPyLammps L.file("in.melt") #Reads and runs a lammps script Li.file("in.melt") #print("Potential energy: ", L.eval("pe")) #L.region("box block", 0, 10, 0, 5, -0.5, 0.5) #L.write_script("input.lmp") #Writes the session to another file
from mpi4py import MPI from lammps import PyLammps L = PyLammps() L.file('in.melt') if MPI.COMM_WORLD.rank == 0: pe = L.eval("pe") print("Potential Energy:", pe)