Skip to content

Commit

Permalink
Merge pull request #46 from Leimeroth/master
Browse files Browse the repository at this point in the history
Allow  custom cmdargs for lammps object
  • Loading branch information
srmnitc authored Oct 14, 2022
2 parents 909ab51 + 20b4a19 commit 56b19c9
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 13 deletions.
4 changes: 2 additions & 2 deletions calphy/alchemy.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def run_averaging(self):
Fix lattice option is not implemented at present.
At the end of the run, the averaged box dimensions are calculated.
"""
lmp = ph.create_object(self.cores, self.simfolder, self.calc.md.timestep)
lmp = ph.create_object(self.cores, self.simfolder, self.calc.md.timestep, self.calc.md.cmdargs)

#set up structure
lmp = ph.create_structure(lmp, self.calc)
Expand Down Expand Up @@ -137,7 +137,7 @@ def run_integration(self, iteration=1):
"""

#create lammps object
lmp = ph.create_object(self.cores, self.simfolder, self.calc.md.timestep)
lmp = ph.create_object(self.cores, self.simfolder, self.calc.md.timestep, self.calc.md.cmdargs)

# Adiabatic switching parameters.
lmp.command("variable li equal 1.0")
Expand Down
4 changes: 2 additions & 2 deletions calphy/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
from pyscal.trajectory import Trajectory


def create_object(cores, directory, timestep):
def create_object(cores, directory, timestep, cmdargs=None):
"""
Create LAMMPS object
Expand All @@ -52,7 +52,7 @@ def create_object(cores, directory, timestep):
lmp : LammpsLibrary object
"""
lmp = LammpsLibrary(mode="local", cores=cores,
working_directory=directory)
working_directory=directory, cmdargs=cmdargs)

lmp.units("metal")
lmp.boundary("p p p")
Expand Down
3 changes: 2 additions & 1 deletion calphy/input.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@ def __init__(self):
self.md.n_cycles = 100
self.md.thermostat_damping = 0.1
self.md.barostat_damping = 0.1
self.md.cmdargs = None

self.nose_hoover = InputTemplate()
self.nose_hoover.thermostat_damping = 0.1
Expand Down Expand Up @@ -586,7 +587,7 @@ def fix_paths(self, potlist):
pcnew = " ".join([*pcraw[:2], filename, *pcraw[3:]])
fixedpots.append(pcnew)
else:
fixedpots.append(pcraw)
fixedpots.append(pot)
return fixedpots

def create_identifier(self):
Expand Down
4 changes: 2 additions & 2 deletions calphy/liquid.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ def run_averaging(self):
At the end of the run, the averaged box dimensions are calculated.
"""
#create lammps object
lmp = ph.create_object(self.cores, self.simfolder, self.calc.md.timestep)
lmp = ph.create_object(self.cores, self.simfolder, self.calc.md.timestep, self.calc.md.cmdargs)

#set up structure
lmp = ph.create_structure(lmp, self.calc, species=self.calc.n_elements+self.calc._ghost_element_count)
Expand Down Expand Up @@ -171,7 +171,7 @@ def run_integration(self, iteration=1):
Run the integration routine where the initial and final systems are connected using
the lambda parameter. See algorithm 4 in publication.
"""
lmp = ph.create_object(self.cores, self.simfolder, self.calc.md.timestep)
lmp = ph.create_object(self.cores, self.simfolder, self.calc.md.timestep, self.calc.md.cmdargs)

# Adiabatic switching parameters.
lmp.command("variable li equal 1.0")
Expand Down
6 changes: 3 additions & 3 deletions calphy/phase.py
Original file line number Diff line number Diff line change
Expand Up @@ -660,7 +660,7 @@ def reversible_scaling(self, iteration=1):
pf = lf*pi

#create lammps object
lmp = ph.create_object(self.cores, self.simfolder, self.calc.md.timestep)
lmp = ph.create_object(self.cores, self.simfolder, self.calc.md.timestep, self.calc.md.cmdargs)

lmp.command("echo log")
lmp.command("variable li equal %f"%li)
Expand Down Expand Up @@ -835,7 +835,7 @@ def temperature_scaling(self, iteration=1):
pf = lf*p0

#create lammps object
lmp = ph.create_object(self.cores, self.simfolder, self.calc.md.timestep)
lmp = ph.create_object(self.cores, self.simfolder, self.calc.md.timestep, self.calc.md.cmdargs)

lmp.command("echo log")
lmp.command("variable li equal %f"%li)
Expand Down Expand Up @@ -919,7 +919,7 @@ def pressure_scaling(self, iteration=1):
pf = self.calc._pressure_stop

#create lammps object
lmp = ph.create_object(self.cores, self.simfolder, self.calc.md.timestep)
lmp = ph.create_object(self.cores, self.simfolder, self.calc.md.timestep, self.calc.md.cmdargs)

lmp.command("echo log")
lmp.command("variable li equal %f"%li)
Expand Down
4 changes: 2 additions & 2 deletions calphy/solid.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ def run_averaging(self):
is calculated.
At the end of the run, the averaged box dimensions are calculated.
"""
lmp = ph.create_object(self.cores, self.simfolder, self.calc.md.timestep)
lmp = ph.create_object(self.cores, self.simfolder, self.calc.md.timestep, self.calc.md.cmdargs)

#set up structure
lmp = ph.create_structure(lmp, self.calc, species=self.calc.n_elements+self.calc._ghost_element_count)
Expand Down Expand Up @@ -206,7 +206,7 @@ def run_integration(self, iteration=1):
Run the integration routine where the initial and final systems are connected using
the lambda parameter. See algorithm 4 in publication.
"""
lmp = ph.create_object(self.cores, self.simfolder, self.calc.md.timestep)
lmp = ph.create_object(self.cores, self.simfolder, self.calc.md.timestep, self.calc.md.cmdargs)

#read in the conf file
conf = os.path.join(self.simfolder, "conf.equilibration.dump")
Expand Down
2 changes: 1 addition & 1 deletion environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ dependencies:
- openmpi
- mpi4py
- lammps =2022.06.23=*openmpi*_0
- pylammpsmpi =0.0.8
- pylammpsmpi >=0.0.9
- pyscal
- matplotlib
- tqdm
Expand Down

0 comments on commit 56b19c9

Please sign in to comment.