Skip to content

Commit

Permalink
Merge pull request #135 from ICAMS/allow_none_pressure_for_liquid
Browse files Browse the repository at this point in the history
do not allow melting when lattice is fixed
  • Loading branch information
srmnitc authored Jun 24, 2024
2 parents 38600be + 47b3735 commit dd581ec
Show file tree
Hide file tree
Showing 18 changed files with 1,484 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 1.3.8
current_version = 1.3.9
commit = True
tag = True

Expand Down
2 changes: 1 addition & 1 deletion calphy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from calphy.alchemy import Alchemy
from calphy.routines import MeltingTemp

__version__ = "1.3.8"
__version__ = "1.3.9"

def addtest(a,b):
return a+b
11 changes: 9 additions & 2 deletions calphy/input.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
from ase.io import read, write
import shutil

__version__ = "1.3.8"
__version__ = "1.3.9"

def read_report(folder):
"""
Expand Down Expand Up @@ -72,7 +72,12 @@ def _to_int(val):
if np.isscalar(val):
return int(val)
else:
return [int(x) for x in val]
return [int(x) for x in val]

def _to_none(val):
if val in ['none', 'None',]:
return None
return val

def _to_float(val):
if np.isscalar(val):
Expand Down Expand Up @@ -558,6 +563,8 @@ def _read_inputfile(file):
for count, calc in enumerate(data['calculations']):
calc['kernel'] = count
calc['inputfile'] = file
if 'pressure' in calc.keys():
calc['pressure'] = _to_none(calc['pressure'])
calculations.append(Calculation(**calc))
return calculations

Expand Down
18 changes: 13 additions & 5 deletions calphy/liquid.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,12 @@ def __init__(self, calculation=None, simfolder=None, log_to_screen=False):

def melt_structure(self, lmp):
"""
"""
"""
if self.calc._fix_lattice and self.calc.melting_cycle:

raise ValueError("Cannot fix lattice and melt structure (set to False) at the same time")


melted = False

#this is the multiplier for thigh to try melting routines
Expand Down Expand Up @@ -136,11 +141,14 @@ def run_averaging(self):
if self.calc.melting_cycle:
self.melt_structure(lmp)

#now assign correct temperature and equilibrate
self.run_zero_pressure_equilibration(lmp)
if not self.calc._fix_lattice:
#now assign correct temperature and equilibrate
self.run_zero_pressure_equilibration(lmp)

#converge pressure
self.run_pressure_convergence(lmp)
#converge pressure
self.run_pressure_convergence(lmp)
else:
self.run_constrained_pressure_convergence(lmp)

#check melted error
self.dump_current_snapshot(lmp, "traj.equilibration_stage1.dat")
Expand Down
1 change: 1 addition & 0 deletions calphy/phase.py
Original file line number Diff line number Diff line change
Expand Up @@ -622,6 +622,7 @@ def finalise_pressure(self,):
self.lz = np.round(np.mean(lz[-ncount+1:]), decimals=3)
self.volatom = volatom
self.vol = self.lx*self.ly*self.lz
self.rho = self.natoms/(self.lx*self.ly*self.lz)
self.logger.info("finalized vol/atom %f at pressure %f"%(self.volatom, mean))
self.logger.info("Avg box dimensions x: %f, y: %f, z:%f"%(self.lx, self.ly, self.lz))

Expand Down
29 changes: 29 additions & 0 deletions examples/example_03/\
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
calculations:
- element: Cu
lattice: fcc
lattice_constant: 3.61
melting_cycle: False
mass: 63.546
md:
timestep: 0.001
mode: ts
n_equilibration_steps: 10000
n_iterations: 1
n_switching_steps: 25000
pair_coeff: '* * ../potentials/Cu01.eam.alloy Cu'
pair_style: eam/alloy
pressure: None
npt: False
queue:
commands:
- conda activate calphy-dev
cores: 4
scheduler: local
reference_phase: liquid
repeat:
- 5
- 5
- 5
temperature:
- 1200.0
- 1400.0
1,018 changes: 1,018 additions & 0 deletions examples/example_03/conf.lqd

Large diffs are not rendered by default.

81 changes: 81 additions & 0 deletions examples/example_03/newtest/input_file.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
calculations:
- berendsen:
barostat_damping: 100.0
thermostat_damping: 100.0
composition_scaling:
output_chemical_composition: {}
restrictions: []
element:
- Cu
equilibration_control: berendsen
file_format: lammps-data
fix_potential_path: true
folder_prefix: null
inputfile: test.input.yaml
kernel: 0
lammps_executable: null
lattice: /mnt/c/Users/menon/Documents/repos/projects-calphy/calphy/examples/example_03/ts-fcc-solid-1200-0.0.data
lattice_constant: 3.61
mass:
- 63.546
md:
barostat_damping: 0.1
cmdargs: ''
init_commands: []
n_cycles: 100
n_every_steps: 10
n_repeat_steps: 10
n_small_steps: 10000
thermostat_damping: 0.1
timestep: 0.001
melting_cycle: true
melting_temperature:
attempts: 5
guess: null
step: 200
mode: ts
mpi_executable: null
n_elements: 1
n_equilibration_steps: 10000
n_iterations: 1
n_print_steps: 0
n_switching_steps: 25000
nose_hoover:
barostat_damping: 0.1
thermostat_damping: 0.1
npt: false
pair_coeff:
- '* * /mnt/c/Users/menon/Documents/repos/projects-calphy/calphy/examples/potentials/Cu01.eam.alloy
Cu'
pair_style:
- eam/alloy
potential_file: null
pressure: 0.0
queue:
commands:
- conda activate calphy-dev
cores: 4
jobname: calphy
memory: 3GB
modules: []
options: []
queuename: ''
scheduler: local
walltime: '23:59:00'
reference_phase: solid
repeat:
- 5
- 5
- 5
script_mode: false
spring_constants: null
temperature:
- 1200.0
- 1400.0
temperature_high: 0.0
tolerance:
lattice_constant: 0.0002
liquid_fraction: 0.05
pressure: 0.5
solid_fraction: 0.7
spring_constant: 0.1
10 changes: 10 additions & 0 deletions examples/example_03/newtest/metadata.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
files:
input_configuration.data: input atomic configuration
input_file.yml: input file
report.yaml: results after thermodynamic integration
software:
doi: 10.5281/zenodo.10527452
name: calphy
repository: https://github.com/ICAMS/calphy
version: 1.3.7
webpage: https://calphy.org/
17 changes: 17 additions & 0 deletions examples/example_03/newtest/report.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
average:
density: 0.0820695985211261
spring_constant: '2.3863384417846154'
vol_atom: 12.184090419830538
input:
concentration: '1.0'
element: Cu
lattice: fcc
pressure: 0.0
temperature: 1200
results:
error: 0.0
free_energy: -4.06638985668307
pv: 0.0
reference_system: -0.6576172684903068
unit: eV/atom
work: -3.4087725881927637
81 changes: 81 additions & 0 deletions examples/example_03/oldcalc/input_file.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
calculations:
- berendsen:
barostat_damping: 100.0
thermostat_damping: 100.0
composition_scaling:
output_chemical_composition: {}
restrictions: []
element:
- Cu
equilibration_control: berendsen
file_format: lammps-data
fix_potential_path: true
folder_prefix: null
inputfile: test.input.yaml
kernel: 0
lammps_executable: null
lattice: /mnt/c/Users/menon/Documents/repos/projects-calphy/calphy/examples/example_03/ts-fcc-solid-1200-0.0.data
lattice_constant: 3.61
mass:
- 63.546
md:
barostat_damping: 0.1
cmdargs: ''
init_commands: []
n_cycles: 100
n_every_steps: 10
n_repeat_steps: 10
n_small_steps: 10000
thermostat_damping: 0.1
timestep: 0.001
melting_cycle: true
melting_temperature:
attempts: 5
guess: null
step: 200
mode: ts
mpi_executable: null
n_elements: 1
n_equilibration_steps: 10000
n_iterations: 1
n_print_steps: 0
n_switching_steps: 25000
nose_hoover:
barostat_damping: 0.1
thermostat_damping: 0.1
npt: false
pair_coeff:
- '* * /mnt/c/Users/menon/Documents/repos/projects-calphy/calphy/examples/potentials/Cu01.eam.alloy
Cu'
pair_style:
- eam/alloy
potential_file: null
pressure: 0.0
queue:
commands:
- conda activate calphy-dev
cores: 4
jobname: calphy
memory: 3GB
modules: []
options: []
queuename: ''
scheduler: local
walltime: '23:59:00'
reference_phase: solid
repeat:
- 5
- 5
- 5
script_mode: false
spring_constants: null
temperature:
- 1200.0
- 1400.0
temperature_high: 0.0
tolerance:
lattice_constant: 0.0002
liquid_fraction: 0.05
pressure: 0.5
solid_fraction: 0.7
spring_constant: 0.1
10 changes: 10 additions & 0 deletions examples/example_03/oldcalc/metadata.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
files:
input_configuration.data: input atomic configuration
input_file.yml: input file
report.yaml: results after thermodynamic integration
software:
doi: 10.5281/zenodo.10527452
name: calphy
repository: https://github.com/ICAMS/calphy
version: 1.3.7
webpage: https://calphy.org/
17 changes: 17 additions & 0 deletions examples/example_03/oldcalc/report.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
average:
density: 0.0820695985211261
spring_constant: '2.3863384417846154'
vol_atom: 12.18403228342489
input:
concentration: '1.0'
element: Cu
lattice: fcc
pressure: 0.0
temperature: 1200
results:
error: 0.0
free_energy: -4.066892072178304
pv: 0.0
reference_system: -0.6576172684903068
unit: eV/atom
work: -3.409274803687998
28 changes: 28 additions & 0 deletions examples/example_03/test.input.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
calculations:
- element: Cu
lattice: conf.lqd
melting_cycle: False
mass: 63.546
md:
timestep: 0.001
mode: ts
n_equilibration_steps: 10000
n_iterations: 1
n_switching_steps: 25000
pair_coeff: '* * ../potentials/Cu01.eam.alloy Cu'
pair_style: eam/alloy
pressure: None
npt: False
queue:
commands:
- conda activate calphy-dev
cores: 4
scheduler: local
reference_phase: liquid
repeat:
- 5
- 5
- 5
temperature:
- 1200.0
- 1400.0
Loading

0 comments on commit dd581ec

Please sign in to comment.