diff --git a/.bumpversion.cfg b/.bumpversion.cfg index 5386939..10da9d4 100644 --- a/.bumpversion.cfg +++ b/.bumpversion.cfg @@ -1,5 +1,5 @@ [bumpversion] -current_version = 1.6.4 +current_version = 1.6.5 commit = True tag = True diff --git a/calphy/__init__.py b/calphy/__init__.py index 87e2d47..53c7c8d 100644 --- a/calphy/__init__.py +++ b/calphy/__init__.py @@ -4,7 +4,7 @@ from calphy.alchemy import Alchemy from calphy.routines import MeltingTemp -__version__ = "1.6.4" +__version__ = "1.6.5" def addtest(a,b): return a+b diff --git a/calphy/input.py b/calphy/input.py index 3bf0e4c..c964aa0 100644 --- a/calphy/input.py +++ b/calphy/input.py @@ -49,7 +49,7 @@ from ase.io import read, write import shutil -__version__ = "1.6.4" +__version__ = "1.6.5" def _check_equal(val): @@ -317,7 +317,7 @@ class Calculation(BaseModel, title="Main input class"): _temperature_stop: float = PrivateAttr(default=None) _temperature_input: float = PrivateAttr(default=None) - melting_cycle: Annotated[bool, Field(default=True)] + melting_cycle: Annotated[bool, Field(default=False)] pair_style: Annotated[ Union[List[str], None], BeforeValidator(to_list), Field(default=None) diff --git a/calphy/liquid.py b/calphy/liquid.py index 71b867f..7af242d 100644 --- a/calphy/liquid.py +++ b/calphy/liquid.py @@ -58,6 +58,36 @@ def __init__(self, calculation=None, simfolder=None, log_to_screen=False): calculation=calculation, simfolder=simfolder, log_to_screen=log_to_screen ) + def rattle_structure(self, lmp): + """ + Disorder the structure using random displacements followed by a + controlled NVT cool-down before liquid equilibration. + + This is a lightweight alternative to :meth:`melt_structure`: + """ + self.logger.info( + "Rattling structure: velocities at 2*thigh=%f, NVT cool-down to T=%f", + self.calc._temperature_high, + self.calc._temperature, + ) + lmp.command( + "displace_atoms all random 0.1 0.1 0.1 %d" % np.random.randint(1, 10000) + ) + lmp.velocity( + "all create", + 2.0 * self.calc._temperature_high, + np.random.randint(1, 10000), + ) + lmp.command( + "fix nh_rattle all nvt temp %f %f %f" + % ( + self.calc._temperature_high, + self.calc._temperature, + ) + ) + lmp.run(int(self.calc.md.n_small_steps)) + lmp.command("unfix nh_rattle") + def melt_structure(self, lmp): """ """ if self.calc._fix_lattice and self.calc.melting_cycle: @@ -163,9 +193,11 @@ def run_averaging(self): lmp.command("variable mlz equal lz") lmp.command("variable mpress equal press") - # MELT + # Disorder the structure before equilibration if self.calc.melting_cycle: self.melt_structure(lmp) + else: + self.rattle_structure(lmp) if not self.calc._fix_lattice: # now assign correct temperature and equilibrate diff --git a/pyproject.toml b/pyproject.toml index dd77064..b9a5c8a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "calphy" -version = "1.6.4" +version = "1.6.5" description = "free energy calculation for python" readme = "README.md" license = "GPL-3.0-only"