Constrained optimization and MD with constraints

Questions and discussions regarding the use of Qbox
Forum rules
You must be a registered user to post in this forum. Registered users may also post new topics if they consider that their subject does not correspond to any topic already present on the forum.
Post Reply
fgygi
Site Admin
Posts: 132
Joined: Tue Jun 17, 2008 7:03 pm

Constrained optimization and MD with constraints

Post by fgygi » Mon Oct 14, 2019 2:12 am

This is a simple example of Qbox calculation with a bond length constraint where the bond length is varied and the geometry is optimized for each value of the constraint. The system is the Si4 molecule described in the test/si4gs directory of the Qbox distribution.

Code: Select all

# Si4 geometry optimization with constraint
# Si4 ground state
set cell 20 0 0  0 20 0  0 0 20 
species silicon Si_VBC_LDA-1.0.xml
atom Si1 silicon  3.700  0.000  0.000
atom Si2 silicon  0.000  2.200  0.000
atom Si3 silicon -3.700  0.000  0.000
atom Si4 silicon  0.000 -2.200  0.000
set ecut 6
set wf_dyn PSDA
set ecutprec 2
randomize_wf
run 0 200
set atoms_dyn CG
run 50 5
# add constraint
constraint define distance dSi Si2 Si4 4.6
constraint enforce
run 20  5
constraint set dSi 4.8
constraint enforce
run 20  5
constraint set dSi 5.0
constraint enforce
run 20  5
The following is a simple example of MD simulation with constraint for the Si4 molecule. It includes a first MD run with a distance constraint of 4.6 bohr between atoms "Si2" and "Si4", and then another MD run with a distance constraint of 4.8 bohr. The force acting on the constraint can be extracted from the <constraint> element in the output.

Code: Select all

# Si4 MD with constraint
set cell 20 0 0  0 20 0  0 0 20 
species silicon Si_VBC_LDA-1.0.xml
atom Si1 silicon  3.700  0.000  0.000
atom Si2 silicon  0.000  2.200  0.000
atom Si3 silicon -3.700  0.000  0.000
atom Si4 silicon  0.000 -2.200  0.000
set ecut 6
set wf_dyn PSDA
set ecutprec 2
# compute initial ground state
randomize_wf
set scf_tol 1.e-6
run -atomic_density 0 50 10
# optimize initial geometry
randomize_r 0.1
set atoms_dyn CG
run 50 5
# add constraint
constraint define distance dSi Si2 Si4 4.6
constraint enforce
# reoptimize geometry with constraint
run 20  5
# run MD with constraint
set atoms_dyn MD
randomize_v 300
set dt 40
run 500 5
# modify constraint and run more MD
constraint set dSi 4.8
constraint enforce
# recompute ground state
run 0 50
# continue MD
run 500 5

Post Reply