Esempio n. 1
0
# Tests molecule.py by calling static method on molecule.xyz

from molecule import Molecule

mol = Molecule.from_file('../../extra-files/molecule.xyz')
print(mol)
Esempio n. 2
0
        path = directory + '/{:d}{:d}_{:d}{:d}'.format(coords, coordd, ks, kd)
        lines = open(path + '/input.out').readlines()
        energy = 0.0
        for line in reversed(lines):
            if line[:23] == ep:
                energy = float(line.split()[-1])
                return energy
        raise Exception('Cannot find energy in ' + path)
    
    H = np.zeros((3*natom, 3*natom))

    for A in range(3*natom):                                                       # calculates matrix elements of hessian
        for B in range(3*natom):
            if A == B:
                H[A,A] = (E(A,0,+1,0,ep) + E(A,0,-1,0,ep) - 2 * E(0,0,0,0,ep))/(disp_size**2)
            else:
                H[A,B] = (E(A,B,+1,+1,ep) + E(A,B,-1,-1,ep) - E(A,B,+1,0,ep) - E(A,B,-1,0,ep) \
                          - E(A,B,0,+1,ep) - E(A,B,0,-1,ep) + 2*E(0,0,0,0,ep))/(2*(disp_size**2))
    np.savetxt('hessian.dat', H)                                                   # writes hessian to hessian.dat
    return H

# testing
if __name__=='__main__':

    mol = Molecule.from_file('../../extra-files/molecule.xyz')     # building molecule from molecule.xyz
    template = open('../../extra-files/template.dat').read()       # reads initial template
    generate_inputs(mol, template, 0.005, 'DISPS')
    run_jobs(mol, '/Users/boyi/bin/psi4/obj/stage/usr/local/bin/psi4', 'DISPS')
    build_hessian(mol,'  @DF-RHF Final Energy:', 0.005, 'DISPS')
    frequencies.get_freqs(mol, 'hessian.dat')                       # calling frequencies function
Esempio n. 3
0
# Tests molecule.py by calling static method on molecule.xyz

from molecule import Molecule

mol=Molecule.from_file('../../extra-files/molecule.xyz')
print(mol)