Skip to content

Commit 0c8420d

Browse files
authored
Merge pull request #232 from ICAMS/faster_liquid
Faster liquid
2 parents b3232f4 + fb3a5ec commit 0c8420d

File tree

5 files changed

+38
-6
lines changed

5 files changed

+38
-6
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.6.4
2+
current_version = 1.6.5
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.6.4"
7+
__version__ = "1.6.5"
88

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

calphy/input.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
from ase.io import read, write
5050
import shutil
5151

52-
__version__ = "1.6.4"
52+
__version__ = "1.6.5"
5353

5454

5555
def _check_equal(val):
@@ -317,7 +317,7 @@ class Calculation(BaseModel, title="Main input class"):
317317
_temperature_stop: float = PrivateAttr(default=None)
318318
_temperature_input: float = PrivateAttr(default=None)
319319

320-
melting_cycle: Annotated[bool, Field(default=True)]
320+
melting_cycle: Annotated[bool, Field(default=False)]
321321

322322
pair_style: Annotated[
323323
Union[List[str], None], BeforeValidator(to_list), Field(default=None)

calphy/liquid.py

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,36 @@ def __init__(self, calculation=None, simfolder=None, log_to_screen=False):
5858
calculation=calculation, simfolder=simfolder, log_to_screen=log_to_screen
5959
)
6060

61+
def rattle_structure(self, lmp):
62+
"""
63+
Disorder the structure using random displacements followed by a
64+
controlled NVT cool-down before liquid equilibration.
65+
66+
This is a lightweight alternative to :meth:`melt_structure`:
67+
"""
68+
self.logger.info(
69+
"Rattling structure: velocities at 2*thigh=%f, NVT cool-down to T=%f",
70+
self.calc._temperature_high,
71+
self.calc._temperature,
72+
)
73+
lmp.command(
74+
"displace_atoms all random 0.1 0.1 0.1 %d" % np.random.randint(1, 10000)
75+
)
76+
lmp.velocity(
77+
"all create",
78+
2.0 * self.calc._temperature_high,
79+
np.random.randint(1, 10000),
80+
)
81+
lmp.command(
82+
"fix nh_rattle all nvt temp %f %f %f"
83+
% (
84+
self.calc._temperature_high,
85+
self.calc._temperature,
86+
)
87+
)
88+
lmp.run(int(self.calc.md.n_small_steps))
89+
lmp.command("unfix nh_rattle")
90+
6191
def melt_structure(self, lmp):
6292
""" """
6393
if self.calc._fix_lattice and self.calc.melting_cycle:
@@ -163,9 +193,11 @@ def run_averaging(self):
163193
lmp.command("variable mlz equal lz")
164194
lmp.command("variable mpress equal press")
165195

166-
# MELT
196+
# Disorder the structure before equilibration
167197
if self.calc.melting_cycle:
168198
self.melt_structure(lmp)
199+
else:
200+
self.rattle_structure(lmp)
169201

170202
if not self.calc._fix_lattice:
171203
# now assign correct temperature and equilibrate

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
44

55
[project]
66
name = "calphy"
7-
version = "1.6.4"
7+
version = "1.6.5"
88
description = "free energy calculation for python"
99
readme = "README.md"
1010
license = "GPL-3.0-only"

0 commit comments

Comments
 (0)