Skip to content

Commit

Permalink
fix updated integrators
Browse files Browse the repository at this point in the history
  • Loading branch information
srmnitc committed Sep 6, 2024
1 parent ac6023b commit 2c0638a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
6 changes: 4 additions & 2 deletions calphy/alchemy.py
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,7 @@ def run_integration(self, iteration=1):
self.calc._temperature))
lmp.command("variable a equal f_swap[1]")
lmp.command("variable b equal f_swap[2]")
lmp.command("fix swap2 all print 1 \"${a} ${b} ${flambda}\" screen no file swap.forward_%d.dat"%iteration)

# Thermo output.
if self.calc.monte_carlo.n_swaps > 0:
Expand All @@ -256,8 +257,7 @@ def run_integration(self, iteration=1):

#save the necessary items to a file: first step
lmp.command("fix f2 all print 1 \"${dU1} ${dU2} ${flambda}\" screen no file forward_%d.dat"%iteration)
lmp.command("run %d"%self.calc._n_switching_steps)

lmp.command("run %d"%self.calc._n_switching_steps)

#now equilibrate at the second potential
lmp.command("unfix f2")
Expand All @@ -267,6 +267,7 @@ def run_integration(self, iteration=1):
#NEW SWAP
if self.calc.monte_carlo.n_swaps > 0:
lmp.command("unfix swap")
lmp.command("unfix swap2")


lmp.command("pair_style %s"%self.calc._pair_style_with_options[1])
Expand Down Expand Up @@ -314,6 +315,7 @@ def run_integration(self, iteration=1):
self.calc._temperature))
lmp.command("variable a equal f_swap[1]")
lmp.command("variable b equal f_swap[2]")
lmp.command("fix swap2 all print 1 \"${a} ${b} ${blambda}\" screen no file swap.backward_%d.dat"%iteration)

# Thermo output.
if self.calc.monte_carlo.n_swaps > 0:
Expand Down
10 changes: 3 additions & 7 deletions calphy/integrators.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,7 @@ def integrate_path(calc,
fwdfilename,
bkdfilename,
solid=True,
composition_integration=False,
simple_average=False):
composition_integration=False):
"""
Get a filename with columns du and dlambda and integrate
Expand Down Expand Up @@ -112,11 +111,8 @@ def integrate_path(calc,
bdu = bdui - bdur

if composition_integration:
if simple_average:
pass
else:
fw = cumtrapz(fdu, flambda, initial=0)
bw = cumtrapz(bdu, blambda, initial=0)
fw = cumtrapz(fdu, flambda, initial=0)
bw = cumtrapz(bdu, blambda, initial=0)
else:
fw = np.trapz(fdu, flambda)
bw = np.trapz(bdu, blambda)
Expand Down

0 comments on commit 2c0638a

Please sign in to comment.