S SmartDocs
Chuỗi bài: AI for Chemistry python 52 dòng · Cập nhật 2023-11-12

process_gjf.py

AI for Chemistry/code/2025_COSMO/data/s-profiles-all/name_mol_gjf_cosmo/123/process_gjf.py

import os

for j in os.listdir("mol"):
    mol = open(f"mol/{j}", "r")
    lines = mol.readlines()
    mol.close()

    cid = j.replace(".mol", "")
    print(lines)
    file = open(f"gjf/{cid}.gjf", "w")
    file.write(f"%chk={cid}-opt-b3lyp.chk\n")
    file.write("%mem=10GB\n")
    file.write("%NProcShared=12\n")
    file.write("# opt=(calcfc) b3lyp/6-31g(d,p) scf=tight\n")
    file.write("\n")
    file.write("pe cosmo generation\n")
    file.write("\n")
    file.write("0 1\n")

    n = int(lines[3][1:3])

    data = lines[4:4+n]

    # for i in data:
        # print(i)

    for i in range(len(data)):
        delete = data[i][33:]
        # print(delete)
        data[i] = data[i].replace(delete, "")

        atom = data[i][31:]   #get data
        data[i] = data[i].replace(atom, "")   #delete atom
        atom = atom.replace(" ", "")   #delete space
        data[i] = atom+data[i]+ "\n"
        # print(data[i])

    file.writelines(data)
    file.write("\n")
    file.write("--Link1--\n")
    file.write(f"%chk={cid}-opt-b3lyp.chk\n")
    file.write("%mem=10GB\n")
    file.write("%NProcShared=12\n")
    file.write("# b3lyp/6-31g(d,p) geom=checkpoint guess=read scf=tight SCRF=(COSMORS)\n")
    file.write("\n")
    file.write("pe cosmo generation\n")
    file.write("\n")
    file.write("0 1\n")
    file.write("\n")
    file.write(f"{cid}-opt-b3lyp.cosmo\n")

    file.close()

Bài viết liên quan

AI for Chemistry python Cập nhật 2023-11-13

cosmo_to_s_profile_ver_1.1.1.py

cosmo_to_s_profile_ver_1.1.1.py — python source code from the AI for Chemistry learning materials (AI for Chemistry/2025_COSMO/data/s-profiles-all/List-9/cosmo_to_s_profile_ver_1.1.1.py).

Đọc bài viết →
AI for Chemistry python Cập nhật 2024-03-20

area.py

area.py — python source code from the AI for Chemistry learning materials (AI for Chemistry/2025_COSMO/data/s-profiles-all/area_volume-org/area.py).

Đọc bài viết →
AI for Chemistry python Cập nhật 2024-06-27

area_volume.py

area_volume.py — python source code from the AI for Chemistry learning materials (AI for Chemistry/2025_COSMO/data/s-profiles-all/area_volume-org/area_volume.py).

Đọc bài viết →
AI for Chemistry python Cập nhật 2024-06-27

volume.py

volume.py — python source code from the AI for Chemistry learning materials (AI for Chemistry/2025_COSMO/data/s-profiles-all/area_volume-org/volume.py).

Đọc bài viết →
AI for Chemistry python Cập nhật 2024-04-26

check_final_CID.py

check_final_CID.py — python source code from the AI for Chemistry learning materials (AI for Chemistry/2025_COSMO/data/s-profiles-all/check/check_final_CID.py).

Đọc bài viết →
AI for Chemistry python Cập nhật 2024-03-20

check_for_CID.py

check_for_CID.py — python source code from the AI for Chemistry learning materials (AI for Chemistry/2025_COSMO/data/s-profiles-all/check/check_for_CID.py).

Đọc bài viết →