1# This Makefile is meant for use after
2# module load gsl/2.2.1+gcc-6.1
3# module load gcc/6.1
4# It also requires LAPACK
5# Module names refer to those on any of RCC's clusters at UChicago.
6
7# This makefile does NOT include GROMACS reading or MKL (sparse matrix)
8# It uses the gcc/g++ compiler (v4.9+) for C++11 support
9
10# 1) Try this first (as it is the easiest)
11NO_GRO_LIBS    = -lgsl -lgslcblas
12
13# 2) If it does not find your libraries automatically, you can specify them manually
14# # A) Set the GSL_LIB to the location of your GSL library's lib directory (must be V2+)
15GSL_LIB = /software/gsl-2.2.1-el6-x86_64+gcc-6.1/lib
16# # B) Set the LAPACK_DIR to the location of your LAPACK library base directory
17LAPACK_LIB = $(HOME)/local/lapack-3.7.0
18# # C) Uncomment this next line and then run again (after cleaning up any object files)
19#NO_GRO_LIBS    = -L$(GSL_LIB) -L$(LAPACK_LIB) -lgsl -lgslcblas -llapack -lm
20
21OPT            = -O2
22NO_GRO_LDFLAGS = $(OPT)
23NO_GRO_CFLAGS  = $(OPT)
24DIMENSION      = 3
25CC             = g++
26
27COMMON_SOURCE = control_input.h fm_output.h force_computation.h geometry.h interaction_hashing.h interaction_model.h matrix.h splines.h topology.h trajectory_input.h misc.h mscg.h
28NO_GRO_COMMON_OBJECTS = control_input.o fm_output.o force_computation.o geometry.o interaction_hashing.o interaction_model.o matrix.o splines.o topology.o trajectory_input_no_gro.o misc.o
29
30# Target executables
31# The library for LAMMPS is lib_mscg.a
32libmscg.a: mscg.o $(NO_GRO_COMMON_OBJECTS)
33	ar rvs libmscg.a *.o
34
35newfm_no_gro.x: newfm.o $(NO_GRO_COMMON_OBJECTS)
36	$(CC) $(NO_GRO_LDFLAGS) -o $@ newfm.o $(NO_GRO_COMMON_OBJECTS) -D"_exclude_gromacs=1" $(NO_GRO_LIBS)
37
38combinefm_no_gro.x: combinefm.o batch_fm_combination.o $(NO_GRO_COMMON_OBJECTS)
39	$(CC) $(NO_GRO_LDFLAGS) -o $@ combinefm.o batch_fm_combination.o $(NO_GRO_COMMON_OBJECTS) -D"_exclude_gromacs=1" $(NO_GRO_LIBS)
40
41rangefinder_no_gro.x: rangefinder.o range_finding.o $(NO_GRO_COMMON_OBJECTS)
42	$(CC) $(NO_GRO_LDFLAGS) -o $@ rangefinder.o range_finding.o $(NO_GRO_COMMON_OBJECTS) -D"_exclude_gromacs=1" $(NO_GRO_LIBS)
43
44# Target objects
45
46mscg.o: mscg.cpp $(COMMON_SOURCE) range_finding.o
47	$(CC) $(NO_GRO_CFLAGS) -c mscg.cpp -o mscg.o $(NO_GRO_LIBS)
48
49newfm.o: newfm.cpp $(COMMON_SOURCE)
50	$(CC) $(NO_GRO_CFLAGS) -c newfm.cpp
51
52combinefm.o: combinefm.cpp batch_fm_combination.h $(COMMON_SOURCE)
53	$(CC) $(NO_GRO_CFLAGS) -c combinefm.cpp
54
55rangefinder.o: rangefinder.cpp range_finding.h $(COMMON_SOURCE)
56	$(CC) $(NO_GRO_CFLAGS) -c rangefinder.cpp
57
58scalarfm.o: scalarfm.cpp $(COMMON_SOURCE)
59	$(CC) $(NO_GRO_CFLAGS) -c scalarfm.cpp
60
61batch_fm_combination.o: batch_fm_combination.cpp batch_fm_combination.h external_matrix_routines.h misc.h
62	$(CC) $(NO_GRO_CFLAGS) -c batch_fm_combination.cpp
63
64control_input.o: control_input.cpp control_input.h misc.h
65	$(CC) $(NO_GRO_CFLAGS) -c control_input.cpp
66
67geometry.o: geometry.cpp geometry.h
68	$(CC) $(NO_GRO_CFLAGS) -c geometry.cpp -DDIMENSION=$(DIMENSION)
69
70fm_output.o: fm_output.cpp fm_output.h force_computation.h misc.h
71	$(CC) $(NO_GRO_CFLAGS) -c fm_output.cpp
72
73force_computation.o: force_computation.cpp force_computation.h interaction_model.h matrix.h trajectory_input.h misc.h
74	$(CC) $(NO_GRO_CFLAGS) -c force_computation.cpp -DDIMENSION=$(DIMENSION)
75
76interaction_hashing.o: interaction_hashing.cpp interaction_hashing.h
77	$(CC) $(NO_GRO_CFLAGS) -c interaction_hashing.cpp
78
79interaction_model.o: interaction_model.cpp interaction_model.h control_input.h interaction_hashing.h topology.h misc.h
80	$(CC) $(NO_GRO_CFLAGS) -c interaction_model.cpp -DDIMENSION=$(DIMENSION)
81
82matrix.o: matrix.cpp matrix.h control_input.h external_matrix_routines.h interaction_model.h misc.h
83	$(CC) $(NO_GRO_CFLAGS) -c matrix.cpp -DDIMENSION=$(DIMENSION)
84
85misc.o: misc.cpp misc.h
86	$(CC) $(NO_GRO_CFLAGS) -c misc.cpp
87
88range_finding.o: range_finding.cpp range_finding.h force_computation.h interaction_model.h matrix.h misc.h
89	$(CC) $(NO_GRO_CFLAGS) -c range_finding.cpp -DDIMENSION=$(DIMENSION)
90
91splines.o: splines.cpp splines.h interaction_model.h
92	$(CC) $(NO_GRO_CFLAGS) -c splines.cpp -DDIMENSION=$(DIMENSION)
93
94topology.o: topology.cpp topology.h interaction_model.h misc.h
95	$(CC) $(NO_GRO_CFLAGS) -c topology.cpp -DDIMENSION=$(DIMENSION)
96
97trajectory_input_no_gro.o: trajectory_input.cpp trajectory_input.h control_input.h misc.h
98	$(CC) $(NO_GRO_CFLAGS) -c trajectory_input.cpp -D"_exclude_gromacs=1" -o trajectory_input_no_gro.o
99
100# Other convenient commands
101clean:
102	rm *.[o]
103
104all: libmscg.a newfm_no_gro.x rangefinder_no_gro.x combinefm_no_gro.x
105