Skip to content

Commit dd581ec

Browse files
authored
Merge pull request #135 from ICAMS/allow_none_pressure_for_liquid
do not allow melting when lattice is fixed
2 parents 38600be + 47b3735 commit dd581ec

File tree

18 files changed

+1484
-10
lines changed

18 files changed

+1484
-10
lines changed

.bumpversion.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[bumpversion]
2-
current_version = 1.3.8
2+
current_version = 1.3.9
33
commit = True
44
tag = True
55

calphy/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
from calphy.alchemy import Alchemy
55
from calphy.routines import MeltingTemp
66

7-
__version__ = "1.3.8"
7+
__version__ = "1.3.9"
88

99
def addtest(a,b):
1010
return a+b

calphy/input.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
from ase.io import read, write
4141
import shutil
4242

43-
__version__ = "1.3.8"
43+
__version__ = "1.3.9"
4444

4545
def read_report(folder):
4646
"""
@@ -72,7 +72,12 @@ def _to_int(val):
7272
if np.isscalar(val):
7373
return int(val)
7474
else:
75-
return [int(x) for x in val]
75+
return [int(x) for x in val]
76+
77+
def _to_none(val):
78+
if val in ['none', 'None',]:
79+
return None
80+
return val
7681

7782
def _to_float(val):
7883
if np.isscalar(val):
@@ -558,6 +563,8 @@ def _read_inputfile(file):
558563
for count, calc in enumerate(data['calculations']):
559564
calc['kernel'] = count
560565
calc['inputfile'] = file
566+
if 'pressure' in calc.keys():
567+
calc['pressure'] = _to_none(calc['pressure'])
561568
calculations.append(Calculation(**calc))
562569
return calculations
563570

calphy/liquid.py

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,12 @@ def __init__(self, calculation=None, simfolder=None, log_to_screen=False):
5656

5757
def melt_structure(self, lmp):
5858
"""
59-
"""
59+
"""
60+
if self.calc._fix_lattice and self.calc.melting_cycle:
61+
62+
raise ValueError("Cannot fix lattice and melt structure (set to False) at the same time")
63+
64+
6065
melted = False
6166

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

139-
#now assign correct temperature and equilibrate
140-
self.run_zero_pressure_equilibration(lmp)
144+
if not self.calc._fix_lattice:
145+
#now assign correct temperature and equilibrate
146+
self.run_zero_pressure_equilibration(lmp)
141147

142-
#converge pressure
143-
self.run_pressure_convergence(lmp)
148+
#converge pressure
149+
self.run_pressure_convergence(lmp)
150+
else:
151+
self.run_constrained_pressure_convergence(lmp)
144152

145153
#check melted error
146154
self.dump_current_snapshot(lmp, "traj.equilibration_stage1.dat")

calphy/phase.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -622,6 +622,7 @@ def finalise_pressure(self,):
622622
self.lz = np.round(np.mean(lz[-ncount+1:]), decimals=3)
623623
self.volatom = volatom
624624
self.vol = self.lx*self.ly*self.lz
625+
self.rho = self.natoms/(self.lx*self.ly*self.lz)
625626
self.logger.info("finalized vol/atom %f at pressure %f"%(self.volatom, mean))
626627
self.logger.info("Avg box dimensions x: %f, y: %f, z:%f"%(self.lx, self.ly, self.lz))
627628

examples/example_03/\

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
calculations:
2+
- element: Cu
3+
lattice: fcc
4+
lattice_constant: 3.61
5+
melting_cycle: False
6+
mass: 63.546
7+
md:
8+
timestep: 0.001
9+
mode: ts
10+
n_equilibration_steps: 10000
11+
n_iterations: 1
12+
n_switching_steps: 25000
13+
pair_coeff: '* * ../potentials/Cu01.eam.alloy Cu'
14+
pair_style: eam/alloy
15+
pressure: None
16+
npt: False
17+
queue:
18+
commands:
19+
- conda activate calphy-dev
20+
cores: 4
21+
scheduler: local
22+
reference_phase: liquid
23+
repeat:
24+
- 5
25+
- 5
26+
- 5
27+
temperature:
28+
- 1200.0
29+
- 1400.0

examples/example_03/conf.lqd

Lines changed: 1018 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
calculations:
2+
- berendsen:
3+
barostat_damping: 100.0
4+
thermostat_damping: 100.0
5+
composition_scaling:
6+
output_chemical_composition: {}
7+
restrictions: []
8+
element:
9+
- Cu
10+
equilibration_control: berendsen
11+
file_format: lammps-data
12+
fix_potential_path: true
13+
folder_prefix: null
14+
inputfile: test.input.yaml
15+
kernel: 0
16+
lammps_executable: null
17+
lattice: /mnt/c/Users/menon/Documents/repos/projects-calphy/calphy/examples/example_03/ts-fcc-solid-1200-0.0.data
18+
lattice_constant: 3.61
19+
mass:
20+
- 63.546
21+
md:
22+
barostat_damping: 0.1
23+
cmdargs: ''
24+
init_commands: []
25+
n_cycles: 100
26+
n_every_steps: 10
27+
n_repeat_steps: 10
28+
n_small_steps: 10000
29+
thermostat_damping: 0.1
30+
timestep: 0.001
31+
melting_cycle: true
32+
melting_temperature:
33+
attempts: 5
34+
guess: null
35+
step: 200
36+
mode: ts
37+
mpi_executable: null
38+
n_elements: 1
39+
n_equilibration_steps: 10000
40+
n_iterations: 1
41+
n_print_steps: 0
42+
n_switching_steps: 25000
43+
nose_hoover:
44+
barostat_damping: 0.1
45+
thermostat_damping: 0.1
46+
npt: false
47+
pair_coeff:
48+
- '* * /mnt/c/Users/menon/Documents/repos/projects-calphy/calphy/examples/potentials/Cu01.eam.alloy
49+
Cu'
50+
pair_style:
51+
- eam/alloy
52+
potential_file: null
53+
pressure: 0.0
54+
queue:
55+
commands:
56+
- conda activate calphy-dev
57+
cores: 4
58+
jobname: calphy
59+
memory: 3GB
60+
modules: []
61+
options: []
62+
queuename: ''
63+
scheduler: local
64+
walltime: '23:59:00'
65+
reference_phase: solid
66+
repeat:
67+
- 5
68+
- 5
69+
- 5
70+
script_mode: false
71+
spring_constants: null
72+
temperature:
73+
- 1200.0
74+
- 1400.0
75+
temperature_high: 0.0
76+
tolerance:
77+
lattice_constant: 0.0002
78+
liquid_fraction: 0.05
79+
pressure: 0.5
80+
solid_fraction: 0.7
81+
spring_constant: 0.1
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
files:
2+
input_configuration.data: input atomic configuration
3+
input_file.yml: input file
4+
report.yaml: results after thermodynamic integration
5+
software:
6+
doi: 10.5281/zenodo.10527452
7+
name: calphy
8+
repository: https://github.com/ICAMS/calphy
9+
version: 1.3.7
10+
webpage: https://calphy.org/
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
average:
2+
density: 0.0820695985211261
3+
spring_constant: '2.3863384417846154'
4+
vol_atom: 12.184090419830538
5+
input:
6+
concentration: '1.0'
7+
element: Cu
8+
lattice: fcc
9+
pressure: 0.0
10+
temperature: 1200
11+
results:
12+
error: 0.0
13+
free_energy: -4.06638985668307
14+
pv: 0.0
15+
reference_system: -0.6576172684903068
16+
unit: eV/atom
17+
work: -3.4087725881927637

0 commit comments

Comments
 (0)