<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.csi.cuny.edu/cunyhpc/index.php?action=history&amp;feed=atom&amp;title=NWChem</id>
	<title>NWChem - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.csi.cuny.edu/cunyhpc/index.php?action=history&amp;feed=atom&amp;title=NWChem"/>
	<link rel="alternate" type="text/html" href="https://wiki.csi.cuny.edu/cunyhpc/index.php?title=NWChem&amp;action=history"/>
	<updated>2026-08-13T17:56:38Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.38.4</generator>
	<entry>
		<id>https://wiki.csi.cuny.edu/cunyhpc/index.php?title=NWChem&amp;diff=65&amp;oldid=prev</id>
		<title>James: Created page with &quot;NWChem has been developed by the Molecular Sciences Software group at the Department of Energy&#039;s EMSL. The software is available on PENZIAS and ANDY. On both servers the module for NWChem must be loaded &quot;prior&quot; to run a job with the command:  &lt;pre&gt; module load nwchem &lt;/pre&gt;  The above command will load the &quot;default&quot; version of NWChem.     ====Performance Considerations====  The NWChem  is GPU enabled meaning it supports GPU so the package can be used both in CPU or in &quot;h...&quot;</title>
		<link rel="alternate" type="text/html" href="https://wiki.csi.cuny.edu/cunyhpc/index.php?title=NWChem&amp;diff=65&amp;oldid=prev"/>
		<updated>2022-10-20T18:55:35Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;NWChem has been developed by the Molecular Sciences Software group at the Department of Energy&amp;#039;s EMSL. The software is available on PENZIAS and ANDY. On both servers the module for NWChem must be loaded &amp;quot;prior&amp;quot; to run a job with the command:  &amp;lt;pre&amp;gt; module load nwchem &amp;lt;/pre&amp;gt;  The above command will load the &amp;quot;default&amp;quot; version of NWChem.     ====Performance Considerations====  The NWChem  is GPU enabled meaning it supports GPU so the package can be used both in CPU or in &amp;quot;h...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;NWChem has been developed by the Molecular Sciences Software group at the Department of Energy&amp;#039;s EMSL. The software is available on PENZIAS and ANDY. On both servers the module for NWChem must be loaded &amp;quot;prior&amp;quot; to run a job with the command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
module load nwchem&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The above command will load the &amp;quot;default&amp;quot; version of NWChem.   &lt;br /&gt;
&lt;br /&gt;
====Performance Considerations====&lt;br /&gt;
&lt;br /&gt;
The NWChem  is GPU enabled meaning it supports GPU so the package can be used both in CPU or in &amp;quot;hybrid&amp;quot; CPU-GPU mode. ANDY lacks GPU so the CPU only mode is possible there. On PENZIAS however,   NWChem can be used on both CPU or CPU-GPU mode.  On other hand, because ANDY has slower interconnect is recommend to use &amp;#039;&amp;#039;&amp;#039;1&amp;#039;&amp;#039;&amp;#039; core per chunk when run NWChem jobs on ANDY. The interconnect at PENZIAS allows the full utilization of the nodes i.e. the maximum number of cores per chunk is &amp;#039;&amp;#039;&amp;#039;12&amp;#039;&amp;#039;&amp;#039;. However users must consult the wiki pages http://wiki.csi.cuny.edu/cunyhpc/index.php/Running_jobs for discussion about how to run a job on a cluster. Keeping in mind the differences in interconnect and lack of GPU on ANDY it is &amp;#039;&amp;#039;&amp;#039;strongly&amp;#039;&amp;#039;&amp;#039; recommend that users utilize NWChem on PENZIAS in CPU-GPU mode. &lt;br /&gt;
&lt;br /&gt;
====NWChem input files====&lt;br /&gt;
&lt;br /&gt;
The ability to run and performance of a run depends very much on a proper settings of start up directives in NWChem input files.  For instance one particular directive - &amp;#039;&amp;#039;&amp;#039;memory&amp;#039;&amp;#039;&amp;#039; - allows the user to specify the amount of memory &amp;#039;&amp;#039;&amp;#039;PER PROCESSOR CORE&amp;#039;&amp;#039;&amp;#039; that NWChem can use for the job in. If this directive is omitted in input file, the NWChem will use the default setting which currently is only &amp;#039;&amp;#039;&amp;#039;400MB&amp;#039;&amp;#039;&amp;#039;. In NWChem there are three distinct regions of memory: &amp;#039;&amp;#039;&amp;#039;stack, heap, and global&amp;#039;&amp;#039;&amp;#039;. On PENZIAS (and on all distributed memory systems) all 3  types of memory compete for the same pool i.e. the memory has total size of &amp;#039;&amp;#039;&amp;#039;stack+heap+global.&amp;#039;&amp;#039;&amp;#039; The default partition is 25% heap, 25% stack, and 50% global, thus 4096mb will be partitioned as 1024 MB for stack, 1024 MB for heap and 2048 MB for global. In the following example first 2 lines are equivalent and they will allocate &amp;#039;&amp;#039;&amp;#039;total available&amp;#039;&amp;#039;&amp;#039; per core memory on PENZIAS node and will use default partitioning. The third line does the same but it will change the partition by allocating 75% of the total memory as a global one.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
memory 3686 mb&lt;br /&gt;
memory total 3686 mb&lt;br /&gt;
memory total 3686 global 2764 mb&lt;br /&gt;
&amp;lt;/pre&amp;gt;  &lt;br /&gt;
&lt;br /&gt;
NWChem recognizes the following memory units:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
real &lt;br /&gt;
double&lt;br /&gt;
integer&lt;br /&gt;
byte&lt;br /&gt;
kb (kilobyte)&lt;br /&gt;
mb (megabyte)&lt;br /&gt;
mw (megawords - 8 bytes)&lt;br /&gt;
&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
For details on the content and structure of each section of the NWChem input deck users should consult the NWChem Users Manual at http://www.emsl.pnl.gov/capabilities/computing/nwchem/docs/usermanual.pdf. A sample NWChem input file which does SCF calculation on water with 6-31g* basis set is shown here:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
echo&lt;br /&gt;
start water2&lt;br /&gt;
title &amp;quot;an example simple water calculation&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# The memory options are system specific see below &lt;br /&gt;
&lt;br /&gt;
memory total   .... mb global .... mb&lt;br /&gt;
&lt;br /&gt;
geometry units au&lt;br /&gt;
 O 0       0              0&lt;br /&gt;
 H 0       1.430    -1.107&lt;br /&gt;
 H 0     -1.430    -1.107&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
basis&lt;br /&gt;
  O library 6-31g*&lt;br /&gt;
  H library 6-31g*&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
task scf gradient&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
If the run has to be done on parallel and on PENZIAS, the standard (and maximum) per-core quantity of memory available on a node along with a portion of it&lt;br /&gt;
used by NWChem Global Arrays computing model should not exceed 3686mb per core. Thus the memory line for parallel runs on PENZIAS should look like: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
memory total 3686 mb global 2764 mb&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
on ANDY it would be &amp;#039;memory total 2880 mb global 2160 mb&amp;#039;. [[Single core runs]] on PENZIAS require different settings.  &lt;br /&gt;
&lt;br /&gt;
====Using NWChem in CPU only mode ==== &lt;br /&gt;
&lt;br /&gt;
A SLURM batch submit script to run above example on &amp;#039;&amp;#039;&amp;#039;16 processors&amp;#039;&amp;#039;&amp;#039; (cores) on PENZIAS. Note that on PENZIAS the main que is called production. &lt;br /&gt;
In this script the maximal values for memory (total and global) are added to above example automatically. However these values may not be optimal for a &lt;br /&gt;
particular molecular system, thus users should compare the obtained performance among several memory set ups  in order to find the optimal values for &lt;br /&gt;
a particular molecular system. &lt;br /&gt;
  &lt;br /&gt;
&amp;lt;pre&amp;gt; &lt;br /&gt;
#!/bin/csh&lt;br /&gt;
#SBATCH --partition production&lt;br /&gt;
#SBATCH --job-name watertest&lt;br /&gt;
#SBATCH --nodes=16&lt;br /&gt;
#SBATCH --ntasks=1&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;This job&amp;#039;s process 0 host is: &amp;quot; `hostname`; echo &amp;quot;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Must explicitly change to your working directory under SLURM&lt;br /&gt;
&lt;br /&gt;
cd $SLURM_SUBMIT_DIR&lt;br /&gt;
&lt;br /&gt;
# Set up NWCHEM environment, permanent, and scratch directory&lt;br /&gt;
# Do not delete/modify the following 4 lines.&lt;br /&gt;
&lt;br /&gt;
setenv NWCHEM_ROOT /share/apps/nwchem/6.5&lt;br /&gt;
setenv PERMANENT_DIR $SLURM_SUBMIT_DIR&lt;br /&gt;
setenv MY_SCRDIR `whoami;date &amp;#039;+%m.%d.%y_%H:%M:%S&amp;#039;`&lt;br /&gt;
setenv MY_SCRDIR `echo $MY_SCRDIR | sed -e &amp;#039;s; ;_;&amp;#039;`&lt;br /&gt;
&lt;br /&gt;
#Edit following 2 lines to match your input and output file.&lt;br /&gt;
&lt;br /&gt;
set INPUT_FILE=&amp;quot;h2o.nw&amp;quot;&lt;br /&gt;
set  OUTPUT_FILE=&amp;quot;h2o.out&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Edit following 2 lines in order to adjust the optimal memory for your system&lt;br /&gt;
set MEMORY_GLBL = 2764&lt;br /&gt;
set MEMORY_TTL = 3686&lt;br /&gt;
&lt;br /&gt;
# Do not edit the following 7 lines&lt;br /&gt;
set RUN_FILE = &amp;quot;runner.nw&amp;quot;&lt;br /&gt;
cp ${INPUT_FILE} ${RUN_FILE}&lt;br /&gt;
setenv SCRATCH_DIR /state/partition1/nw6.3_scr/${MY_SCRDIR}_$$&lt;br /&gt;
mkdir -p $SCRATCH_DIR&lt;br /&gt;
printf &amp;#039;%s\t%s\n&amp;#039; &amp;#039;scratch_dir&amp;#039;   $SCRATCH_DIR &amp;gt;&amp;gt; runner.nw&lt;br /&gt;
printf &amp;#039;%s\t%s\n&amp;#039; &amp;#039;permanent_dir&amp;#039; $PERMANENT_DIR &amp;gt;&amp;gt; runner.nw&lt;br /&gt;
printf &amp;#039;%s%s%s%s%s%s\n&amp;#039; &amp;#039;memory   &amp;#039; &amp;#039;total   &amp;#039; $MEMORY_TTL &amp;#039;  global   &amp;#039; $MEMORY_GLBL &amp;#039;  mb&amp;#039; &amp;gt;&amp;gt; runner.nw&lt;br /&gt;
&lt;br /&gt;
# Starts NWCHEM job. Adjust &amp;#039;&amp;#039;&amp;#039;only&amp;#039;&amp;#039;&amp;#039; the number of CPU requested. &lt;br /&gt;
# Do not remove/modify $RUN_FILE or $OUTPUT_FILE&lt;br /&gt;
&lt;br /&gt;
mpirun -np 16 nwchem ${RUN_FILE} &amp;gt; ${OUTPUT_FILE}&lt;br /&gt;
&lt;br /&gt;
# Clean up scratch and temporary files. Do  not remove following 2 lines. &lt;br /&gt;
&lt;br /&gt;
/bin/rm -r $SCRATCH_DIR&lt;br /&gt;
/bin/rm -r $RUN_FILE&lt;br /&gt;
&lt;br /&gt;
echo &amp;#039;Job is done!&amp;#039;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Please consult the sections on the SLURM Pro Batch scheduling system for information on how to modify this &lt;br /&gt;
sample deck for different processor counts and about the meaning of each of the SLURM script lines.&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
On PENZIAS in order to utilize all available memory and depend on concrete studied system sometimes is better to use the below SLURM construction.   &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#SBATCH --nodes=8&lt;br /&gt;
#SBATCH --ntasks=2&lt;br /&gt;
#SBATCH --mem=3686&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In order to run on 128 cores on PENZIAS the line should look like:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#SBATCH --nodes=16&lt;br /&gt;
#SBATCH --ntasks=8&lt;br /&gt;
#SBATCH --mem=3686&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Please do not forget to adjust memory requirements in above SLURM script file according to your particular molecular system requirements. In particular that means to adjust values of MEMORY_TTL and MEMORY_GLBL variables. Remember that performance depends on how memory is allocated as well so try few allocation schemes before pick the best one for your job. For instance for  some small molecular systems sometimes it is possible to gain performance by reducing memory and keep job in a single node.  &lt;br /&gt;
&lt;br /&gt;
The optimal number of cores also depend on studied molecular system. There is no such thing like &amp;quot;one fits all&amp;quot;. Users can find the optimal number of processor cores by starting with some small number i.e. 4 or 8 and double the number of cores for each consecutive run. Repeat&lt;br /&gt;
the process till no significant improvement in performance is recorded in 2 follow up runs. Further increase of cpu cores&lt;br /&gt;
should be avoided.&lt;br /&gt;
&lt;br /&gt;
====Final Remarks====&lt;br /&gt;
&lt;br /&gt;
To get their NWChem jobs to run each user will need to &amp;#039;&amp;#039;&amp;#039;copy or create a symbolic link&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
to a &amp;quot;.nwchemrc&amp;quot; file in their $HOME directory to the site specific &amp;quot;default.nwchemrc&amp;quot; file&lt;br /&gt;
located in:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/share/apps/nwchem/default/data/&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Symbolic link can be created with a command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ln -s /share/apps/nwchem/default/data/default.nwchemrc $HOME/.nwchemrc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Users may also check the [[Q/A]] section of this document for common mistakes and their solution.&lt;/div&gt;</summary>
		<author><name>James</name></author>
	</entry>
</feed>