def __init__(self, atomlist, Nst=2, **kwds): """ The DFTB module has many parameters which can be set from the command line using options, e.g. --scf_conv=1.0e-10. During the initialization - the command line arguments are parsed for options - Slater-Koster tables and repulsive potentials are loaded for the atom pair present in the molecule Parameters: =========== atomlist: list of tuples (Zi,[xi,yi,zi]) for each atom in the molecule Nst: number of electronic states (including ground state) """ usage = "Type --help to show all options for DFTB" parser = optparse.OptionParserFuncWrapper([ DFTB2.__init__, DFTB2.runSCC, SolventCavity.__init__, LR_TDDFTB.getEnergies ], usage, section_headers=["DFTBaby"], unknown_options="ignore") options, args = parser.parse_args(DFTB2.__init__) self.atomlist = atomlist self.tddftb = LR_TDDFTB(atomlist, **options) solvent_options, args = parser.parse_args(SolventCavity.__init__) solvent_cavity = SolventCavity(**solvent_options) self.tddftb.dftb2.setSolventCavity(solvent_cavity) self.grads = Gradients(self.tddftb) self.tddftb.setGeometry(atomlist, charge=kwds.get("charge", 0.0)) self.options, args = parser.parse_args(self.tddftb.getEnergies) self.scf_options, args = parser.parse_args(self.tddftb.dftb2.runSCC) self.options.update(self.scf_options) self.Nst = Nst # # always use iterative diagonalizer for lowest Nst-1 excited states self.options["nstates"] = Nst - 1 # save geometry, orbitals and TD-DFT coefficients from # last calculation self.last_calculation = None # save transition dipoles from last calculation self.tdip_old = None
def atomistic_dftb(atomlist): """ perform an atomistic tight-binding DFT calculation to get the ground state and the molecular orbitals """ # get parameters controlling DFTB calculation from # command line or configuration file usage = "Type --help to show all options for DFTB" parser = optparse.OptionParserFuncWrapper([ DFTB2.__init__, DFTB2.runSCC, SolventCavity.__init__, MoldenExporter.export ], usage, section_headers=["DFTBaby"], unknown_options="ignore") options, args = parser.parse_args(DFTB2.__init__) dftb2 = DFTB2(atomlist, **options) (scf_options, args) = parser.parse_args(dftb2.runSCC) # solvent cavity (solvent_options, args) = parser.parse_args(SolventCavity.__init__) solvent_cavity = SolventCavity(**solvent_options) dftb2.setSolventCavity(solvent_cavity) dftb2.setGeometry(atomlist, charge=0.0) dftb2.getEnergy(**scf_options) # export molden file with orbitals (options, args) = parser.parse_args(MoldenExporter(None).export) molden = MoldenExporter(dftb2) molden.export(**options) return dftb2
usage += " - `dftbaby.cfg` with the options controlling the TD-DFTB calculation and dynamics\n" usage += " Output Files:\n" usage += " - `dynamics.xyz`: geometries for each time step (in Angstrom)\n" usage += " - `state.dat`: current electronic state\n" usage += " - `energy_I.dat`: total energy of electronic state I in Hartree vs. time in fs.\n" usage += " The ground state energy at time t=0 is subtracted from all later energies.\n" usage += " - `nonadiabaticIJ.dat`: scalar non-adiabatic coupling between states I and J.\n" # This wrapper makes the optional parameters of the python function __init__ visible # as optional command line argument. parser = optparse.OptionParserFuncWrapper( [ # options for MD MolecularDynamics.__init__, # electronic structure options DFTB2.__init__, DFTB2.runSCC, SolventCavity.__init__, LR_TDDFTB.getEnergies ], usage, section_headers=["SurfaceHopping", "DFTBaby"]) # extract optional parameters from command line (options, args) = parser.parse_args(MolecularDynamics.__init__) md = MolecularDynamics(**options) # run molecular dynamics - this takes a while md.verlet() print "FINISHED"
Examples: GeometryOptimization.py molecule.xyz --state=0 --calc_hessian=1 optimizes the molecule on the ground state and computes the Hessian. GeometryOptimization.py molecule.xyz --state=1 --coord_system='internal' finds the minimum on the 1st excited state using redundant internal coordinates. """ % os.path.basename(sys.argv[0]) # This wrapper makes the optional parameters of the python functions visible # as optional command line argument. parser = optparse.OptionParserFuncWrapper( [ # options for geometry optimization GeometryOptimization.__init__, # electronic structure options DFTB2.__init__, DFTB2.runSCC, SolventCavity.__init__, LR_TDDFTB.getEnergies ], usage, section_headers=["DFTBaby", "GeometryOptimization"]) # extract optional parameters from command line (options, args) = parser.parse_args(GeometryOptimization.__init__) if len(args) < 1: print(usage) exit(-1) GOpt = GeometryOptimization(**options) # xyz_file = args[0]