1#-------------------------------------------------------------------------------
2#
3# Copyright (c) 2008-2014 The Regents of the University of California
4#
5# This file is part of Qbox
6#
7# Qbox is distributed under the terms of the GNU General Public License
8# as published by the Free Software Foundation, either version 2 of
9# the License, or (at your option) any later version.
10# See the file COPYING in the root directory of this distribution
11# or <http://www.gnu.org/licenses/>.
12#
13#-------------------------------------------------------------------------------
14include $(TARGET).mk
15#------------------------------------------------------------------------------
16#
17EXEC=qb
18TESTEXECS=testAndersonMixer testBase64Transcoder testBasis testBasisMapping \
19testCGOptimizer testChargeDensity testContext testEnergyFunctional \
20testFourierTransform testFunction3d testLDAFunctional testLineMinimizer \
21testMatrix testSample testSampleReader testSlaterDet \
22testSpecies testUnitCell testVWN testWavefunction \
23testXCFunctional testXMLGFPreprocessor test_fftw test_vext \
24testjacobi testjade
25
26OBJECTS=MPIdata.o qb.o AtomSet.o Atom.o Species.o \
27        Wavefunction.o SlaterDet.o \
28        EnergyFunctional.o SampleStepper.o \
29        Basis.o BasisMapping.o FourierTransform.o Matrix.o Context.o \
30        sinft.o spline.o UnitCell.o StructureFactor.o \
31        ChargeDensity.o UserInterface.o RunCmd.o \
32        SpeciesCmd.o SpeciesReader.o SpeciesHandler.o \
33        XCOperator.o ExchangeOperator.o Bisection.o \
34	XCPotential.o LDAFunctional.o VWNFunctional.o \
35        PBEFunctional.o BLYPFunctional.o SCANFunctional.o \
36        B3LYPFunctional.o  BHandHLYPFunctional.o \
37        NonLocalPotential.o \
38        SDWavefunctionStepper.o PSDWavefunctionStepper.o \
39        PSDAWavefunctionStepper.o JDWavefunctionStepper.o \
40        release.o qbox_xmlns.o isodate.o \
41        ConstraintSet.o Constraint.o PositionConstraint.o DistanceConstraint.o \
42        AngleConstraint.o TorsionConstraint.o \
43        ExtForceSet.o ExtForce.o AtomicExtForce.o PairExtForce.o \
44        GlobalExtForce.o \
45        uuid_str.o sampling.o \
46        LoadCmd.o SaveCmd.o \
47        ExponentialIntegral.o HSEFunctional.o \
48        RSHFunctional.o \
49        SampleReader.o StructuredDocumentHandler.o \
50        SampleHandler.o AtomSetHandler.o WavefunctionHandler.o \
51        XMLGFPreprocessor.o Base64Transcoder.o \
52        CPSampleStepper.o BOSampleStepper.o \
53        MDWavefunctionStepper.o SDIonicStepper.o MDIonicStepper.o \
54        BMDIonicStepper.o \
55        CellStepper.o SDCellStepper.o \
56        CGCellStepper.o ConfinementPotential.o Preconditioner.o \
57        AndersonMixer.o SDAIonicStepper.o CGIonicStepper.o \
58        ANDIonicStepper.o \
59        jacobi.o jade.o \
60        SampleWriter.o ComputeMLWFCmd.o MLWFTransform.o \
61        PlotCmd.o \
62        sampling.o CGOptimizer.o LineMinimizer.o \
63        ElectricEnthalpy.o PartialChargeCmd.o \
64        ExternalPotential.o ResponseCmd.o \
65        Function3d.o Function3dHandler.o \
66        SpectrumCmd.o \
67        cout0.o \
68        $(PLTOBJECTS)
69
70CXXFLAGS += -DTARGET='"$(TARGET)"'
71# to include VERSION info in release string, use:
72# env VERSION=`git describe` make
73CXXFLAGS += -DVERSION='"$(VERSION)"'
74 $(EXEC):    $(OBJECTS)
75	$(LD) $(DFLAGS) -o $@ $^ $(LDFLAGS)
76
77 tests: $(TESTEXECS)
78
79 testMPIdata: testMPIdata.o MPIdata.o
80	$(LD) $(DFLAGS) -o $@ $^ $(LDFLAGS)
81 testLineMinimizer: testLineMinimizer.o LineMinimizer.o
82	$(LD) $(DFLAGS) -o $@ $^ $(LDFLAGS)
83 testCGOptimizer: testCGOptimizer.o CGOptimizer.o LineMinimizer.o
84	$(LD) $(DFLAGS) -o $@ $^ $(LDFLAGS)
85 testAndersonMixer: testAndersonMixer.o AndersonMixer.o Context.o
86	$(LD) $(DFLAGS) -o $@ $^ $(LDFLAGS)
87 testSample: testSample.o AtomSet.o Atom.o Species.o \
88        Wavefunction.o SlaterDet.o \
89        Basis.o BasisMapping.o FourierTransform.o Matrix.o Context.o \
90        sinft.o spline.o UnitCell.o \
91        Base64Transcoder.o Constraint.o ConstraintSet.o DistanceConstraint.o \
92        AngleConstraint.o TorsionConstraint.o PositionConstraint.o \
93        ExtForceSet.o ExtForce.o PairExtForce.o AtomicExtForce.o \
94        GlobalExtForce.o sampling.o MPIdata.o cout0.o
95	$(LD) $(DFLAGS) -o $@ $^ $(LDFLAGS)
96 testSampleReader: testSampleReader.o AtomSet.o Atom.o Species.o \
97        Wavefunction.o SlaterDet.o \
98        Basis.o BasisMapping.o FourierTransform.o Matrix.o Context.o \
99        sinft.o spline.o UnitCell.o \
100        Base64Transcoder.o Constraint.o ConstraintSet.o DistanceConstraint.o \
101        AngleConstraint.o TorsionConstraint.o PositionConstraint.o \
102        ExtForceSet.o ExtForce.o PairExtForce.o AtomicExtForce.o \
103        GlobalExtForce.o sampling.o \
104        SampleReader.o StructuredDocumentHandler.o \
105        SampleHandler.o AtomSetHandler.o WavefunctionHandler.o \
106        SpeciesReader.o SpeciesHandler.o \
107        XMLGFPreprocessor.o Base64Transcoder.o MPIdata.o cout0.o
108	$(LD) $(DFLAGS) -o $@ $^ $(LDFLAGS)
109 testChargeDensity: testChargeDensity.o ChargeDensity.o \
110        Wavefunction.o SlaterDet.o \
111        Basis.o BasisMapping.o FourierTransform.o Matrix.o UnitCell.o \
112        Context.o Base64Transcoder.o MPIdata.o cout0.o
113	$(LD) $(DFLAGS) -o $@ $^ $(LDFLAGS)
114 testWavefunction: testWavefunction.o Wavefunction.o SlaterDet.o \
115        Basis.o BasisMapping.o FourierTransform.o Matrix.o UnitCell.o \
116        Context.o Base64Transcoder.o MPIdata.o cout0.o
117	$(LD) $(DFLAGS) -o $@ $^ $(LDFLAGS)
118 testEnergyFunctional: testEnergyFunctional.o EnergyFunctional.o Basis.o \
119	BasisMapping.o SlaterDet.o Matrix.o UnitCell.o Context.o \
120        FourierTransform.o \
121        Wavefunction.o Species.o Atom.o AtomSet.o StructureFactor.o \
122        ExtForceSet.o ExtForce.o PairExtForce.o AtomicExtForce.o \
123        GlobalExtForce.o \
124        ConstraintSet.o Constraint.o DistanceConstraint.o \
125        AngleConstraint.o TorsionConstraint.o PositionConstraint.o \
126        NonLocalPotential.o sampling.o Base64Transcoder.o \
127        ChargeDensity.o sinft.o spline.o \
128        XCOperator.o ExchangeOperator.o Bisection.o \
129	XCPotential.o LDAFunctional.o VWNFunctional.o \
130        PBEFunctional.o BLYPFunctional.o B3LYPFunctional.o  \
131        BHandHLYPFunctional.o SCANFunctional.o \
132	ExponentialIntegral.o HSEFunctional.o RSHFunctional.o \
133        ConfinementPotential.o ElectricEnthalpy.o MLWFTransform.o \
134        ExternalPotential.o Function3d.o Function3dHandler.o qbox_xmlns.o \
135        jade.o MPIdata.o cout0.o
136	$(LD) $(DFLAGS) -o $@ $^ $(LDFLAGS)
137 testSlaterDet: testSlaterDet.o SlaterDet.o FourierTransform.o \
138        Basis.o BasisMapping.o UnitCell.o Matrix.o Context.o \
139        Base64Transcoder.o MPIdata.o
140	$(LD) $(DFLAGS) -o $@ $^ $(LDFLAGS)
141 testBasisMapping: testBasisMapping.o BasisMapping.o Basis.o \
142        Context.o UnitCell.o
143	$(LD) $(DFLAGS) -o $@ $^ $(LDFLAGS)
144 testSpecies: testSpecies.o Species.o sinft.o spline.o \
145	SpeciesReader.o StructuredDocumentHandler.o SpeciesHandler.o
146	$(LD) $(DFLAGS) -o $@ $^ $(LDFLAGS)
147 testXCFunctional: testXCFunctional.o LDAFunctional.o PBEFunctional.o
148	$(LD) $(DFLAGS) -o $@ $^ $(LDFLAGS)
149 testLDAFunctional: testLDAFunctional.o LDAFunctional.o
150	$(LD) $(DFLAGS) -o $@ $^ $(LDFLAGS)
151 testVWN: testVWN.o VWNFunctional.o LDAFunctional.o
152	$(LD) $(DFLAGS) -o $@ $^ $(LDFLAGS)
153 testMatrix: testMatrix.o Matrix.o Context.o MPIdata.o
154	$(LD) $(DFLAGS) -o $@ $^ $(LDFLAGS)
155 testjacobi: testjacobi.o jacobi.o Matrix.o Context.o
156	$(LD) $(DFLAGS) -o $@ $^ $(LDFLAGS)
157 testjade: testjade.o jade.o Matrix.o Context.o
158	$(LD) $(DFLAGS) -o $@ $^ $(LDFLAGS)
159 testFourierTransform: testFourierTransform.o FourierTransform.o \
160        Basis.o BasisMapping.o UnitCell.o
161	$(LD) $(DFLAGS) -o $@ $^ $(LDFLAGS)
162 testUnitCell: testUnitCell.o UnitCell.o
163	$(LD) $(DFLAGS) -o $@ $^ $(LDFLAGS)
164 testBasis: testBasis.o Basis.o UnitCell.o
165	$(LD) $(DFLAGS) -o $@ $^ $(LDFLAGS)
166 testContext: testContext.o Context.o
167	$(LD) $(DFLAGS) -o $@ $^ $(LDFLAGS)
168 testXMLGFPreprocessor: testXMLGFPreprocessor.o XMLGFPreprocessor.o Context.o \
169        Base64Transcoder.o Matrix.o
170	$(LD) $(DFLAGS) -o $@ $^ $(LDFLAGS)
171 testBase64Transcoder: testBase64Transcoder.o Base64Transcoder.o
172	$(LD) $(DFLAGS) -o $@ $^ $(LDFLAGS)
173 test_fftw: test_fftw.o $(PLTOBJECTS)
174	$(LD) $(DFLAGS) -o $@ $^ $(LDFLAGS)
175 testFunction3d: testFunction3d.o Function3d.o Function3dHandler.o \
176        Base64Transcoder.o qbox_xmlns.o $(PLTOBJECTS)
177	$(LD) $(DFLAGS) -o $@ $^ $(LDFLAGS)
178 test_vext: test_vext.o Function3d.o Function3dHandler.o \
179        Base64Transcoder.o qbox_xmlns.o $(PLTOBJECTS)
180	$(LD) $(DFLAGS) -o $@ $^ $(LDFLAGS)
181#------------------------------------------------------------------------------
182# generate dependencies in makefile: use -Y to avoid library header files
183# that are likely to be different on other platforms.
184 depend :
185	makedepend -Y -D$(PLT) $(PLTFLAGS) *.cpp
186#------------------------------------------------------------------------------
187#  Cleanup object files
188 clean :
189	rm -f *.o
190	rm -f $(EXEC) $(TESTEXECS)
191#------------------------------------------------------------------------------
192 ctags :
193	ctags -o tags *.[Ch]
194#------------------------------------------------------------------------------
195# DO NOT DELETE
196