Skip to content

Commit

Permalink
further fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
srmnitc committed Sep 27, 2023
1 parent 122c93b commit 8497b3e
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 7 deletions.
2 changes: 1 addition & 1 deletion calphy/alchemy.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ def run_integration(self, iteration=1):

lmp.command("velocity all create %f %d mom yes rot yes dist gaussian"%(self.calc._temperature, np.random.randint(1, 10000)))
# Integrator & thermostat.
if self.calc._npt:
if self.calc.npt:
lmp.command("fix f1 all npt temp %f %f %f %s %f %f %f"%(self.calc._temperature, self.calc._temperature,
self.calc.md.thermostat_damping[1], self.iso, self.calc._pressure, self.calc._pressure, self.calc.md.barostat_damping[1]))
else:
Expand Down
28 changes: 24 additions & 4 deletions calphy/input.py
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ def _validate_temperature(self) -> 'Input':
if self._temperature_high is None:
self._temperature_high = 2*temp[0]
elif np.shape(self.temperature) == (2,):
temp = self.temperature_input
temp = self.temperature
self._temperature = temp[0]
self._temperature_stop = temp[1]
if self._temperature_high is None:
Expand Down Expand Up @@ -557,11 +557,12 @@ def _convert_legacy_inputfile(file):
"melting_cycle", "equilibration_control", "folder_prefix", "temperature_high"]:
if key in ci.keys():
calc[key] = ci[key]
#print(combo)
calc["lattice"] = str(combo[0]["lattice"])
calc["lattice_constant"] = float(combo[0]["lattice_constant"])
calc["reference_phase"] = str(combo[0]["reference_phase"])
calc["pressure"] = float(combo[1])
calc["temperature"] = float(combo[2])
calc["pressure"] = _to_float(combo[1])
calc["temperature"] = _to_float(combo[2])
calculations.append(calc)

newdata = {}
Expand All @@ -571,4 +572,23 @@ def _convert_legacy_inputfile(file):
warnings.warn(f'Old style input file calphy < v2 found. Converted input in {outfile}. Please check!')
with open(outfile, 'w') as fout:
yaml.safe_dump(newdata, fout)
return outfile
return outfile


def _to_str(val):
if np.isscalar(val):
return str(val)
else:
return [str(x) for x in val]

def _to_int(val):
if np.isscalar(val):
return int(val)
else:
return [int(x) for x in val]

def _to_float(val):
if np.isscalar(val):
return float(val)
else:
return [float(x) for x in val]
4 changes: 2 additions & 2 deletions calphy/phase.py
Original file line number Diff line number Diff line change
Expand Up @@ -804,7 +804,7 @@ def reversible_scaling(self, iteration=1):
lmp = ph.remap_box(lmp, self.lx, self.ly, self.lz)

#set thermostat and run equilibrium
if self.calc._npt:
if self.calc.npt:
lmp.command("fix f1 all npt temp %f %f %f %s %f %f %f"%(t0, t0, self.calc.md.thermostat_damping[1],
self.iso, pi, pi, self.calc.md.barostat_damping[1]))
else:
Expand All @@ -818,7 +818,7 @@ def reversible_scaling(self, iteration=1):
lmp.command("variable ycm equal xcm(all,y)")
lmp.command("variable zcm equal xcm(all,z)")

if self.calc._npt:
if self.calc.npt:
lmp.command("fix f1 all npt temp %f %f %f %s %f %f %f fixedpoint ${xcm} ${ycm} ${zcm}"%(t0, t0, self.calc.md.thermostat_damping[1],
self.iso, pi, pi, self.calc.md.barostat_damping[1]))
else:
Expand Down

0 comments on commit 8497b3e

Please sign in to comment.