コード例 #1
0
def cal_heatf():
    """calculate the heat of formation as following:
    \delta H_f = E_system + 4RT + POP + n_CI_C + n_HI_H
    POP: contribution of high energy conformations. (default -0.2 kcal/mol)
    I_C: heat increament for C (see STD)
    I_H: heat increament for H (see STD)
    @ref: reaxFF 2001
    """
    # get E_system
    assert os.path.exists("fort.74")
    f =  open("fort.74", "r")
    ener = float(f.readline()[27:37])
    f.close()

    assert os.path.exists("geo")
    fname = "geo"
    a = Geo(fname)
    b = a.parser()
    # get atom map
    b.assignAtomTypes()
    # get element type
    b.assignEleTypes()
    ht = {}

    for i in b.map:
        ht[i[1]] = 0

    for i in b.atoms:
        ener = ener + STD[i.element]

    ener = ener + 4*300*8.314/4184 + (-0.21)

    print b.name, ener
コード例 #2
0
ファイル: e_2_geo.py プロジェクト: tarbaig/simpy
def main():
    parser = argparse.ArgumentParser()
    parser.add_argument("fname", default="geo", nargs="?", help="geo file name")
    parser.add_argument("-c", action="store_true", help="convert the file to other formats (geo, xyz, gjf, lammps)")
    parser.add_argument("-pbc", action="store_true", help="using default pbc 5nm * 5nm * 5nm")
    parser.add_argument("-b", nargs=2, type=int, help="get the bond distance between a1, a2, a3")
    parser.add_argument("-a", nargs=3, type=int,help="get the angle of a1-a2-a3")
    parser.add_argument("-vol", action="store_true", help="get the volume of the simulation box")
    args = parser.parse_args()
    #print b.getBondDist(3,2)
    fname = args.fname

    assert os.path.exists(fname)
    a = Geo(fname)
    b = a.parser()
    b.assignEleTypes()
    b.assignAtomTypes2()

    if args.c:
        print "converting %s to geo, xyz, gjf and lammps..."%fname
        if args.pbc:
            b.pbc = [50, 50, 50, 90.0, 90.0, 90.0]
        convertors(b)

    if args.b:
        a1 = args.b[0] 
        a2 = args.b[1]
        val = b.getBondDist(a1, a2)
        print "Distance between %d and %d is %.3f."%(a1, a2, val)

    if args.a:
        a1 = args.a[0] 
        a2 = args.a[1]
        a3 = args.a[2]
        val = b.getAngle(a1, a2, a3)
        print "Angle of %d-%d-%d is %.3f."%(a1, a2, a3, val)

    if args.vol:
        vol = b.getVol()
        print "Volume is %.3f"%vol
コード例 #3
0
""" parse the geo file with multi configuration into
seperated files
"""
import os
from utilities import parseBlock
from mytype import System, Molecule, Atom
from geo import Geo
from output_conf import toGeo
from output_conf import toXyz

os.chdir("/home/tao/Documents/debug/geofile")
parseBlock("geo", 1)
for i in range(204):
    fname = "out%03d" % i
    a = Geo(fname)
    b = a.parser()
    b.assignAtomTypes()
    toGeo(b, b.name + '.geo')
    toXyz(b, b.name + '.xyz')
コード例 #4
0
ファイル: e_2_multi_geo.py プロジェクト: carlos-salgado/simpy
""" parse the geo file with multi configuration into
seperated files
"""
import os
from utilities import parseBlock
from mytype import System, Molecule, Atom
from geo import Geo
from output_conf import toGeo
from output_conf import toXyz

os.chdir("/home/tao/Documents/debug/geofile")
parseBlock("geo", 1)
for i in range(204):
    fname = "out%03d"%i 
    a = Geo(fname)
    b = a.parser()
    b.assignAtomTypes()
    toGeo(b, b.name+'.geo')
    toXyz(b, b.name+'.xyz')