Skip to content

Commit 5778fba

Browse files
committed
Added example of Si using force field; updated manual
1 parent 6221a23 commit 5778fba

File tree

4 files changed

+153
-1
lines changed

4 files changed

+153
-1
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ Then:
1414
Documentation
1515
----------------
1616

17-
Check out [manual.pdf](manual.pdf)
17+
Check out [manual.rst](manual.rst)
1818

1919

2020
Get Involved

examples/Si/csld.in-forcefield

+126
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
1+
[structure]
2+
prim = POSCAR
3+
sym_tol = 1E-3
4+
## Either text file containing 3x3 matrix, or 9 numbers for the same matrix
5+
#epsilon_inf = 2 0 0 0 2 0 0 0 2
6+
### Either text file containing n_atom matrices, or n_atom*9 numbers for the same matrices
7+
#born_charge = 1 0 0 0 1 0 0 0 1 -1 0 0 0 -1 0 0 0 -1
8+
9+
#######################################################################
10+
[model]
11+
model_type = LD
12+
cluster_in = clusters.out
13+
cluster_out = clusters.out
14+
symC_in = Cmat.mtx
15+
symC_out = Cmat.mtx
16+
max_order = 4
17+
fractional_distance = False
18+
cluster_diameter = 10.8 6.1 5.0
19+
## Be VERY careful with these! Do not change unless you understand it. Bond distance cutoff is adjustable
20+
cluster_filter = lambda cls: ((cls.order_uniq<=2) or (cls.bond_counts(2.9) >=2)) and cls.is_small_in('fcc333/sc.txt')
21+
22+
# polynomial expansion based on bond length
23+
# must be used together with options "--ldff_step=2"
24+
[LDFF]
25+
# number of basis functions
26+
num_basis = 12
27+
# list of which orbit of clusters to include in LDFF
28+
# the nearest-neighbor pair interaction (0=const, 1=point)
29+
orbit_indices = 3
30+
# min, max, interval of sampling points
31+
interpolation_pts = -0.3 0.3 0.01
32+
# pair basis functions
33+
basis_2 = lambda l, x: np.polynomial.legendre.legval(x/0.5, np.identity(13)[l+1])
34+
35+
36+
#######################################################################
37+
[training]
38+
interface = VASP
39+
corr_type = f
40+
corr_in = Amat.mtx
41+
corr_out = Amat.mtx
42+
fval_in = fval.txt
43+
fval_out = fval.txt
44+
traindat1 = fcc333/SPOSCAR fcc333/dir*
45+
46+
47+
48+
#######################################################################
49+
[fitting]
50+
solution_in = solution_all
51+
solution_out = sol_FF
52+
nsubset = 5
53+
holdsize = 0.09
54+
## 1 FPC 2 FPC sparse 3 split 4 sparse split
55+
## 5 split+ right preconditioning 6 sparse split + r preconditioning
56+
## 101 Bayesian CS
57+
method = 5
58+
59+
# For weight of L1 or L2 regularization
60+
mulist = 1E-3 1E-4 1E-5 1E-6 1E-7 1E-9
61+
maxIter = 300
62+
tolerance = 1E-6
63+
subsetsize = 0.85
64+
lambda = 0.5
65+
uscale_list = 0.03
66+
67+
submodel1 = pairFF 5
68+
69+
[phonon]
70+
## -1 (disabled,default), 0 (dipole)
71+
#nac= 0
72+
73+
## dispersion
74+
qpoint_fractional = False
75+
# 'Auto' or something like "[[10, [0,0,0],'\\Gamma', [0.5,0.5,0.5], 'X', [0.5,0.5,0], 'K']]"
76+
wavevector = [[25, [0,0,0],'\Gamma', [0,0.5,0.5], 'X'], [25, [1,0.5,0.5], 'X', [0.75,0.375,0.375], 'K', [0,0,0], '\Gamma', [0.5, 0.5, 0.5], 'L']]
77+
#wavevector = Auto
78+
## THz, meV, eV, cm
79+
unit = THz
80+
81+
## num. of grid points, 3 integers
82+
dos_grid = 15 15 15
83+
## Num. of points in DOS
84+
nE_dos = 400
85+
## 0 (Gaussian), 1 (Lorentzian), -1 (tetrahedron method)
86+
ismear= -1
87+
## width in THz of Gaussian/Lorentzian smearing
88+
epsilon = 0.05
89+
pdos = True
90+
91+
92+
## debye velocity averaging
93+
#debye_t_qfrac = 0.03
94+
#debye_t_v_intgrid = 40 40
95+
96+
## quasi-harmonic thermal properties (requires dos_grid)
97+
## Temperature in K: begin end increment
98+
thermal_T_range = 50 800 50
99+
thermal_out = thermal_out.txt
100+
101+
## export structures to supercells
102+
#supercell = 2 0 0 0 2 0 0 0 2
103+
## temperature in K: start, end, increment
104+
#snapshot_T_range = 100 800 100
105+
## list of [kp1, kp2, kp3, index_band]
106+
#modes = 0.125 0.125 0.25 0 0.125 0.125 0.25 1 0.125 0.125 0.25 2
107+
## amplitude in Angstrom
108+
#mode_amplitude = 0 0.03
109+
110+
111+
[export_potential]
112+
#save_pot_cell0 = fcc333 -3 3 3 3 -3 3 3 3 -3
113+
#save_pot_cell1 = prim111 1 0 0 0 1 0 0 0 1
114+
#combine_improper = false
115+
## first 3 integers for size of supercell for which Hessian/2nd order FCs are exported, then order of FCs
116+
export_shengbte = 5 5 5 2 3 4
117+
118+
119+
[prediction]
120+
interface = VASP
121+
corr_type = f
122+
corr_in = Amat_pred.mtx
123+
corr_out = Amat_pred.mtx
124+
fval_in = fval_pred.txt
125+
fval_out = fval_pred.txt
126+
traindat0 = fcc222/POSCAR fcc222/traj*

examples/Si/fit-forcefield.sh

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
SCRIPT=../../scripts/csld_main
2+
# first fit force field coefficients only
3+
$SCRIPT --ldff_step 2 -f csld.in-forcefield --phonon_step -1
4+
# next read coefficients and fit FCT only
5+
$SCRIPT --ldff_step 2 -f csld.in-forcefield --phonon_step -1 --symC_step 1 --train_step 1 \
6+
--override '[fitting] solution_known = sol_FF' \
7+
--override '[fitting] solution_out = sol_LD+FF' \
8+
--override '[fitting] submodel1 = FCT 0 1 2 3 4'
9+
# now the obtained phonon doesn't make sense, but the FF potential should look okay.
10+
11+
# alternatively, 1 fit orders 0,1,2 for phonons; 2. fit FF (order "5"); 3. fit orders 3 4
12+
# such that the phonon spectrum is correct but the FF looks weird.
13+
# your choice

manual.rst

+13
Original file line numberDiff line numberDiff line change
@@ -311,6 +311,19 @@ The csld_main script runs in the following steps, each controlled by a command-l
311311
"solution_in", str , "filename for loading previous solution instead of fitting"
312312
"solution_known", str, "filename for previously obtained parameter phi_in. The force predicted by phi_in will be subtracted from the total force. This is useful in conjunction with submodel to fit in several steps, e.g. assuming max_order=4, first fit harmonic terms with submodel=harmonic 1 2; solution_out=sol_2nd, then fit anharmonic terms with solution_known=sol_2nd; submodel1=anh 3 4; solution_out=solution_all"
313313

314+
- Pairwise force-field setup step to capture the bulk of the anharmonicity and to make fitting the residual force/energy easier. Turned **off** by default
315+
316+
- switch "--ldff_step STEP". **0**=off, 2=on.
317+
318+
.. csv-table:: "[LDFF]" section
319+
:header: "tag", "value", "description"
320+
:widths: 4, 4, 16
321+
322+
num_basis, int, "Number of basis"
323+
orbit_indices, "int [int]", "list of clusters to include in LDFF, usually choose only the nearest-neighbor pairs"
324+
interpolation_pts, "int int int", "min, max, interval of sampling points"
325+
basis_2, str, "pair basis functions. See Si/csld.in-forcefield for an example"
326+
314327
- Phonon step
315328

316329
- switch "--phonon_step STEP". 0=skip, **1** = compute.

0 commit comments

Comments
 (0)