@@ -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
0 commit comments