コード例 #1
0
def h2_pyscf_equil_test():
    jobs = []

    xyz = open('structures/h2_equil.xyz', 'r')
    xyz.readline()  # Remove headers.
    xyz.readline()

    scfman = PySCFManager(name='scf',
                          path='test_h2eq_py',
                          writer=PySCFWriter({
                              'spin': 0,
                              'xyz': xyz.read()
                          }),
                          runner=PySCFRunnerPBS(queue='secondary',
                                                nn=1,
                                                np=16,
                                                walltime='0:01:00'))
    jobs.append(scfman)

    var = QWalkManager(name='var',
                       path=scfman.path,
                       writer=VarianceWriter(),
                       reader=VarianceReader(),
                       runner=RunnerPBS(nn=1,
                                        np=16,
                                        queue='secondary',
                                        walltime='0:05:00'),
                       trialfunc=SlaterJastrow(scfman, kpoint=0))

    jobs.append(var)

    lin = QWalkManager(name='linear',
                       path=scfman.path,
                       writer=LinearWriter(),
                       reader=LinearReader(),
                       runner=RunnerPBS(nn=1,
                                        np=16,
                                        queue='secondary',
                                        walltime='0:10:00'),
                       trialfunc=SlaterJastrow(slatman=scfman,
                                               jastman=var,
                                               kpoint=0))

    jobs.append(lin)

    dmc = QWalkManager(name='dmc',
                       path=scfman.path,
                       writer=DMCWriter(),
                       reader=DMCReader(),
                       runner=RunnerPBS(
                           nn=1,
                           np=16,
                           queue='secondary',
                           walltime='0:10:00',
                       ),
                       trialfunc=SlaterJastrow(slatman=scfman, jastman=lin))
    jobs.append(dmc)

    return jobs
コード例 #2
0
def h2_test_local():
  ''' Simple test that checks PySCF using PySCFRunnerLocal.'''

  # Most basic possible job.
  eqwriter=PySCFWriter({'xyz':h2})
  eqman=PySCFManager(
      name='scf',
      path='h2equil',
      writer=eqwriter,
      runner=PySCFRunnerLocal()
    )

  return [eqman]
コード例 #3
0
def h2_test_PBS():
  ''' Simple tests that check PySCF and queue interaction.'''

  # Change some options and run with PBS.
  stwriter=PySCFWriter({
      'xyz':h2stretch,
      'method':'UKS',
      'dm_generator':dm_set_spins([1,-1],[]),
    })
  stman=PySCFManager(
      name='scf',
      path='h2stretch',
      writer=stwriter,
      runner=PySCFRunnerPBS(nn=1,walltime='0:05:00',np=16,queue='secondary'),
    )

  return [stman]
コード例 #4
0
sys.path.append('..')


# # Generating a PySCF input.
# 
# One of the simplest uses of autogen is to generate input files in succinct ways and have an object store the options for posterity. 

# ### The `PySCFWriter` object
# The PySCFWriter writes input files and stores the input parameters within itself.

# In[ ]:


from autopyscf import PySCFWriter

pyscf_writer = PySCFWriter()
pyscf_writer.__dict__


# ### Importing a structure.
# The only required input (without a default) is the structure definition. 
# For molecules, this means specifying the xyz coordinates of the atoms.

# In[ ]:


# A hydrogen molecule.
h2='\n'.join([
    'H 0.0 0.0 0.0 ',
    'H 0.74 0.0 0.0 '
])
コード例 #5
0
# ### Manager for hydrogen DFT run.
# The job of this manager is to give you DFT results for the hydrogen molecule.
# It has three "subordinates" at its disposal: the writer, the reader, and the runner from the last three notebooks.
#
# First, lets set these elementary parts up.

# In[ ]:

from autopyscf import PySCFWriter, PySCFReader
from autorunner import PySCFRunnerLocal

h2 = '\n'.join(['H 0.0 0.0 0.0 ', 'H 0.74 0.0 0.0 '])

# The three components we've seen already:
pyscf_writer = PySCFWriter({'xyz': h2, 'method': 'RKS', 'dft': 'pbe,pbe'})
pyscf_reader = PySCFReader()
pyscf_runner = PySCFRunnerLocal()

# The manger needs to know what space it has to work.
# This is the `path` arguement.
# Data will be stored on disk at this location.
#
# The manager also needs to have a `name`.
# All filenames are generated based on the `name` you give it.
# You can have multiple managers with the same `path` so long as they have different `name`.

# In[ ]:

from pyscfmanager import PySCFManager
pyscf_manager = PySCFManager(path='04-scratch',
コード例 #6
0
from autorunner import PySCFRunnerLocal, RunnerLocal
from trialfunc import SlaterJastrow
from variance import VarianceWriter, VarianceReader
from pyscfmanager import PySCFManager
from qwalkmanager import QWalkManager

path = '00-scratch'

# A hydrogen molecule.
h2 = '\n'.join(['H 0.0 0.0 0.0 ', 'H 0.74 0.0 0.0 '])

# Input parameters for SCF calculation.
pyscf_writer = PySCFWriter({
    'xyz': h2,
    'dft': 'pbe,pbe',
    'spin': 0,
    'dm_generator': dm_set_spins([1, -1], []),
    'pyscf_path': sys.path
})

vmc_writer = VarianceWriter()

# Manage the PySCF job.
scfmanager = PySCFManager(name='h2_pbe',
                          path=path,
                          writer=pyscf_writer,
                          runner=PySCFRunnerLocal())

# Manage the VMC job.
voptmanager = QWalkManager(name='h2_vopt',
                           path=path,