def test2(): from Atom import Atom from Molecule import Molecule from TullySurfaceHopping import TullySurfaceHopping from Constants import fs2tau, tau2fs from IO_MOLPRO import molpro_input_parser from VelocityVerlet import set_random_momentum mol, inp = molpro_input_parser("mlpinp1.com") set_random_momentum(mol,0.1) pot = Potential_TSH(mol,inp,now_state=0,nrange=3) pot.override_output("mlpinp0.out_01") read_velocity(mol,"velocity5_1") read_coord(mol,"coord5_1") tsh = TullySurfaceHopping(mol,pot,dt=0.5*fs2tau,nstep=100,\ tsh_times=5) # These are special fort TSH tsh.run()
from IO_MOLPRO import molpro_input_parser from Potential import Potential_TSH_CASSCF, Potential_MM, Potential_QMMM from TullySurfaceHopping import TullySurfaceHopping_QMMM from Constants import fs2tau, bohr2ang import sys from IO_MOLPRO import OutputMOLPRO from MakeInitial import SetLattice, SetMaxwell, superpositioned_atoms_delete mol_qm, inp = molpro_input_parser("template.com") mol_qm.read_coord_from_file("coord1") mol_qm.read_velocity_from_file("velocity1") pot_qm = Potential_TSH_CASSCF(mol_qm, inp, now_state=2, nrange=4) n = 500 lattice = SetLattice("Ar",n,1.77) vlength = lattice.get_lattice_length() mol_mm = lattice.set_molecule() SetMaxwell(mol_mm, 300).set_velocities() mol_mm = superpositioned_atoms_delete(mol_mm, mol_qm) pot_mm = Potential_MM(mol_mm, rlimit = vlength / 2) pot_qmmm = Potential_QMMM(mol_qm, mol_mm, rlimit = vlength / 2) tsh = TullySurfaceHopping_QMMM(mol_qm, mol_mm, pot_qm, pot_mm,\ pot_qmmm, dt=0.5*fs2tau, nstep=5000,tsh_times=5) tsh.run()
if chk and l.find('Intensities [relative]') > -1: for _ in xrange(len(mol)*3): l = f.readline() trs1.append(map(float,l.split()[1:])) if chk2: trs = np.append(trs,trs1,axis=1) else: trs = trs1 trs1 = [] chk2 = True if chk and l.find('Wavenumbers [cm-1]') > -1: print l freq.append(map(float,l.split()[2:])) if chk and l.find('Normal Modes of low/zero frequencies') > -1: break l = f.readline() if len(trs) == 0 or len(freq) == 0: print 'cant get gradient' sys.exit() else: return trs.T,np.array(freq) if __name__ == '__main__': mol, inp = molpro_input_parser("mlpinp0_cis.com") wigner_distribution("mlpinp0_cis.out",mol,10,False)
import pyximport pyximport.install() cProfile.runctx("do()", globals(), locals(), "Profile.prof") s = pstats.Stats("Profile.prof") s.strip_dirs().sort_stats("time").print_stats() sys.exit() for i in xrange(500): x = 1.0 + 0.1 * i mol_mm.set_positions([[0.,0.,0.],[0.,0.,x*ang2bohr]]) pot_mm.calc() #print x, pot_mm.get_potential_energy(), pot_mm.get_forces()[0][2] print x, pot_mm.get_forces() #print pot_mm.get_forces() sys.exit() n = 256 mol_mm = Molecule(["Ar"]*n) SetLattice(mol_mm,1.77).set_positions() SetMaxwellVelocities(mol_mm,30).set_velocities() pot_mm = Potential_MM(mol_mm) vel = VelocityVerlet(mol_mm, pot_mm, nstep=2000, dt=0.5*fs2tau) vel.run() sys.exit() mol, inp = molpro_input_parser("template.com") read_coord(mol,"coord1") read_velocity(mol,"velocity1") pot = Potential_TSH_CASSCF(mol, inp, now_state=1, nrange=2) tsh = TullySurfaceHopping(mol,pot,dt=0.5*fs2tau,\ nstep=500,tsh_times=5) tsh.run()