コード例 #1
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
コード例 #2
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]
    }
}