Skip to content

Commit

Permalink
Switch MSVC to LLVM compiler for Windows builds (#1264)
Browse files Browse the repository at this point in the history
* Switch MSVC to LLVM compiler

* Fix compilation of core

* Fix compilation of adc

* Fix compilation of ccdensity

* Fix compilation of ccenergy

* Fix compilation of ccresponse

* Fix compilation of cctriples

* Fix compilation of libfock

* Fix compilation of libmints

* Fix compilation of libqt

* Fix compilation of libtrans

* Fix compilation of mrcc

* Fix compilation of occ

* Fix compilation of optking

* Fix compilation of psimrcc

* Update passing Windows tests
  • Loading branch information
raimis authored and andysim committed Oct 1, 2018
1 parent c9be896 commit 6d43493
Show file tree
Hide file tree
Showing 27 changed files with 87 additions and 54 deletions.
14 changes: 5 additions & 9 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ install:
- conda config --set always_yes yes
- conda create --channel conda-forge
--name %CONDA_ENV%
cmake
deepdiff
intel-openmp=2018.0.3
mkl-devel=2018.0.3
Expand All @@ -27,19 +28,16 @@ install:
- conda list

before_build:
- call "C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\SetEnv.cmd" /x64
- call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" x86_amd64
- set SOURCE_FOLDER=%APPVEYOR_BUILD_FOLDER%
- set BUILD_FOLDER=%SOURCE_FOLDER%\build
- set INSTALL_FOLDER=%SOURCE_FOLDER%\install
- mkdir %BUILD_FOLDER% & cd %BUILD_FOLDER%
# TODO fix OpenMP
- cmake -G Ninja
-DCMAKE_BUILD_TYPE=%CONFIGURATION%
-DCMAKE_INSTALL_PREFIX=%INSTALL_FOLDER%
-DCMAKE_C_FLAGS="/wd4018 /wd4101 /wd4996"
-DCMAKE_CXX_FLAGS="/wd4251 /wd4267"
-DENABLE_OPENMP=OFF
-DCMAKE_C_COMPILER=clang-cl
-DCMAKE_CXX_COMPILER=clang-cl
-DENABLE_XHOST=OFF
-DMAX_AM_ERI=5
%SOURCE_FOLDER%
Expand Down Expand Up @@ -74,11 +72,9 @@ test_script:
#
# Failling tests:
# ci-property
# sapt-dft1 sapt1 tu5-sapt
# pywrap-db1
#
- ctest --build-config %CONFIGURATION%
--exclude-regex "^(cbs-delta-energy|cbs-xtpl-gradient|dfmp2-ecp|fnocc2|mp2-module|scf5|psimrcc-sp1|pywrap-all|pywrap-cbs1|ci-property|pywrap-db1|sapt-dft1|sapt1|tu5-sapt)$"
--exclude-regex "^(cbs-delta-energy|cbs-xtpl-gradient|dfmp2-ecp|fnocc2|mp2-module|scf5|psimrcc-sp1|pywrap-all|pywrap-cbs1|ci-property)$"
--label-regex quick
--output-on-failure
--parallel %NUMBER_OF_PROCESSORS%
Expand All @@ -87,7 +83,7 @@ after_test:
# Run failling tests, but their results are ignored
# TODO fix the tests
- ctest --build-config %CONFIGURATION%
--tests-regex "^(ci-property|pywrap-db1|sapt-dft1|sapt1|tu5-sapt)$"
--tests-regex "^(ci-property)$"
--output-on-failure
--parallel %NUMBER_OF_PROCESSORS% & exit 0
- python %INSTALL_FOLDER%\bin\psi4 --test & exit 0
Expand Down
12 changes: 8 additions & 4 deletions psi4/src/core.cc
Original file line number Diff line number Diff line change
Expand Up @@ -224,14 +224,16 @@ void py_reopen_outfile() {
if (outfile_name == "stdout") {
// outfile = stdout;
} else {
outfile = std::make_shared<PsiOutStream>(outfile_name, std::ostream::app);
auto mode = std::ostream::app;
outfile = std::make_shared<PsiOutStream>(outfile_name, mode);
if (!outfile) throw PSIEXCEPTION("Psi4: Unable to reopen output file.");
}
}

void py_be_quiet() {
py_close_outfile();
outfile = std::make_shared<PsiOutStream>("/dev/null", std::ostream::app);
auto mode = std::ostream::app;
outfile = std::make_shared<PsiOutStream>("/dev/null", mode);
if (!outfile) throw PSIEXCEPTION("Psi4: Unable to redirect output to /dev/null.");
}

Expand Down Expand Up @@ -1219,11 +1221,13 @@ PYBIND11_MODULE(core, core) {
core.def("opt_clean", py_psi_opt_clean, "Cleans up the optimizer's scratch files.");
core.def("get_options", py_psi_get_options, py::return_value_policy::reference, "Get options");
core.def("set_output_file", [](const std::string ofname) {
outfile = std::make_shared<PsiOutStream>(ofname, std::ostream::trunc);
auto mode = std::ostream::trunc;
outfile = std::make_shared<PsiOutStream>(ofname, mode);
outfile_name = ofname;
});
core.def("set_output_file", [](const std::string ofname, bool append) {
outfile = std::make_shared<PsiOutStream>(ofname, (append ? std::ostream::app : std::ostream::trunc));
auto mode = append ? std::ostream::app : std::ostream::trunc;
outfile = std::make_shared<PsiOutStream>(ofname, mode);
outfile_name = ofname;
});
core.def("get_output_file", []() { return outfile_name; });
Expand Down
3 changes: 2 additions & 1 deletion psi4/src/psi4/adc/diagonalize.cc
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,8 @@ void ADCWfn::rhf_diagonalize(int irrep, int num_root, bool first, double omega_i
for (int I = 0; I < rpi_[irrep]; I++) lambda_o[I] = omega_guess_->get(irrep, I);
shift_denom4(irrep, omega_in);

auto printer = std::make_shared<PsiOutStream>("iter.dat", std::ostream::app);
auto mode = std::ostream::app;
auto printer = std::make_shared<PsiOutStream>("iter.dat", mode);

timer_on("SEM");
while (converged < rpi_[irrep] && iter < sem_max_) {
Expand Down
6 changes: 4 additions & 2 deletions psi4/src/psi4/cc/ccdensity/densgrid_RHF.cc
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,8 @@ void densgrid_RHF(std::shared_ptr<Wavefunction> wfn, Options &options) {
int zsteps = (int)((zmax - zmin) / step_size + 1);

// Prep .dx file
auto printer = std::make_shared<PsiOutStream>("density.dx", std::ostream::trunc);
auto mode = std::ostream::trunc;
auto printer = std::make_shared<PsiOutStream>("density.dx", mode);
printer->Printf("# Output from Psi4 calculation\n");
printer->Printf("# Electronic density (in e/ang^3) for: \n");
printer->Printf("object 1 class gridpositions counts %d %d %d\n", xsteps, ysteps, zsteps);
Expand Down Expand Up @@ -255,7 +256,8 @@ void densgrid_RHF(std::shared_ptr<Wavefunction> wfn, Options &options) {
printer->Printf("\n");
printer->Printf("end");

auto printer2 = std::make_shared<PsiOutStream>("molecule.dx", std::ostream::trunc);
auto mode2 = std::ostream::trunc;
auto printer2 = std::make_shared<PsiOutStream>("molecule.dx", mode2);

printer2->Printf("%d\n", molecule->natom());
printer2->Printf("Initial atomic coordinates\n");
Expand Down
6 changes: 4 additions & 2 deletions psi4/src/psi4/cc/ccenergy/analyze.cc
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@ void CCEnergyWavefunction::analyze() {
max = 9;
min = 0;
width = (max - min) / (num_div);
auto printer = std::make_shared<PsiOutStream>("tamps.dat", std::ostream::app);
auto mode = std::ostream::app;
auto printer = std::make_shared<PsiOutStream>("tamps.dat", mode);
amp_array = init_array(num_div);

nvir = moinfo_.virtpi[0];
Expand Down Expand Up @@ -111,7 +112,8 @@ void CCEnergyWavefunction::analyze() {
max = 2;
min = -5;
width = (max - min) / (num_div);
auto printer2 = std::make_shared<PsiOutStream>("t1amps.dat", std::ostream::app);
auto mode2 = std::ostream::app;
auto printer2 = std::make_shared<PsiOutStream>("t1amps.dat", mode2);
amp_array = init_array(num_div);

global_dpd_->file2_init(&T1, PSIF_CC_OEI, 0, 0, 1, "tIA");
Expand Down
6 changes: 4 additions & 2 deletions psi4/src/psi4/cc/ccresponse/analyze.cc
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@ void analyze(const char *pert, int irrep, double omega) {
width = (max - min) / (num_div);

sprintf(lbl, "X_%s_%5.3f", pert, omega);
auto printer = std::make_shared<PsiOutStream>(lbl, std::ostream::app);
auto mode = std::ostream::app;
auto printer = std::make_shared<PsiOutStream>(lbl, mode);
// ffile(&efile, lbl, 1);
amp_array = init_array(num_div);

Expand Down Expand Up @@ -124,7 +125,8 @@ void analyze(const char *pert, int irrep, double omega) {
width = (max - min) / (num_div);

sprintf(lbl, "X1_%s_%5.3f", pert, omega);
auto printer2 = std::make_shared<PsiOutStream>(lbl, std::ostream::app);
auto mode2 = std::ostream::app;
auto printer2 = std::make_shared<PsiOutStream>(lbl, mode2);
// ffile(&efile, lbl, 1);
amp_array = init_array(num_div);

Expand Down
3 changes: 2 additions & 1 deletion psi4/src/psi4/cc/ccresponse/scatter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,8 @@ void scatter(std::shared_ptr<Molecule> molecule, Options &options, double step,

// Write Out the Tensor Derivatives to File tender.dat //
// Outfile derivs("tender.dat", "w");
auto derivs = std::make_shared<PsiOutStream>("tender.dat", std::ostream::trunc);
auto mode = std::ostream::trunc;
auto derivs = std::make_shared<PsiOutStream>("tender.dat", mode);
derivs->Printf("******************************************************\n");
derivs->Printf("********** **********\n");
derivs->Printf("********** TENSOR DERIVATIVES **********\n");
Expand Down
3 changes: 2 additions & 1 deletion psi4/src/psi4/cc/cctriples/ET_RHF.cc
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,8 @@ double ET_RHF() {
global_dpd_->buf4_mat_irrep_init(&Dints, h);
global_dpd_->buf4_mat_irrep_rd(&Dints, h);
}
auto printer = std::make_shared<PsiOutStream>("ijk.dat", std::ostream::trunc);
auto mode = std::ostream::trunc;
auto printer = std::make_shared<PsiOutStream>("ijk.dat", mode);
// ffile(&ijkfile,"ijk.dat", 0);

/* each thread gets its own F buffer to assign memory and read blocks
Expand Down
3 changes: 2 additions & 1 deletion psi4/src/psi4/cc/cctriples/ET_UHF_AAA.cc
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,8 @@ double ET_UHF_AAA() {
}
}
}
auto printer = std::make_shared<PsiOutStream>("ijk.dat", std::ostream::trunc);
auto mode = std::ostream::trunc;
auto printer = std::make_shared<PsiOutStream>("ijk.dat", mode);
// ffile(&ijkfile,"ijk.dat", 0);
printer->Printf("Spin Case: AAA\n");
printer->Printf("Number of IJK combintions: %d\n", nijk);
Expand Down
3 changes: 2 additions & 1 deletion psi4/src/psi4/cc/cctriples/ET_UHF_AAB.cc
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,8 @@ double ET_UHF_AAB() {
}
}
}
auto printer = std::make_shared<PsiOutStream>("ijk.dat", std::ostream::trunc);
auto mode = std::ostream::trunc;
auto printer = std::make_shared<PsiOutStream>("ijk.dat", mode);
// ffile(&ijkfile,"ijk.dat",0);
printer->Printf("Spin Case: AAB\n");
printer->Printf("Number of IJK combintions: %d\n", nijk);
Expand Down
3 changes: 2 additions & 1 deletion psi4/src/psi4/cc/cctriples/ET_UHF_ABB.cc
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,8 @@ double ET_UHF_ABB() {
}
}
}
auto printer = std::make_shared<PsiOutStream>("ijk.dat", std::ostream::trunc);
auto mode = std::ostream::trunc;
auto printer = std::make_shared<PsiOutStream>("ijk.dat", mode);
// ffile(&ijkfile,"ijk.dat",0);
printer->Printf("Spin Case: ABB\n");
printer->Printf("Number of IJK combintions: %d\n", nijk);
Expand Down
3 changes: 2 additions & 1 deletion psi4/src/psi4/cc/cctriples/ET_UHF_BBB.cc
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,8 @@ double ET_UHF_BBB() {
}
}
}
auto printer = std::make_shared<PsiOutStream>("ijk.dat", std::ostream::trunc);
auto mode = std::ostream::trunc;
auto printer = std::make_shared<PsiOutStream>("ijk.dat", mode);
// ffile(&ijkfile,"ijk.dat",0);
printer->Printf("Spin Case: BBB\n");
printer->Printf("Number of IJK combintions: %d\n", nijk);
Expand Down
3 changes: 2 additions & 1 deletion psi4/src/psi4/cc/cctriples/EaT_RHF.cc
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,8 @@ double EaT_RHF() {
global_dpd_->buf4_mat_irrep_init(&Dints, h);
global_dpd_->buf4_mat_irrep_rd(&Dints, h);
}
auto printer = std::make_shared<PsiOutStream>("ijk.dat", std::ostream::trunc);
auto mode = std::ostream::trunc;
auto printer = std::make_shared<PsiOutStream>("ijk.dat", mode);
// ffile(&ijkfile,"ijk.dat", 0);

/* each thread gets its own F buffer to assign memory and read blocks
Expand Down
3 changes: 2 additions & 1 deletion psi4/src/psi4/libfock/DirectJK.cc
Original file line number Diff line number Diff line change
Expand Up @@ -578,7 +578,8 @@ void DirectJK::build_JK(std::vector<std::shared_ptr<TwoBodyAOInt> >& ints,
}

if (bench_) {
auto printer = std::make_shared<PsiOutStream>("bench.dat",std::ostream::app);
auto mode = std::ostream::app;
auto printer = std::make_shared<PsiOutStream>("bench.dat", mode);
size_t ntri = nshell * (nshell + 1L) / 2L;
size_t possible_shells = ntri * (ntri + 1L) / 2L;
printer->Printf( "Computed %20zu Shell Quartets out of %20zu, (%11.3E ratio)\n", computed_shells, possible_shells, computed_shells / (double) possible_shells);
Expand Down
9 changes: 6 additions & 3 deletions psi4/src/psi4/libfock/cubature.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4448,7 +4448,8 @@ void OctreeGridBlocker::block()
int index = 0;
int unique_block = 0;
if (bench_) {
printer=std::make_shared<PsiOutStream>("finished_blocks.dat",std::ostream::app);
auto mode = std::ostream::app;
printer = std::make_shared<PsiOutStream>("finished_blocks.dat", mode);
//outfile->Printf(fh_blocks, "# %4s %15s %15s %15s %15s\n", "ID", "X", "Y", "Z", "W");
}
for (size_t A = 0; A < completed_tree.size(); A++) {
Expand Down Expand Up @@ -4487,7 +4488,8 @@ void OctreeGridBlocker::block()
}

if (bench_) {
printer=std::make_shared<PsiOutStream>("extents.dat",std::ostream::app);
auto mode = std::ostream::app;
printer = std::make_shared<PsiOutStream>("extents.dat", mode);
//FILE* fh_extents = fopen("extents.dat","w");
//outfile->Printf(fh_extents," %4s %15s %15s %15s %15s\n","ID","X","Y","Z","R");
std::shared_ptr<BasisSet> basis = extents_->basis();
Expand All @@ -4504,7 +4506,8 @@ void OctreeGridBlocker::block()
for (int i = 2; i < 20; i++) {
std::stringstream ss;
ss << "extents" << i << ".dat";
printer=std::make_shared<PsiOutStream>(ss.str(),std::ostream::app);
auto mode = std::ostream::app;
printer = std::make_shared<PsiOutStream>(ss.str(), mode);
//FILE* fh_extents = fopen(ss.str().c_str(),"w");
//outfile->Printf(fh_extents," %4s %15s %15s %15s %15s\n","ID","X","Y","Z","R");
extents_->set_delta(pow(10.0,-i));
Expand Down
3 changes: 2 additions & 1 deletion psi4/src/psi4/libmints/benchmark.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1559,7 +1559,8 @@ void benchmark_math(double min_time) {
ops.push_back("fabs");

// In case the compiler gets awesome
auto printer = std::make_shared<PsiOutStream>("dump.dat", std::ostream::trunc);
auto mode = std::ostream::trunc;
auto printer = std::make_shared<PsiOutStream>("dump.dat", mode);

#define LOOP_SIZE 10000
#define UNROLL_SIZE 10
Expand Down
4 changes: 2 additions & 2 deletions psi4/src/psi4/libmints/matrix.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2841,8 +2841,8 @@ void Matrix::save(const std::string &filename, bool append, bool saveLowerTriang
if (symmetry_ && saveLowerTriangle)
throw PSIEXCEPTION("Matrix::save: Unable to save lower triangle for non-totally symmetric matrix.");

std::shared_ptr<psi::PsiOutStream> printer =
std::make_shared<PsiOutStream>(filename, (append ? std::ostream::app : std::ostream::trunc));
auto mode = append ? std::ostream::app : std::ostream::trunc;
auto printer = std::make_shared<PsiOutStream>(filename, mode);
printer->Printf("%s\n", name_.c_str());
printer->Printf("symmetry %d\n", symmetry_);

Expand Down
3 changes: 2 additions & 1 deletion psi4/src/psi4/libmints/molecule.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1246,7 +1246,8 @@ void Molecule::print_out_of_planes() const {
void Molecule::save_xyz_file(const std::string &filename, bool save_ghosts) const {
double factor = (units_ == Angstrom ? 1.0 : pc_bohr2angstroms);

auto printer = std::make_shared<PsiOutStream>(filename, std::ostream::trunc);
auto mode = std::ostream::trunc;
auto printer = std::make_shared<PsiOutStream>(filename, mode);

int N = natom();
if (!save_ghosts) {
Expand Down
6 changes: 4 additions & 2 deletions psi4/src/psi4/libmints/writer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ MoldenWriter::MoldenWriter(std::shared_ptr<Wavefunction> wavefunction) : wavefun
void MoldenWriter::write(const std::string &filename, std::shared_ptr<Matrix> Ca, std::shared_ptr<Matrix> Cb,
std::shared_ptr<Vector> Ea, std::shared_ptr<Vector> Eb, std::shared_ptr<Vector> OccA,
std::shared_ptr<Vector> OccB, bool dovirtual) {
auto printer = std::make_shared<PsiOutStream>(filename, std::ostream::app);
auto mode = std::ostream::app;
auto printer = std::make_shared<PsiOutStream>(filename, mode);

int atom;

Expand Down Expand Up @@ -598,7 +599,8 @@ void NBOWriter::write(const std::string &filename) {

MintsHelper helper(wavefunction_->basisset(), wavefunction_->options(), 0);
SharedMatrix sotoao = helper.petite_list()->sotoao();
auto printer = std::make_shared<PsiOutStream>(filename, std::ostream::app);
auto mode = std::ostream::app;
auto printer = std::make_shared<PsiOutStream>(filename, mode);

// Get the basis set and molecule from the wavefuntion
BasisSet &basisset = *wavefunction_->basisset().get();
Expand Down
3 changes: 2 additions & 1 deletion psi4/src/psi4/libqt/dx_write.cc
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,8 @@ void dx_write(std::shared_ptr<Wavefunction> wfn, Options &options, double **D) {
int zsteps = (int)((zmax - zmin) / step_size + 1);

// Prep .dx file
auto printer = std::make_shared<PsiOutStream>("density.dx", std::ostream::app);
auto mode = std::ostream::app;
auto printer = std::make_shared<PsiOutStream>("density.dx", mode);
printer->Printf("# Output from Psi4 calculation\n");
printer->Printf("# Electronic density (in e/ang^3) for: \n");
printer->Printf("object 1 class gridpositions counts %d %d %d\n", xsteps, ysteps, zsteps);
Expand Down
3 changes: 2 additions & 1 deletion psi4/src/psi4/libqt/timer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1010,7 +1010,8 @@ void timer_done(void) {
gethostname(host, 40);

/* Dump the timing data to timer.dat and free the timers */
auto printer = std::make_shared<PsiOutStream>("timer.dat", std::ostream::app);
auto mode = std::ostream::app;
auto printer = std::make_shared<PsiOutStream>("timer.dat", mode);
printer->Printf("\n");
printer->Printf("Host: %s\n", host);
free(host);
Expand Down
3 changes: 2 additions & 1 deletion psi4/src/psi4/libtrans/fcidump_helper.cc
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ void fcidump_tei_helper(int nirrep, bool restricted, std::map<std::string, int>
std::string fname) {
outfile->Printf("Writing TEI integrals in FCIDUMP format to " + fname + "\n");
// Append to the file created by the fcidump function Python-side
auto intdump = std::make_shared<PsiOutStream>(fname.c_str(), std::ostream::app);
auto mode = std::ostream::app;
auto intdump = std::make_shared<PsiOutStream>(fname.c_str(), mode);

// Use the IntegralTransform object's DPD instance, for convenience
dpd_set_default(DPD_info["instance_id"]);
Expand Down
6 changes: 4 additions & 2 deletions psi4/src/psi4/mrcc/mrcc.cc
Original file line number Diff line number Diff line change
Expand Up @@ -694,7 +694,8 @@ PsiReturnType mrcc_generate_input(SharedWavefunction ref_wfn, Options &options,

outfile->Printf("\n");
// FILE* fort55 = fopen("fort.55", "w");
auto printer = std::make_shared<PsiOutStream>("fort.55", std::ostream::trunc);
auto mode = std::ostream::trunc;
auto printer = std::make_shared<PsiOutStream>("fort.55", mode);
printer->Printf("%22d%22d\n", nbf, nelectron);

// Print out orbital symmetries
Expand Down Expand Up @@ -913,7 +914,8 @@ PsiReturnType mrcc_generate_input(SharedWavefunction ref_wfn, Options &options,
for (int h = 0; h < nirrep; ++h)
for (int n = 0; n < active_socc[h]; ++n) symm ^= h;
symm += 1; // stupid 1 based fortran
printer = std::make_shared<PsiOutStream>("fort.56", std::ostream::trunc);
auto mode2 = std::ostream::trunc;
printer = std::make_shared<PsiOutStream>("fort.56", mode2);
// FILE* fort56 = fopen("fort.56", "w");
printer->Printf("%6d%6d%6d%6d%6d 0 0%6d 0%6d%6d%6d%6d 0 0%6d 0 0 0.00 0%6lu\n",
exlevel, // # 1
Expand Down
10 changes: 6 additions & 4 deletions psi4/src/psi4/occ/arrays.cc
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,9 @@ void Array1d::print()

void Array1d::print(std::string out_fname)
{
std::shared_ptr<psi::PsiOutStream> printer=(out_fname=="outfile"?outfile:
std::make_shared<PsiOutStream>(out_fname,std::ostream::app));
auto mode = std::ostream::app;
auto printer = out_fname == "outfile" ? outfile
: std::make_shared<PsiOutStream>(out_fname, mode);
if (name_.length()) printer->Printf( "\n ## %s ##\n", name_.c_str());
for (int p=0; p<dim1_; p++){
printer->Printf(" %3d %10.7f \n",p,A1d_[p]);
Expand Down Expand Up @@ -402,8 +403,9 @@ void Array2d::print()

void Array2d::print(std::string out_fname)
{
std::shared_ptr<psi::PsiOutStream> printer=(out_fname=="outfile"?outfile:
std::make_shared<PsiOutStream>(out_fname,std::ostream::app));
auto mode = std::ostream::app;
auto printer = out_fname=="outfile" ? outfile
: std::make_shared<PsiOutStream>(out_fname, mode);
if (name_.length()) printer->Printf( "\n ## %s ##\n", name_.c_str());
print_mat(A2d_,dim1_,dim2_,out_fname);
}//
Expand Down
Loading

0 comments on commit 6d43493

Please sign in to comment.