Usage of Automatic Force Field Generation (Self-learning Hybrid Monte Carlo Method)¶
Sequence of Use¶
One initial structure is created by the user using Advance/NanoLabo, etc.
Based on the initial structure, the generation of training data and the learning of the force field are automatically proceeded.
Molecular dynamics calculations are performed using the created force field file. LAMMPS, to which we have added Neural Network Potential functionality, is used for the calculation.
Explanation¶
Step 1. Initial Structure Creation¶
Prepare the atomic structure of the sample that would like to be used as training data, and create an input file for SCF calculations of Quantum ESPRESSO based on it. Our product Advance/NanoLabo can easily generate an input file from atomic structure files such as cif.
The path to the pseudopotential in the file must be the one used for the actual calculation in step 2. For example, when running the calculation on a calculation server, the path must point to the pseudopotential directory in the calculation server.
Once the input file is prepared, add the following settings to have the necessary information output.
&CONTROL
tprnfor = .true.
tsannp = .true.
disk_io = 'none'
/
&SYSTEM
nosym = .true.
/
Save the created input file with the file name espresso.in
.
You can also create the file by editing espresso.in
output by slhmc --template
without creating it from scratch.
Step 2. Automatic Generation of Force Field¶
When using Quantum ESPRESSO bundled with NanoLabo Tool, setup of the library search path and others are required. Please refer to the following for the settings.
The automatic generation of the force field proceeds by calling Quantum ESPRESSO, LAMMPS, and NeuralMD sequentially from the executable slhmc
. Therefore, first set up the system so that these can be executed.
slhmc --template
Execute the above to output the template of the required configuration file.
slhmc.prop
Configuration file for the self-learning Hybrid Monte Carlo method. Please refer to the following for the settings.
espresso.sh
, lammps.sh
, sannp.sh
(.bat for Windows)
Execution files for Quantum ESPRESSO, LAMMPS, and NeuralMD. These files will be executed from slhmc. If necessary, add the environment variable settings required for execution (path:
PATH
,LD_LIBRARY_PATH
, license:ADVANCED_LICENSE_FILE
), parallel execution settings (command:mpirun
, OpenMP parallel number:OMP_NUM_THREADS
), etc. Do not change the input/output file names written in the file, which are fixed.OMP_NUM_THREADS=1 mpirun -n 4 pw.x -in espresso.in 1> espresso.out 2> espresso.errNote
NeuralMD of Windows version does not support MPI parallel execution while OpenMP parallel is available.
sannp.prop
NeuralMD configuration file. Refer to the Format of sannp.prop to edit as needed.
When calculating the charge, set
withCharge 1
insannp.prop
and uncomment out the line ofsannp --train-charge
insannp.sh
.When using Δ-NNP(LJ-like force field), set
withLJlike 1
insannp.prop
and uncomment out the line ofsannp --classical
insannp.sh
.When using Δ-NNP(ReaxFF), set
withReaxFF 1
insannp.prop
and place the parameter definition fileffield.reax
in the same folder.
After preparation, place espresso.in
created in step 1 in the same folder and run
slhmc --calc
to initiate force field creation.
Note
Parallel execution of slhmc itself is not available. Set up parallel execution in each sh(bat) file for Quantum ESPRESSO, LAMMPS, and NerualMD.
When using a job management system, make a job script to run slhmc --calc
and post the job. In this case, too, do not parallel execute slhmc itself but set up parallel execution in each sh file.
Hint
An already created force field is available as the initial force field alternatively while in default that based on the first-principles molecular dynamics calculations is used which is performed at first. Set initialTrain 0
in slhmc.prop
, place the force field file ffield.sannp
in the same folder, and then run slhmc.
Hint
To perform calculations using GPU, replace sannp
with sannp_gpu
in sannp.sh
, and lammps
with lammps_gpu
in lammps.sh
. Also, if you place configuration files for GPU sannp.mpi2gpu , gpu.conf in the same folder, the settings are applied at execution.
Running slhmc --stop
aborts the force field creation. Setting restart 1
in slhmc.prop
and running slhmc --calc
again resumes the force field creation from where it is interrupted.
During execution, the force field file field.sannp
is output progressively when the force field is updated. Also, the history of the structure is output as slhmc.xyz
.
The input/output files for each calculation engine are stored in the subfolder slhmc_dat
.
If the calculation does not proceed due to errors etc, check the file slhmc.CRASH
in which input/output files of relevant calculation engine are saved.
Step 3. Molecular Dynamics Calculations with LAMMPS¶
Run molecular dynamics calculations with LAMMPS using the output force field file field.sannp
. See Step 5. Molecular Dynamics Calculations with LAMMPS on the Basic Usage page.
Hint
To create a force field using several different initial structures with a self-learning hybrid Monte Carlo method, first perform up to step 2 for each initial structure. Then, combine the resultant training data sannp.train
and use it to train the neural network again (see Step 4. Training of Neural Network (Optimization) on the Basic Usage page).