コード例 #1
0
def run_client():
    atoms = getatoms()
    atoms.calc = EMT()

    try:
        with open('client.log', 'w') as fd:
            client = SocketClient(log=fd, port=port, timeout=timeout)
            client.run(atoms, use_stress=False)
    except BrokenPipeError:
        # I think we can find a way to close sockets so as not to get an
        # error, but presently things are not like that.
        pass
コード例 #2
0
    "outfilename": "aims.out",
}

dft_settings = {
    # system settings
    "xc": "pbe",
    "spin": "none",
    "compute_forces": True,
}

# ################# Set aims calculator ######################
workdir = "aims_rundir"
port_aims = 12345
aux_settings = {"label": workdir, "use_pimd_wrapper": ("localhost", port_aims)}

calc = Aims(**usr_settings, **dft_settings, **aux_settings)

# atoms.set_calculator(calc)

# ################# Create Client ############################
# inet
port_ipi = 10200
host_ipi = "localhost"
client = SocketClient(host=host_ipi, port=port_ipi)

# ################# Create ASE SERVER ############################

with SocketIOCalculator(calc, log="socketio.log", port=port_aims) as io_calc:
    atoms.set_calculator(io_calc)
    client.run(atoms)
コード例 #3
0
from __future__ import print_function
from ase.io import read
from ase.calculators.socketio import SocketClient
from gpaw import GPAW, Mixer

# The atomic numbers are not transferred over the socket, so we have to
# read the file
atoms = read('initial.traj')
unixsocket = 'ase_server_socket'

atoms.calc = GPAW(mode='lcao',
                  basis='dzp',
                  txt='gpaw.client.txt',
                  mixer=Mixer(0.7, 7, 20.0))

client = SocketClient(unixsocket=unixsocket)

# Each step of the loop changes the atomic positions, but the generator
# yields None.
for i, _ in enumerate(client.irun(atoms, use_stress=False)):
    print('step:', i)
コード例 #4
0
ファイル: run-ase.py プロジェクト: LuoshuTheBest/gaus_ipi
from ase.io import read
from ase.calculators.cp2k import CP2K

# Define atoms object

atoms = read("init.xyz", 0)

# Set CP2K calculator #################

workdir = "CP2Ktest"
aux_settings = {"label": workdir}

if "ASE_CP2K_COMMAND" not in os.environ:
    print("$ASE_CP2K_COMMAND not defined")
    print(
        'You can try with:\n "export ASE_CP2K_COMMAND=/usr/bin/cp2k_shell" \n\n'
    )
    sys.exit()

calc = CP2K(**aux_settings)

atoms.set_calculator(calc)

# Create Client
# inet
port = 10200
host = "localhost"
client = SocketClient(host=host, port=port)

client.run(atoms)