# How to set the memory for the Gaussian 09 cubegen utility?

I am connected to a supercomputer via SSH and my cluster uses Linux Scientific, I am using the Bash (Unix Shell), I load the modules of Gaussian 09 and Gaussview. I am trying to print orbital densities for a very large tetramer system, but when I try to generate the orbitals on Gaussview, the system crashes because of insufficient memory. On the internet, I found that using the "cubegen" keyword I can generate the cube files of the orbitals. The keyword gives me the power to modify the amount of memory but I do not know how. I go to interactive mode so I can use computational resources directly and on the command shell I do the following: (I try changing Gaussian's memory's environmental variable directly at the folder I am at)

GAUSS_MEMDEF=16gb


then,

cubegen 16000000 MO=HOMO xxx.fchk xxx.cub 0 h


But it still crashes with the following message,

Out-of-memory error in routine DecCub-RdMO (IEnd=      34279201 MxCore=      33546152)
Use %mem=33MW to provide the minimum amount of memory required to complete this step.
Error termination via Lnk1e at Wed Sep 28 16:41:41 2016.
Segmentation fault (core dumped)


How can I solve this problem? How can I allocate memory to Gaussian from the command window (I do not know where Gaussian folders are located since I just load it as a module, given that the software is already installed on the system)

• First, you need to know which shell is used. You can type echo $0 to see which shell you are using. – Wildcat Sep 28 '16 at 17:33 • Anyway, I guess (from the error message), that GAUSS_MEMDEF=33000000 cubegen bla-bla should work fine, at least in Bash shell. IIRC, GAUSS_MEMDEF is set in words, so since the error message says 33MW are needed, use the value 33000000, or a bit more, say, 35000000. – Wildcat Sep 28 '16 at 17:43 • Note that cubegen nprocs kind fchkfile cubefile npts format cubefile2, so the second number should be the number of processes you'd like to use not the memory. – Martin - マーチン Sep 29 '16 at 3:40 • Btw. GAUSS_MEMDEF=16gb cubgen [...] should also work fine. It must be set immediately before the command though. As a over the thumb rule you can use 1MW are about 8MB for a 64 bit machine. – Martin - マーチン Sep 29 '16 at 3:48 • For cubegen you want to set GAUSS_UDEF:  export GAUSS_UDEF=4GB  Then you should be able to run cubegen with nprocs=1 (or whatever). – Ben McDowell Jun 27 at 20:17 ## 1 Answer By reading the information from Gaussian about cubegen, you would find out, that use of cubegen is like the following: cubegen nprocs kind fchkfile cubefile npts format cubefile2 They further elaborate about nprocs: nprocs Number of shared memory processors used for electrostatic potential calculations. A value of 0 is equivalent to 1 (it is the default). Note that this parameter must be included if other parameters are specified. Previously this parameter was used to specify the amount of memory to allocate. The GAUSS_MEMDEF environment variable should be used instead. You can read about setting GAUSS_MEMDEF on the site about the default.route file. Environment Variables All of these directives can also be set via environment variables or UNIX command line arguments. The environment variable GAUSS_XDEF provides a line equivalent to -X- in the Default.Route file. Similarly, the command line argument below specifies the same setting:$ g09 -x="value"

Similarly, all of the following have the equivalent effect:

Default.Route file: -M- 4GB
bash shell: export GAUSS_MDEF=4GB
tcsh shell: setenv GAUSS_MDEF 4GB
command line: g09 -m="4GB"

Based on that, you could try the way by exporting GAUSS_MDEF to the amount that you want, or by using the commandline. But I have no idea if the latter works with cubegen instead of g09. Let me know. :)

• The latter will not work with cubegen, I tried. Setting (export) the environment variable works very well (it affects the whole session though). It also works immediately specifying it before the command GAUSS_MEMDEF=X cubegen .... – Martin - マーチン Oct 11 '16 at 5:18