コード例 #1
0
def test_reproduce_2D_example():
    """
    Testing Reproducing examples/propanol-2d
    """
    from torsiondrive import launch
    this_file_folder = os.path.dirname(os.path.realpath(__file__))
    example_path = os.path.join(this_file_folder, '..', '..', 'examples')
    os.chdir(example_path)
    subprocess.call('tar zxf propanol-2d.tar.gz', shell=True)
    # reproduce qchem work_queue geomeTRIC
    os.chdir('propanol-2d/work_queue_qchem_geomeTRIC')
    shutil.copy('scan.xyz', 'orig_scan.xyz')
    argv = sys.argv[:]
    sys.argv = 'torsiondrive-launch qc.in dihedrals.txt -e qchem -g 15 --zero_based_numbering -v'.split(
    )
    launch.main()
    assert filecmp.cmp('scan.xyz', 'orig_scan.xyz')
    os.chdir(example_path)
    # reproduce qchem work_queue native_opt
    os.chdir('propanol-2d/work_queue_qchem_native_opt')
    shutil.copy('scan.xyz', 'orig_scan.xyz')
    shutil.copy('scan.xyz', 'orig_scan.xyz')
    sys.argv = 'torsiondrive-launch qc.in dihedrals.txt -e qchem -g 15 --native_opt --zero_based_numbering -v'.split(
    )
    launch.main()
    sys.argv = argv
    assert filecmp.cmp('scan.xyz', 'orig_scan.xyz')
    os.chdir(example_path)
コード例 #2
0
def test_reproduce_energy_upper_limit_example(example_path):
    """
    Testing Reproducing examples/extra_constraints
    """
    from torsiondrive import launch
    os.chdir(example_path)
    os.chdir('energy_upper_limit')
    # reproduce ring example
    os.chdir('limit_ring_0.05')
    subprocess.run('tar zxf opt_tmp.tar.gz', shell=True, check=True)
    shutil.copy('scan.xyz', 'orig_scan.xyz')
    argv = sys.argv[:]
    with open('run_command') as f:
        sys.argv = f.read().split()
    launch.main()
    sys.argv = argv
    assert filecmp.cmp('scan.xyz', 'orig_scan.xyz')
    os.chdir('..')
    # reproduce ring example
    os.chdir('limit_flexible_0.01')
    subprocess.run('tar zxf opt_tmp.tar.gz', shell=True, check=True)
    shutil.copy('scan.xyz', 'orig_scan.xyz')
    argv = sys.argv[:]
    with open('run_command') as f:
        sys.argv = f.read().split()
    launch.main()
    sys.argv = argv
    assert filecmp.cmp('scan.xyz', 'orig_scan.xyz')
コード例 #3
0
def test_reproduce_2D_example(example_path):
    """
    Testing Reproducing examples/propanol-2d
    """
    from torsiondrive import launch
    # reproduce qchem work_queue geomeTRIC
    os.chdir(example_path)
    os.chdir('propanol-2d/work_queue_qchem_geomeTRIC')
    subprocess.run('tar zxf opt_tmp.tar.gz', shell=True, check=True)
    shutil.copy('scan.xyz', 'orig_scan.xyz')
    argv = sys.argv[:]
    sys.argv = 'torsiondrive-launch qc.in dihedrals.txt -e qchem -g 15 -v'.split(
    )
    launch.main()
    assert filecmp.cmp('scan.xyz', 'orig_scan.xyz')
    # reproduce qchem work_queue native_opt
    os.chdir(example_path)
    os.chdir('propanol-2d/work_queue_qchem_native_opt')
    subprocess.run('tar zxf opt_tmp.tar.gz', shell=True, check=True)
    shutil.copy('scan.xyz', 'orig_scan.xyz')
    sys.argv = 'torsiondrive-launch qc.in dihedrals.txt -e qchem -g 15 --native_opt -v'.split(
    )
    launch.main()
    sys.argv = argv
    assert filecmp.cmp('scan.xyz', 'orig_scan.xyz')
コード例 #4
0
def test_reproduce_energy_upper_limit_example(example_path):
    """
    Testing Reproducing examples/extra_constraints
    """
    from torsiondrive import launch
    os.chdir(example_path)
    os.chdir('energy_upper_limit')
    # reproduce ring example
    os.chdir('limit_ring_0.05')
    subprocess.run('tar zxf opt_tmp.tar.gz', shell=True, check=True)
    shutil.copy('scan.xyz', 'orig_scan.xyz')
    argv = sys.argv[:]
    sys.argv = 'torsiondrive-launch run.in dihedrals.txt -e terachem -g 15 --energy_upper_limit 0.05 -v'.split(
    )
    launch.main()
    sys.argv = argv
    assert filecmp.cmp('scan.xyz', 'orig_scan.xyz')
    os.chdir('..')
    # reproduce ring example
    os.chdir('limit_flexible_0.01')
    subprocess.run('tar zxf opt_tmp.tar.gz', shell=True, check=True)
    shutil.copy('scan.xyz', 'orig_scan.xyz')
    argv = sys.argv[:]
    sys.argv = 'torsiondrive-launch run.in dihedrals.txt -e terachem -g 10 --energy_upper_limit 0.01 -v'.split(
    )
    launch.main()
    sys.argv = argv
    assert filecmp.cmp('scan.xyz', 'orig_scan.xyz')
コード例 #5
0
def test_reproduce_2D_example(example_path):
    """
    Testing Reproducing examples/propanol-2d
    """
    from torsiondrive import launch
    # reproduce psi4 work_queue geomeTRIC
    os.chdir(example_path)
    os.chdir('propanol-2d')
    subprocess.run('tar zxf opt_tmp.tar.gz', shell=True, check=True)
    shutil.copy('scan.xyz', 'orig_scan.xyz')
    argv = sys.argv[:]
    with open('run_command') as f:
        sys.argv = f.read().split()
    launch.main()
    assert filecmp.cmp('scan.xyz', 'orig_scan.xyz')
コード例 #6
0
def test_reproduce_extra_constraints_example(example_path):
    """
    Testing Reproducing examples/extra_constraints
    """
    from torsiondrive import launch
    os.chdir(example_path)
    os.chdir('extra_constraints')
    subprocess.run('tar zxf opt_tmp.tar.gz', shell=True, check=True)
    shutil.copy('scan.xyz', 'orig_scan.xyz')
    argv = sys.argv[:]
    sys.argv = 'torsiondrive-launch qc.in dihedrals.txt -g 15 -e qchem -c constraints.txt -v'.split(
    )
    launch.main()
    sys.argv = argv
    assert filecmp.cmp('scan.xyz', 'orig_scan.xyz')
コード例 #7
0
def test_reproduce_range_limit_split_example(example_path):
    """
    Testing Reproducing examples/range_limited_split
    """
    from torsiondrive import launch
    # reproduce qchem work_queue geomeTRIC
    os.chdir(example_path)
    os.chdir('range_limited')
    subprocess.run('tar zxf opt_tmp.tar.gz', shell=True, check=True)
    shutil.copy('scan.xyz', 'orig_scan.xyz')
    argv = sys.argv[:]
    sys.argv = 'torsiondrive-launch qc.in dihedrals.txt -g 15 30 -e qchem -v'.split(
    )
    launch.main()
    sys.argv = argv
    assert filecmp.cmp('scan.xyz', 'orig_scan.xyz')