コード例 #1
0
def main(pdb_path, splitAt, work_dir):

    monomers = create_monomers(pdb_path, splitAt, work_dir)

    settings = Settings()
    settings.basis = "DZP"
    #    settings.functional = "CAMY-B3LYP"
    settings.specific.adf.basis.core = "None"
    settings.specific.adf.symmetry = "Nosym"
    settings.specific.adf.xc.hybrid = "CAMY-B3LYP"
    settings.specific.adf.xc.xcfun = ""

    fde_settings = Settings()
    #    fde_settings.functional = "camy-b3lyp"
    fde_settings.specific.adf.xc.hybrid = "CAMY-B3LYP"
    fde_settings.specific.adf.xc.xcfun = ""
    fde_settings.basis = "DZP"
    fde_settings.specific.adf.symmetry = "Nosym"
    fde_settings.specific.adf.fde.PW91k = ""
    fde_settings.specific.adf.fde.fullgrid = ""
    fde_settings.specific.adf.allow = "Partialsuperfrags"
    fde_settings.specific.adf.fde.GGAPOTXFD = "Becke"
    fde_settings.specific.adf.fde.GGAPOTCFD = "LYP"

    # Read input from molfiles
    jobs = chain(*list(
        map(lambda xs: create_jobs(settings, fde_settings, *xs),
            enumerate(monomers))))

    run(gather(*jobs), n_processes=2)
コード例 #2
0
ファイル: opt_orca.py プロジェクト: miroi/qmworks
def test_opt_orca():
    """
    Test Orca input generation and run functions.
    """
    h2o = Molecule('test/test_files/h2o.xyz', 'xyz', charge=0, multiplicity=1)

    h2o_geometry = dftb(templates.geometry, h2o)

    s = Settings()
    # generic keyword "basis" must be present in the generic dictionary
    s.basis = "sto_dzp"
    # "specific" allows the user to apply specific keywords for a
    # package that are not in a generic dictionary
    # s.specific.adf.basis.core = "large"

    r = templates.singlepoint.overlay(s)
    h2o_singlepoint = orca(r, h2o_geometry.molecule)

    dipole = h2o_singlepoint.dipole

    final_result = run(dipole, n_processes=1)

    expected_dipole = [0.82409, 0.1933, -0.08316]
    diff = sqrt(sum((x - y)**2 for x, y in zip(final_result, expected_dipole)))
    print("Expected dipole computed with Orca 3.0.3 is:", expected_dipole)
    print("Actual dipole is:", final_result)

    assert diff < 1e-2
コード例 #3
0
def cp2k_input(range_orbitals,
               cell_parameters,
               cell_angles,
               added_mos,
               basis="DZVP-MOLOPT-SR-GTH",
               potential="GTH-PBE"):
    """
    # create ``Settings`` for the Cp2K Jobs.
    """
    # Main Cp2k Jobs
    cp2k_args = Settings()
    cp2k_args.basis = fun_format(basis)
    cp2k_args.potential = fun_format(potential)
    cp2k_args.cell_parameters = cell_parameters
    cp2k_args.cell_angles = cell_angles
    main_dft = cp2k_args.specific.cp2k.force_eval.dft
    main_dft.scf.added_mos = added_mos
    main_dft.scf.max_scf = 40
    main_dft.scf.eps_scf = 5e-4
    main_dft['print']['mo']['mo_index_range'] = '"{} {}"'.format(
        *range_orbitals)
    cp2k_args.specific.cp2k.force_eval.subsys.cell.periodic = fun_format(
        'None')

    # Setting to calculate the wave function used as guess
    cp2k_OT = Settings()
    cp2k_OT.basis = fun_format(basis)
    cp2k_OT.potential = fun_format(potential)
    cp2k_OT.cell_parameters = cell_parameters
    cp2k_OT.cell_angles = cell_angles
    ot_dft = cp2k_OT.specific.cp2k.force_eval.dft
    ot_dft.scf.scf_guess = fun_format('atomic')
    ot_dft.scf.ot.minimizer = fun_format('DIIS')
    ot_dft.scf.ot.n_diis = 7
    ot_dft.scf.ot.preconditioner = fun_format('FULL_SINGLE_INVERSE')
    ot_dft.scf.added_mos = 0
    ot_dft.scf.eps_scf = 1e-06
    ot_dft.scf.scf_guess = fun_format('restart')
    cp2k_OT.specific.cp2k.force_eval.subsys.cell.periodic = fun_format('None')

    return cp2k_args, cp2k_OT
コード例 #4
0
ファイル: merge_job.py プロジェクト: ljzhou86/qmworks-namd
def main():

    # Current Work Directory
    cwd = os.getcwd()

    # ========== Fill in the following variables
    # Varaible to define the Path ehere the Cp2K jobs will be computed
    scratch = "/path/to/scratch"
    project_name = 'My_awesome_project'  # name use to create folders

    # Path to the basis set used by Cp2k
    basisCP2K = "/Path/to/CP2K/BASIS_MOLOPT"
    potCP2K = "/Path/to/CP2K/GTH_POTENTIALS"

    path_to_trajectory = 'Path/to/trajectory/in/XYZ'

    # Number of MO used to compute the coupling
    nHOMO = None
    couplings_range = None

    # Basis
    basis = "DZVP-MOLOPT-SR-GTH"

    # Algorithm to compute the NAC
    algorithm = 'levine'

    # Integation step used for the dynamics (femtoseconds)
    dt = 1

    # ============== End of User definitions ===================================

    cp2k_args = Settings()
    cp2k_args.basis = basis

    # Results folder
    results_dir = join(cwd, 'total_results')
    if not os.path.exists(results_dir):
        os.mkdir(results_dir)

    # Merge all the HDF5 files
    file_hdf5 = merge_hdf5(scratch, project_name, cwd, results_dir)

    # compute missing couplings
    script_name = "merge_data.py"

    write_python_script(scratch, 'total_results', path_to_trajectory,
                        project_name, basisCP2K, potCP2K, cp2k_args,
                        Settings(), 0, script_name, file_hdf5, nHOMO,
                        couplings_range, algorithm, dt)

    # Script using SLURM
    write_slurm_script(scratch, results_dir, script_name)
コード例 #5
0
def test_linear_ts():
    """
    compute a first approximation to the TS.
    """
    # Read the Molecule from file
    cnc = Molecule('test/test_files/C-N-C.mol', 'mol')

    # User define Settings
    settings = Settings()
    settings.functional = "pbe"
    settings.basis = "SZ"
    settings.specific.dftb.dftb.scc

    constraint1 = Distance(0, 4)
    constraint2 = Distance(2, 3)

    # scan input
    pes = PES(cnc,
              constraints=[constraint1, constraint2],
              offset=[2.3, 2.3],
              get_current_values=False,
              nsteps=2,
              stepsize=[0.1, 0.1])

    # returns a set of results object containing the output of
    # each point in the scan
    lt = pes.scan([dftb, adf], settings)

    # Gets the object presenting the molecule
    # with the maximum energy calculated from the scan
    apprTS = select_max(lt, "energy")

    # Run the TS optimization, using the default TS template
    ts = run(apprTS)

    expected_energy = -3.219708290363864

    assert abs(ts.energy - expected_energy) < 0.02
コード例 #6
0
def bond_distance(r1, r2):
    return sqrt(sum((x - y)**2 for x, y in zip(r1, r2)))


# ========== =============

plams.init()

# Read the Molecule from file
cnc = Molecule('C-N-C.mol', 'mol')

# User define Settings
settings = Settings()
settings.functional = "pbe"
settings.basis = "TZ2P"
settings.specific.dftb.dftb.scc

constraint1 = "dist 1 5"
constraint2 = "dist 3 4"

# scan input
scan = {
    'constraint': [constraint1, constraint2],
    'surface': {
        'nsteps': 6,
        'start': [2.3, 2.3],
        'stepsize': [0.1, 0.1]
    }
}
コード例 #7
0
ファイル: FDE_Fragments.py プロジェクト: miroi/qmworks
# ----------------------------------------------------------------


plams.init()

# Read the Molecule from file
m_h2o_1 = Molecule('FDE-H2O-1.xyz')
m_h2o_2 = Molecule('FDE-H2O-2.xyz')
m_mol   = Molecule('FDE-mol.xyz')

m_tot = m_mol + m_h2o_1 + m_h2o_2

print(m_tot)

settings = Settings()
settings.basis = 'SZ'
settings.specific.adf.nosymfit = ''

# Prepare first water molecule
r_h2o_1 = adf(templates.singlepoint.overlay(settings), m_h2o_1, job_name="h2o_1")

# Prepare second water molecule
r_h2o_2 = adf(templates.singlepoint.overlay(settings), m_h2o_2, job_name="h2o_2")

frozen_frags = [Fragment(r_h2o_1, [m_h2o_1]),
                Fragment(r_h2o_2, [m_h2o_2])]

fde_res = run(fragmentsjob(settings, m_mol, *frozen_frags))

print(fde_res.dipole)
コード例 #8
0
ファイル: mo_cp2k.py プロジェクト: miroi/qmworks
def fun_ethylene(scratch_path):
    """
    Test Ethylene singlw
    """
    project_name = 'ethylene'

    # create Settings for the Cp2K Jobs
    s = Settings()
    s.basis = "DZVP-MOLOPT-SR-GTH"
    s.potential = "GTH-PBE"
    s.cell_parameters = [12.74] * 3
    dft = s.specific.cp2k.force_eval.dft
    dft.scf.added_mos = 20
    dft.scf.eps_scf = 1e-4

    dft['print']['ao_matrices']['overlap'] = ''
    dft['print']['ao_matrices']['filename'] = join(scratch_path, 'overlap.out')

    # Copy the basis and potential to a tmp file
    shutil.copy('test/test_files/BASIS_MOLOPT', scratch_path)
    shutil.copy('test/test_files/GTH_POTENTIALS', scratch_path)
    # Cp2k configuration files
    basiscp2k = join(scratch_path, 'BASIS_MOLOPT')
    potcp2k = join(scratch_path, 'GTH_POTENTIALS')
    cp2k_config = {"basis": basiscp2k, "potential": potcp2k}

    # HDF5 path
    path_hdf5 = join(scratch_path, 'ethylene.hdf5')

    # all_geometries type :: [String]
    path_xyz = 'test/test_files/ethylene.xyz'
    geometries = split_file_geometries(path_xyz)

    # Input/Output Files
    file_xyz = join(scratch_path, 'coordinates.xyz')
    file_inp = join(scratch_path, 'ethylene.inp')
    file_out = join(scratch_path, 'ethylene.out')
    file_MO = join(scratch_path, 'mo_coeffs.out')

    files = JobFiles(file_xyz, file_inp, file_out, file_MO)

    schedule_job = schedule(prepare_job_cp2k)

    promise = schedule_job(geometries[0],
                           files,
                           s,
                           scratch_path,
                           project_name=project_name,
                           hdf5_file=path_hdf5,
                           wfn_restart_job=None,
                           store_in_hdf5=True,
                           nHOMOS=25,
                           nLUMOS=25,
                           package_config=cp2k_config)

    cp2k_result = run(promise)

    path_properties = cp2k_result.orbitals

    with h5py.File(path_hdf5) as f5:
        assert (all(p in f5 for p in path_properties))