set_memory

psi4.driver.set_memory(inputval, execute=True)[source]

Function to reset the total memory allocation. Takes memory value inputval as type int, float, or str; int and float are taken literally as bytes to be set, string taken as a unit-containing value (e.g., 30 mb) which is case-insensitive. Set execute to False to interpret inputval without setting in Psi4 core.

Returns:memory_amount (float) Number of bytes of memory set
Raises:ValidationError when <500MiB or disallowed type or misformatted
Examples:
1
2
3
4
>>> # [1] Passing absolute number of bytes
>>> psi4.set_memory(600000000)
>>> psi4.get_memory()
Out[1]: 600000000L
1
2
3
4
>>> # [2] Passing memory value as string with units
>>> psi4.set_memory('30 GB')
>>> psi4.get_memory()
Out[2]: 30000000000L
1
2
3
4
5
6
7
8
9
>>> # Good examples
>>> psi4.set_memory(800000000)        # 800000000
>>> psi4.set_memory(2004088624.9)     # 2004088624
>>> psi4.set_memory(1.0e9)            # 1000000000
>>> psi4.set_memory('600 mb')         # 600000000
>>> psi4.set_memory('600.0 MiB')      # 629145600
>>> psi4.set_memory('.6 Gb')          # 600000000
>>> psi4.set_memory(' 100000000kB ')  # 100000000000
>>> psi4.set_memory('2 eb')           # 2000000000000000000
1
2
3
4
5
6
7
8
>>> # Bad examples
>>> psi4.set_memory({})         # odd type
>>> psi4.set_memory('')         # no info
>>> psi4.set_memory("8 dimms")  # unacceptable units
>>> psi4.set_memory("1e5 gb")   # string w/ exponent
>>> psi4.set_memory("5e5")      # string w/o units
>>> psi4.set_memory(2000)       # mem too small
>>> psi4.set_memory(-5e5)       # negative (and too small)