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)
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. :)