Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add tutorial from DFTB+ school 2022 #47

Open
wants to merge 17 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add charge transfer part
charlymedrano7 committed Jul 1, 2022
commit 25d90030552763a566d9d9dbe23759eafebefd61
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
22 C
C H N
1 1 -5.1728644000E-01 -7.2571119000E-01 5.5846500000E-03
2 1 8.5078177000E-01 -1.1301429800E+00 2.0378600000E-03
3 1 1.2261304100E+00 -2.4865873900E+00 -1.5372900000E-03
4 1 1.9994598000E-01 -3.4347336900E+00 -4.3233500000E-03
5 2 2.2839472400E+00 -2.7882631200E+00 -3.3389800000E-03
6 1 -1.1562943300E+00 -3.0498598500E+00 -2.9476600000E-03
7 2 4.5464746000E-01 -4.5055579500E+00 -8.7991900000E-03
8 1 -1.5299440000E+00 -1.7037797500E+00 2.9104100000E-03
9 2 -1.9330937600E+00 -3.8293745100E+00 -7.3501000000E-03
10 2 -2.5921016000E+00 -1.4158925700E+00 3.5784700000E-03
11 1 -5.1730828000E-01 7.2567935000E-01 5.8213800000E-03
12 1 8.5080047000E-01 1.1301031400E+00 0.0000000000E+00
13 3 1.6513735600E+00 -1.0210000000E-05 0.0000000000E+00
14 1 -1.5297530300E+00 1.7038648900E+00 8.4112200000E-03
15 1 -1.1559873900E+00 3.0499477100E+00 1.8125700000E-03
16 2 -2.5920072900E+00 1.4162563500E+00 1.4849170000E-02
17 1 2.0031694000E-01 3.4347032300E+00 -7.4452800000E-03
18 2 -1.9327718800E+00 3.8294924100E+00 2.8904500000E-03
19 1 1.2263781800E+00 2.4864970000E+00 -7.6315500000E-03
20 2 2.2841771200E+00 2.7882250200E+00 -1.4735950000E-02
21 2 4.5487270000E-01 4.5055017500E+00 -1.5258710000E-02
22 2 2.6797365300E+00 -1.0210000000E-05 -4.1508500000E-03
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
Geometry = GenFormat {
<<< "coords.gen"
}

Driver = {}

Hamiltonian = DFTB {
SCC = Yes
SCCTolerance = 1e-7
MaxAngularMomentum = {
C = "p"
H = "s"
N = "p"
}
SlaterKosterFiles = Type2FileNames {
Prefix = "../../mio-1-1/"
Separator = "-"
Suffix = ".skf"
}
}

ElectronDynamics = {
Steps = 10000
TimeStep [au] = 0.2
Perturbation = Laser{ # Laser type perturbation
PolarizationDirection = # calculate with calc_timeprop_maxpoldir
LaserEnergy [ev] = # energy of interest
}
FieldStrength [v/a] = 0.001
Populations = Yes # to write populations during dynamic
}

Options {
WriteDetailedXML = Yes # needed for waveplot
}

Analysis {
WriteEigenvectors = Yes # needed for waveplot
}


InputVersion = 21.2


Parallel {
# Allow OMP threads explicitely to test for hybrid parallelisation with
# MPI-binary. (Check the manual before using this in production runs!)
UseOmpThreads = Yes
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# General options

Options {
RealComponent = Yes # Plot real component of the wavefunction
PlottedSpins = 1 -1
PlottedLevels = ### Levels (Orbitals) to plot
PlottedRegion = OptimalCuboid {} # Region to plot

NrOfPoints = 50 50 50 # Number of grid points in each direction
NrOfCachedGrids = -1 # Nr of cached grids (speeds up things)
Verbose = Yes # Wanna see a lot of messages?
}

DetailedXml = "detailed.xml" # File containing the detailed xml output
# of DFTB+
EigenvecBin = "eigenvec.bin" # File cointaining the binary eigenvecs
# Both files must be asked for the user in the
# input for DFTB+ calculation (they are not default
# printed)


# Definition of the basis
Basis {
Resolution = 0.01
# Including mio-1-1.hsd. (If you use a set, which depends on other sets,
# the wfc.*.hsd files for each required set must be included in a similar
# way.)
<<+ "./.hsd" ### Path for Wave function coeffiecients for waveplot
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
83 C
H C O N
1 1 -7.5120000000E+00 -8.6200000000E-01 -6.3900000000E-01
2 1 -7.5140000000E+00 9.0200000000E-01 -5.6500000000E-01
3 2 -7.1380000000E+00 -2.0000000000E-03 -3.8000000000E-02
4 3 -5.7070000000E+00 -2.2740000000E+00 1.2000000000E-02
5 4 -5.6920000000E+00 1.0000000000E-03 -3.2000000000E-02
6 2 -5.0880000000E+00 -1.2620000000E+00 -2.0000000000E-03
7 3 -5.7050000000E+00 2.2760000000E+00 2.4000000000E-02
8 2 -5.0890000000E+00 1.2640000000E+00 4.0000000000E-03
9 2 -3.5790000000E+00 -1.2240000000E+00 -2.0000000000E-03
10 2 -2.8730000000E+00 -2.4250000000E+00 -1.0000000000E-03
11 1 -3.4320000000E+00 -3.3710000000E+00 -1.0000000000E-03
12 2 -3.5790000000E+00 1.2240000000E+00 3.0000000000E-03
13 2 -2.8570000000E+00 0.0000000000E+00 0.0000000000E+00
14 2 -1.4710000000E+00 -2.4370000000E+00 -1.0000000000E-03
15 2 -2.8730000000E+00 2.4250000000E+00 8.0000000000E-03
16 2 -1.4290000000E+00 0.0000000000E+00 0.0000000000E+00
17 1 -3.4320000000E+00 3.3710000000E+00 1.2000000000E-02
18 2 -7.3100000000E-01 -1.2480000000E+00 -1.0000000000E-03
19 1 -9.5900000000E-01 -3.4080000000E+00 -1.0000000000E-03
20 2 -1.4720000000E+00 2.4370000000E+00 7.0000000000E-03
21 2 -7.3100000000E-01 1.2480000000E+00 2.0000000000E-03
22 2 7.3100000000E-01 -1.2480000000E+00 0.0000000000E+00
23 1 7.3970000000E+00 -1.0140000000E+00 -1.8860000000E+00
24 2 1.4710000000E+00 -2.4370000000E+00 -2.0000000000E-03
25 1 7.3950000000E+00 7.5400000000E-01 -1.9960000000E+00
26 2 7.3100000000E-01 1.2480000000E+00 0.0000000000E+00
27 1 9.5900000000E-01 -3.4080000000E+00 -3.0000000000E-03
28 1 -9.6000000000E-01 3.4080000000E+00 9.0000000000E-03
29 2 1.4290000000E+00 0.0000000000E+00 0.0000000000E+00
30 2 2.8730000000E+00 -2.4250000000E+00 -2.0000000000E-03
31 2 1.4710000000E+00 2.4370000000E+00 -3.0000000000E-03
32 2 7.7620000000E+00 -9.5000000000E-02 -1.3830000000E+00
33 2 2.8570000000E+00 0.0000000000E+00 0.0000000000E+00
34 1 9.5900000000E-01 3.4080000000E+00 -4.0000000000E-03
35 2 3.5790000000E+00 -1.2240000000E+00 0.0000000000E+00
36 2 2.8730000000E+00 2.4250000000E+00 -5.0000000000E-03
37 2 9.2900000000E+00 -9.4000000000E-02 -1.3640000000E+00
38 2 3.5790000000E+00 1.2240000000E+00 -3.0000000000E-03
39 1 3.4320000000E+00 -3.3710000000E+00 -3.0000000000E-03
40 2 5.0880000000E+00 -1.2620000000E+00 -2.0000000000E-03
41 3 5.7070000000E+00 -2.2740000000E+00 -1.6000000000E-02
42 2 5.0890000000E+00 1.2640000000E+00 -6.0000000000E-03
43 1 3.4320000000E+00 3.3710000000E+00 -9.0000000000E-03
44 4 5.6920000000E+00 1.0000000000E-03 2.8000000000E-02
45 3 5.7050000000E+00 2.2760000000E+00 -2.6000000000E-02
46 2 7.1390000000E+00 -7.0000000000E-03 2.4000000000E-02
47 1 9.6570000000E+00 -9.4100000000E-01 -7.4600000000E-01
48 1 9.6560000000E+00 8.2600000000E-01 -8.5900000000E-01
49 1 7.5140000000E+00 -8.5700000000E-01 6.3700000000E-01
50 1 7.5200000000E+00 9.0500000000E-01 5.3400000000E-01
51 1 -7.4666400000E+00 -4.5350000000E-02 9.7936000000E-01
52 1 9.6345700000E+00 -1.5942000000E-01 -2.3748900000E+00
53 1 1.5081470000E+01 -8.2919100000E+00 -3.0163600000E+00
54 1 1.5717470000E+01 -5.8730100000E+00 -3.0153600000E+00
55 2 1.4302470000E+01 -7.5190100000E+00 -3.0193600000E+00
56 2 1.4661470000E+01 -6.1730100000E+00 -3.0173600000E+00
57 1 1.5720470000E+01 -3.1039100000E+00 -3.0123600000E+00
58 2 1.2951470000E+01 -7.9059100000E+00 -3.0253600000E+00
59 1 1.2701470000E+01 -8.9759100000E+00 -3.0293600000E+00
60 2 1.3643470000E+01 -5.2089100000E+00 -3.0193600000E+00
61 2 1.4665470000E+01 -2.8009100000E+00 -3.0133600000E+00
62 2 1.3644470000E+01 -3.7630100000E+00 -3.0173600000E+00
63 2 1.1925470000E+01 -6.9639100000E+00 -3.0253600000E+00
64 2 1.2270470000E+01 -5.5999100000E+00 -3.0193600000E+00
65 1 1.0874470000E+01 -7.2809100000E+00 -3.0313600000E+00
66 2 1.2273470000E+01 -3.3670100000E+00 -3.0163600000E+00
67 4 1.1479470000E+01 -4.4829100000E+00 -3.0303600000E+00
68 1 9.8134700000E+00 -5.4159100000E+00 -1.0313600000E+00
69 2 1.1931470000E+01 -2.0030100000E+00 -3.0183600000E+00
70 2 9.4504700000E+00 -4.5169100000E+00 -1.5473600000E+00
71 1 9.8154700000E+00 -3.6460100000E+00 -9.8736000000E-01
72 2 1.0059470000E+01 -4.4829100000E+00 -2.9733600000E+00
73 1 9.6774700000E+00 -5.3540100000E+00 -3.5323600000E+00
74 1 1.0881470000E+01 -1.6829100000E+00 -3.0233600000E+00
75 2 7.9344700000E+00 -4.5149100000E+00 -1.5243600000E+00
76 1 9.6784700000E+00 -3.5860100000E+00 -3.4893600000E+00
77 1 7.5764700000E+00 -5.3839100000E+00 -2.0933600000E+00
78 1 7.5784700000E+00 -3.6149100000E+00 -2.0473600000E+00
79 1 1.5091470000E+01 -6.8291000000E-01 -3.0063600000E+00
80 2 1.4309470000E+01 -1.4539100000E+00 -3.0113600000E+00
81 2 1.2959470000E+01 -1.0630100000E+00 -3.0163600000E+00
82 1 1.2712470000E+01 7.0900000000E-03 -3.0173600000E+00
83 1 7.5833600000E+00 -4.5407800000E+00 -5.1394000000E-01
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
Geometry = GenFormat {
<<< "coords.gen"
}

Driver = {}

Hamiltonian = DFTB {
SCC = Yes
SCCTolerance = 1e-7
MaxAngularMomentum = {
C = "p"
H = "s"
N = "p"
O = "p"
}
SlaterKosterFiles = Type2FileNames {
Prefix = "../../mio-1-1/"
Separator = "-"
Suffix = ".skf"
}
}

ElectronDynamics = {
Steps = 10000 #define the time window
TimeStep [au] = 0.2 #resolution of the spectrum
Perturbation = Kick { #must be a kick (Dirac delta)
PolarizationDirection = "all" #desired direction/s
}
FieldStrength [v/a] = 0.001 #Field strength of the perturbation
}


InputVersion = 21.2


Parallel {
# Allow OMP threads explicitely to test for hybrid parallelisation with
# MPI-binary. (Check the manual before using this in production runs!)
UseOmpThreads = Yes
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
#!/usr/bin/env python3

'''
Charge per fragment of DFTB+ TD data
'''

import sys
import optparse
import numpy as np

USAGE = """usage: %prog -l ii:jj,ll:mm

Reads output from TD calculation with external laser and produces net charges per fragment
(subtracting value at time = 0).

Needs qsvst.dat file present in working directory."""

def main():
parser = optparse.OptionParser(usage=USAGE)
parser.add_option("-l", "--list", type='str', action="store", dest="at_list",
help="list of atom indices starting from 1 (initial and final index separated by colons, ranges separated by commas)")

(options, args) = parser.parse_args()

print(options.at_list)
list_ranges = options.at_list.split(',')
nfrag = len(list_ranges) #number of fragments
idx_ini = np.zeros(nfrag, dtype=int)
idx_end = np.zeros(nfrag, dtype=int)
for ii, ir in enumerate(list_ranges):
ini_end = ir.split(':')
idx_ini[ii] = int(ini_end[0]) - 1 # because first index is 0
idx_end[ii] = int(ini_end[1]) - 1

qsdata = np.genfromtxt('qsvst.dat')
time = qsdata[:,0]
natoms = qsdata.shape[1] - 2
print ('Number of atoms = {}'.format(natoms))
if any(idx_ini > natoms) or any(idx_end) > natoms+1:
print('List ranges above total number of atoms = {}'.format(natoms))
sys.exit()

for ii in range(nfrag): #sum of the atomic charges inside each fragment
print ('Fragment {}: from atom {} till {}'.format(ii, idx_ini[ii]+1, idx_end[ii]+1))
q_fragment = qsdata[:,2+idx_ini[ii]:2+idx_end[ii]+1].sum(axis=1)
np.savetxt("charge_frag%s.dat"%(ii+1), np.column_stack((time, q_fragment-q_fragment[0])))

if __name__ == "__main__":
main()

Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
83 C
H C O N
1 1 -7.5120000000E+00 -8.6200000000E-01 -6.3900000000E-01
2 1 -7.5140000000E+00 9.0200000000E-01 -5.6500000000E-01
3 2 -7.1380000000E+00 -2.0000000000E-03 -3.8000000000E-02
4 3 -5.7070000000E+00 -2.2740000000E+00 1.2000000000E-02
5 4 -5.6920000000E+00 1.0000000000E-03 -3.2000000000E-02
6 2 -5.0880000000E+00 -1.2620000000E+00 -2.0000000000E-03
7 3 -5.7050000000E+00 2.2760000000E+00 2.4000000000E-02
8 2 -5.0890000000E+00 1.2640000000E+00 4.0000000000E-03
9 2 -3.5790000000E+00 -1.2240000000E+00 -2.0000000000E-03
10 2 -2.8730000000E+00 -2.4250000000E+00 -1.0000000000E-03
11 1 -3.4320000000E+00 -3.3710000000E+00 -1.0000000000E-03
12 2 -3.5790000000E+00 1.2240000000E+00 3.0000000000E-03
13 2 -2.8570000000E+00 0.0000000000E+00 0.0000000000E+00
14 2 -1.4710000000E+00 -2.4370000000E+00 -1.0000000000E-03
15 2 -2.8730000000E+00 2.4250000000E+00 8.0000000000E-03
16 2 -1.4290000000E+00 0.0000000000E+00 0.0000000000E+00
17 1 -3.4320000000E+00 3.3710000000E+00 1.2000000000E-02
18 2 -7.3100000000E-01 -1.2480000000E+00 -1.0000000000E-03
19 1 -9.5900000000E-01 -3.4080000000E+00 -1.0000000000E-03
20 2 -1.4720000000E+00 2.4370000000E+00 7.0000000000E-03
21 2 -7.3100000000E-01 1.2480000000E+00 2.0000000000E-03
22 2 7.3100000000E-01 -1.2480000000E+00 0.0000000000E+00
23 1 7.3970000000E+00 -1.0140000000E+00 -1.8860000000E+00
24 2 1.4710000000E+00 -2.4370000000E+00 -2.0000000000E-03
25 1 7.3950000000E+00 7.5400000000E-01 -1.9960000000E+00
26 2 7.3100000000E-01 1.2480000000E+00 0.0000000000E+00
27 1 9.5900000000E-01 -3.4080000000E+00 -3.0000000000E-03
28 1 -9.6000000000E-01 3.4080000000E+00 9.0000000000E-03
29 2 1.4290000000E+00 0.0000000000E+00 0.0000000000E+00
30 2 2.8730000000E+00 -2.4250000000E+00 -2.0000000000E-03
31 2 1.4710000000E+00 2.4370000000E+00 -3.0000000000E-03
32 2 7.7620000000E+00 -9.5000000000E-02 -1.3830000000E+00
33 2 2.8570000000E+00 0.0000000000E+00 0.0000000000E+00
34 1 9.5900000000E-01 3.4080000000E+00 -4.0000000000E-03
35 2 3.5790000000E+00 -1.2240000000E+00 0.0000000000E+00
36 2 2.8730000000E+00 2.4250000000E+00 -5.0000000000E-03
37 2 9.2900000000E+00 -9.4000000000E-02 -1.3640000000E+00
38 2 3.5790000000E+00 1.2240000000E+00 -3.0000000000E-03
39 1 3.4320000000E+00 -3.3710000000E+00 -3.0000000000E-03
40 2 5.0880000000E+00 -1.2620000000E+00 -2.0000000000E-03
41 3 5.7070000000E+00 -2.2740000000E+00 -1.6000000000E-02
42 2 5.0890000000E+00 1.2640000000E+00 -6.0000000000E-03
43 1 3.4320000000E+00 3.3710000000E+00 -9.0000000000E-03
44 4 5.6920000000E+00 1.0000000000E-03 2.8000000000E-02
45 3 5.7050000000E+00 2.2760000000E+00 -2.6000000000E-02
46 2 7.1390000000E+00 -7.0000000000E-03 2.4000000000E-02
47 1 9.6570000000E+00 -9.4100000000E-01 -7.4600000000E-01
48 1 9.6560000000E+00 8.2600000000E-01 -8.5900000000E-01
49 1 7.5140000000E+00 -8.5700000000E-01 6.3700000000E-01
50 1 7.5200000000E+00 9.0500000000E-01 5.3400000000E-01
51 1 -7.4666400000E+00 -4.5350000000E-02 9.7936000000E-01
52 1 9.6345700000E+00 -1.5942000000E-01 -2.3748900000E+00
53 1 1.5081470000E+01 -8.2919100000E+00 -3.0163600000E+00
54 1 1.5717470000E+01 -5.8730100000E+00 -3.0153600000E+00
55 2 1.4302470000E+01 -7.5190100000E+00 -3.0193600000E+00
56 2 1.4661470000E+01 -6.1730100000E+00 -3.0173600000E+00
57 1 1.5720470000E+01 -3.1039100000E+00 -3.0123600000E+00
58 2 1.2951470000E+01 -7.9059100000E+00 -3.0253600000E+00
59 1 1.2701470000E+01 -8.9759100000E+00 -3.0293600000E+00
60 2 1.3643470000E+01 -5.2089100000E+00 -3.0193600000E+00
61 2 1.4665470000E+01 -2.8009100000E+00 -3.0133600000E+00
62 2 1.3644470000E+01 -3.7630100000E+00 -3.0173600000E+00
63 2 1.1925470000E+01 -6.9639100000E+00 -3.0253600000E+00
64 2 1.2270470000E+01 -5.5999100000E+00 -3.0193600000E+00
65 1 1.0874470000E+01 -7.2809100000E+00 -3.0313600000E+00
66 2 1.2273470000E+01 -3.3670100000E+00 -3.0163600000E+00
67 4 1.1479470000E+01 -4.4829100000E+00 -3.0303600000E+00
68 1 9.8134700000E+00 -5.4159100000E+00 -1.0313600000E+00
69 2 1.1931470000E+01 -2.0030100000E+00 -3.0183600000E+00
70 2 9.4504700000E+00 -4.5169100000E+00 -1.5473600000E+00
71 1 9.8154700000E+00 -3.6460100000E+00 -9.8736000000E-01
72 2 1.0059470000E+01 -4.4829100000E+00 -2.9733600000E+00
73 1 9.6774700000E+00 -5.3540100000E+00 -3.5323600000E+00
74 1 1.0881470000E+01 -1.6829100000E+00 -3.0233600000E+00
75 2 7.9344700000E+00 -4.5149100000E+00 -1.5243600000E+00
76 1 9.6784700000E+00 -3.5860100000E+00 -3.4893600000E+00
77 1 7.5764700000E+00 -5.3839100000E+00 -2.0933600000E+00
78 1 7.5784700000E+00 -3.6149100000E+00 -2.0473600000E+00
79 1 1.5091470000E+01 -6.8291000000E-01 -3.0063600000E+00
80 2 1.4309470000E+01 -1.4539100000E+00 -3.0113600000E+00
81 2 1.2959470000E+01 -1.0630100000E+00 -3.0163600000E+00
82 1 1.2712470000E+01 7.0900000000E-03 -3.0173600000E+00
83 1 7.5833600000E+00 -4.5407800000E+00 -5.1394000000E-01
Loading