This repository provides a local Gaussian external interface for machine-learning interatomic potentials. The current implementation is built around two scripts:
server.py: starts and manages a persistent local model server.mlpint_local.py: the script called by Gaussian through theexternal=keyword.
The workflow is:
- Start
server.pyonce. - Gaussian calls
mlpint_local.pyduring the job. mlpint_local.pyparses Gaussian's external input, sends a request to the local server, and writes energy / gradient / optional Hessian back in Gaussian's external output format.
| File | Purpose |
|---|---|
server.py |
Persistent local TCP service for loading the model and evaluating structures |
mlpint_local.py |
Gaussian external bridge script |
examples/complex_1.gjf |
Example Gaussian input using external='python ./mlpint_local.py' |
examples/complex_1.out |
Example Gaussian output showing optimization and frequency analysis |
server.py loads the ML calculator once and listens on 127.0.0.1 on an automatically assigned port. It stores the port in mlpint_server_port.json, so later Gaussian calls can reuse the same process instead of reloading the model every step.
Main server commands:
start: start the persistent serverstatus: check whether the server is runningexit: stop the server
mlpint_local.py is not a standalone optimization program. It is a bridge script used by Gaussian.
For each external call, it:
- reads Gaussian's external input file;
- parses atom count, derivative level, charge, multiplicity, element labels / atomic numbers, and coordinates;
- converts coordinates from Bohr to Angstrom;
- sends the structure to the local server through a TCP socket;
- receives energy, gradient, and optional Hessian;
- writes the result back in Gaussian external output format.
Inside server.py, the request is turned into an ase.Atoms object and evaluated with MACECalculator.
- Energy is returned in Hartree for Gaussian.
- Gradient is derived from forces and converted to Gaussian units.
- Hessian can be computed in two modes:
numeric: viaase.vibrations.Vibrationsanalytic: viacalculator.get_hessian(atoms)if the calculator supports it
This repository does not currently provide a dedicated dependency file. From the current source imports, the runtime depends at least on:
numpytorchasemace- Gaussian with support for the
externalinterface
If your environment uses different package names or installation methods, install the equivalents that provide these Python imports.
Example commands from the repository:
python ./server.py start --model CatESP --device cuda --threads 1 --hessian numeric --background --debugpython ./server.py start --model s --device cuda --threads 1 --hessian numeric --background --debugCheck status:
python ./server.py statusStop the server:
python ./server.py exit--model accepts either:
- a built-in alias such as
CatESP,s,small,m,medium,mace,mace-omol,mace-polar-m,mace-polar-l; or - an explicit model path.
If the alias-based path resolution does not match your local model layout, pass the full path explicitly with --model.
The repository includes examples/complex_1.gjf, which runs an optimization and then a frequency job through Link1.
Example route sections:
# external='python ./mlpint_local.py' opt(calcfc,nomicro,maxcycle=1000)
and later:
# freq external='python ./mlpint_local.py' geom=allcheck
A minimal pattern is:
%nprocshared=1
%mem=8GB
%chk=job.chk
# external='python ./mlpint_local.py' opt(calcfc,nomicro,maxcycle=1000)
Title
0 1
... coordinates ...
mlpint_local.py also supports these options before Gaussian's trailing arguments:
--port-file <path>: override the server port file--timeout <seconds>: response timeout (0means no timeout)--debug: enable detailed logging--debug-log <path>: write debug logs to a custom file
By default, the script looks for mlpint_server_port.json next to itself.
examples/complex_1.out shows that the interface can drive both geometry optimization and a frequency job.
Useful markers in the output are:
Optimization completed.-- Stationary point found.Normal termination of Gaussian 16
The same example also contains lines such as:
Frequencies -- -41.4314 -21.4308 -11.8975
So the sample demonstrates that the workflow runs successfully, but the final structure in that example is not a strict local minimum because the frequency analysis contains imaginary frequencies.
Start the server with --debug to write a server debug log. The server also tracks the active port file through:
mlpint_server_port.jsonmlpint_server_active.json
Enable --debug in mlpint_local.py if you need per-job diagnostics. The script writes a debug log path to Gaussian's message file.
- Server not started:
mlpint_local.pywill fail if the port file does not exist. - Model file not found:
server.pychecks the resolved model path before starting. - Unsupported analytic Hessian: use
--hessian numericif your calculator does not implementget_hessian(). - Path mismatch in Gaussian: make sure the
external='python ./mlpint_local.py'path is valid from the Gaussian working directory.
- The current implementation is a local TCP service plus a Gaussian external bridge script.