Page 1 of 1

Crash after computing stress tensor

Posted: Thu Jul 13, 2017 11:24 pm
by tbbishop
Francois,

I'm having trouble with some MD calculations on 256 atom sample (8x8x4 supercell). After computing the ground state wave function I perform the calculation in two steps, one to let the system reach equilibrium and then many MD steps. The inputs are

Code: Select all

set nrowmax 160
load gs.xml
set xc PBE
set wf_dyn JD
set ecutprec 10
set stress ON
set atoms_dyn MD
set dt 60
set thermostat BDP
set th_temp 12
set scf_tol 2.e-6
run 100 10 
save md1.xml
I have to do this several times, loading the previous save. I use randomize_v on the first run but not subsequent ones. And the next input is:

Code: Select all

set nrowmax 80
load md1.xml
set stress ON
set cell_dyn SD
set cell_mass 9.e7
set cell_lock CS
run 300 10
save md2.xml
The calculation running the first input is fine, but on the second one, it appears to crash right after calculating the stress. The error message is

Code: Select all

qb: StructureFactor.C:78: void StructureFactor::update(const std::vector<std::vector<double, std::allocator<double>>, std::allocator<std::vector<double, std::allocator<double>>>> &, const Basis &): Assertion `basis.localsize() == _ng' failed.
We didn't realize we needed the stress tensor until later so the line "set stress ON" was added to the first input midway during the calculation (the job was resubmitted and I loaded the previous xml file). So perhaps that is the cause of the error, but it didn't affect the previous calculation at all, just the last one.

I appreciate any help you can provide,
Tyler

Re: Crash after computing stress tensor

Posted: Fri Jul 14, 2017 12:30 am
by fgygi
Tyler,
This can happen when a variable cell calculation is performed without defining a reference cell. The reference cell (variable ref_cell) is a unit cell that is chosen so as to always enclose the actual unit cell during a variable cell calculation. This requires making a reasonable guess about the largest cell size that is expected during the simulation.
The need for a reference cell comes from the fact that the plane wave basis set changes (for a fixed energy cutoff) when the cell changes. When a reference cell is defined, the basis set is defined in terms of the reference cell (which remains constant during the simulation).
You can add a "set ref_cell .... " statement at the beginning of your second script (that load gs.xml). However, this completely redefines the basis set, so you then have to recompute the ground state before continuing the MD simulation.
Note also that the effective resolution of the basis set will fluctuate during the simulation. This is discussed in detail in the papers

P. Focher, G. L. Chiarotti, M. Bernasconi, et al. Structural Phase-Transformations Via 1St-
Principles Simulation, Europhys. Lett. 26 (5): 345-351 (1994).
2. M. Bernasconi, G. L. Chiarotti, P. Focher, et al. First-Principle Constant-Pressure Molecular-
Dynamics, Journal Of Physics And Chemistry Of Solids 56 (3-4): 501-505 (1995).

In order to restore constant resolution, Qbox uses the variable ecuts (see the Qbox User Guide).

This would look something like this:

Code: Select all

set nrowmax 80
load md1.xml
# guess of ref_cell: larger than the largest cell reached during the simulation
# guess based on a 8x8x1 supercell, adjust if needed.
set ref_cell  63 0 0 0 57 0 0 0 30
# the plane wave cutoff needs to be increased by about 5 Ry above the effective cutoff used.
set ecut 65
# effective cutoff ecuts
set ecuts 60
set wf_dyn JD
set xc PBE
set stress ON
# recompute the ground state
run 0 50 10
# start the variable cell calculation
set atoms_dyn MD
set dt 60
set cell_dyn SD
set cell_mass 9.e7
set cell_lock CS
run 300 10
save md2.xml
The recalculation of the ground state only needs to be done once. In subsequent simulations, the input can be:

Code: Select all

set nrowmax 80
load previous_md.xml
set stress ON
set ecuts 60
set wf_dyn JD
set xc PBE
set atoms_dyn MD
set dt 60
set cell_dyn SD
set cell_mass 9.e7
set cell_lock CS
run 300 10
save new_md.xml
Let me know if that solves the problem.

An example of variable cell calculation (optimization of the cell parameters) is also given in the "si2gs" and "cgcell" directories in the "test" part of the Qbox distribution.

Francois

Re: Crash after computing stress tensor

Posted: Fri Jul 14, 2017 12:36 am
by fgygi
I also note that your first script sets the thermostat temperature to 12. This means 12 Kelvin. This would essentially freeze the system. Maybe this is a typo.

Re: Crash after computing stress tensor

Posted: Thu Jul 27, 2017 9:26 pm
by tbbishop
Hi Francois,

Yes it did solve the problem. Thank you very much! Also, no, that is not a typo, the system we are using makes a transition at a very low temperature.

Thanks,
Tyler