├── .gitattribute ├── .github ├── ISSUE_TEMPLATE.md └── PULL_REQUEST_TEMPLATE.md ├── .gitignore ├── CHANGELOG.md ├── CONTRIBUTING.md ├── CPV ├── Makefile └── src │ ├── Makefile │ ├── berryion.f90 │ ├── bforceion.f90 │ ├── cell_nose.f90 │ ├── cg.f90 │ ├── cg_sub.f90 │ ├── cglib.f90 │ ├── chargedensity.f90 │ ├── cp_autopilot.f90 │ ├── cp_emass.f90 │ ├── cp_interfaces.f90 │ ├── cp_restart.f90 │ ├── cplib.f90 │ ├── cplib_meta.f90 │ ├── cpr.f90 │ ├── cpr_loop.f90 │ ├── cpr_mod.f90 │ ├── cprstart.f90 │ ├── dealloc.f90 │ ├── dforceb.f90 │ ├── efermi.f90 │ ├── efield.f90 │ ├── eigs0.f90 │ ├── electrons.f90 │ ├── electrons_nose.f90 │ ├── energies.f90 │ ├── ensemble_dft.f90 │ ├── entropy.f90 │ ├── exch_corr.f90 │ ├── exx_cg.f90 │ ├── exx_es.f90 │ ├── exx_gs.f90 │ ├── exx_module.f90 │ ├── exx_pair.f90 │ ├── exx_psi.f90 │ ├── exx_vofr.f90 │ ├── fft.f90 │ ├── forces.f90 │ ├── fpmdpp.f90 │ ├── fromscra.f90 │ ├── gradrho.f90 │ ├── gram.f90 │ ├── gtable.f90 │ ├── init.f90 │ ├── init_run.f90 │ ├── inner_loop_cold.f90 │ ├── input.f90 │ ├── ions_nose.f90 │ ├── ions_positions.f90 │ ├── ksstates.f90 │ ├── ldaU.f90 │ ├── ldaU_cp.f90 │ ├── ldaUpen.f90 │ ├── mainvar.f90 │ ├── make.depend │ ├── makov_payne.f90 │ ├── manycp.f90 │ ├── metaxc.f90 │ ├── modules.f90 │ ├── move_electrons.f90 │ ├── newd.f90 │ ├── nl_base.f90 │ ├── nlcc.f90 │ ├── ortho.f90 │ ├── ortho_base.f90 │ ├── phasefactor.f90 │ ├── plugin_add_potential.f90 │ ├── plugin_clean.f90 │ ├── plugin_clock.f90 │ ├── plugin_energy.f90 │ ├── plugin_ext_forces.f90 │ ├── plugin_get_potential.f90 │ ├── plugin_init_base.f90 │ ├── plugin_init_cell.f90 │ ├── plugin_init_ions.f90 │ ├── plugin_initialization.f90 │ ├── plugin_int_forces.f90 │ ├── plugin_print_energies.f90 │ ├── plugin_print_info.f90 │ ├── plugin_read_input.f90 │ ├── plugin_utilities.f90 │ ├── potentials.f90 │ ├── pres_ai_mod.f90 │ ├── print_out.f90 │ ├── printout_base.f90 │ ├── problem_size.f90 │ ├── pseudo_base.f90 │ ├── pseudopot.f90 │ ├── pseudopot_sub.f90 │ ├── qmatrixd.f90 │ ├── qqberry.f90 │ ├── restart.f90 │ ├── restart_sub.f90 │ ├── runcp.f90 │ ├── sic.f90 │ ├── smallbox.f90 │ ├── smallbox_grid.f90 │ ├── smallbox_gvec.f90 │ ├── smallbox_lib.f90 │ ├── smallbox_subs.f90 │ ├── spinsq.f90 │ ├── spline.f90 │ ├── stop_run.f90 │ ├── stress.f90 │ ├── vofrho.f90 │ ├── vol_clu.f90 │ ├── wannier.f90 │ ├── wannier_base.f90 │ ├── wave.f90 │ ├── wave_types.f90 │ ├── wf.f90 │ └── wfdd.f90 ├── Doc └── release-notes ├── FFTXlib ├── Makefile ├── README.TEST ├── block_distro.f90 ├── cuda.f90 ├── fft_error.f90 ├── fft_fwinv.f90 ├── fft_interfaces.f90 ├── fft_parallel.f90 ├── fft_param.f90 ├── fft_scalar.DFTI.f90 ├── fft_scalar.ESSL.f90 ├── fft_scalar.FFTW.f90 ├── fft_scalar.FFTW3.f90 ├── fft_scalar.f90 ├── fft_smallbox.f90 ├── fft_smallbox_type.f90 ├── fft_stick.c ├── fft_support.f90 ├── fft_types.f90 ├── fftw.c ├── fftw.h ├── ipca2a.c ├── konst.h ├── make.depend ├── scatter_mod.f90 ├── stick_base.f90 ├── task_groups.f90 ├── test.f90 └── test0.f90 ├── LAXlib ├── Makefile ├── README.TEST ├── distools.f90 ├── dspev_drv.f90 ├── la_error.f90 ├── la_param.f90 ├── la_types.f90 ├── make.depend ├── ptoolkit.f90 ├── test.f90 ├── transto.f90 └── zhpev_drv.f90 ├── LR_Modules ├── Makefile ├── adddvepsi_us.f90 ├── adddvscf.f90 ├── addusdbec.f90 ├── addusdbec_nc.f90 ├── apply_dpot.f90 ├── cft_wave.f90 ├── cg_psi.f90 ├── cgsolve_all.f90 ├── ch_psi_all.f90 ├── commutator_Hx_psi.f90 ├── compute_vsgga.f90 ├── dfpt_tetra_mod.f90 ├── dgradcorr.f90 ├── dnonloccorr.f90 ├── dv_of_drho.f90 ├── dv_rVV10.f90 ├── dv_vdW_DF.f90 ├── dynmat_sub.f90 ├── h_prec.f90 ├── incdrhoscf.f90 ├── incdrhoscf_nc.f90 ├── lr_sm1_psi.f90 ├── lrcom.f90 ├── make.depend ├── newdq.f90 ├── orthogonalize.f90 ├── qdipol_cryst.f90 ├── set_dbecsum_nc.f90 ├── set_int3_nc.f90 ├── setqmod.f90 ├── setup_alpha_pv.f90 ├── setup_dgc.f90 ├── setup_dmuxc.f90 ├── setup_nbnd_occ.f90 ├── setup_nscf.f90 └── smallgq.f90 ├── License ├── Makefile ├── Modules ├── Makefile ├── atom.f90 ├── atomic_number.f90 ├── autopilot.f90 ├── basic_algebra_routines.f90 ├── becmod.f90 ├── bfgs_module.f90 ├── bspline.f90 ├── bz_form.f90 ├── capital.f90 ├── cell_base.f90 ├── check_stop.f90 ├── clocks.f90 ├── command_line_options.f90 ├── compute_dipole.f90 ├── constants.f90 ├── constraints_module.f90 ├── control_flags.f90 ├── coulomb_vcut.f90 ├── cryst_to_car.f90 ├── date_and_tim.f90 ├── deviatoric.f90 ├── dylmr2.f90 ├── electrons_base.f90 ├── environment.f90 ├── erf.f90 ├── error_handler.f90 ├── expint.f90 ├── fcp_variables.f90 ├── fd_gradient.f90 ├── fft_base.f90 ├── fft_custom.f90 ├── find_free_unit.f90 ├── fsockets.f90 ├── funct.f90 ├── funct_gpu.f90 ├── functionals.f90 ├── generate_function.f90 ├── generate_k_along_lines.f90 ├── gpu_routines.f90 ├── gth.f90 ├── gvecw.f90 ├── has_xml.f90 ├── hdf5_qe.f90 ├── inpfile.f90 ├── input_parameters.f90 ├── int_to_char.f90 ├── invmat.f90 ├── io_base.f90 ├── io_files.f90 ├── io_global.f90 ├── ions_base.f90 ├── kernel_table.f90 ├── kind.f90 ├── latgen.f90 ├── libxc.f90 ├── libxc_funcs.f90 ├── linpack.f90 ├── lsda_functionals.f90 ├── make.depend ├── matches.f90 ├── metagga.f90 ├── mm_dispersion.f90 ├── more_functionals.f90 ├── mp.f90 ├── mp_bands.f90 ├── mp_base.f90 ├── mp_diag.f90 ├── mp_exx.f90 ├── mp_global.f90 ├── mp_images.f90 ├── mp_pools.f90 ├── mp_wave.f90 ├── mp_world.f90 ├── noncol.f90 ├── open_close_input_file.f90 ├── parallel_include.f90 ├── parameters.f90 ├── parser.f90 ├── paw_variables.f90 ├── plot_io.f90 ├── plugin_arguments.f90 ├── plugin_flags.f90 ├── plugin_variables.f90 ├── pseudo_types.f90 ├── pw_dot.f90 ├── qes_libs.f90 ├── qes_module.f90 ├── qes_types.f90 ├── qexml.f90 ├── qexsd.f90 ├── qexsd_input.f90 ├── qexsd_reader_module.f90 ├── qmmm.f90 ├── radial_gradients.f90 ├── radial_grids.f90 ├── random_numbers.f90 ├── read_cards.f90 ├── read_input.f90 ├── read_namelists.f90 ├── read_ncpp.f90 ├── read_pseudo.f90 ├── read_upf_v1.f90 ├── read_upf_v2.f90 ├── read_uspp.f90 ├── read_xml.f90 ├── read_xml_cards.f90 ├── read_xml_fields.f90 ├── recips.f90 ├── recvec.f90 ├── recvec_subs.f90 ├── remove_tot_torque.f90 ├── rgen.f90 ├── run_info.f90 ├── set_hubbard_l.f90 ├── set_hubbard_n.f90 ├── set_signal.f90 ├── setqf.f90 ├── simpsn.f90 ├── sort.f90 ├── space_group.f90 ├── sph_bes.f90 ├── sph_dbes.f90 ├── splinelib.f90 ├── test_input_file.f90 ├── timestep.f90 ├── trimcheck.f90 ├── tsvdw.f90 ├── upf.f90 ├── upf_to_internal.f90 ├── uspp.f90 ├── version.f90 ├── volume.f90 ├── w0gauss.f90 ├── w1gauss.f90 ├── wannier_gw.f90 ├── wannier_new.f90 ├── wave_base.f90 ├── wavefunctions.f90 ├── wgauss.f90 ├── wrappers.f90 ├── write_upf_v2.f90 ├── ws_base.f90 ├── wypos.f90 ├── xc_rVV10.f90 ├── xc_vdW_DF.f90 ├── xml_input.f90 ├── xml_io_base.f90 ├── xsf.f90 ├── ylmr2.f90 ├── zdotc_wrapper.f90 └── zvscal.f90 ├── PHonon ├── FD │ ├── Makefile │ ├── fd.f90 │ ├── fd_ef.f90 │ ├── fd_ifc.f90 │ ├── make.depend │ ├── run_fd │ └── stop_pp.f90 ├── Gamma │ ├── Makefile │ ├── a_h.f90 │ ├── cg_readin.f90 │ ├── cg_setup.f90 │ ├── cg_setupdgc.f90 │ ├── cgcom.f90 │ ├── cgsolve.f90 │ ├── d2ion.f90 │ ├── dgradcorr.f90 │ ├── dielec.f90 │ ├── drhodv.f90 │ ├── dvb_cc.f90 │ ├── dvpsi_e.f90 │ ├── dvpsi_kb.f90 │ ├── dyndiar.f90 │ ├── dynmat_init.f90 │ ├── dynmatcc.f90 │ ├── find_equiv_sites.f90 │ ├── generate_dynamical_matrix.f90 │ ├── generate_effective_charges.f90 │ ├── h_h.f90 │ ├── macro.f90 │ ├── make.depend │ ├── phcg.f90 │ ├── rhod2vkb.f90 │ ├── solve_e.f90 │ ├── solve_ph.f90 │ └── writedyn.f90 ├── Makefile └── PH │ ├── Makefile │ ├── acfdtest.f90 │ ├── add_dkmds.f90 │ ├── add_for_charges.f90 │ ├── add_zstar_ue.f90 │ ├── add_zstar_ue_us.f90 │ ├── addcore.f90 │ ├── adddvscf.f90 │ ├── addnlcc.f90 │ ├── addnlcc_zstar_eu_us.f90 │ ├── addusddens.f90 │ ├── addusddense.f90 │ ├── addusdynmat.f90 │ ├── addusldos.f90 │ ├── allocate_part.f90 │ ├── allocate_pert.f90 │ ├── allocate_phq.f90 │ ├── bcast_ph_input.f90 │ ├── ccg_psi.f90 │ ├── cch_psi_all.f90 │ ├── check_if_partial_dyn.f90 │ ├── check_initial_status.f90 │ ├── check_q_points_sym.f90 │ ├── check_restart_recover.f90 │ ├── chi_test.f90 │ ├── clean_pw_ph.f90 │ ├── clinear.f90 │ ├── close_phq.f90 │ ├── compute_alphasum.f90 │ ├── compute_becalp.f90 │ ├── compute_becsum_ph.f90 │ ├── compute_drhous.f90 │ ├── compute_drhous_nc.f90 │ ├── compute_dvloc.f90 │ ├── compute_nldyn.f90 │ ├── compute_weight.f90 │ ├── d2ionq.f90 │ ├── d2ionq_mm.f90 │ ├── d2mxc.f90 │ ├── davcio_drho.f90 │ ├── deallocate_part.f90 │ ├── deallocate_phq.f90 │ ├── dfile_autoname.f90 │ ├── dfile_star.f90 │ ├── dhdrhopsi.f90 │ ├── dielec.f90 │ ├── dielec_test.f90 │ ├── do_phonon.f90 │ ├── drho.f90 │ ├── drhodv.f90 │ ├── drhodvloc.f90 │ ├── drhodvnl.f90 │ ├── drhodvus.f90 │ ├── dvanqq.f90 │ ├── dvkb3.f90 │ ├── dvpsi_e.f90 │ ├── dvpsi_e2.f90 │ ├── dvqpsi_us.f90 │ ├── dvqpsi_us_only.f90 │ ├── dyndia.f90 │ ├── dynmat.f90 │ ├── dynmat0.f90 │ ├── dynmat_us.f90 │ ├── dynmatcc.f90 │ ├── dynmatrix.f90 │ ├── ef_shift.f90 │ ├── el_opt.f90 │ ├── el_ph_collect.f90 │ ├── elph.f90 │ ├── elph_scdft_mod.f90 │ ├── elph_tetra_mod.f90 │ ├── elphon.f90 │ ├── ep_matrix_element_wannier.f90 │ ├── find_equiv_sites.f90 │ ├── find_irrep.f90 │ ├── find_mode_sym.f90 │ ├── fqha.f90 │ ├── generate_dynamical_matrix_c.f90 │ ├── generate_effective_charges_c.f90 │ ├── gmressolve_all.f90 │ ├── hdiag.f90 │ ├── incdrhous.f90 │ ├── incdrhous_nc.f90 │ ├── init_representations.f90 │ ├── initialize_ph.f90 │ ├── io_dyn_mat.f90 │ ├── io_dyn_mat_old.f90 │ ├── io_pattern.f90 │ ├── lambda.f90 │ ├── localdos.f90 │ ├── make.depend │ ├── matdyn.f90 │ ├── mix_pot.f90 │ ├── mode_group.f90 │ ├── obsolete.f90 │ ├── openfilq.f90 │ ├── pcgreen.f90 │ ├── ph_restart.f90 │ ├── phcom.f90 │ ├── phescf.f90 │ ├── phonon.f90 │ ├── phq_init.f90 │ ├── phq_readin.f90 │ ├── phq_recover.f90 │ ├── phq_setup.f90 │ ├── phq_summary.f90 │ ├── phqscf.f90 │ ├── polariz.f90 │ ├── prepare_q.f90 │ ├── prepare_sym_analysis.f90 │ ├── print_clock_ph.f90 │ ├── psidspsi.f90 │ ├── psym_dmag.f90 │ ├── psym_dmage.f90 │ ├── psymdvscf.f90 │ ├── psyme.f90 │ ├── psyme2.f90 │ ├── punch_plot_e.f90 │ ├── q2qstar.f90 │ ├── q2qstar_ph.f90 │ ├── q2r.f90 │ ├── q2trans.f90 │ ├── q2trans_fd.f90 │ ├── q_points.f90 │ ├── q_points_wannier.f90 │ ├── raman.f90 │ ├── raman_mat.f90 │ ├── ramanm.f90 │ ├── random_matrix.f90 │ ├── read_wfc_rspace_and_fwfft.f90 │ ├── rigid.f90 │ ├── rotate_and_add_dyn.f90 │ ├── rotate_dvscf_star.f90 │ ├── rotate_pattern_add.f90 │ ├── run_nscf.f90 │ ├── save_ph_input.f90 │ ├── set_asr_c.f90 │ ├── set_drhoc.f90 │ ├── set_dvscf.f90 │ ├── set_int12_nc.f90 │ ├── set_irr.f90 │ ├── set_irr_nosym.f90 │ ├── set_irr_sym.f90 │ ├── set_small_group_of_q.f90 │ ├── setlocq.f90 │ ├── sgam_ph.f90 │ ├── solve_e.f90 │ ├── solve_e2.f90 │ ├── solve_e_fpol.f90 │ ├── solve_e_nscf.f90 │ ├── solve_linter.f90 │ ├── star_q.f90 │ ├── stop_ph.f90 │ ├── summarize.f90 │ ├── sym_and_write_zue.f90 │ ├── sym_def.f90 │ ├── sym_dmag.f90 │ ├── sym_dmage.f90 │ ├── symdvscf.f90 │ ├── symdyn_munu.f90 │ ├── symdynph_gq.f90 │ ├── syme.f90 │ ├── syme2.f90 │ ├── symm.f90 │ ├── symmorphic_or_nzb.f90 │ ├── tra_write_matrix.f90 │ ├── transform_alphasum_nc.f90 │ ├── transform_alphasum_so.f90 │ ├── transform_int_nc.f90 │ ├── transform_int_so.f90 │ ├── trntnsc.f90 │ ├── write_eigenvectors.f90 │ ├── write_epsilon_and_zeu.f90 │ ├── write_matrix.f90 │ ├── write_modes.f90 │ ├── write_qplot_data.f90 │ ├── write_ramtns.f90 │ ├── write_rec.f90 │ ├── yambo.f90 │ ├── zstar_eu.f90 │ └── zstar_eu_us.f90 ├── PW ├── Makefile ├── src │ ├── Makefile │ ├── a2fmod.f90 │ ├── acfdt_in_pw.f90 │ ├── add_bfield.f90 │ ├── add_efield.f90 │ ├── add_monofield.f90 │ ├── add_paw_to_deeq.f90 │ ├── add_qexsd_step.f90 │ ├── add_vhub_to_deeq.f90 │ ├── add_vuspsi.F90 │ ├── addusdens.f90 │ ├── addusforce.f90 │ ├── addusstress.f90 │ ├── allocate_fft.f90 │ ├── allocate_locpot.f90 │ ├── allocate_nlpot.f90 │ ├── allocate_wfc.f90 │ ├── atomic_rho.f90 │ ├── atomic_wfc.f90 │ ├── atomic_wfc_mod.f90 │ ├── average_pp.f90 │ ├── bp_c_phase.f90 │ ├── bp_calc_btq.f90 │ ├── bp_mod.f90 │ ├── bp_qvan3.f90 │ ├── bp_strings.f90 │ ├── buffers.f90 │ ├── c_bands.f90 │ ├── c_phase_field.f90 │ ├── ccgdiagg.f90 │ ├── cdiagh.f90 │ ├── cdiaghg.F90 │ ├── cegterg.f90 │ ├── clean_pw.f90 │ ├── close_files.f90 │ ├── compute_becsum.f90 │ ├── compute_deff.f90 │ ├── compute_dip.f90 │ ├── compute_qdipol.f90 │ ├── compute_qdipol_so.f90 │ ├── compute_rho.f90 │ ├── compute_ux.f90 │ ├── coset.f90 │ ├── cpu_gpu_interface.f90 │ ├── d_matrix.f90 │ ├── data_structure.f90 │ ├── data_structure_custom.f90 │ ├── deriv_drhoc.f90 │ ├── divide.f90 │ ├── divide_class.f90 │ ├── divide_class_so.f90 │ ├── divide_et_impera.f90 │ ├── dqvan2.f90 │ ├── drhoc.f90 │ ├── dvloc_of_g.f90 │ ├── dynamics_module.f90 │ ├── efermig.f90 │ ├── efermit.f90 │ ├── electrons.f90 │ ├── eqvect.f90 │ ├── esm.f90 │ ├── esm_cft.f90 │ ├── ewald.f90 │ ├── ewald_dipole.f90 │ ├── exx.f90 │ ├── fcp.f90 │ ├── find_group.f90 │ ├── force_cc.f90 │ ├── force_corr.f90 │ ├── force_ew.f90 │ ├── force_hub.f90 │ ├── force_lc.f90 │ ├── force_us.f90 │ ├── forces.f90 │ ├── forces_bp_efield.f90 │ ├── g2_kin.f90 │ ├── g_psi.F90 │ ├── g_psi_mod.f90 │ ├── gen_at_dj.f90 │ ├── gen_at_dy.f90 │ ├── gen_us_dj.f90 │ ├── gen_us_dy.f90 │ ├── generate_rVV10_kernel_table.f90 │ ├── generate_vdW_kernel_table.f90 │ ├── get_locals.f90 │ ├── gk_sort.f90 │ ├── gradcorr.f90 │ ├── gweights.f90 │ ├── h_1psi.f90 │ ├── h_epsi_her_apply.f90 │ ├── h_epsi_her_set.f90 │ ├── h_psi.F90 │ ├── h_psi_meta.f90 │ ├── hinit0.f90 │ ├── hinit1.f90 │ ├── init_at_1.f90 │ ├── init_ns.f90 │ ├── init_q_aeps.f90 │ ├── init_run.f90 │ ├── init_us_0.f90 │ ├── init_us_1.f90 │ ├── init_us_2.f90 │ ├── init_us_b0.f90 │ ├── init_vloc.f90 │ ├── input.f90 │ ├── interpolate.f90 │ ├── io_rho_xml.f90 │ ├── irrek.f90 │ ├── iweights.f90 │ ├── kpoint_grid.f90 │ ├── lchk_tauxk.f90 │ ├── ldaU.f90 │ ├── make.depend │ ├── make_pointlists.f90 │ ├── makov_payne.f90 │ ├── manypw.f90 │ ├── martyna_tuckerman.f90 │ ├── memory_report.f90 │ ├── mix_rho.f90 │ ├── move_ions.f90 │ ├── multable.f90 │ ├── n_plane_waves.f90 │ ├── new_ns.f90 │ ├── new_occ.f90 │ ├── newd.f90 │ ├── non_scf.f90 │ ├── ns_adj.f90 │ ├── offset_atom_wfc.f90 │ ├── openfil.f90 │ ├── orbm_kubo.f90 │ ├── ortho_wfc.f90 │ ├── orthoatwfc.f90 │ ├── output_tau.f90 │ ├── para.f90 │ ├── paw_exx.f90 │ ├── paw_init.f90 │ ├── paw_onecenter.f90 │ ├── paw_symmetry.f90 │ ├── plugin_clean.f90 │ ├── plugin_clock.f90 │ ├── plugin_ext_forces.f90 │ ├── plugin_init_cell.f90 │ ├── plugin_init_ions.f90 │ ├── plugin_init_potential.f90 │ ├── plugin_initbase.f90 │ ├── plugin_initialization.f90 │ ├── plugin_int_forces.f90 │ ├── plugin_print_energies.f90 │ ├── plugin_read_input.f90 │ ├── plugin_scf_energy.f90 │ ├── plugin_scf_potential.f90 │ ├── plugin_summary.f90 │ ├── plus_u_full.f90 │ ├── potinit.f90 │ ├── print_clock_pw.f90 │ ├── print_ks_energies.f90 │ ├── punch.f90 │ ├── pw2blip.f90 │ ├── pw2casino.f90 │ ├── pw2casino_write.f90 │ ├── pw_init_qexsd_input.f90 │ ├── pw_restart.f90 │ ├── pw_restart_new.f90 │ ├── pwcom.f90 │ ├── pwscf.f90 │ ├── qvan2.f90 │ ├── rcgdiagg.f90 │ ├── rdiagh.f90 │ ├── rdiaghg.f90 │ ├── read_conf_from_file.f90 │ ├── read_file.f90 │ ├── read_file_new.f90 │ ├── realus.f90 │ ├── regterg.f90 │ ├── remove_atomic_rho.f90 │ ├── report_mag.f90 │ ├── restart_in_electrons.f90 │ ├── rho2zeta.f90 │ ├── rotate_wfc.F90 │ ├── rotate_wfc_gamma.f90 │ ├── rotate_wfc_k.F90 │ ├── run_driver.f90 │ ├── run_pwscf.f90 │ ├── ruotaijk.f90 │ ├── s_1psi.f90 │ ├── s_psi.F90 │ ├── save_in_cbands.f90 │ ├── save_in_electrons.f90 │ ├── scale_h.f90 │ ├── scf_mod.f90 │ ├── set_kplusq.f90 │ ├── set_kup_and_kdw.f90 │ ├── set_rhoc.f90 │ ├── set_vrs.f90 │ ├── setlocal.f90 │ ├── setup.f90 │ ├── sph_ind.f90 │ ├── spinor.f90 │ ├── start_k.f90 │ ├── stop_run.f90 │ ├── stres_cc.f90 │ ├── stres_ewa.f90 │ ├── stres_gradcorr.f90 │ ├── stres_har.f90 │ ├── stres_hub.f90 │ ├── stres_knl.f90 │ ├── stres_loc.f90 │ ├── stres_nonloc_dft.f90 │ ├── stres_us.f90 │ ├── stress.f90 │ ├── struct_fact.f90 │ ├── sum_band.f90 │ ├── sumkg.f90 │ ├── sumkt.f90 │ ├── summary.f90 │ ├── symm_base.f90 │ ├── symme.f90 │ ├── symmetrize_at.f90 │ ├── tabd.f90 │ ├── tetra.f90 │ ├── transform_becsum_nc.f90 │ ├── transform_becsum_so.f90 │ ├── transform_qq_so.f90 │ ├── trnvecc.f90 │ ├── update_pot.f90 │ ├── us_exx.f90 │ ├── usnldiag.f90 │ ├── v_of_rho.f90 │ ├── vcsmd.f90 │ ├── vcsubs.f90 │ ├── vhpsi.f90 │ ├── vloc_of_g.f90 │ ├── vloc_psi.F90 │ ├── wannier_check.f90 │ ├── wannier_clean.f90 │ ├── wannier_enrg.f90 │ ├── wannier_init.f90 │ ├── wannier_occ.f90 │ ├── wannier_proj.f90 │ ├── weights.f90 │ ├── wfcinit.f90 │ ├── write_ns.f90 │ ├── wsweight.f90 │ ├── wyckoff.f90 │ └── xdm_dispersion.f90 └── tools │ ├── Makefile │ ├── bs.awk │ ├── castep2qe.sh │ ├── cif2qe.sh │ ├── dist.f90 │ ├── ev.f90 │ ├── ev_xml.f90 │ ├── kpoints.f90 │ ├── make.depend │ ├── md_analyzer.sh │ ├── mv.awk │ ├── pwi2xsf.f90 │ ├── pwi2xsf.sh │ ├── pwo2xsf.sh │ ├── qeout2axsf.sh │ └── xsf2pwi.sh ├── README.md ├── archive ├── README └── iotk-1.2.beta.tar.gz ├── clib ├── Makefile ├── c_mkdir.c ├── copy.c ├── cptimer.c ├── customize_signals.c ├── eval_infix.c ├── indici.c ├── make.depend ├── md5.c ├── md5.h ├── md5_from_file.c ├── memstat.c ├── ptrace.c ├── qmmm_aux.c ├── qsort.c ├── sockets.c └── stack.c ├── environment_variables ├── include ├── c_defs.h └── fft_defs.h └── install ├── Makefile.lib_eigsolve ├── Makefile_iotk ├── README.DFLAGS ├── addsonpatch.sh ├── addsontool.sh ├── clean.sh ├── extlibs_makefile ├── includedep.sh ├── install_utils ├── iotk_config.h ├── make.check-cuda ├── make.inc_CRAY_PizDaint ├── make.inc_POWER_DAVIDE_CPU-ESSLSMP ├── make.inc_POWER_DAVIDE_CPU-ESSLSMP_SCALAPACK ├── make.inc_POWER_DAVIDE_GPU-ESSL ├── make.inc_POWER_DAVIDE_GPU-ESSLSMP ├── make.inc_POWER_SUMMITDEV ├── make.inc_x86-64 ├── make.inc_x86-64_CPU-only ├── makedeps.sh ├── moduledep.sh ├── namedep.sh └── update_version /.gitattribute: -------------------------------------------------------------------------------- 1 | .github/ISSUE_TEMPLATE.md export-ignore 2 | .github/PULL_REQUEST_TEMPLATE.md export-ignore 3 | *.github export-ignore 4 | .gitignore export-ignore 5 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | ### Version of QE-GPU 2 | 3 | Write here (refer to git TAG or git hash) 4 | 5 | ### Expected behavior/result 6 | 7 | Write here... 8 | 9 | ### Actual behavior/result 10 | 11 | Write here... 12 | 13 | ### Steps to reproduce behavior/result 14 | 15 | Together with instructions how to reproduce the problem and where input files and pseudo-potentials are located), please report: 16 | * architecture of your machine (e.g. x86, POWER, CRAY) 17 | * type of GPU you are using (remember, Tesla P100 are recommended) 18 | * version and flavor of MPI (e.g. Open MPI 1.x.y, 2.x.y, 3.x.y, MVAPICH2, MVAPICH2-GDR, Spectrum MPI) 19 | * PGI compiler (both major and minor version, e.g. 17.4, specify also if it is the _Community_ version) 20 | * the full ``DFLAGS`` line as specified in the make.inc 21 | * how you run the code (number of MPI/GPU, number of threads) 22 | 23 | -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | Thank you for creating a pull request to contribute to QE-GPU code! Before you open the request please review the following guidelines and tips to help it be more easily integrated: 2 | * Describe the scope of your change -- i.e. what the change does and what parts of the code were modified. This will help us understand any risks of integrating the code. 3 | * Describe any known limitations with your change. For example if the change doesn't apply to a supported platform of the library please mention it. 4 | * Please run any tests or examples that can exercise your modified code. We strive to not break users of the code and running tests/examples helps with this process. 5 | 6 | Thank you again for contributing! Testing and integration of any change will occur as soon as possible, but be aware it is impossible to immediately respond to every request. There is no need to bump or check in on a pull request (it will clutter the discussion of the request). 7 | 8 | After reviewing the guidelines above you can delete this text from the pull request and proceed further 9 | 10 | 11 | ### Description of the Pull Request (PR) 12 | 13 | Write your description of the PR here. Be sure to include as much background, 14 | and details necessary for the reviewers to understand exactly what this is 15 | fixing or enhancing. 16 | 17 | 18 | ### This fixes or addresses the following GitHub issues 19 | 20 | - Ref: # 21 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.a 2 | *.o 3 | *.mod 4 | *_tmp.f90 5 | *.x 6 | *.so 7 | *.pyc 8 | .github/ISSUE_TEMPLATE.md 9 | .github/PULL_REQUEST_TEMPLATE.md 10 | *.github 11 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | All notable changes to this project will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). 3 | 4 | ## [Unreleased] 5 | ### Fixes 6 | - Workaround for compiler bug on POWER systems (commit 92327a54a03b81774f7928a431acfe26adda7ff7) 7 | 8 | ## [1.0.0] - 2017-11-03 9 | 10 | ### Added 11 | - GPU support using CUDA FORTRAN to PWscf v6.1, k-point calculation only 12 | 13 | ### Changed 14 | - Simplified build system 15 | 16 | ### Removed 17 | - Auxiliary CPU-only packages: XSpectra, TDDFPT, PWCOND, PP, NEB, GWW, EPW, COUPLE, atomic 18 | - Autoconf scripts 19 | - Example files 20 | - Documentation (please refer to official release) 21 | -------------------------------------------------------------------------------- /CPV/Makefile: -------------------------------------------------------------------------------- 1 | # Makefile for CPV 2 | sinclude ../make.inc 3 | 4 | default: all 5 | 6 | all: 7 | ( cd src ; $(MAKE) all || exit 1 ) 8 | 9 | clean : 10 | ( cd src ; $(MAKE) clean ) 11 | 12 | doc: 13 | (cd Doc ; $(MAKE) all || exit 1 ) 14 | 15 | doc_clean: 16 | (cd Doc ; $(MAKE) clean ) 17 | 18 | distclean: clean doc_clean 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /CPV/src/cp_emass.f90: -------------------------------------------------------------------------------- 1 | ! 2 | ! Copyright (C) 2002-2005 FPMD-CPV groups 3 | ! This file is distributed under the terms of the 4 | ! GNU General Public License. See the file `License' 5 | ! in the root directory of the present distribution, 6 | ! or http://www.gnu.org/copyleft/gpl.txt . 7 | ! 8 | 9 | !------------------------------------------------------------------------------! 10 | MODULE cp_electronic_mass 11 | !------------------------------------------------------------------------------! 12 | 13 | ! This module contains variable and functions relative to the 14 | ! Car-Parrinello fictitious electronic masse 15 | 16 | USE kinds, ONLY: DP 17 | ! 18 | IMPLICIT NONE 19 | SAVE 20 | 21 | REAL(DP) :: emass = 1.0d0 ! fictitious electronic mass ( mu ) 22 | REAL(DP) :: emass_cutoff = 1.0d0 ! kinetic energy cutoff for plane 23 | ! waves to be used for Fourier acceleration 24 | ! preconditioning 25 | 26 | !------------------------------------------------------------------------------! 27 | CONTAINS 28 | !------------------------------------------------------------------------------! 29 | 30 | SUBROUTINE emass_precond( ema0bg, ggp, ngw, tpiba2, emaec ) 31 | USE control_flags, ONLY: iverbosity 32 | IMPLICIT NONE 33 | REAL(DP), INTENT(OUT) :: ema0bg(:) 34 | REAL(DP), INTENT(IN) :: ggp(:), tpiba2, emaec 35 | INTEGER, INTENT(IN) :: ngw 36 | INTEGER :: i 37 | ! mass preconditioning: ema0bg(i) = ratio of emass(g=0) to emass(g) 38 | ! for g**2>emaec the electron mass ema0bg(g) rises quadratically 39 | do i = 1, ngw 40 | ema0bg(i) = 1.0d0 / MAX( 1.d0, tpiba2 * ggp(i) / emaec ) 41 | IF( iverbosity > 2 ) print *,i,' ema0bg(i) ',ema0bg(i) 42 | end do 43 | 44 | RETURN 45 | END SUBROUTINE emass_precond 46 | 47 | 48 | !------------------------------------------------------------------------------! 49 | END MODULE cp_electronic_mass 50 | !------------------------------------------------------------------------------! 51 | -------------------------------------------------------------------------------- /CPV/src/cpr_loop.f90: -------------------------------------------------------------------------------- 1 | ! 2 | ! Copyright (C) 2002-2011 Quantum ESPRESSO group 3 | ! This file is distributed under the terms of the 4 | ! GNU General Public License. See the file `License' 5 | ! in the root directory of the present distribution, 6 | ! or http://www.gnu.org/copyleft/gpl.txt . 7 | ! 8 | ! ... set ion_positions = 'from_input' and rd_pos = +your_positions+ 9 | ! ... to force cprmain to compute forces for +your_position+ configuration 10 | ! 11 | !---------------------------------------------------------------------------- 12 | SUBROUTINE cpr_loop( nloop ) 13 | !---------------------------------------------------------------------------- 14 | ! 15 | USE kinds, ONLY : DP 16 | USE ions_base, ONLY : nat 17 | ! 18 | IMPLICIT NONE 19 | ! 20 | INTEGER, INTENT(IN) :: nloop 21 | ! 22 | INTEGER :: iloop 23 | REAL(DP), ALLOCATABLE :: tau(:,:) 24 | REAL(DP), ALLOCATABLE :: fion(:,:) 25 | REAL(DP) :: etot 26 | ! 27 | ! 28 | IF ( nat > 0 ) THEN 29 | ! 30 | ALLOCATE( tau( 3, nat ) ) 31 | ALLOCATE( fion( 3, nat ) ) 32 | ! 33 | ELSE 34 | ! 35 | CALL errore( ' cpr_loop ', ' nat less or equal 0 ', 1 ) 36 | ! 37 | END IF 38 | ! 39 | CALL init_run() 40 | ! 41 | DO iloop = 1, nloop 42 | ! 43 | CALL cprmain( tau, fion, etot ) 44 | ! 45 | END DO 46 | ! 47 | CALL terminate_run() 48 | ! 49 | DEALLOCATE( tau, fion ) 50 | ! 51 | RETURN 52 | ! 53 | END SUBROUTINE cpr_loop 54 | -------------------------------------------------------------------------------- /CPV/src/cpr_mod.f90: -------------------------------------------------------------------------------- 1 | ! 2 | ! Copyright (C) 2002-2005 FPMD-CPV groups 3 | ! This file is distributed under the terms of the 4 | ! GNU General Public License. See the file `License' 5 | ! in the root directory of the present distribution, 6 | ! or http://www.gnu.org/copyleft/gpl.txt . 7 | ! 8 | !---------------------------------------------------------------------------- 9 | module betax 10 | !---------------------------------------------------------------------------- 11 | ! 12 | USE kinds, ONLY : DP 13 | ! 14 | IMPLICIT NONE 15 | SAVE 16 | ! 17 | INTEGER :: mmx = 5000 18 | REAL(DP) :: refg 19 | REAL(DP),ALLOCATABLE :: betagx(:,:,:), dbetagx(:,:,:), & 20 | qradx(:,:,:,:), dqradx(:,:,:,:) 21 | ! 22 | CONTAINS 23 | ! 24 | SUBROUTINE deallocate_betax() 25 | ! 26 | IF ( ALLOCATED( betagx ) ) DEALLOCATE( betagx ) 27 | IF ( ALLOCATED( dbetagx ) ) DEALLOCATE( dbetagx ) 28 | IF ( ALLOCATED( qradx ) ) DEALLOCATE( qradx ) 29 | IF ( ALLOCATED( dqradx ) ) DEALLOCATE( dqradx ) 30 | ! 31 | END SUBROUTINE deallocate_betax 32 | ! 33 | END MODULE betax 34 | ! 35 | -------------------------------------------------------------------------------- /CPV/src/entropy.f90: -------------------------------------------------------------------------------- 1 | ! 2 | ! Copyright (C) 2002-2005 FPMD-CPV groups 3 | ! This file is distributed under the terms of the 4 | ! GNU General Public License. See the file `License' 5 | ! in the root directory of the present distribution, 6 | ! or http://www.gnu.org/copyleft/gpl.txt . 7 | ! 8 | ! AB INITIO COSTANT PRESSURE MOLECULAR DYNAMICS 9 | ! ---------------------------------------------- 10 | ! Car-Parrinello Parallel Program 11 | ! Carlo Cavazzoni - Gerardo Ballabio 12 | ! SISSA, Trieste, Italy - 1997-99 13 | ! Last modified: Tue Nov 30 10:59:55 MET 1999 14 | ! ---------------------------------------------- 15 | ! BEGIN manual 16 | 17 | SUBROUTINE entropy(f,temp,nx,ent) 18 | 19 | ! this routine computes the entropic contribution due to the finite 20 | ! temperature assigned to electrons when computing occupation numbers 21 | ! ---------------------------------------------- 22 | ! END manual 23 | 24 | USE kinds 25 | IMPLICIT NONE 26 | 27 | ! ... declare subroutine arguments 28 | INTEGER nx 29 | REAL(DP) f(nx),temp,ent 30 | 31 | ! ... declare other variables 32 | INTEGER i 33 | REAL(DP) fm 34 | REAL(DP), PARAMETER :: eps = 1.0d-10 35 | 36 | ! end of declarations 37 | ! ---------------------------------------------- 38 | 39 | ent=0.d0 40 | DO i=1,nx 41 | fm=0.5d0*f(i) 42 | ent = ent+ fm*log(eps+fm)+(1.d0-fm)*log(eps+1.d0-fm) 43 | END DO 44 | ent=-2.d0*temp*ent 45 | 46 | RETURN 47 | END SUBROUTINE entropy 48 | 49 | subroutine entropy_s(f,temp,nx,ent) 50 | use kinds 51 | implicit none 52 | integer nx 53 | integer i 54 | real(DP) f(nx),temp,ent, fm,eps 55 | parameter(eps=1.d-10) 56 | 57 | ent=0.d0 58 | do i=1,nx 59 | fm=0.5d0*f(i) 60 | ent = ent+ fm*log(eps+fm)+(1.d0-fm)*log(eps+1.d0-fm) 61 | enddo 62 | ent=-2.d0*temp*ent 63 | 64 | return 65 | end subroutine entropy_s 66 | 67 | -------------------------------------------------------------------------------- /CPV/src/ldaU_cp.f90: -------------------------------------------------------------------------------- 1 | ! 2 | ! Copyright (C) 2011-2014 Quantum ESPRESSO group 3 | ! This file is distributed under the terms of the 4 | ! GNU General Public License. See the file `License' 5 | ! in the root directory of the present distribution, 6 | ! or http://www.gnu.org/copyleft/gpl.txt . 7 | ! 8 | !------------------------------------------------------------------------- 9 | MODULE ldaU_cp 10 | !------------------------------------------------------------------------- 11 | USE parameters, ONLY: nsx 12 | USE kinds 13 | implicit none 14 | save 15 | real(DP) :: Hubbard_U(nsx) 16 | real(DP) :: e_hubbard = 0.d0 17 | real(DP), allocatable :: ns(:,:,:,:) 18 | integer :: Hubbard_l(nsx), Hubbard_lmax=0, ldmx=0, nwfcU 19 | logical :: lda_plus_u 20 | COMPLEX(DP), allocatable:: vupsi(:,:) 21 | ! 22 | contains 23 | ! 24 | subroutine ldaU_init0 ( nsp, lda_plus_u_, Hubbard_U_ ) 25 | !----------------------------------------------------------------------- 26 | ! 27 | USE constants, ONLY: autoev 28 | ! 29 | IMPLICIT NONE 30 | INTEGER, INTENT(IN) :: nsp 31 | LOGICAL, INTENT(IN) :: lda_plus_u_ 32 | REAL(DP),INTENT(IN) :: Hubbard_U_(nsp) 33 | 34 | lda_plus_u = lda_plus_u_ 35 | Hubbard_U(1:nsp) = Hubbard_U_(1:nsp) / autoev 36 | ! 37 | END SUBROUTINE ldaU_init0 38 | ! 39 | subroutine deallocate_lda_plus_u() 40 | ! 41 | IF( ALLOCATED( ns ) ) DEALLOCATE( ns ) 42 | IF( ALLOCATED( vupsi ) ) DEALLOCATE( vupsi ) 43 | ! 44 | ! 45 | end subroutine 46 | ! 47 | end module ldaU_cp 48 | -------------------------------------------------------------------------------- /CPV/src/plugin_add_potential.f90: -------------------------------------------------------------------------------- 1 | ! 2 | ! Copyright (C) 2015 Quantum ESPRESSO group 3 | ! This file is distributed under the terms of the 4 | ! GNU General Public License. See the file `License' 5 | ! in the root directory of the present distribution, 6 | ! or http://www.gnu.org/copyleft/gpl.txt . 7 | ! 8 | !---------------------------------------------------------------------------- 9 | !---------------------------------------------------------------------------- 10 | SUBROUTINE plugin_add_potential( v ) 11 | !---------------------------------------------------------------------------- 12 | ! This routine is used to add the plugin potentials to the total electronic potential 13 | ! 14 | USE io_global, ONLY : stdout, ionode 15 | USE kinds, ONLY : DP 16 | ! 17 | USE fft_base, ONLY : dfftp 18 | USE electrons_base, ONLY : nspin 19 | ! 20 | USE plugin_flags 21 | ! 22 | ! ***Environ MODULES BEGIN*** 23 | ! ***Environ MODULES END*** 24 | ! 25 | IMPLICIT NONE 26 | ! 27 | REAL(DP), INTENT(INOUT) :: v(dfftp%nnr,nspin) 28 | ! 29 | ! ***Environ VARIABLES BEGIN*** 30 | ! ***Environ VARIABLES END*** 31 | ! 32 | ! ***Environ CALLS BEGIN*** 33 | ! ***Environ CALLS END*** 34 | 35 | END SUBROUTINE plugin_add_potential 36 | -------------------------------------------------------------------------------- /CPV/src/plugin_clean.f90: -------------------------------------------------------------------------------- 1 | ! Copyright (C) 2015 Quantum ESPRESSO group 2 | ! This file is distributed under the terms of the 3 | ! GNU General Public License. See the file `License' 4 | ! in the root directory of the present distribution, 5 | ! or http://www.gnu.org/copyleft/gpl.txt . 6 | ! 7 | subroutine plugin_clean() 8 | ! 9 | ! This routine is used for cleaning calls 10 | ! from plugins 11 | ! DO NOT REMOVE THE TAGS ! ***ADDSON_NAME KIND_OF_PATCH*** 12 | ! 13 | USE plugin_flags 14 | ! 15 | ! ***Environ MODULES BEGIN*** 16 | ! ***Environ MODULES END*** 17 | ! 18 | implicit none 19 | ! 20 | ! ***Environ VARIABLES BEGIN*** 21 | ! ***Environ VARIABLES END*** 22 | ! 23 | ! ***Environ CALLS BEGIN*** 24 | ! ***Environ CALLS END*** 25 | ! 26 | end subroutine plugin_clean 27 | 28 | -------------------------------------------------------------------------------- /CPV/src/plugin_clock.f90: -------------------------------------------------------------------------------- 1 | ! 2 | ! Copyright (C) 2015 Quantum ESPRESSO group 3 | ! This file is distributed under the terms of the 4 | ! GNU General Public License. See the file `License' 5 | ! in the root directory of the present distribution, 6 | ! or http://www.gnu.org/copyleft/gpl.txt . 7 | ! 8 | subroutine plugin_clock() 9 | ! 10 | ! This routine is used for printing plugins clocks 11 | ! DO NOT REMOVE THE TAGS ! ***ADDSON_NAME KIND_OF_PATCH*** 12 | ! 13 | USE plugin_flags 14 | USE io_global, ONLY : stdout 15 | ! 16 | ! ***Environ MODULES BEGIN*** 17 | ! ***Environ MODULES END*** 18 | ! 19 | implicit none 20 | ! 21 | ! ***Environ VARIABLES BEGIN*** 22 | ! ***Environ VARIABLES END*** 23 | ! 24 | ! ***Environ CALLS BEGIN*** 25 | ! ***Environ CALLS END*** 26 | ! 27 | end subroutine plugin_clock 28 | -------------------------------------------------------------------------------- /CPV/src/plugin_energy.f90: -------------------------------------------------------------------------------- 1 | ! 2 | ! Copyright (C) 2015 Quantum ESPRESSO group 3 | ! This file is distributed under the terms of the 4 | ! GNU General Public License. See the file `License' 5 | ! in the root directory of the present distribution, 6 | ! or http://www.gnu.org/copyleft/gpl.txt . 7 | ! 8 | !---------------------------------------------------------------------------- 9 | SUBROUTINE plugin_energy(rhoin,plugin_etot) 10 | !---------------------------------------------------------------------------- 11 | ! This routine is used to calculate plugin energy related quantities 12 | ! that needs to be solved inside the scf cycle 13 | ! 14 | USE io_global, ONLY : stdout, ionode 15 | USE kinds, ONLY : DP 16 | USE io_files, ONLY : tmp_dir 17 | ! 18 | USE fft_base, ONLY : dfftp 19 | USE electrons_base, ONLY : nspin 20 | ! 21 | USE plugin_flags 22 | ! 23 | ! ***Environ MODULES BEGIN*** 24 | ! ***Environ MODULES END*** 25 | ! 26 | IMPLICIT NONE 27 | ! 28 | real(DP), intent(in) :: rhoin(dfftp%nnr,nspin) 29 | real(DP), intent(inout) :: plugin_etot 30 | ! 31 | ! ***Environ VARIABLES BEGIN*** 32 | ! ***Environ VARIABLES END*** 33 | ! 34 | ! ***Environ CALLS BEGIN*** 35 | ! ***Environ CALLS END*** 36 | ! 37 | END SUBROUTINE plugin_energy 38 | -------------------------------------------------------------------------------- /CPV/src/plugin_ext_forces.f90: -------------------------------------------------------------------------------- 1 | ! 2 | ! Copyright (C) 2001-2009 Quantum ESPRESSO group 3 | ! This file is distributed under the terms of the 4 | ! GNU General Public License. See the file `License' 5 | ! in the root directory of the present distribution, 6 | ! or http://www.gnu.org/copyleft/gpl.txt . 7 | ! 8 | !---------------------------------------------------------------------------- 9 | SUBROUTINE plugin_ext_forces() 10 | !---------------------------------------------------------------------------- 11 | ! 12 | ! 13 | USE mp_global, ONLY : intra_image_comm 14 | USE mp, ONLY : mp_bcast 15 | USE io_global, ONLY : stdout, ionode, ionode_id 16 | USE kinds, ONLY : DP 17 | ! 18 | USE plugin_flags 19 | ! 20 | IMPLICIT NONE 21 | ! 22 | ! 23 | END SUBROUTINE plugin_ext_forces 24 | -------------------------------------------------------------------------------- /CPV/src/plugin_get_potential.f90: -------------------------------------------------------------------------------- 1 | ! 2 | ! Copyright (C) 2015 Quantum ESPRESSO group 3 | ! This file is distributed under the terms of the 4 | ! GNU General Public License. See the file `License' 5 | ! in the root directory of the present distribution, 6 | ! or http://www.gnu.org/copyleft/gpl.txt . 7 | ! 8 | !---------------------------------------------------------------------------- 9 | SUBROUTINE plugin_get_potential(rhoin,nfi) 10 | !---------------------------------------------------------------------------- 11 | ! This routine is used to calculate plugin contribution 12 | ! to the potential acting on the electrons 13 | ! 14 | USE io_global, ONLY : stdout, ionode 15 | USE kinds, ONLY : DP 16 | ! 17 | USE fft_base, ONLY : dfftp 18 | USE electrons_base, ONLY : nspin 19 | ! 20 | USE plugin_flags 21 | ! 22 | ! ***Environ MODULES BEGIN*** 23 | ! ***Environ MODULES END*** 24 | ! 25 | IMPLICIT NONE 26 | ! 27 | REAL(DP), intent(in) :: rhoin(dfftp%nnr,nspin) 28 | INTEGER, intent(in) :: nfi 29 | ! 30 | ! ***Environ VARIABLES BEGIN*** 31 | ! ***Environ VARIABLES END*** 32 | ! 33 | ! ***Environ CALLS BEGIN*** 34 | ! ***Environ CALLS END*** 35 | ! 36 | END SUBROUTINE plugin_get_potential 37 | -------------------------------------------------------------------------------- /CPV/src/plugin_init_base.f90: -------------------------------------------------------------------------------- 1 | ! Copyright (C) 2015 Quantum ESPRESSO group 2 | ! This file is distributed under the terms of the 3 | ! GNU General Public License. See the file `License' 4 | ! in the root directory of the present distribution, 5 | ! or http://www.gnu.org/copyleft/gpl.txt . 6 | ! 7 | subroutine plugin_init_base() 8 | ! 9 | ! This routine is used for fft related quantities in plugins 10 | ! DO NOT REMOVE THE TAGS ! ***ADDSON_NAME KIND_OF_PATCH*** 11 | ! 12 | USE plugin_flags 13 | USE fft_base, ONLY : dfftp 14 | USE mp_bands, ONLY : me_bgrp 15 | ! 16 | ! ***Environ MODULES BEGIN*** 17 | ! ***Environ MODULES END*** 18 | ! 19 | implicit none 20 | ! 21 | ! ***Environ VARIABLES BEGIN*** 22 | ! ***Environ VARIABLES END*** 23 | ! 24 | ! ***Environ CALLS BEGIN*** 25 | ! ***Environ CALLS END*** 26 | ! 27 | end subroutine plugin_init_base 28 | 29 | -------------------------------------------------------------------------------- /CPV/src/plugin_init_cell.f90: -------------------------------------------------------------------------------- 1 | ! 2 | ! Copyright (C) 2015 Quantum ESPRESSO group 3 | ! This file is distributed under the terms of the 4 | ! GNU General Public License. See the file `License' 5 | ! in the root directory of the present distribution, 6 | ! or http://www.gnu.org/copyleft/gpl.txt . 7 | ! 8 | !---------------------------------------------------------------------------- 9 | SUBROUTINE plugin_init_cell() 10 | !---------------------------------------------------------------------------- 11 | ! 12 | USE kinds, ONLY : DP 13 | USE fft_base, ONLY : dfftp 14 | USE plugin_flags 15 | ! 16 | ! ***Environ MODULES BEGIN*** 17 | ! ***Environ MODULES END*** 18 | ! 19 | IMPLICIT NONE 20 | ! 21 | ! ***Environ VARIABLES BEGIN*** 22 | ! ***Environ VARIABLES END*** 23 | ! 24 | ! ***Environ CALLS BEGIN*** 25 | ! ***Environ CALLS END*** 26 | ! 27 | END SUBROUTINE plugin_init_cell 28 | -------------------------------------------------------------------------------- /CPV/src/plugin_init_ions.f90: -------------------------------------------------------------------------------- 1 | ! 2 | ! Copyright (C) 2015 Quantum ESPRESSO group 3 | ! This file is distributed under the terms of the 4 | ! GNU General Public License. See the file `License' 5 | ! in the root directory of the present distribution, 6 | ! or http://www.gnu.org/copyleft/gpl.txt . 7 | ! 8 | !---------------------------------------------------------------------------- 9 | SUBROUTINE plugin_init_ions( tau ) 10 | !---------------------------------------------------------------------------- 11 | ! 12 | USE kinds, ONLY : DP 13 | USE fft_base, ONLY : dfftp 14 | USE ions_base, ONLY : nat, nsp, na 15 | USE plugin_flags 16 | ! 17 | ! ***Environ MODULES BEGIN*** 18 | ! ***Environ MODULES END*** 19 | ! 20 | IMPLICIT NONE 21 | ! 22 | REAL(DP), INTENT(IN) :: tau(3,nat) 23 | ! 24 | ! ***Environ VARIABLES BEGIN*** 25 | ! ***Environ VARIABLES END*** 26 | ! 27 | ! ***Environ CALLS BEGIN*** 28 | ! ***Environ CALLS END*** 29 | ! 30 | END SUBROUTINE plugin_init_ions 31 | -------------------------------------------------------------------------------- /CPV/src/plugin_initialization.f90: -------------------------------------------------------------------------------- 1 | ! 2 | ! Copyright (C) 2001-2009 Quantum ESPRESSO group 3 | ! This file is distributed under the terms of the 4 | ! GNU General Public License. See the file `License' 5 | ! in the root directory of the present distribution, 6 | ! or http://www.gnu.org/copyleft/gpl.txt . 7 | ! 8 | !---------------------------------------------------------------------------- 9 | SUBROUTINE plugin_initialization() 10 | !---------------------------------------------------------------------------- 11 | ! 12 | ! 13 | USE io_global, ONLY : stdout, ionode 14 | USE kinds, ONLY : DP 15 | USE io_files, ONLY : tmp_dir 16 | ! 17 | USE plugin_flags 18 | ! 19 | IMPLICIT NONE 20 | ! 21 | ! 22 | END SUBROUTINE plugin_initialization 23 | -------------------------------------------------------------------------------- /CPV/src/plugin_int_forces.f90: -------------------------------------------------------------------------------- 1 | ! 2 | ! Copyright (C) 2015 Quantum ESPRESSO group 3 | ! This file is distributed under the terms of the 4 | ! GNU General Public License. See the file `License' 5 | ! in the root directory of the present distribution, 6 | ! or http://www.gnu.org/copyleft/gpl.txt . 7 | ! 8 | !---------------------------------------------------------------------------- 9 | SUBROUTINE plugin_int_forces(force) 10 | !---------------------------------------------------------------------------- 11 | ! 12 | USE kinds, ONLY : DP 13 | USE io_global, ONLY : stdout 14 | USE ions_base, ONLY : nat, ityp 15 | USE cell_base, ONLY : omega 16 | USE fft_base, ONLY : dfftp 17 | USE fft_interfaces, ONLY : fwfft 18 | USE electrons_base, ONLY : nspin 19 | USE gvect, ONLY : ngm, nl, eigts1, eigts2, eigts3 20 | ! 21 | USE plugin_flags 22 | ! 23 | ! ***Environ MODULES BEGIN*** 24 | ! ***Environ MODULES END*** 25 | ! 26 | IMPLICIT NONE 27 | ! 28 | REAL(DP), INTENT(INOUT) :: force(3,nat) 29 | ! 30 | ! aux is used to store a possible additional density 31 | ! now defined in real space 32 | ! 33 | COMPLEX(DP), ALLOCATABLE :: auxg(:), auxr(:) 34 | ! 35 | INTEGER :: ipol, na 36 | ! counter on polarization 37 | ! counter on atoms 38 | ! 39 | ! ***Environ VARIABLES BEGIN*** 40 | ! ***Environ VARIABLES END*** 41 | ! 42 | ! ***Environ CALLS BEGIN*** 43 | ! ***Environ CALLS END*** 44 | ! 45 | END SUBROUTINE plugin_int_forces 46 | -------------------------------------------------------------------------------- /CPV/src/plugin_print_energies.f90: -------------------------------------------------------------------------------- 1 | ! 2 | ! Copyright (C) 2015 Quantum ESPRESSO group 3 | ! This file is distributed under the terms of the 4 | ! GNU General Public License. See the file `License' 5 | ! in the root directory of the present distribution, 6 | ! or http://www.gnu.org/copyleft/gpl.txt . 7 | ! 8 | !---------------------------------------------------------------------------- 9 | SUBROUTINE plugin_print_energies() 10 | !---------------------------------------------------------------------------- 11 | ! 12 | ! This routine is used for printing energy contrib from plugins 13 | ! DO NOT REMOVE THE TAGS ! ***ADDSON_NAME KIND_OF_PATCH*** 14 | ! 15 | USE io_global, ONLY : stdout, ionode 16 | USE kinds, ONLY : DP 17 | USE io_files, ONLY : tmp_dir 18 | ! 19 | USE plugin_flags 20 | ! 21 | ! 22 | ! ***Environ MODULES BEGIN*** 23 | ! ***Environ MODULES END*** 24 | ! 25 | IMPLICIT NONE 26 | ! 27 | ! ***Environ VARIABLES BEGIN*** 28 | ! ***Environ VARIABLES END*** 29 | ! 30 | ! ***Environ CALLS BEGIN*** 31 | ! ***Environ CALLS END*** 32 | ! 33 | END SUBROUTINE plugin_print_energies 34 | -------------------------------------------------------------------------------- /CPV/src/plugin_print_info.f90: -------------------------------------------------------------------------------- 1 | ! 2 | ! Copyright (C) 2015 Quantum ESPRESSO group 3 | ! This file is distributed under the terms of the 4 | ! GNU General Public License. See the file `License' 5 | ! in the root directory of the present distribution, 6 | ! or http://www.gnu.org/copyleft/gpl.txt . 7 | ! 8 | subroutine plugin_print_info() 9 | ! 10 | ! This routine is used for printing 11 | ! plugins informations 12 | ! DO NOT REMOVE THE TAGS ! ***ADDSON_NAME KIND_OF_PATCH*** 13 | ! 14 | USE plugin_flags 15 | ! 16 | ! ***Environ MODULES BEGIN*** 17 | ! ***Environ MODULES END*** 18 | ! 19 | implicit none 20 | ! 21 | ! ***Environ VARIABLES BEGIN*** 22 | ! ***Environ VARIABLES END*** 23 | ! 24 | ! ***Environ CALLS BEGIN*** 25 | ! ***Environ CALLS END*** 26 | ! 27 | end subroutine plugin_print_info 28 | -------------------------------------------------------------------------------- /CPV/src/plugin_read_input.f90: -------------------------------------------------------------------------------- 1 | ! 2 | ! Copyright (C) 2015 Quantum ESPRESSO group 3 | ! This file is distributed under the terms of the 4 | ! GNU General Public License. See the file `License' 5 | ! in the root directory of the present distribution, 6 | ! or http://www.gnu.org/copyleft/gpl.txt . 7 | ! 8 | subroutine plugin_read_input() 9 | ! 10 | ! This routine is used for reading 11 | ! plugin input files 12 | ! DO NOT REMOVE THE TAGS ! ***ADDSON_NAME KIND_OF_PATCH*** 13 | ! 14 | USE plugin_flags 15 | USE input_parameters, ONLY : nat, ntyp 16 | USE input_parameters, ONLY : assume_isolated, ibrav 17 | ! 18 | ! ***Environ MODULES BEGIN*** 19 | ! ***Environ MODULES END*** 20 | ! 21 | implicit none 22 | ! 23 | ! ***Environ VARIABLES BEGIN*** 24 | ! ***Environ VARIABLES END*** 25 | ! 26 | ! ***Environ CALLS BEGIN*** 27 | ! ***Environ CALLS END*** 28 | ! 29 | end subroutine plugin_read_input 30 | -------------------------------------------------------------------------------- /CPV/src/smallbox_gvec.f90: -------------------------------------------------------------------------------- 1 | ! 2 | ! Copyright (C) 20102011 Quantum ESPRESSO group 3 | ! This file is distributed under the terms of the 4 | ! GNU General Public License. See the file `License' 5 | ! in the root directory of the present distribution, 6 | ! or http://www.gnu.org/copyleft/gpl.txt . 7 | ! 8 | !=----------------------------------------------------------------------------=! 9 | MODULE smallbox_gvec 10 | !=----------------------------------------------------------------------------=! 11 | USE kinds, ONLY: DP 12 | 13 | IMPLICIT NONE 14 | SAVE 15 | 16 | ! ... Variables describing G-vectors for the small box grid 17 | ! ... Basically the same meaning as for the corresponding 18 | ! ... quantities for the true lattice 19 | ! 20 | INTEGER :: ngb = 0 ! local number of G vectors 21 | INTEGER :: ngbl = 0 ! number of G-vector shells up to ngw 22 | 23 | REAL(DP), ALLOCATABLE :: gb(:) ! G(i)^2 in (tpi/alatb)**2 units 24 | REAL(DP), ALLOCATABLE :: gxb(:,:) ! G(:,i) in tpi/alatb units 25 | REAL(DP), ALLOCATABLE :: glb(:) ! shells of G(i)^2 26 | INTEGER, ALLOCATABLE :: npb(:), nmb(:) ! FFT indices 27 | INTEGER, ALLOCATABLE :: mill_b(:,:) ! miller indices 28 | 29 | REAL(DP) :: gcutb = 0.0_DP ! effective cut-off in (tpi/alatb)**2 units 30 | 31 | CONTAINS 32 | 33 | SUBROUTINE deallocate_smallbox_gvec() 34 | IF( ALLOCATED( gb ) ) DEALLOCATE( gb ) 35 | IF( ALLOCATED( gxb ) ) DEALLOCATE( gxb ) 36 | IF( ALLOCATED( glb ) ) DEALLOCATE( glb ) 37 | IF( ALLOCATED( npb ) ) DEALLOCATE( npb ) 38 | IF( ALLOCATED( nmb ) ) DEALLOCATE( nmb ) 39 | IF( ALLOCATED( mill_b ) ) DEALLOCATE( mill_b ) 40 | END SUBROUTINE deallocate_smallbox_gvec 41 | 42 | !=----------------------------------------------------------------------------=! 43 | END MODULE smallbox_gvec 44 | !=----------------------------------------------------------------------------=! 45 | -------------------------------------------------------------------------------- /CPV/src/stop_run.f90: -------------------------------------------------------------------------------- 1 | ! 2 | ! Copyright (C) 2001-2005 Quantum ESPRESSO group 3 | ! This file is distributed under the terms of the 4 | ! GNU General Public License. See the file `License' 5 | ! in the root directory of the present distribution, 6 | ! or http://www.gnu.org/copyleft/gpl.txt . 7 | ! 8 | ! 9 | !---------------------------------------------------------------------------- 10 | SUBROUTINE stop_run() 11 | !---------------------------------------------------------------------------- 12 | ! 13 | ! ... Close all files and synchronize processes before stopping. 14 | ! 15 | USE environment, ONLY : environment_end 16 | USE control_flags, ONLY : lconstrain 17 | USE constraints_module, ONLY : deallocate_constraint 18 | USE mp_global, ONLY : mp_global_end 19 | ! 20 | IMPLICIT NONE 21 | ! 22 | ! 23 | CALL environment_end( 'CP' ) 24 | ! 25 | CALL deallocate_modules_var() 26 | ! 27 | IF ( lconstrain ) CALL deallocate_constraint() 28 | ! 29 | CALL plugin_clean() 30 | ! 31 | CALL mp_global_end() 32 | ! 33 | END SUBROUTINE stop_run 34 | 35 | SUBROUTINE do_stop( flag ) 36 | IMPLICIT NONE 37 | ! 38 | LOGICAL, INTENT(IN) :: flag 39 | ! 40 | IF ( flag ) THEN 41 | STOP 42 | ELSE 43 | STOP 1 44 | END IF 45 | ! 46 | END SUBROUTINE do_stop 47 | -------------------------------------------------------------------------------- /FFTXlib/Makefile: -------------------------------------------------------------------------------- 1 | # Makefile for FFTXlib 2 | 3 | include ../make.inc 4 | 5 | # location of needed modules 6 | #MODFLAGS= $(MOD_FLAG)../iotk/src $(MOD_FLAG). 7 | 8 | FFTX = \ 9 | cuda.o \ 10 | task_groups.o \ 11 | scatter_mod.o \ 12 | fft_fwinv.o \ 13 | fft_scalar.o \ 14 | fft_scalar.DFTI.o \ 15 | fft_scalar.ESSL.o \ 16 | fft_scalar.FFTW.o \ 17 | fft_scalar.FFTW3.o \ 18 | fft_parallel.o \ 19 | fft_interfaces.o \ 20 | stick_base.o \ 21 | fft_smallbox.o \ 22 | fft_smallbox_type.o \ 23 | fft_support.o \ 24 | fft_error.o \ 25 | fft_stick.o \ 26 | fft_types.o \ 27 | fft_param.o \ 28 | ipca2a.o 29 | 30 | 31 | all : libqefft.a 32 | 33 | libqefft.a: $(FFTX) 34 | $(AR) $(ARFLAGS) $@ $? 35 | $(RANLIB) $@ 36 | 37 | fft_scalar.o : fft_scalar.f90 fft_scalar.FFTW3.f90 fft_scalar.FFTW.f90 fft_scalar.DFTI.f90 fft_scalar.ESSL.f90 38 | 39 | 40 | fft_stick.o : fft_stick.c fftw.c fftw.h konst.h 41 | 42 | # 43 | ipca2a.o : ipca2a.c 44 | $(MPICC) $(CFLAGS) -D__align__\(n\)=__attribute__\(\(aligned\(n\)\)\) -D__location__\(a\)=__annotate__\(a\) -DCUDARTAPI= -c ipca2a.c -o ipca2a.o -I${CUDADIR}/include 45 | 46 | TEST : test.o libqefft.a 47 | $(LD) $(LDFLAGS) -o fft_test.x test.o libqefft.a $(LIBS) 48 | 49 | TEST0: test0.o libqefft.a 50 | $(LD) $(LDFLAGS) -o fft_test0.x test0.o libqefft.a $(LIBS) 51 | 52 | clean : 53 | - /bin/rm -f *.o *.a *.d *.i *~ *_tmp.f90 *.mod *.L 54 | 55 | # .PHONY forces execution of a rule irrespective of the presence of an 56 | # updated file with the same name of the rule. In this way, the script 57 | # that generates version.f90 always runs, updating the version if you 58 | # execute "svn update". The update_version script takes care of not 59 | # changing the file if the svn version did not change 60 | 61 | .PHONY: all clean 62 | 63 | include make.depend 64 | -------------------------------------------------------------------------------- /FFTXlib/README.TEST: -------------------------------------------------------------------------------- 1 | This library provides a Testing and Timing code 2 | to asses the performance of your FFT, estimate the 3 | scalability and the size of your simulation. 4 | 5 | To compile the test program, once you have properly 6 | configure QE, go inside the directory FFTXlib and 7 | type: 8 | make TEST 9 | 10 | Then you can run your FFT tests using command like: 11 | 12 | mpirun -np 4 ./fft_test.x -ecutwfc 80 -alat 20 -nbnd 128 -ntg 4 13 | 14 | or, in case of serial build 15 | 16 | ./fft_test.x -ecutwfc 80 -alat 20 -nbnd 128 -ntg 4 17 | 18 | 19 | Command line arguments: 20 | -ecutwfc Plane wave energy cut off 21 | -alat Lattice parameter 22 | -nbnd Number of bands (fft cycles) 23 | -ntg Number of task groups 24 | -------------------------------------------------------------------------------- /FFTXlib/fft_error.f90: -------------------------------------------------------------------------------- 1 | ! 2 | ! Copyright (C) Quantum ESPRESSO group 3 | ! 4 | ! This file is distributed under the terms of the 5 | ! GNU General Public License. See the file `License' 6 | ! in the root directory of the present distribution, 7 | ! or http://www.gnu.org/copyleft/gpl.txt . 8 | ! 9 | !---------------------------------------------------------------------------- 10 | SUBROUTINE fftx_error__( calling_routine, message, ierr ) 11 | !---------------------------------------------------------------------------- 12 | ! 13 | ! ... This is a simple routine which writes an error message to output: 14 | ! 15 | USE fft_param 16 | IMPLICIT NONE 17 | ! 18 | CHARACTER(LEN=*), INTENT(IN) :: calling_routine, message 19 | ! the name of the calling calling_routine 20 | ! the output message 21 | INTEGER, INTENT(IN) :: ierr 22 | ! 23 | CHARACTER(LEN=6) :: cerr 24 | INTEGER :: info 25 | ! 26 | IF( ierr <= 0 ) THEN 27 | RETURN 28 | END IF 29 | ! 30 | ! ... the error message is written un the "*" unit 31 | ! 32 | WRITE( cerr, FMT = '(I6)' ) ierr 33 | WRITE( UNIT = *, FMT = '(/,1X,78("%"))' ) 34 | WRITE( UNIT = *, FMT = '(5X,"Error in routine ",A," (",A,"):")' ) & 35 | TRIM(calling_routine), TRIM(ADJUSTL(cerr)) 36 | WRITE( UNIT = *, FMT = '(5X,A)' ) TRIM(message) 37 | WRITE( UNIT = *, FMT = '(1X,78("%"),/)' ) 38 | ! 39 | WRITE( *, '(" stopping ...")' ) 40 | ! 41 | #if defined(__MPI) 42 | ! 43 | CALL mpi_abort(MPI_COMM_WORLD,ierr,info) 44 | ! 45 | #endif 46 | ! 47 | STOP 1 48 | ! 49 | RETURN 50 | ! 51 | END SUBROUTINE fftx_error__ 52 | -------------------------------------------------------------------------------- /FFTXlib/fft_param.f90: -------------------------------------------------------------------------------- 1 | ! 2 | ! Copyright (C) Quantum ESPRESSO group 3 | ! 4 | ! This file is distributed under the terms of the 5 | ! GNU General Public License. See the file `License' 6 | ! in the root directory of the present distribution, 7 | ! or http://www.gnu.org/copyleft/gpl.txt . 8 | ! 9 | MODULE fft_param 10 | 11 | #if defined(__MPI) 12 | #if defined(__MPI_MODULE) 13 | USE mpi 14 | #else 15 | INCLUDE 'mpif.h' 16 | #endif 17 | #endif 18 | 19 | INTEGER, PARAMETER :: ndims = 10 20 | !! Number of different FFT tables that the module 21 | !!could keep into memory without reinitialization 22 | 23 | INTEGER, PARAMETER :: nfftx = 2049 24 | !!Max allowed fft dimension 25 | 26 | INTEGER, PARAMETER :: DP = selected_real_kind(14,200) 27 | INTEGER, PARAMETER :: stdout = 6 ! unit connected to standard output 28 | 29 | END MODULE fft_param 30 | -------------------------------------------------------------------------------- /FFTXlib/fft_scalar.f90: -------------------------------------------------------------------------------- 1 | ! 2 | ! Copyright (C) Quantum ESPRESSO group 3 | ! 4 | ! This file is distributed under the terms of the 5 | ! GNU General Public License. See the file `License' 6 | ! in the root directory of the present distribution, 7 | ! or http://www.gnu.org/copyleft/gpl.txt . 8 | ! 9 | !--------------------------------------------------------------------------! 10 | ! FFT scalar drivers Module - contains machine-dependent routines for ! 11 | ! internal FFTW, FFTW v.3, IBM ESSL, Intel DFTI, ARMlib ! 12 | ! (both 3d for serial execution and 1d+2d FFTs for parallel execution); ! 13 | ! legacy NEC ASL libraries (3d only, no parallel execution) ! 14 | ! Written by Carlo Cavazzoni, modified by P. Giannozzi, contributions ! 15 | ! by Martin Hilgemans, Guido Roma, Pascal Thibaudeau, Stephane Lefranc, ! 16 | ! Nicolas Lacorne, Filippo Spiga, Nicola Varini - Last update Jul 2015 ! 17 | !--------------------------------------------------------------------------! 18 | 19 | !=----------------------------------------------------------------------=! 20 | MODULE fft_scalar 21 | !=----------------------------------------------------------------------=! 22 | 23 | USE fft_param 24 | #if defined(__FFTW3) 25 | USE fft_scalar_fftw3 26 | #elif defined(__DFTI) 27 | USE fft_scalar_dfti 28 | #elif defined(__LINUX_ESSL) 29 | USE fft_scalar_essl 30 | #else 31 | USE fft_scalar_fftw 32 | #endif 33 | 34 | IMPLICIT NONE 35 | SAVE 36 | 37 | PRIVATE 38 | PUBLIC :: cft_1z, cft_2xy, cfft3d, cfft3ds 39 | 40 | END MODULE fft_scalar 41 | -------------------------------------------------------------------------------- /FFTXlib/make.depend: -------------------------------------------------------------------------------- 1 | fft_error.o : fft_param.o 2 | fft_fwinv.o : fft_parallel.o 3 | fft_fwinv.o : fft_param.o 4 | fft_fwinv.o : fft_scalar.o 5 | fft_fwinv.o : fft_smallbox.o 6 | fft_fwinv.o : fft_smallbox_type.o 7 | fft_fwinv.o : fft_types.o 8 | fft_fwinv.o : task_groups.o 9 | fft_interfaces.o : fft_param.o 10 | fft_interfaces.o : fft_smallbox_type.o 11 | fft_interfaces.o : fft_types.o 12 | fft_interfaces.o : task_groups.o 13 | fft_parallel.o : fft_param.o 14 | fft_parallel.o : fft_scalar.o 15 | fft_parallel.o : fft_types.o 16 | fft_parallel.o : scatter_mod.o 17 | fft_parallel.o : task_groups.o 18 | fft_scalar.DFTI.o : fft_param.o 19 | fft_scalar.ESSL.o : fft_param.o 20 | fft_scalar.FFTW.o : fft_param.o 21 | fft_scalar.FFTW3.o : fft_param.o 22 | fft_scalar.o : fft_param.o 23 | fft_scalar.o : fft_scalar.DFTI.o 24 | fft_scalar.o : fft_scalar.ESSL.o 25 | fft_scalar.o : fft_scalar.FFTW.o 26 | fft_scalar.o : fft_scalar.FFTW3.o 27 | fft_support.o : fft_param.o 28 | fft_types.o : fft_param.o 29 | fft_types.o : fft_support.o 30 | fft_types.o : stick_base.o 31 | scatter_mod.o : fft_param.o 32 | scatter_mod.o : fft_types.o 33 | scatter_mod.o : task_groups.o 34 | scatter_mod.o : ipca2a.o 35 | stick_base.o : fft_param.o 36 | task_groups.o : fft_param.o 37 | task_groups.o : fft_types.o 38 | test.o : fft_parallel.o 39 | test.o : fft_param.o 40 | test.o : fft_support.o 41 | test.o : fft_types.o 42 | test.o : stick_base.o 43 | test.o : task_groups.o 44 | test0.o : fft_interfaces.o 45 | test0.o : fft_parallel.o 46 | test0.o : fft_param.o 47 | test0.o : fft_scalar.o 48 | test0.o : fft_support.o 49 | test0.o : fft_types.o 50 | fft_scalar.ARM_LIB.o : ../include/fft_defs.h 51 | fft_scalar.FFTW.o : ../include/fft_defs.h 52 | fft_scalar.FFTW3.o : ../include/fft_defs.h 53 | fft_smallbox.o : ../include/fft_defs.h 54 | fft_stick.o : ../include/c_defs.h 55 | fft_stick.o : fftw.c 56 | -------------------------------------------------------------------------------- /LAXlib/Makefile: -------------------------------------------------------------------------------- 1 | # Makefile for LAXlib 2 | 3 | include ../make.inc 4 | 5 | MODFLAGS= $(MOD_FLAG)../ELPA/src 6 | 7 | LAX = la_types.o \ 8 | la_error.o \ 9 | dspev_drv.o \ 10 | ptoolkit.o \ 11 | transto.o \ 12 | distools.o \ 13 | zhpev_drv.o \ 14 | la_param.o 15 | 16 | 17 | all : libqela.a 18 | 19 | 20 | libqela.a: $(LAX) 21 | $(AR) $(ARFLAGS) $@ $? 22 | $(RANLIB) $@ 23 | 24 | la_test.x : test.o libqela.a 25 | $(LD) $(LDFLAGS) -o la_test.x test.o libqela.a $(LIBS) 26 | 27 | TEST : la_test.x 28 | 29 | clean : 30 | - /bin/rm -f *.o *.a *.d *.i *~ *_tmp.f90 *.mod *.L *.x 31 | 32 | # .PHONY forces execution of a rule irrespective of the presence of an 33 | # updated file with the same name of the rule. In this way, the script 34 | # that generates version.f90 always runs, updating the version if you 35 | # execute "svn update". The update_version script takes care of not 36 | # changing the file if the svn version did not change 37 | 38 | .PHONY: all clean 39 | 40 | include make.depend 41 | -------------------------------------------------------------------------------- /LAXlib/README.TEST: -------------------------------------------------------------------------------- 1 | This library provides a Testing and Timing code 2 | to asses the performance of Linear Algebra subroutines, 3 | estimate the scalability and the size of your simulation. 4 | 5 | To compile the test program, once you have properly 6 | configure QE, go inside the directory LAXlib and 7 | type: 8 | make TEST 9 | 10 | Then you can run your LA tests using command like: 11 | 12 | mpirun -np 4 ./la_test.x -n 1024 13 | 14 | or, in case of serial build 15 | 16 | ./la_test.x -n 1024 17 | 18 | where 1024 is the size of the matrix to be processed. 19 | -------------------------------------------------------------------------------- /LAXlib/la_error.f90: -------------------------------------------------------------------------------- 1 | ! 2 | ! Copyright (C) Quantum ESPRESSO group 3 | ! 4 | ! This file is distributed under the terms of the 5 | ! GNU General Public License. See the file `License' 6 | ! in the root directory of the present distribution, 7 | ! or http://www.gnu.org/copyleft/gpl.txt . 8 | ! 9 | !---------------------------------------------------------------------------- 10 | SUBROUTINE lax_error__( calling_routine, message, ierr ) 11 | !---------------------------------------------------------------------------- 12 | ! 13 | ! ... This is a simple routine which writes an error message to output: 14 | ! 15 | USE la_param 16 | IMPLICIT NONE 17 | ! 18 | CHARACTER(LEN=*), INTENT(IN) :: calling_routine, message 19 | ! the name of the calling calling_routine 20 | ! the output message 21 | INTEGER, INTENT(IN) :: ierr 22 | ! 23 | CHARACTER(LEN=6) :: cerr 24 | INTEGER :: info 25 | ! 26 | IF( ierr <= 0 ) THEN 27 | RETURN 28 | END IF 29 | ! 30 | ! ... the error message is written un the "*" unit 31 | ! 32 | WRITE( cerr, FMT = '(I6)' ) ierr 33 | WRITE( UNIT = *, FMT = '(/,1X,78("%"))' ) 34 | WRITE( UNIT = *, FMT = '(5X,"Error in routine ",A," (",A,"):")' ) & 35 | TRIM(calling_routine), TRIM(ADJUSTL(cerr)) 36 | WRITE( UNIT = *, FMT = '(5X,A)' ) TRIM(message) 37 | WRITE( UNIT = *, FMT = '(1X,78("%"),/)' ) 38 | ! 39 | WRITE( *, '(" stopping ...")' ) 40 | ! 41 | #if defined(__MPI) 42 | ! 43 | CALL mpi_abort(MPI_COMM_WORLD,ierr,info) 44 | ! 45 | #endif 46 | ! 47 | STOP 1 48 | ! 49 | RETURN 50 | ! 51 | END SUBROUTINE lax_error__ 52 | -------------------------------------------------------------------------------- /LAXlib/la_param.f90: -------------------------------------------------------------------------------- 1 | ! 2 | ! Copyright (C) Quantum ESPRESSO group 3 | ! 4 | ! This file is distributed under the terms of the 5 | ! GNU General Public License. See the file `License' 6 | ! in the root directory of the present distribution, 7 | ! or http://www.gnu.org/copyleft/gpl.txt . 8 | ! 9 | MODULE la_param 10 | 11 | #if defined(__MPI) 12 | #if defined(__MPI_MODULE) 13 | USE mpi 14 | #else 15 | INCLUDE 'mpif.h' 16 | #endif 17 | #endif 18 | 19 | INTEGER, PARAMETER :: DP = selected_real_kind(14,200) 20 | 21 | END MODULE la_param 22 | -------------------------------------------------------------------------------- /LAXlib/make.depend: -------------------------------------------------------------------------------- 1 | dspev_drv.o : la_param.o 2 | dspev_drv.o : la_types.o 3 | la_error.o : la_param.o 4 | ptoolkit.o : dspev_drv.o 5 | ptoolkit.o : la_param.o 6 | ptoolkit.o : la_types.o 7 | ptoolkit.o : zhpev_drv.o 8 | test.o : dspev_drv.o 9 | test.o : la_param.o 10 | test.o : la_types.o 11 | transto.o : la_param.o 12 | zhpev_drv.o : la_param.o 13 | -------------------------------------------------------------------------------- /LR_Modules/Makefile: -------------------------------------------------------------------------------- 1 | # Makefile for LR_Modules 2 | 3 | include ../make.inc 4 | 5 | # location of needed modules and included files (if any) 6 | MODFLAGS=$(MOD_FLAG)../FFTXlib $(MOD_FLAG)../Modules $(MOD_FLAG)../PW/src $(MOD_FLAG). 7 | 8 | IFLAGS= 9 | 10 | LR_MODULES = \ 11 | adddvscf.o \ 12 | addusdbec.o \ 13 | addusdbec_nc.o \ 14 | apply_dpot.o \ 15 | cft_wave.o \ 16 | cgsolve_all.o \ 17 | cg_psi.o \ 18 | ch_psi_all.o \ 19 | commutator_Hx_psi.o \ 20 | dfpt_tetra_mod.o \ 21 | dynmat_sub.o \ 22 | h_prec.o \ 23 | incdrhoscf.o \ 24 | incdrhoscf_nc.o \ 25 | dv_of_drho.o \ 26 | dgradcorr.o \ 27 | dnonloccorr.o \ 28 | dv_vdW_DF.o \ 29 | dv_rVV10.o \ 30 | newdq.o \ 31 | orthogonalize.o \ 32 | setup_nscf.o \ 33 | set_dbecsum_nc.o \ 34 | set_int3_nc.o \ 35 | smallgq.o \ 36 | lr_sm1_psi.o \ 37 | setup_dgc.o \ 38 | compute_vsgga.o \ 39 | setup_dmuxc.o \ 40 | setup_nbnd_occ.o \ 41 | setup_alpha_pv.o \ 42 | qdipol_cryst.o \ 43 | adddvepsi_us.o \ 44 | setqmod.o \ 45 | lrcom.o 46 | 47 | TLDEPS=libfft mods 48 | 49 | all : liblrmod.a 50 | 51 | liblrmod.a: $(LR_MODULES) 52 | $(AR) $(ARFLAGS) $@ $? 53 | $(RANLIB) $@ 54 | 55 | tldeps : 56 | if test -n "$(TLDEPS)" ; then \ 57 | ( cd ../; $(MAKE) $(TLDEPS) || exit 1 ) ; fi 58 | 59 | clean : 60 | - /bin/rm -f *.o *.a *.d *.i *~ *_tmp.f90 *.mod *.L 61 | 62 | include make.depend 63 | -------------------------------------------------------------------------------- /LR_Modules/cg_psi.f90: -------------------------------------------------------------------------------- 1 | ! 2 | ! Copyright (C) 2001 PWSCF group 3 | ! This file is distributed under the terms of the 4 | ! GNU General Public License. See the file `License' 5 | ! in the root directory of the present distribution, 6 | ! or http://www.gnu.org/copyleft/gpl.txt . 7 | ! 8 | ! 9 | !----------------------------------------------------------------- 10 | subroutine cg_psi (lda, n, m, psi, h_diag) 11 | !----------------------------------------------------------------- 12 | ! 13 | ! This routine gives a preconditioning to the linear system solver. 14 | ! The preconditioning is diagonal in reciprocal space 15 | ! 16 | ! 17 | USE kinds, only : DP 18 | USE noncollin_module, only : noncolin, npol 19 | implicit none 20 | 21 | integer :: lda, n, m 22 | ! input: the leading dimension of the psi vector 23 | ! input: the real dimension of the vector 24 | ! input: the number of vectors 25 | 26 | complex(DP) :: psi (lda*npol, m) 27 | ! inp/out: the vector to be preconditioned 28 | 29 | real(DP) :: h_diag (lda*npol, m) 30 | ! input: the preconditioning vector 31 | 32 | integer :: k, i 33 | ! counter on bands 34 | ! counter on the elements of the vector 35 | ! 36 | do k = 1, m 37 | do i = 1, n 38 | psi (i, k) = psi (i, k) * h_diag (i, k) 39 | enddo 40 | enddo 41 | IF (noncolin) THEN 42 | do k = 1, m 43 | do i = 1, n 44 | psi (i+lda, k) = psi (i+lda, k) * h_diag (i+lda, k) 45 | enddo 46 | enddo 47 | END IF 48 | return 49 | end subroutine cg_psi 50 | -------------------------------------------------------------------------------- /LR_Modules/dnonloccorr.f90: -------------------------------------------------------------------------------- 1 | ! 2 | ! Copyright (C) 2001-2016 PWSCF group 3 | ! This file is distributed under the terms of the 4 | ! GNU General Public License. See the file `License' 5 | ! in the root directory of the present distribution, 6 | ! or http://www.gnu.org/copyleft/gpl.txt . 7 | ! 8 | !-------------------------------------------------------------------- 9 | subroutine dnonloccorr(rho, drho, xq, dvaux ) 10 | ! =================== 11 | !-------------------------------------------------------------------- 12 | ! 13 | USE kinds, ONLY : DP 14 | USE noncollin_module, ONLY : nspin_lsda, nspin_mag, nspin_gga 15 | USE fft_base, ONLY: dfftp 16 | USE funct, ONLY : dft_is_gradient, dft_is_nonlocc, get_inlc 17 | USE ph_vdW_DF, ONLY : dv_drho_vdwdf 18 | USE ph_rVV10, ONLY : dv_drho_rvv10 19 | implicit none 20 | ! 21 | real(DP), INTENT(IN) :: rho (dfftp%nnr, nspin_mag), xq(3) 22 | complex(DP), INTENT(IN) :: drho (dfftp%nnr, nspin_mag) 23 | complex(DP), INTENT(INOUT) :: dvaux (dfftp%nnr, nspin_mag) 24 | 25 | complex(DP), ALLOCATABLE :: dvnonloc(:,:) 26 | 27 | integer :: inlc 28 | 29 | allocate(dvnonloc(dfftp%nnr,nspin_mag)) 30 | dvnonloc(:,:)= (0.d0,0.d0) 31 | if (get_inlc()==1 .or. get_inlc()==2) CALL dv_drho_vdwdf(rho, drho, nspin_mag, xq, dvnonloc) 32 | if (get_inlc()==3) CALL dv_drho_rvv10(rho, drho, nspin_mag, xq, dvnonloc) 33 | dvaux = dvaux + dvnonloc 34 | deallocate(dvnonloc) 35 | 36 | return 37 | end subroutine dnonloccorr 38 | -------------------------------------------------------------------------------- /LR_Modules/qdipol_cryst.f90: -------------------------------------------------------------------------------- 1 | ! 2 | ! Copyright (C) 2001-2016 Quantum ESPRESSO group 3 | ! This file is distributed under the terms of the 4 | ! GNU General Public License. See the file `License' 5 | ! in the root directory of the present distribution, 6 | ! or http://www.gnu.org/copyleft/gpl.txt . 7 | ! 8 | subroutine qdipol_cryst() 9 | ! 10 | ! This subroutine puts the dipole of Q on the crystal basis 11 | ! 12 | 13 | USE kinds, ONLY : DP 14 | USE lsda_mod, ONLY : nspin 15 | USE uspp_param, ONLY : nh 16 | USE spin_orb, ONLY : lspinorb 17 | USE cell_base, ONLY : at 18 | USE ions_base, ONLY : nat, ityp, ntyp => nsp 19 | USE lrus, ONLY : dpqq, dpqq_so 20 | 21 | IMPLICIT NONE 22 | 23 | REAL(DP) :: fact(3) 24 | COMPLEX(DP) :: fact_so(3) 25 | INTEGER :: nt, na, ih, jh, ipol, is 26 | 27 | DO nt = 1, ntyp 28 | DO ih = 1, nh (nt) 29 | DO jh = 1, nh (nt) 30 | IF (lspinorb) THEN 31 | DO is=1,nspin 32 | DO ipol=1,3 33 | fact_so(ipol)=at(1,ipol)*dpqq_so(ih,jh,is,1,nt)+ & 34 | at(2,ipol)*dpqq_so(ih,jh,is,2,nt)+ & 35 | at(3,ipol)*dpqq_so(ih,jh,is,3,nt) 36 | ENDDO 37 | dpqq_so(ih,jh,is,:,nt)=fact_so(:) 38 | ENDDO 39 | END IF 40 | DO ipol=1,3 41 | fact(ipol)=at(1,ipol)*dpqq(ih,jh,1,nt)+ & 42 | at(2,ipol)*dpqq(ih,jh,2,nt)+ & 43 | at(3,ipol)*dpqq(ih,jh,3,nt) 44 | ENDDO 45 | dpqq(ih,jh,:,nt)=fact(:) 46 | ENDDO 47 | ENDDO 48 | ENDDO 49 | 50 | RETURN 51 | END SUBROUTINE qdipol_cryst 52 | -------------------------------------------------------------------------------- /LR_Modules/setqmod.f90: -------------------------------------------------------------------------------- 1 | ! 2 | ! Copyright (C) 2001-2016 Quantum ESPRESSO group 3 | ! This file is distributed under the terms of the 4 | ! GNU General Public License. See the file `License' 5 | ! in the root directory of the present distribution, 6 | ! or http://www.gnu.org/copyleft/gpl.txt . 7 | ! 8 | ! 9 | !----------------------------------------------------------------------- 10 | subroutine setqmod (ngm, xq, g, qmod, qpg) 11 | !----------------------------------------------------------------------- 12 | ! 13 | ! This subroutine puts in qmod the modulus of q+G for the interpolation 14 | ! table used to compute qgm 15 | ! 16 | USE kinds, only : DP 17 | 18 | implicit none 19 | 20 | integer :: ngm 21 | ! input: the number of G vectors 22 | 23 | real(DP) :: xq (3), g (3, ngm), qmod (ngm), qpg (3, ngm) 24 | ! input: the q vector 25 | ! input: the G vectors 26 | ! output: the modulus of the G vectors 27 | ! output: the q+G vectors 28 | 29 | integer :: ig 30 | ! counter on G vectors 31 | 32 | do ig = 1, ngm 33 | qpg (1, ig) = xq (1) + g (1, ig) 34 | qpg (2, ig) = xq (2) + g (2, ig) 35 | qpg (3, ig) = xq (3) + g (3, ig) 36 | qmod (ig) = qpg (1, ig) **2 + qpg (2, ig) **2 + qpg (3, ig) **2 37 | enddo 38 | 39 | return 40 | 41 | end subroutine setqmod 42 | -------------------------------------------------------------------------------- /Modules/atom.f90: -------------------------------------------------------------------------------- 1 | ! 2 | ! Copyright (C) 2004-2007 Quantum ESPRESSO group 3 | ! This file is distributed under the terms of the 4 | ! GNU General Public License. See the file `License' 5 | ! in the root directory of the present distribution, 6 | ! or http://www.gnu.org/copyleft/gpl.txt . 7 | ! 8 | !-------------------------------------------------------------------------- 9 | ! 10 | MODULE atom 11 | ! 12 | ! ... The variables needed to describe the atoms and related quantities 13 | ! 14 | USE radial_grids, ONLY : radial_grid_type 15 | ! 16 | SAVE 17 | ! 18 | type(radial_grid_type), allocatable, target :: & 19 | rgrid(:) ! the information on atomic radial grids. 20 | ! NB: some of the subsequent data are therefore redundant 21 | ! and will be eliminated in due course asap 22 | INTEGER, ALLOCATABLE :: & 23 | msh(:) ! the point at rcut 24 | ! 25 | END MODULE atom 26 | -------------------------------------------------------------------------------- /Modules/date_and_tim.f90: -------------------------------------------------------------------------------- 1 | ! 2 | ! Copyright (C) 2001 PWSCF group 3 | ! This file is distributed under the terms of the 4 | ! GNU General Public License. See the file `License' 5 | ! in the root directory of the present distribution, 6 | ! or http://www.gnu.org/copyleft/gpl.txt . 7 | ! 8 | subroutine date_and_tim (cdate, ctime) 9 | ! 10 | ! Returns two strings containing the date and the time 11 | ! in human-readable format. Uses a standard f90 call. 12 | ! 13 | implicit none 14 | character (len=9) :: cdate, ctime 15 | ! 16 | character(len=3), dimension(12) :: months 17 | data months /'Jan','Feb','Mar','Apr','May','Jun', & 18 | 'Jul','Aug','Sep','Oct','Nov','Dec'/ 19 | INTEGER date_time(8) 20 | ! 21 | call date_and_time(values=date_time) 22 | ! 23 | write (cdate,'(i2,a3,i4)') date_time(3), months(date_time(2)), date_time(1) 24 | write (ctime,'(i2,":",i2,":",i2)') date_time(5), date_time(6), date_time(7) 25 | 26 | end subroutine date_and_tim 27 | -------------------------------------------------------------------------------- /Modules/fcp_variables.f90: -------------------------------------------------------------------------------- 1 | ! 2 | ! Copyright (C) 2002-2011 Quantum ESPRESSO group 3 | ! This file is distributed under the terms of the 4 | ! GNU General Public License. See the file `License' 5 | ! in the root directory of the present distribution, 6 | ! or http://www.gnu.org/copyleft/gpl.txt . 7 | ! 8 | !------------------------------------------------------------------------------! 9 | MODULE fcp_variables 10 | !------------------------------------------------------------------------------! 11 | ! 12 | USE kinds, ONLY : DP 13 | ! 14 | IMPLICIT NONE 15 | SAVE 16 | ! 17 | LOGICAL :: lfcpopt = .FALSE. 18 | LOGICAL :: lfcpdyn = .FALSE. 19 | REAL(DP) :: fcp_mu = 0.0_DP 20 | REAL(DP) :: fcp_mass = 10000.0_DP 21 | REAL(DP) :: fcp_temperature = 0.0_DP 22 | REAL(DP) :: fcp_relax_step = 0.5_DP 23 | REAL(DP) :: fcp_relax_crit = 0.001_DP 24 | REAL(DP) :: fcp_tot_charge_first = 0.0_DP 25 | REAL(DP) :: fcp_tot_charge_last = 0.0_DP 26 | 27 | END MODULE fcp_variables 28 | -------------------------------------------------------------------------------- /Modules/find_free_unit.f90: -------------------------------------------------------------------------------- 1 | ! 2 | ! Copyright (C) 2002-2009 Quantum ESPRESSO group 3 | ! This file is distributed under the terms of the 4 | ! GNU General Public License. See the file `License' 5 | ! in the root directory of the present distribution, 6 | ! or http://www.gnu.org/copyleft/gpl.txt . 7 | ! 8 | !-------------------------------------------------------------------------- 9 | FUNCTION find_free_unit() 10 | !-------------------------------------------------------------------------- 11 | ! 12 | IMPLICIT NONE 13 | ! 14 | INTEGER :: find_free_unit 15 | INTEGER :: iunit 16 | LOGICAL :: opnd 17 | ! 18 | ! 19 | unit_loop: DO iunit = 99, 1, -1 20 | ! 21 | INQUIRE( UNIT = iunit, OPENED = opnd ) 22 | ! 23 | IF ( .NOT. opnd ) THEN 24 | ! 25 | find_free_unit = iunit 26 | ! 27 | RETURN 28 | ! 29 | END IF 30 | ! 31 | END DO unit_loop 32 | ! 33 | CALL errore( 'find_free_unit()', 'free unit not found ?!?', 1 ) 34 | ! 35 | RETURN 36 | ! 37 | END FUNCTION find_free_unit 38 | ! 39 | -------------------------------------------------------------------------------- /Modules/has_xml.f90: -------------------------------------------------------------------------------- 1 | ! 2 | ! Copyright (C) 2010 Quantum ESPRESSO group 3 | ! This file is distributed under the terms of the 4 | ! GNU General Public License. See the file `License' 5 | ! in the root directory of the present distribution, 6 | ! or http://www.gnu.org/copyleft/gpl.txt . 7 | ! 8 | LOGICAL FUNCTION has_xml(inp_string) 9 | ! 10 | ! This function returns true if the last four characters of inp_string are 11 | ! .xml or .XML. On output the string .xml or .XML is removed from inp_string 12 | ! 13 | IMPLICIT NONE 14 | 15 | CHARACTER(LEN=*), INTENT(INOUT) :: inp_string 16 | 17 | INTEGER :: leng, start 18 | CHARACTER(LEN=4) :: aux 19 | LOGICAL, EXTERNAL :: matches 20 | 21 | has_xml=.FALSE. 22 | leng=LEN_TRIM(inp_string) 23 | 24 | !cannot match xml if it is only 1 or 2 chars long 25 | IF(leng<3) RETURN 26 | 27 | start=MAX(leng-3,1) 28 | aux=inp_string(start:leng) 29 | 30 | IF (matches(aux,'.xml').OR.matches(aux,'.XML')) THEN 31 | has_xml=.TRUE. 32 | inp_string(leng-3:leng)=' ' 33 | ENDIF 34 | 35 | RETURN 36 | END FUNCTION has_xml 37 | -------------------------------------------------------------------------------- /Modules/int_to_char.f90: -------------------------------------------------------------------------------- 1 | ! 2 | ! Copyright (C) 2009 Quantum ESPRESSO groups 3 | ! This file is distributed under the terms of the 4 | ! GNU General Public License. See the file `License' 5 | ! in the root directory of the present distribution, 6 | ! or http://www.gnu.org/copyleft/gpl.txt . 7 | ! 8 | !----------------------------------------------------------------------- 9 | FUNCTION int_to_char( i ) 10 | !----------------------------------------------------------------------- 11 | ! 12 | ! ... converts an integer number of up to 6 figures 13 | ! ... into a left-justifed character variable 14 | ! 15 | IMPLICIT NONE 16 | ! 17 | INTEGER, INTENT(IN) :: i 18 | CHARACTER (LEN=6) :: int_to_char 19 | CHARACTER :: c 20 | INTEGER :: n, j, nc 21 | LOGICAL :: neg 22 | ! 23 | nc = 6 24 | ! 25 | IF( i < 0 ) then 26 | nc = nc - 1 27 | n = -i 28 | neg = .true. 29 | ELSE 30 | n = i 31 | neg = .false. 32 | END IF 33 | ! 34 | j = 1 35 | DO WHILE( j <= nc ) 36 | int_to_char(j:j) = CHAR( MOD( n, 10 ) + ICHAR( '0' ) ) 37 | n = n / 10 38 | IF( n == 0 ) EXIT 39 | j = j + 1 40 | END DO 41 | ! 42 | IF( j <= nc ) THEN 43 | DO n = 1, j/2 44 | c = int_to_char( n : n ) 45 | int_to_char( n : n ) = int_to_char( j-n+1 : j-n+1 ) 46 | int_to_char( j-n+1 : j-n+1 ) = c 47 | END DO 48 | IF( j < nc ) int_to_char(j+1:nc) = ' ' 49 | ELSE 50 | int_to_char(:) = '*' 51 | END IF 52 | ! 53 | IF( neg ) THEN 54 | DO n = nc+1, 2, -1 55 | int_to_char(n:n) = int_to_char(n-1:n-1) 56 | END DO 57 | int_to_char(1:1) = '-' 58 | END IF 59 | ! 60 | RETURN 61 | ! 62 | END FUNCTION int_to_char 63 | -------------------------------------------------------------------------------- /Modules/io_global.f90: -------------------------------------------------------------------------------- 1 | ! 2 | ! Copyright (C) 2002-2013 Quantum ESPRESSO group 3 | ! This file is distributed under the terms of the 4 | ! GNU General Public License. See the file `License' 5 | ! in the root directory of the present distribution, 6 | ! or http://www.gnu.org/copyleft/gpl.txt . 7 | ! 8 | !---------------------------------------------------------------------------- 9 | MODULE io_global 10 | !---------------------------------------------------------------------------- 11 | ! 12 | IMPLICIT NONE 13 | ! 14 | PRIVATE 15 | SAVE 16 | ! 17 | PUBLIC :: stdin, stdout, qestdin 18 | PUBLIC :: ionode, ionode_id, meta_ionode, meta_ionode_id 19 | ! 20 | INTEGER, PARAMETER :: stdin = 5 ! unit connected to standard input 21 | INTEGER :: qestdin= 9 ! unit connected to input file (xml or text) 22 | INTEGER :: stdout = 6 ! unit connected to standard output 23 | ! 24 | ! For parallel execution: I/O within an image 25 | ! These are set at startup by calling mp_world_start 26 | ! 27 | INTEGER :: ionode_id = 0 ! index of the i/o node for this image 28 | LOGICAL :: ionode = .TRUE. ! true if this processor is a i/o node 29 | ! for this image 30 | ! For parallel execution: global I/O node (for NEB, PHonon, etc) 31 | ! These are set at startup by calling mp_image_start 32 | ! 33 | INTEGER :: meta_ionode_id = 0 ! index of the global i/o node 34 | LOGICAL :: meta_ionode = .TRUE. ! true if this processor is global i/o node 35 | ! 36 | INTEGER :: xmloutputunit = 51 ! unit connected to the xml output 37 | ! 38 | END MODULE io_global 39 | -------------------------------------------------------------------------------- /Modules/parallel_include.f90: -------------------------------------------------------------------------------- 1 | ! 2 | ! Copyright (C) 2003-2004 Carlo Cavazzoni 3 | ! This file is distributed under the terms of the 4 | ! GNU General Public License. See the file `License' 5 | ! in the root directory of the present distribution, 6 | ! or http://www.gnu.org/copyleft/gpl.txt . 7 | ! 8 | !------------------------------------------------------------------------------! 9 | ! SISSA Code Interface -- Carlo Cavazzoni 10 | !------------------------------------------------------------------------------C 11 | MODULE parallel_include 12 | 13 | #if defined (__MPI) 14 | ! 15 | ! Include file for MPI 16 | ! 17 | #if defined (__MPI_MODULE) 18 | USE mpi 19 | #else 20 | INCLUDE 'mpif.h' 21 | #endif 22 | #else 23 | ! dummy world and null communicator 24 | INTEGER, PARAMETER :: MPI_COMM_WORLD = 0 25 | INTEGER, PARAMETER :: MPI_COMM_NULL = -1 26 | INTEGER, PARAMETER :: MPI_COMM_SELF = -2 27 | #endif 28 | 29 | END MODULE parallel_include 30 | -------------------------------------------------------------------------------- /Modules/parameters.f90: -------------------------------------------------------------------------------- 1 | ! 2 | ! Copyright (C) 2001-2009 Quantum ESPRESSO group 3 | ! This file is distributed under the terms of the 4 | ! GNU General Public License. See the file `License' 5 | ! in the root directory of the present distribution, 6 | ! or http://www.gnu.org/copyleft/gpl.txt . 7 | ! 8 | ! 9 | MODULE parameters 10 | 11 | IMPLICIT NONE 12 | SAVE 13 | 14 | INTEGER, PARAMETER :: & 15 | ntypx = 10, &! max number of different types of atom 16 | npsx = ntypx, &! max number of different PPs (obsolete) 17 | nsx = ntypx, &! max number of atomic species (CP) 18 | npk = 40000, &! max number of k-points 19 | lmaxx = 3, &! max non local angular momentum (l=0 to lmaxx) 20 | lqmax= 2*lmaxx+1 ! max number of angular momenta of Q 21 | 22 | END MODULE parameters 23 | -------------------------------------------------------------------------------- /Modules/plugin_flags.f90: -------------------------------------------------------------------------------- 1 | ! 2 | ! Copyright (C) 2002-2007 Quantum ESPRESSO group 3 | ! This file is distributed under the terms of the 4 | ! GNU General Public License. See the file `License' 5 | ! in the root directory of the present distribution, 6 | ! or http://www.gnu.org/copyleft/gpl.txt . 7 | ! 8 | !=----------------------------------------------------------------------------=! 9 | MODULE plugin_flags 10 | !=--------------------------------------------------------------------------=! 11 | ! 12 | ! ... this module contains all basic variables that controls 13 | ! ... the use or not of plugins. 14 | !---------------------------------------------- 15 | ! 16 | USE kinds 17 | USE parameters 18 | ! 19 | IMPLICIT NONE 20 | ! 21 | SAVE 22 | ! 23 | PRIVATE 24 | ! 25 | ! 26 | ! ... declare execution control variables 27 | ! 28 | CHARACTER(LEN=256), PUBLIC :: plugin_name 29 | LOGICAL, PUBLIC :: use_plumed 30 | LOGICAL, PUBLIC :: use_pw2casino 31 | LOGICAL, PUBLIC :: use_environ 32 | ! 33 | END MODULE plugin_flags 34 | -------------------------------------------------------------------------------- /Modules/plugin_variables.f90: -------------------------------------------------------------------------------- 1 | ! 2 | ! Copyright (C) 2002-2007 Quantum ESPRESSO group 3 | ! This file is distributed under the terms of the 4 | ! GNU General Public License. See the file `License' 5 | ! in the root directory of the present distribution, 6 | ! or http://www.gnu.org/copyleft/gpl.txt . 7 | ! 8 | !=----------------------------------------------------------------------------=! 9 | MODULE plugin_variables 10 | !=--------------------------------------------------------------------------=! 11 | ! 12 | ! ... this module contains all basic variables possibly 13 | ! ... used by plug ins 14 | !---------------------------------------------- 15 | ! 16 | USE kinds 17 | USE parameters 18 | ! 19 | IMPLICIT NONE 20 | ! 21 | SAVE 22 | ! 23 | PRIVATE 24 | ! 25 | PUBLIC :: plugin_etot 26 | ! 27 | REAL(DP) :: plugin_etot 28 | ! 29 | END MODULE plugin_variables 30 | -------------------------------------------------------------------------------- /Modules/pw_dot.f90: -------------------------------------------------------------------------------- 1 | ! 2 | ! Copyright (C) 2003 PWSCF group 3 | ! This file is distributed under the terms of the 4 | ! GNU General Public License. See the file `License' 5 | ! in the root directory of the present distribution, 6 | ! or http://www.gnu.org/copyleft/gpl.txt . 7 | ! 8 | !----------------------------------------------------------------------- 9 | SUBROUTINE pw_dot(sum_over_nodes,n,m,a,lda,b,ldb,c) 10 | !----------------------------------------------------------------------- 11 | ! 12 | ! calculate m dot products c_i = real( a^*_ij b_ji ) 13 | ! using half G vectors or half PWs 14 | ! 15 | USE kinds, ONLY: DP 16 | USE gvect, ONLY: gstart 17 | USE mp_global, ONLY : intra_pool_comm 18 | USE mp, ONLY : mp_sum 19 | IMPLICIT NONE 20 | ! input 21 | INTEGER :: n, m, lda, ldb 22 | CHARACTER(len=1) sum_over_nodes 23 | COMPLEX(DP) :: a(lda,m), b(ldb,m) 24 | ! output 25 | real(DP) :: c(m) 26 | ! local 27 | INTEGER i 28 | real(DP), EXTERNAL :: ddot 29 | ! 30 | DO i= 1,m 31 | c(i) = 2.d0*ddot(2*n,a(1,i),1,b(1,i),1) 32 | IF (gstart==2) c(i) = c(i) - dble(a(1,i))*dble(b(1,i)) 33 | ENDDO 34 | #if defined(__MPI) 35 | IF (sum_over_nodes=='y'.or.sum_over_nodes=='Y') CALL mp_sum( c, intra_pool_comm ) 36 | #endif 37 | RETURN 38 | END SUBROUTINE pw_dot 39 | -------------------------------------------------------------------------------- /Modules/qes_module.f90: -------------------------------------------------------------------------------- 1 | ! 2 | ! Copyright (C) 2003-2016 Quantum ESPRESSO group 3 | ! This file is distributed under the terms of the 4 | ! GNU General Public License. See the file `License' 5 | ! in the root directory of the present distribution, 6 | ! or http://www.gnu.org/copyleft/gpl.txt . 7 | ! 8 | MODULE qes_module 9 | 10 | USE iotk_module 11 | USE qes_types_module 12 | USE qes_libs_module 13 | 14 | END MODULE qes_module 15 | -------------------------------------------------------------------------------- /Modules/run_info.f90: -------------------------------------------------------------------------------- 1 | ! 2 | ! Copyright (C) 2011 Quantum ESPRESSO groups 3 | ! This file is distributed under the terms of the 4 | ! GNU General Public License. See the file `License' 5 | ! in the root directory of the present distribution, 6 | ! or http://www.gnu.org/copyleft/gpl.txt . 7 | ! 8 | !==-----------------------------------------------------------------------==! 9 | MODULE run_info 10 | !==-----------------------------------------------------------------------==! 11 | 12 | IMPLICIT NONE 13 | ! ... title of the simulation 14 | CHARACTER(LEN=75) :: title=' ' 15 | ! 16 | END MODULE run_info 17 | !==-----------------------------------------------------------------------==! 18 | -------------------------------------------------------------------------------- /Modules/set_hubbard_l.f90: -------------------------------------------------------------------------------- 1 | ! 2 | ! Copyright (C) 2001-2010 Quantum ESPRESSO group 3 | ! This file is distributed under the terms of the 4 | ! GNU General Public License. See the file `License' 5 | ! in the root directory of the present distribution, 6 | ! or http://www.gnu.org/copyleft/gpl.txt . 7 | ! 8 | !--------------------------------------------------------------------------- 9 | FUNCTION set_hubbard_l( psd ) RESULT( hubbard_l ) 10 | !--------------------------------------------------------------------------- 11 | ! 12 | USE io_global, ONLY : stdout 13 | ! 14 | IMPLICIT NONE 15 | ! 16 | INTEGER :: hubbard_l 17 | CHARACTER(LEN=2), INTENT(IN) :: psd 18 | ! 19 | ! 20 | SELECT CASE( TRIM(ADJUSTL(psd)) ) 21 | ! 22 | ! ... transition metals 23 | ! 24 | CASE( 'Ti', 'V', 'Cr', 'Mn', 'Fe', 'Co', 'Ni', 'Cu', 'Zn', & 25 | 'Zr', 'Nb', 'Mo', 'Tc', 'Ru', 'Rh', 'Pd', 'Ag', 'Cd', & 26 | 'Hf', 'Ta', 'W', 'Re', 'Os', 'Ir', 'Pt', 'Au', 'Hg' ) 27 | ! 28 | hubbard_l = 2 29 | ! 30 | ! 31 | ! ... rare earths 32 | ! 33 | CASE('Ce','Pr','Nd','Pm','Sm','Eu','Gd','Tb','Dy','Ho','Er','Tm','Yb','Lu', & 34 | 'Th','Pa','U', 'Np','Pu','Am','Cm','Bk','Cf','Es','Fm','Md','No','Lr' ) 35 | ! 36 | hubbard_l = 3 37 | ! 38 | ! 39 | ! ... other elements 40 | ! 41 | CASE( 'H' ) 42 | ! 43 | hubbard_l = 0 44 | ! 45 | CASE( 'C', 'N', 'O' ) 46 | ! 47 | hubbard_l = 1 48 | ! 49 | CASE( 'As', 'Ga', 'In' ) 50 | ! 51 | hubbard_l = 2 52 | ! 53 | CASE DEFAULT 54 | ! 55 | hubbard_l = -1 56 | ! 57 | WRITE( stdout, '(/,"psd = ",A,/)' ) psd 58 | ! 59 | CALL errore( 'set_hubbard_l', 'pseudopotential not yet inserted', 1 ) 60 | ! 61 | END SELECT 62 | ! 63 | RETURN 64 | ! 65 | END FUNCTION set_Hubbard_l 66 | -------------------------------------------------------------------------------- /Modules/test_input_file.f90: -------------------------------------------------------------------------------- 1 | ! 2 | ! Copyright (C) 2013 Quantum ESPRESSO group 3 | ! This file is distributed under the terms of the 4 | ! GNU General Public License. See the file `License' 5 | ! in the root directory of the present distribution, 6 | ! or http://www.gnu.org/copyleft/gpl.txt . 7 | ! 8 | LOGICAL FUNCTION test_input_xml (myunit) 9 | ! 10 | ! check if file opened as unit "myunit" is a xml file or not 11 | ! 12 | IMPLICIT NONE 13 | ! 14 | INTEGER, INTENT(in) :: myunit 15 | ! 16 | CHARACTER(LEN=256) :: dummy 17 | CHARACTER(LEN=1), EXTERNAL :: capital 18 | INTEGER :: i, j 19 | LOGICAL :: exst 20 | ! 21 | test_input_xml = .false. 22 | INQUIRE ( UNIT=myunit, EXIST=exst ) 23 | IF ( .NOT. exst ) GO TO 10 24 | 25 | ! read until a non-empty line is found 26 | 27 | dummy = ' ' 28 | DO WHILE ( LEN_TRIM(dummy) < 1 ) 29 | READ ( myunit,'(A)', ERR=10, END=10) dummy 30 | END DO 31 | 32 | ! remove blanks from line, convert to capital, clean trailing characters 33 | 34 | j=1 35 | DO i=1, LEN_TRIM(dummy) 36 | IF ( dummy(i:i) /= ' ' ) THEN 37 | dummy(j:j) = capital(dummy(i:i)) 38 | j=j+1 39 | END IF 40 | END DO 41 | DO i=j, LEN_TRIM(dummy) 42 | dummy(i:i) = ' ' 43 | END DO 44 | 45 | ! check for string "" at the end 46 | 47 | j = LEN_TRIM (dummy) 48 | test_input_xml = ( (dummy(1:5) == "") 50 | RETURN 51 | 52 | 10 WRITE (0,"('from test_input_xml: input file not opened or empty')") 53 | 54 | END FUNCTION test_input_xml 55 | -------------------------------------------------------------------------------- /Modules/trimcheck.f90: -------------------------------------------------------------------------------- 1 | ! 2 | ! Copyright (C) 2002-2013 Quantum ESPRESSO group 3 | ! This file is distributed under the terms of the 4 | ! GNU General Public License. See the file `License' 5 | ! in the root directory of the present distribution, 6 | ! or http://www.gnu.org/copyleft/gpl.txt . 7 | ! 8 | ! 9 | !----------------------------------------------------------------------- 10 | FUNCTION trimcheck ( directory ) 11 | !----------------------------------------------------------------------- 12 | ! 13 | ! ... verify if directory ends with /, add one if needed; 14 | ! ... trim white spaces and put the result in trimcheck 15 | ! 16 | IMPLICIT NONE 17 | ! 18 | CHARACTER (LEN=*), INTENT(IN) :: directory 19 | CHARACTER (LEN=256) :: trimcheck 20 | INTEGER :: l 21 | ! 22 | l = LEN_TRIM( directory ) 23 | IF ( l == 0 ) CALL errore( 'trimcheck', ' input name empty', 1) 24 | ! 25 | IF ( directory(l:l) == '/' ) THEN 26 | trimcheck = TRIM ( ADJUSTL(directory) ) 27 | ELSE 28 | IF ( l < LEN( trimcheck ) ) THEN 29 | trimcheck = TRIM ( ADJUSTL(directory) ) // '/' 30 | ELSE 31 | CALL errore( 'trimcheck', ' input name too long', l ) 32 | END IF 33 | END IF 34 | ! 35 | RETURN 36 | ! 37 | END FUNCTION trimcheck 38 | ! 39 | -------------------------------------------------------------------------------- /Modules/version.f90: -------------------------------------------------------------------------------- 1 | ! 2 | ! Copyright (C) 2003-2015 Quantum ESPRESSO group 3 | ! This file is distributed under the terms of the 4 | ! GNU General Public License. See the file `License' 5 | ! in the root directory of the present distribution, 6 | ! or http://www.gnu.org/copyleft/gpl.txt . 7 | ! 8 | !---------------------------------------------------------------------------- 9 | MODULE global_version 10 | ! 11 | IMPLICIT NONE 12 | ! 13 | SAVE 14 | ! 15 | CHARACTER (LEN=6) :: version_number = '6.1' 16 | CHARACTER (LEN=12) :: svn_revision = '13369' 17 | ! 18 | CHARACTER (LEN=6) :: gpu_version_number = '1.0' 19 | ! 20 | END MODULE global_version 21 | -------------------------------------------------------------------------------- /Modules/volume.f90: -------------------------------------------------------------------------------- 1 | ! 2 | ! Copyright (C) 2001 PWSCF group 3 | ! This file is distributed under the terms of the 4 | ! GNU General Public License. See the file `License' 5 | ! in the root directory of the present distribution, 6 | ! or http://www.gnu.org/copyleft/gpl.txt . 7 | ! 8 | ! 9 | !--------------------------------------------------------------------- 10 | subroutine volume (alat, a1, a2, a3, omega) 11 | !--------------------------------------------------------------------- 12 | ! 13 | ! Compute the volume of the unit cell 14 | ! 15 | use kinds, ONLY: DP 16 | implicit none 17 | ! 18 | ! First the I/O variables 19 | ! 20 | real(DP) :: alat, a1 (3), a2 (3), a3 (3), omega 21 | ! input: lattice parameter (unit length) 22 | ! input: the first lattice vector 23 | ! input: the second lattice vector 24 | ! input: the third lattice vector 25 | ! input: the volume of the unit cell 26 | ! 27 | ! Here the local variables required by the routine 28 | ! 29 | 30 | real(DP) :: s 31 | ! the sign of a permutation 32 | integer :: i, j, k, l, iperm 33 | !\ 34 | ! \ 35 | ! / auxiliary indices 36 | !/ 37 | ! counter on permutations 38 | ! 39 | ! Compute the volume 40 | ! 41 | omega = 0.d0 42 | s = 1.d0 43 | i = 1 44 | j = 2 45 | k = 3 46 | 101 do iperm = 1, 3 47 | omega = omega + s * a1 (i) * a2 (j) * a3 (k) 48 | l = i 49 | i = j 50 | j = k 51 | k = l 52 | enddo 53 | i = 2 54 | j = 1 55 | k = 3 56 | s = - s 57 | 58 | if (s.lt.0.d0) goto 101 59 | 60 | omega = abs (omega) * alat**3 61 | return 62 | end subroutine volume 63 | -------------------------------------------------------------------------------- /Modules/zdotc_wrapper.f90: -------------------------------------------------------------------------------- 1 | ! 2 | ! Copyright (C) 2014 Quantum ESPRESSO group 3 | ! This file is distributed under the terms of the 4 | ! GNU General Public License. See the file `License' 5 | ! in the root directory of the present distribution, 6 | ! or http://www.gnu.org/copyleft/gpl.txt . 7 | ! 8 | !-------------------------------------------------------------------------- 9 | ! Wrapper for nonstandard implementation of complex BLAS function zdotc 10 | ! (e.g. some versions of optimized BLAS for Mac) 11 | ! In order to activate it, add -Dzdotc=zdotc_wrapper to DFLAGS in make.inc 12 | !-------------------------------------------------------------------------- 13 | FUNCTION zdotc_wrapper(n,a,ia,b,ib) RESULT(c) 14 | !-------------------------------------------------------------------------- 15 | USE kinds, ONLY: dp 16 | IMPLICIT NONE 17 | COMPLEX(dp), INTENT(in) :: a(*), b(*) 18 | INTEGER, INTENT(in):: n,ia,ib 19 | COMPLEX(dp) :: c 20 | #ifdef zdotc 21 | #undef zdotc 22 | CALL zdotc(c,n,a,ia,b,ib) 23 | #else 24 | c=0.0_dp 25 | #endif 26 | RETURN 27 | END FUNCTION zdotc_wrapper 28 | -------------------------------------------------------------------------------- /Modules/zvscal.f90: -------------------------------------------------------------------------------- 1 | ! 2 | ! Copyright (C) 2003 PWSCF group 3 | ! This file is distributed under the terms of the 4 | ! GNU General Public License. See the file `License' 5 | ! in the root directory of the present distribution, 6 | ! or http://www.gnu.org/copyleft/gpl.txt . 7 | ! 8 | ! 9 | SUBROUTINE zvscal(n,lda,m,v,zin,zout) 10 | IMPLICIT NONE 11 | INTEGER :: n, lda, m 12 | real(8) :: v(n), zin(2,lda,m), zout(2,lda,m) 13 | INTEGER :: i,j 14 | ! 15 | DO j = 1,m 16 | DO i = 1,n 17 | zout(1,i,j) = zin(1,i,j)*v(i) 18 | zout(2,i,j) = zin(2,i,j)*v(i) 19 | ENDDO 20 | ENDDO 21 | ! 22 | RETURN 23 | END SUBROUTINE zvscal 24 | -------------------------------------------------------------------------------- /PHonon/FD/Makefile: -------------------------------------------------------------------------------- 1 | # Makefile for school 2 | 3 | include ../../make.inc 4 | 5 | # location of include files 6 | #IFLAGS=-I../../../include 7 | 8 | # location of needed modules 9 | MODFLAGS= $(MOD_FLAG)../../iotk/src $(MOD_FLAG)../../Modules \ 10 | $(MOD_FLAG)../../LAXlib $(MOD_FLAG)../../FFTXlib $(MOD_FLAG)../../PW/src $(MOD_FLAG). 11 | 12 | FDOBJS = \ 13 | stop_pp.o 14 | 15 | 16 | QEMODS = ../../Modules/libqemod.a ../../FFTXlib/libqefft.a ../../LAXlib/libqela.a 17 | PWOBJS = ../../PW/src/libpw.a 18 | 19 | 20 | TLDEPS= bindir libs pw 21 | 22 | all : tldeps fd.x fd_ifc.x fd_ef.x 23 | 24 | fd_ifc.x : fd_ifc.o libfd.a $(FDOBJS) $(PWOBJS) $(QEMODS) 25 | $(LD) $(LDFLAGS) -o $@ \ 26 | fd_ifc.o libfd.a $(PWOBJS) $(QEMODS) $(LIBOBJS) $(LIBS) 27 | - ( cd ../../bin ; ln -fs ../PHonon/FD/$@ . ) 28 | 29 | fd.x : fd.o libfd.a $(FDOBJS) $(PWOBJS) $(QEMODS) 30 | $(LD) $(LDFLAGS) -o $@ \ 31 | fd.o libfd.a $(PWOBJS) $(QEMODS) $(LIBOBJS) $(LIBS) 32 | - ( cd ../../bin ; ln -fs ../PHonon/FD/$@ . ) 33 | 34 | fd_ef.x : fd_ef.o libfd.a $(FDOBJS) $(PWOBJS) $(QEMODS) 35 | $(LD) $(LDFLAGS) -o $@ \ 36 | fd_ef.o libfd.a $(PWOBJS) $(QEMODS) $(LIBOBJS) $(LIBS) 37 | - ( cd ../../bin ; ln -fs ../PHonon/FD/$@ . ) 38 | tldeps : 39 | if test -n "$(TLDEPS)" ; then \ 40 | ( cd ../.. ; $(MAKE) $(TLDEPS) || exit 1 ) ; fi 41 | 42 | libfd.a : $(FDOBJS) 43 | $(AR) $(ARFLAGS) $@ $? 44 | $(RANLIB) $@ 45 | 46 | clean : 47 | - /bin/rm -f *.x *.o *~ *_tmp.f90 *.d *.mod *.i *.L libfd.a 48 | 49 | include make.depend 50 | # DO NOT DELETE 51 | 52 | -------------------------------------------------------------------------------- /PHonon/FD/make.depend: -------------------------------------------------------------------------------- 1 | fd.o : ../../Modules/cell_base.o 2 | fd.o : ../../Modules/constants.o 3 | fd.o : ../../Modules/environment.o 4 | fd.o : ../../Modules/fft_base.o 5 | fd.o : ../../Modules/gvecw.o 6 | fd.o : ../../Modules/io_files.o 7 | fd.o : ../../Modules/io_global.o 8 | fd.o : ../../Modules/ions_base.o 9 | fd.o : ../../Modules/kind.o 10 | fd.o : ../../Modules/mp.o 11 | fd.o : ../../Modules/mp_global.o 12 | fd.o : ../../Modules/mp_world.o 13 | fd.o : ../../Modules/recvec.o 14 | fd.o : ../../Modules/wrappers.o 15 | fd.o : ../../PW/src/pwcom.o 16 | fd.o : ../../PW/src/symm_base.o 17 | fd.o : ../../PW/src/symme.o 18 | fd_ef.o : ../../Modules/cell_base.o 19 | fd_ef.o : ../../Modules/constants.o 20 | fd_ef.o : ../../Modules/environment.o 21 | fd_ef.o : ../../Modules/fft_base.o 22 | fd_ef.o : ../../Modules/gvecw.o 23 | fd_ef.o : ../../Modules/io_files.o 24 | fd_ef.o : ../../Modules/io_global.o 25 | fd_ef.o : ../../Modules/ions_base.o 26 | fd_ef.o : ../../Modules/kind.o 27 | fd_ef.o : ../../Modules/mp.o 28 | fd_ef.o : ../../Modules/mp_global.o 29 | fd_ef.o : ../../Modules/parser.o 30 | fd_ef.o : ../../PW/src/pwcom.o 31 | fd_ef.o : ../../PW/src/symm_base.o 32 | fd_ef.o : ../../PW/src/symme.o 33 | fd_ifc.o : ../../Modules/cell_base.o 34 | fd_ifc.o : ../../Modules/constants.o 35 | fd_ifc.o : ../../Modules/environment.o 36 | fd_ifc.o : ../../Modules/fft_base.o 37 | fd_ifc.o : ../../Modules/gvecw.o 38 | fd_ifc.o : ../../Modules/invmat.o 39 | fd_ifc.o : ../../Modules/io_files.o 40 | fd_ifc.o : ../../Modules/io_global.o 41 | fd_ifc.o : ../../Modules/ions_base.o 42 | fd_ifc.o : ../../Modules/kind.o 43 | fd_ifc.o : ../../Modules/mp.o 44 | fd_ifc.o : ../../Modules/mp_global.o 45 | fd_ifc.o : ../../PW/src/pwcom.o 46 | fd_ifc.o : ../../PW/src/symm_base.o 47 | fd_ifc.o : ../../PW/src/symme.o 48 | stop_pp.o : ../../Modules/control_flags.o 49 | stop_pp.o : ../../Modules/io_files.o 50 | stop_pp.o : ../../Modules/mp_global.o 51 | stop_pp.o : ../../Modules/parallel_include.o 52 | -------------------------------------------------------------------------------- /PHonon/FD/run_fd: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | #Same than in fd.in 4 | fd_outfile=displaced 5 | 6 | IN_DIR='./fd_files/' 7 | OUT_DIR='./fd_files/' 8 | FORCEDIR='./fd_forces/' 9 | pw_exe='../../../../bin/pw.x' 10 | 11 | #check directories 12 | if [ ! -d "${IN_DIR}" ]; then 13 | echo ERROR: ${IN_DIR} does not exist 14 | exit 15 | fi 16 | 17 | if [ ! -d "${OUT_DIR}" ]; then 18 | mkdir -p ${OUT_DIR} 19 | fi 20 | 21 | if [ ! -d "${FORCEDIR}" ]; then 22 | mkdir -p ${FORCEDIR} 23 | fi 24 | # scf calculation of the displaced macrocells 25 | #x,y,z displacements 26 | #atomic_index within original unit cell (two Si atoms) 27 | #positive/negative displacement 28 | 29 | for i in $(seq 1 3); do 30 | for n in $(seq 1 2); do 31 | for m in $(seq 1 2 ); do 32 | echo running serial pw.x on ${fd_outfile}.$m.$i.$n.in 33 | $pw_exe < $IN_DIR/${fd_outfile}.$m.$i.$n.in > $OUT_DIR/${fd_outfile}.$m.$i.$n.out; 34 | done 35 | done 36 | done 37 | 38 | # scf calculation of the reference macrocell (no displacement) 39 | echo running serial pw.x on ${fd_outfile}.0.0.0.in 40 | $pw_exe < $IN_DIR/${fd_outfile}.0.0.0.in > $OUT_DIR/${fd_outfile}.0.0.0.out 41 | 42 | # extract forces 43 | grep 'force = ' $OUT_DIR/${fd_outfile}.0.0.0.out | grep ' atom ' > forces 44 | awk '{printf("% 18.12f % 18.12f % 18.12f \n",$7,$8,$9)}' < forces > $FORCEDIR/force.0.0.0 45 | rm forces 46 | 47 | for i in `seq 1 3 ` ; do 48 | for n in `seq 1 2 ` ; do 49 | for m in `seq 1 2 ` ; do 50 | grep 'force = ' $OUT_DIR/${fd_outfile}.$m.$i.$n.out | grep ' atom ' > forces 51 | awk '{printf("% 18.12f % 18.12f % 18.12f \n",$7,$8,$9)}' < forces > $FORCEDIR/force.$m.$i.$n 52 | rm forces 53 | done 54 | done 55 | done 56 | 57 | -------------------------------------------------------------------------------- /PHonon/FD/stop_pp.f90: -------------------------------------------------------------------------------- 1 | ! 2 | ! Copyright (C) 2010 PWSCF group 3 | ! This file is distributed under the terms of the 4 | ! GNU General Public License. See the file `License' 5 | ! in the root directory of the present distribution, 6 | ! or http://www.gnu.org/copyleft/gpl.txt . 7 | ! 8 | ! 9 | ! Author: L. Martin-Samos 10 | ! 11 | !-------------------------------------------------------------------- 12 | subroutine stop_pp 13 | !-------------------------------------------------------------------- 14 | ! 15 | ! Synchronize processes before stopping. 16 | ! 17 | use control_flags, only: twfcollect 18 | use io_files, only: iunwfc 19 | use mp_global, only: mp_global_end 20 | USE parallel_include 21 | #if defined(__MPI) 22 | 23 | integer :: info 24 | logical :: op 25 | 26 | inquire ( iunwfc, opened = op ) 27 | 28 | if ( op ) then 29 | if (twfcollect) then 30 | close (unit = iunwfc, status = 'delete') 31 | else 32 | close (unit = iunwfc, status = 'keep') 33 | end if 34 | end if 35 | 36 | call mp_global_end( ) 37 | 38 | #endif 39 | 40 | stop 41 | end subroutine stop_pp 42 | -------------------------------------------------------------------------------- /PHonon/Gamma/Makefile: -------------------------------------------------------------------------------- 1 | # Makefile for Gamma-only phonon code 2 | 3 | include ../../make.inc 4 | 5 | # location of needed modules and included files (if any) 6 | MODFLAGS= $(MOD_FLAG)../../iotk/src $(MOD_FLAG)../../Modules \ 7 | $(MOD_FLAG)../../LAXlib $(MOD_FLAG)../../FFTXlib \ 8 | $(MOD_FLAG)../../PW/src $(MOD_FLAG). 9 | IFLAGS= 10 | 11 | CGOBJS = \ 12 | a_h.o \ 13 | cg_readin.o \ 14 | cg_setup.o \ 15 | cg_setupdgc.o \ 16 | cgcom.o \ 17 | cgsolve.o \ 18 | d2ion.o \ 19 | dgradcorr.o \ 20 | dielec.o \ 21 | drhodv.o \ 22 | dvb_cc.o \ 23 | dvpsi_e.o \ 24 | dvpsi_kb.o \ 25 | dyndiar.o \ 26 | dynmat_init.o \ 27 | dynmatcc.o \ 28 | find_equiv_sites.o \ 29 | generate_dynamical_matrix.o \ 30 | generate_effective_charges.o \ 31 | h_h.o \ 32 | macro.o \ 33 | phcg.o \ 34 | rhod2vkb.o \ 35 | solve_e.o \ 36 | solve_ph.o \ 37 | writedyn.o 38 | 39 | PWOBJS = ../../PW/src/libpw.a 40 | QEMODS = ../../Modules/libqemod.a ../../FFTXlib/libqefft.a ../../LAXlib/libqela.a 41 | 42 | TLDEPS= bindir mods libs pw 43 | 44 | all : tldeps phcg.x libcg.a 45 | 46 | phcg.x : $(PWOBJS) $(CGOBJS) $(QEMODS) $(LIBOBJS) 47 | $(LD) $(LDFLAGS) -o phcg.x \ 48 | $(CGOBJS) $(PWOBJS) $(QEMODS) $(LIBOBJS) $(LIBS) 49 | - ( cd ../../bin ; ln -fs ../PHonon/Gamma/phcg.x . ) 50 | tldeps : 51 | if test -n "$(TLDEPS)" ; then \ 52 | ( cd ../.. ; $(MAKE) $(TLDEPS) || exit 1 ) ; fi 53 | 54 | clean : 55 | - /bin/rm -f *.x *.o *.d *.i *~ *_tmp.f90 *.mod *.L *.a 56 | - /bin/rm -f ../../bin/phcg.x 57 | 58 | libcg.a : $(CGOBJS) 59 | $(AR) $(ARFLAGS) $@ $? 60 | $(RANLIB) $@ 61 | 62 | include make.depend 63 | -------------------------------------------------------------------------------- /PHonon/Gamma/drhodv.f90: -------------------------------------------------------------------------------- 1 | ! 2 | ! Copyright (C) 2003 PWSCF group 3 | ! This file is distributed under the terms of the 4 | ! GNU General Public License. See the file `License' 5 | ! in the root directory of the present distribution, 6 | ! or http://www.gnu.org/copyleft/gpl.txt . 7 | ! 8 | ! 9 | !----------------------------------------------------------------------- 10 | SUBROUTINE drhodv(nu_i) 11 | !----------------------------------------------------------------------- 12 | ! 13 | ! calculate the electronic term of the dynamical matrix 14 | ! 15 | USE mp_global, ONLY : intra_pool_comm 16 | USE mp, ONLY : mp_sum 17 | USE klist, ONLY : wk !, nks 18 | USE wvfct, ONLY : nbnd, npw, npwx 19 | USE cgcom 20 | 21 | IMPLICIT NONE 22 | INTEGER :: nu_i 23 | ! 24 | INTEGER :: nu_j, ibnd, ik 25 | real(DP) :: dynel(nmodes), work(nbnd) 26 | ! 27 | CALL start_clock('drhodv') 28 | ! 29 | dynel(:) = 0.d0 30 | ik = 1 31 | ! do ik=1,nks 32 | ! 33 | !** calculate the dynamical matrix () 34 | ! 35 | DO nu_j = 1,nmodes 36 | ! 37 | ! DeltaV*psi(ion) for mode nu_j is recalculated 38 | ! 39 | CALL dvpsi_kb(ik,nu_j) 40 | ! 41 | ! this is the real part of 42 | ! 43 | CALL pw_dot('N',npw,nbnd,dvpsi,npwx,dpsi ,npwx,work) 44 | DO ibnd = 1,nbnd 45 | dynel(nu_j) = dynel(nu_j) + 2.0d0*wk(ik)*work(ibnd) 46 | ENDDO 47 | ENDDO 48 | #if defined(__MPI) 49 | CALL mp_sum( dynel, intra_pool_comm ) 50 | #endif 51 | ! 52 | ! NB this must be done only at the end of the calculation! 53 | ! 54 | DO nu_j = 1,nmodes 55 | dyn(nu_i,nu_j) = - (dyn(nu_i,nu_j)+dynel(nu_j)) 56 | ENDDO 57 | ! 58 | CALL stop_clock('drhodv') 59 | ! 60 | RETURN 61 | END SUBROUTINE drhodv 62 | 63 | -------------------------------------------------------------------------------- /PHonon/Gamma/dvb_cc.f90: -------------------------------------------------------------------------------- 1 | ! 2 | ! Copyright (C) 2003 PWSCF group 3 | ! This file is distributed under the terms of the 4 | ! GNU General Public License. See the file `License' 5 | ! in the root directory of the present distribution, 6 | ! or http://www.gnu.org/copyleft/gpl.txt . 7 | ! 8 | !--------------------------------------------------------------------- 9 | SUBROUTINE dvb_cc (nlcc,npseu,ngm,nrxx, & 10 | nl,igtongl,rho_core,dmuxc,ga,aux,dvb_nlcc) 11 | !--------------------------------------------------------------------- 12 | ! calculate the core-correction contribution to Delta V bare 13 | ! 14 | USE kinds, ONLY : dp 15 | USE fft_base, ONLY : dffts, dfftp 16 | USE fft_interfaces, ONLY : fwfft, invfft 17 | IMPLICIT NONE 18 | INTEGER:: npseu,ngm,nrxx,np,ng,i 19 | LOGICAL :: nlcc(npseu) 20 | INTEGER :: nl(ngm), igtongl(ngm) 21 | real(dp) :: rho_core(*), dmuxc(nrxx) 22 | COMPLEX(dp) :: ga(ngm), dvb_nlcc(ngm), aux(nrxx) 23 | ! 24 | DO np=1,npseu 25 | IF(nlcc(np)) GOTO 10 26 | ENDDO 27 | RETURN 28 | 10 CONTINUE 29 | ! 30 | aux(:) = (0.d0, 0.d0) 31 | DO ng=1,ngm 32 | aux(nl(ng)) = ga(ng) * rho_core(igtongl(ng)) 33 | ENDDO 34 | CALL invfft ('Dense', aux, dfftp) 35 | ! 36 | aux(:) = aux(:) * dmuxc(:) 37 | ! 38 | CALL fwfft ('Dense', aux, dfftp) 39 | DO ng=1,ngm 40 | dvb_nlcc(ng) = aux(nl(ng)) 41 | ENDDO 42 | ! 43 | RETURN 44 | END SUBROUTINE dvb_cc 45 | 46 | -------------------------------------------------------------------------------- /PHonon/Gamma/dynmat_init.f90: -------------------------------------------------------------------------------- 1 | ! 2 | ! Copyright (C) 2003 PWSCF group 3 | ! This file is distributed under the terms of the 4 | ! GNU General Public License. See the file `License' 5 | ! in the root directory of the present distribution, 6 | ! or http://www.gnu.org/copyleft/gpl.txt . 7 | ! 8 | ! 9 | !----------------------------------------------------------------------- 10 | SUBROUTINE dynmat_init 11 | !----------------------------------------------------------------------- 12 | ! 13 | ! Calculate part of the terms appearing in the dynamical matrix 14 | ! 15 | USE ions_base, ONLY : ntyp => nsp, nat, ityp, zv, tau 16 | USE cell_base, ONLY : at, bg, omega, alat 17 | USE gvect, ONLY : ngm, g, gg 18 | USE cgcom 19 | IMPLICIT NONE 20 | real(DP), ALLOCATABLE:: dyn0(:,:),dyn1(:,:), dyncc(:,:) 21 | INTEGER :: i,j, na,nb 22 | ! 23 | CALL start_clock('dynmat_init') 24 | ! 25 | ALLOCATE ( dyn0 ( 3*nat, nmodes)) 26 | ALLOCATE ( dyn1 ( 3*nat, nmodes)) 27 | ALLOCATE ( dyncc( 3*nat, nmodes)) 28 | ! 29 | ! first electronic contribution arising from the term 30 | ! 31 | CALL rhod2vkb(dyn0) 32 | ! 33 | ! ionic contribution 34 | ! 35 | CALL d2ion (nat,ntyp,ityp,zv,tau,alat,omega, & 36 | at,bg,g,gg,ngm,nmodes,u,has_equivalent,dyn1) 37 | ! 38 | ! core-correction contribution 39 | ! 40 | CALL dynmatcc(dyncc) 41 | ! 42 | DO j=1,nmodes 43 | DO i=1,3*nat 44 | dyn(i,j)=dyn0(i,j)+dyn1(i,j)+dyncc(i,j) 45 | ENDDO 46 | ENDDO 47 | ! 48 | DEALLOCATE(dyncc) 49 | DEALLOCATE(dyn1 ) 50 | DEALLOCATE(dyn0 ) 51 | ! 52 | CALL stop_clock('dynmat_init') 53 | ! 54 | RETURN 55 | END SUBROUTINE dynmat_init 56 | -------------------------------------------------------------------------------- /PHonon/Gamma/find_equiv_sites.f90: -------------------------------------------------------------------------------- 1 | ! 2 | ! Copyright (C) 2003 PWSCF group 3 | ! This file is distributed under the terms of the 4 | ! GNU General Public License. See the file `License' 5 | ! in the root directory of the present distribution, 6 | ! or http://www.gnu.org/copyleft/gpl.txt . 7 | ! 8 | ! 9 | SUBROUTINE find_equiv_sites (nat,nsym,irt,has_equivalent, & 10 | n_diff_sites,n_equiv_atoms,equiv_atoms) 11 | ! 12 | IMPLICIT NONE 13 | INTEGER :: nat, nsym, na, nb, ns, n_diff_sites, irt(48,nat), & 14 | equiv_atoms(nat,nat), n_equiv_atoms(nat), has_equivalent(nat) 15 | ! 16 | n_diff_sites = 0 17 | DO na = 1,nat 18 | has_equivalent(na) = 0 19 | ENDDO 20 | ! 21 | DO na = 1,nat 22 | IF (has_equivalent(na)==0) THEN 23 | n_diff_sites = n_diff_sites + 1 24 | n_equiv_atoms (n_diff_sites) = 1 25 | equiv_atoms(n_diff_sites,1) = na 26 | ! 27 | DO nb = na+1,nat 28 | DO ns = 1, nsym 29 | IF ( irt(ns,nb) == na) THEN 30 | has_equivalent(nb) = 1 31 | n_equiv_atoms (n_diff_sites) = & 32 | n_equiv_atoms (n_diff_sites) + 1 33 | equiv_atoms(n_diff_sites, & 34 | n_equiv_atoms(n_diff_sites)) = nb 35 | GOTO 10 36 | ENDIF 37 | ENDDO 38 | 10 CONTINUE 39 | ENDDO 40 | ENDIF 41 | ENDDO 42 | ! 43 | RETURN 44 | END SUBROUTINE find_equiv_sites 45 | -------------------------------------------------------------------------------- /PHonon/Gamma/h_h.f90: -------------------------------------------------------------------------------- 1 | ! 2 | ! Copyright (C) 2003-2007 Quantum ESPRESSO group 3 | ! This file is distributed under the terms of the 4 | ! GNU General Public License. See the file `License' 5 | ! in the root directory of the present distribution, 6 | ! or http://www.gnu.org/copyleft/gpl.txt . 7 | ! 8 | ! 9 | !----------------------------------------------------------------------- 10 | SUBROUTINE H_h(e,h,Ah) 11 | !----------------------------------------------------------------------- 12 | ! 13 | USE kinds, ONLY: DP 14 | USE wvfct, ONLY: nbnd, npwx, npw, g2kin 15 | USE gvect, ONLY : gstart 16 | USE uspp, ONLY : vkb, nkb 17 | USE lsda_mod, ONLY : current_spin 18 | USE scf, ONLY : vrs 19 | USE becmod, ONLY: bec_type, becp, calbec 20 | USE cgcom 21 | ! 22 | IMPLICIT NONE 23 | ! 24 | real(DP):: e(nbnd) 25 | COMPLEX(DP):: h(npwx,nbnd), Ah(npwx,nbnd) 26 | ! 27 | INTEGER:: j,ibnd 28 | ! 29 | CALL start_clock('h_h') 30 | ! 31 | ! [(k+G)^2 - e ]psi 32 | DO ibnd = 1,nbnd 33 | ! set to zero the imaginary part of h at G=0 34 | ! needed for numerical stability 35 | IF (gstart==2) h(1,ibnd) = cmplx( dble(h(1,ibnd)),0.d0,kind=DP) 36 | DO j = 1,npw 37 | ah(j,ibnd) = (g2kin(j)-e(ibnd)) * h(j,ibnd) 38 | ENDDO 39 | ENDDO 40 | ! V_Loc psi 41 | CALL vloc_psi_gamma(npwx, npw, nbnd, h, vrs(1,current_spin), ah) 42 | ! V_NL psi 43 | CALL calbec ( npw, vkb, h, becp ) 44 | IF (nkb > 0) CALL add_vuspsi (npwx, npw, nbnd, ah) 45 | ! set to zero the imaginary part of ah at G=0 46 | ! needed for numerical stability 47 | IF (gstart==2) THEN 48 | DO ibnd = 1, nbnd 49 | ah(1,ibnd) = cmplx( dble(ah(1,ibnd)),0.d0,kind=DP) 50 | ENDDO 51 | ENDIF 52 | ! 53 | CALL stop_clock('h_h') 54 | ! 55 | RETURN 56 | END SUBROUTINE H_h 57 | -------------------------------------------------------------------------------- /PHonon/Gamma/macro.f90: -------------------------------------------------------------------------------- 1 | ! 2 | ! Copyright (C) 2003 PWSCF group 3 | ! This file is distributed under the terms of the 4 | ! GNU General Public License. See the file `License' 5 | ! in the root directory of the present distribution, 6 | ! or http://www.gnu.org/copyleft/gpl.txt . 7 | ! 8 | ! 9 | !---------------------------------------------------------------------- 10 | SUBROUTINE macro 11 | !---------------------------------------------------------------------- 12 | ! 13 | USE klist, ONLY : nks 14 | USE cgcom, ONLY : iubar, dvpsi 15 | USE io_files, ONLY : seqopn 16 | ! 17 | IMPLICIT NONE 18 | INTEGER:: ik, ipol 19 | CHARACTER(len=7) :: filbar 20 | LOGICAL :: here 21 | ! 22 | DO ik=1,nks 23 | ! NB: this version works only for nks = 1 ! 24 | DO ipol=1,3 25 | WRITE(filbar,'("filbar",i1)') ipol 26 | iubar=ipol 27 | CALL seqopn (iubar,filbar,'unformatted',here) 28 | !!! if (.not.here) then 29 | ! calculate x * psi (if not already done) 30 | dvpsi(:,:) = (0.d0, 0.d0) 31 | !!! else 32 | ! otherwise restart from x * psi that is present on from file 33 | !!! read(iubar) dvpsi 34 | !!! end if 35 | CALL dvpsi_e(ik,ipol) 36 | ! write x * psi 37 | REWIND(iubar) 38 | WRITE(iubar) dvpsi 39 | CLOSE(unit=iubar,status='keep') 40 | ENDDO 41 | ENDDO 42 | ! 43 | RETURN 44 | END SUBROUTINE macro 45 | -------------------------------------------------------------------------------- /PHonon/Makefile: -------------------------------------------------------------------------------- 1 | # Makefile for PH 2 | sinclude ../make.inc 3 | 4 | default: all 5 | 6 | all: phonon phgamma_only finite_diffs 7 | 8 | phonon: 9 | ( cd PH ; $(MAKE) all || exit 1 ) 10 | 11 | phgamma_only: 12 | ( cd Gamma ; $(MAKE) all || exit 1 ) 13 | 14 | finite_diffs: 15 | ( cd FD ; $(MAKE) all || exit 1 ) 16 | 17 | clean: phonon_clean phgamma_only_clean examples_clean finite_diffs_clean 18 | 19 | phonon_clean: 20 | ( cd PH ; $(MAKE) clean ) 21 | 22 | phgamma_only_clean: 23 | ( cd Gamma ; $(MAKE) clean ) 24 | 25 | #third_order_q_clean: 26 | # ( cd D3q ; $(MAKE) clean ) 27 | 28 | finite_diffs_clean: 29 | ( cd FD ; $(MAKE) clean ) 30 | 31 | examples_clean: 32 | if test -d examples ; then \ 33 | ( cd examples ; ./clean_all ) ; fi 34 | 35 | doc: 36 | if test -d Doc ; then \ 37 | ( cd Doc ; $(MAKE) all || exit 1 ) ; fi 38 | 39 | doc_clean: 40 | if test -d Doc ; then \ 41 | (cd Doc ; $(MAKE) clean ) ; fi 42 | 43 | distclean: clean doc_clean 44 | -------------------------------------------------------------------------------- /PHonon/PH/acfdtest.f90: -------------------------------------------------------------------------------- 1 | ! 2 | ! Copyright (C) 2001-2004 PWSCF group 3 | ! This file is distributed under the terms of the 4 | ! GNU General Public License. See the file `License' 5 | ! in the root directory of the present distribution, 6 | ! or http://www.gnu.org/copyleft/gpl.txt . 7 | ! 8 | !---------------------------------------------------------------------------- 9 | ! 10 | ! ... Common variables for the acfdt program 11 | ! 12 | ! 13 | MODULE acfdtest 14 | USE kinds 15 | SAVE 16 | LOGICAL :: acfdt_is_active=.FALSE. 17 | LOGICAL :: off_vrs_setup =.FALSE. 18 | LOGICAL :: acfdt_num_der=.FALSE. 19 | LOGICAL :: acfdt_term1 = .FALSE. 20 | LOGICAL :: acfdt_term2 = .FALSE. 21 | LOGICAL :: acfdt_term3 = .FALSE. 22 | LOGICAL :: test_oep=.FALSE. 23 | LOGICAL :: do_numer_eig=.FALSE. 24 | LOGICAL :: int_numer_eig=.FALSE. 25 | INTEGER :: ir_point=0 26 | REAL(DP):: delta_vrs=0.0_DP 27 | REAL(DP):: f1=1.0_DP 28 | REAL(DP):: f2=1.0_DP 29 | REAL(DP):: f3=1.0_DP 30 | REAL(DP):: sum_der_etot=1.0_DP 31 | REAL(DP), ALLOCATABLE :: vrs_save(:) 32 | REAL(DP), ALLOCATABLE :: den_xc(:) 33 | LOGICAL :: skip_ph = .FALSE. 34 | END MODULE acfdtest 35 | 36 | -------------------------------------------------------------------------------- /PHonon/PH/allocate_part.f90: -------------------------------------------------------------------------------- 1 | ! 2 | ! Copyright (C) 2001 PWSCF group 3 | ! This file is distributed under the terms of the 4 | ! GNU General Public License. See the file `License' 5 | ! in the root directory of the present distribution, 6 | ! or http://www.gnu.org/copyleft/gpl.txt . 7 | ! 8 | !----------------------------------------------------------------------- 9 | subroutine allocate_part ( nat ) 10 | !----------------------------------------------------------------------- 11 | ! 12 | ! dynamical allocation of arrays for the control of partial computation 13 | ! of the dynamical matrix 14 | ! 15 | USE partial, ONLY : comp_irr, done_irr, atomo 16 | USE el_phon, ONLY : comp_elph, done_elph, elph 17 | IMPLICIT NONE 18 | INTEGER, INTENT(IN) :: nat 19 | ! 20 | ! allocate space for several arrays which control the run 21 | ! 22 | allocate (comp_irr ( 0:3 * nat)) 23 | allocate (done_irr ( 0:3 * nat)) 24 | IF (elph) THEN 25 | allocate (comp_elph (1:3 * nat)) 26 | allocate (done_elph (1:3 * nat)) 27 | ENDIF 28 | allocate (atomo ( nat)) 29 | atomo(:) = 0 30 | return 31 | end subroutine allocate_part 32 | -------------------------------------------------------------------------------- /PHonon/PH/allocate_pert.f90: -------------------------------------------------------------------------------- 1 | ! 2 | ! Copyright (C) 2001-2009 PWSCF group 3 | ! This file is distributed under the terms of the 4 | ! GNU General Public License. See the file `License' 5 | ! in the root directory of the present distribution, 6 | ! or http://www.gnu.org/copyleft/gpl.txt . 7 | ! 8 | ! 9 | !----------------------------------------------------------------------- 10 | subroutine allocate_pert() 11 | !----------------------------------------------------------------------- 12 | ! 13 | ! dynamical allocation of arrays: quantities depending on the 14 | ! maximum number of perturbations npertx 15 | ! 16 | USE ions_base, ONLY : nat 17 | 18 | USE modes, ONLY : npertx, t, tmq 19 | 20 | implicit none 21 | ! 22 | ! allocate space for the quantities with dimensions that depend 23 | ! on the maximum number of perturbations 24 | ! 25 | ALLOCATE ( t ( npertx, npertx, 48, 3 * nat ) ) 26 | ALLOCATE ( tmq ( npertx, npertx, 3 * nat ) ) 27 | 28 | RETURN 29 | END SUBROUTINE allocate_pert 30 | 31 | !----------------------------------------------------------------------- 32 | subroutine deallocate_pert() 33 | !----------------------------------------------------------------------- 34 | ! 35 | ! dynamical allocation of arrays: quantities depending on the 36 | ! maximum number of perturbations npertx 37 | ! 38 | USE modes, ONLY : t, tmq 39 | 40 | IMPLICIT NONE 41 | ! 42 | ! allocate space for the quantities with dimensions that depend 43 | ! on the maximum number of perturbations 44 | ! 45 | IF (ASSOCIATED(t)) DEALLOCATE ( t ) 46 | IF (ASSOCIATED(tmq)) DEALLOCATE ( tmq ) 47 | 48 | RETURN 49 | END SUBROUTINE deallocate_pert 50 | -------------------------------------------------------------------------------- /PHonon/PH/ccg_psi.f90: -------------------------------------------------------------------------------- 1 | ! 2 | ! Copyright (C) 2001 PWSCF group 3 | ! This file is distributed under the terms of the 4 | ! GNU General Public License. See the file `License' 5 | ! in the root directory of the present distribution, 6 | ! or http://www.gnu.org/copyleft/gpl.txt . 7 | ! 8 | ! 9 | !----------------------------------------------------------------- 10 | subroutine ccg_psi (lda, n, m, psi, h_diag, flag) 11 | !----------------------------------------------------------------- 12 | ! 13 | ! This routine gives a preconditioning to the linear system solver. 14 | ! The preconditioning is diagonal in reciprocal space 15 | ! 16 | ! 17 | USE kinds, only : DP 18 | USE noncollin_module, ONLY : noncolin, npol 19 | implicit none 20 | 21 | integer :: lda, n, m, flag 22 | ! input: the leading dimension of the psi vector 23 | ! input: the real dimension of the vector 24 | ! input: the number of vectors 25 | ! input: flag=1 use h_diag, flag=-1 use conjg(h_diag) 26 | complex(kind=DP) :: psi (lda*npol, m) 27 | ! inp/out: the vector to be preconditioned 28 | 29 | complex(kind=DP) :: h_diag (lda*npol, m) 30 | ! input: the preconditioning vector 31 | 32 | integer :: k, i 33 | ! counter on bands 34 | ! counter on the elements of the vector 35 | ! 36 | do k = 1, m 37 | do i = 1, n 38 | if (flag .eq. 1) then 39 | psi (i, k) = psi (i, k) * h_diag (i, k) 40 | else if (flag .eq. -1) then 41 | psi (i, k) = psi (i, k) * CONJG(h_diag (i, k)) 42 | else 43 | print*, 'flag is neither 1 nor -1. Stop' 44 | endif 45 | enddo 46 | IF (noncolin) THEN 47 | do i = 1, n 48 | if (flag .eq. 1) then 49 | psi (i+lda, k) = psi (i+lda, k) * h_diag (i+lda, k) 50 | else if (flag .eq. -1) then 51 | psi (i+lda, k) = psi (i+lda, k) * CONJG(h_diag (i+lda, k)) 52 | else 53 | print*, 'flag is neither 1 nor -1. Stop' 54 | endif 55 | end do 56 | END IF 57 | enddo 58 | return 59 | end subroutine ccg_psi 60 | -------------------------------------------------------------------------------- /PHonon/PH/check_q_points_sym.f90: -------------------------------------------------------------------------------- 1 | ! 2 | ! Copyright (C) 2010 Quantum ESPRESSO group 3 | ! This file is distributed under the terms of the 4 | ! GNU General Public License. See the file `License' 5 | ! in the root directory of the present distribution, 6 | ! or http://www.gnu.org/copyleft/gpl.txt . 7 | ! 8 | LOGICAL FUNCTION check_q_points_sym(nqs, q, at, bg, nsym, s, invs, & 9 | nq1, nq2, nq3) 10 | ! 11 | ! This function returns .true. if the mesh of q points given as input 12 | ! is compatible with the FFT mesh. It returns .false. if a rotation of 13 | ! the point group gives a q point that is not in the FFT mesh. 14 | ! 15 | ! 16 | USE kinds, ONLY : DP 17 | IMPLICIT NONE 18 | INTEGER, INTENT(IN) :: nqs, nsym 19 | INTEGER, INTENT(IN) :: nq1, nq2, nq3 20 | INTEGER, INTENT(IN) :: s(3,3,48), invs(48) 21 | REAL(DP), INTENT(IN) :: q(3,nqs), at(3,3), bg(3,3) 22 | 23 | INTEGER :: nq, ipol, icar, iq, jq 24 | INTEGER :: nr(3), isq (48), imq 25 | LOGICAL :: lq 26 | REAL(DP) :: xq, sxq(3,48) 27 | REAL(DP) :: eps=1.d-5 28 | 29 | nr(1)=nq1 30 | nr(2)=nq2 31 | nr(3)=nq3 32 | lq = .TRUE. 33 | DO iq = 1,nqs 34 | call star_q (q(:,iq), at, bg, nsym, s, invs, nq, sxq, isq, imq, .FALSE. ) 35 | DO jq=1,nq 36 | DO ipol=1,3 37 | xq = 0.0d0 38 | DO icar=1,3 39 | xq = xq + at(icar,ipol) * sxq(icar,jq) * nr(ipol) 40 | END DO 41 | lq = lq .AND. (ABS(NINT(xq) - xq) .LT. eps) 42 | ENDDO 43 | ENDDO 44 | ENDDO 45 | check_q_points_sym=lq 46 | 47 | RETURN 48 | END FUNCTION check_q_points_sym 49 | -------------------------------------------------------------------------------- /PHonon/PH/check_restart_recover.f90: -------------------------------------------------------------------------------- 1 | ! 2 | ! Copyright (C) 2008 Quantum ESPRESSO group 3 | ! This file is distributed under the terms of the 4 | ! GNU General Public License. See the file `License' 5 | ! in the root directory of the present distribution, 6 | ! or http://www.gnu.org/copyleft/gpl.txt . 7 | ! 8 | SUBROUTINE check_restart_recover(exst_recover, exst_restart) 9 | USE io_files, ONLY : seqopn 10 | IMPLICIT NONE 11 | INTEGER :: iunrec, iunres 12 | LOGICAL :: exst_recover, exst_restart 13 | 14 | iunrec = 99 15 | iunres = 98 16 | CALL seqopn (iunrec, 'recover', 'unformatted', exst_recover) 17 | CALL seqopn( iunres, 'restart_k', 'UNFORMATTED', exst_restart ) 18 | IF (exst_recover) THEN 19 | close (unit = iunrec, status = 'keep') 20 | ELSE 21 | close (unit = iunrec, status = 'delete') 22 | ENDIF 23 | IF (exst_restart) THEN 24 | close (unit = iunres, status = 'keep') 25 | ELSE 26 | close (unit = iunres, status = 'delete') 27 | ENDIF 28 | RETURN 29 | END SUBROUTINE check_restart_recover 30 | -------------------------------------------------------------------------------- /PHonon/PH/clean_pw_ph.f90: -------------------------------------------------------------------------------- 1 | ! 2 | ! Copyright (C) 2009 Quantum ESPRESSO group 3 | ! This file is distributed under the terms of the 4 | ! GNU General Public License. See the file `License' 5 | ! in the root directory of the present distribution, 6 | ! or http://www.gnu.org/copyleft/gpl.txt . 7 | ! 8 | !----------------------------------------------------------------------- 9 | SUBROUTINE clean_pw_ph(iq) 10 | !----------------------------------------------------------------------- 11 | ! 12 | ! This routine deallocate all the variables of pwscf and of the 13 | ! phonon code, and reset the same variables as after reading input in 14 | ! phq_readin, so that it is possible to start a calculation at 15 | ! a new q. 16 | ! 17 | USE kinds, ONLY : DP 18 | USE modes, ONLY : nirr 19 | USE partial, ONLY : done_irr 20 | USE disp, ONLY : done_iq 21 | USE control_ph, ONLY : rec_code_read 22 | USE save_ph, ONLY : restore_ph_input_variables 23 | 24 | USE lr_symm_base, ONLY : nsymq 25 | ! 26 | IMPLICIT NONE 27 | ! 28 | INTEGER, INTENT(IN) :: iq 29 | ! 30 | INTEGER :: irr 31 | ! 32 | done_iq(iq)=.TRUE. 33 | DO irr=1,nirr 34 | IF (.NOT.done_irr(irr)) done_iq(iq)=.FALSE. 35 | ENDDO 36 | CALL clean_pw( .FALSE. ) 37 | CALL deallocate_phq() 38 | rec_code_read=-1000 39 | nsymq=0 40 | ! 41 | ! ... Close the files 42 | ! 43 | CALL close_phq( .TRUE. ) 44 | ! 45 | CALL restore_ph_input_variables() 46 | ! 47 | RETURN 48 | END SUBROUTINE clean_pw_ph 49 | -------------------------------------------------------------------------------- /PHonon/PH/deallocate_part.f90: -------------------------------------------------------------------------------- 1 | ! 2 | ! Copyright (C) 2001-2004 PWSCF group 3 | ! This file is distributed under the terms of the 4 | ! GNU General Public License. See the file `License' 5 | ! in the root directory of the present distribution, 6 | ! or http://www.gnu.org/copyleft/gpl.txt . 7 | ! 8 | !-------------------------------------------------- 9 | subroutine deallocate_part() 10 | !----------===============------------------------- 11 | 12 | USE partial, ONLY : comp_irr, done_irr, atomo 13 | USE el_phon, ONLY : done_elph, comp_elph 14 | IMPLICIT NONE 15 | 16 | if (allocated(comp_irr)) deallocate (comp_irr) 17 | if (allocated(done_irr)) deallocate (done_irr) 18 | if (allocated(comp_elph)) deallocate (comp_elph) 19 | if (allocated(done_elph)) deallocate (done_elph) 20 | if (allocated(atomo)) deallocate (atomo) 21 | 22 | return 23 | end subroutine deallocate_part 24 | -------------------------------------------------------------------------------- /PHonon/PH/elph.f90: -------------------------------------------------------------------------------- 1 | ! 2 | ! Copyright (C) 2001-2003 PWSCF group 3 | ! This file is distributed under the terms of the 4 | ! GNU General Public License. See the file `License' 5 | ! in the root directory of the present distribution, 6 | ! or http://www.gnu.org/copyleft/gpl.txt . 7 | ! 8 | !---------------------------------------------------------------------------- 9 | ! 10 | MODULE el_phon 11 | USE kinds, ONLY : DP 12 | ! 13 | SAVE 14 | ! 15 | LOGICAL :: elph, elph_mat, elph_simple 16 | INTEGER :: elph_nbnd_min, elph_nbnd_max 17 | INTEGER :: el_ph_ngauss, el_ph_nsigma 18 | INTEGER :: iunwfcwann, lrwfcr 19 | INTEGER :: npwq_refolded, ikqg 20 | INTEGER, allocatable :: wan_index_dyn(:) 21 | INTEGER, allocatable :: kpq(:), g_kpq(:,:),igqg(:) 22 | REAL(DP) :: el_ph_sigma 23 | REAL(DP), allocatable :: xk_gamma(:,:) 24 | COMPLEX(DP), ALLOCATABLE, TARGET :: & 25 | el_ph_mat(:,:,:,:) ! nbnd, nbnd, nks, 3*nat 26 | COMPLEX(DP), ALLOCATABLE, TARGET :: & 27 | el_ph_mat_rec(:,:,:,:) ! nbnd, nbnd, nksq, npe 28 | COMPLEX(DP), POINTER :: & 29 | el_ph_mat_rec_col(:,:,:,:) ! nbnd, nbnd, nksqtot, npe 30 | CHARACTER (LEN=256) :: auxdvscf 31 | LOGICAL, ALLOCATABLE :: comp_elph(:), done_elph(:) 32 | REAL(DP), ALLOCATABLE :: gamma_disp(:,:,:) 33 | ! 34 | END MODULE el_phon 35 | -------------------------------------------------------------------------------- /PHonon/PH/find_equiv_sites.f90: -------------------------------------------------------------------------------- 1 | ! 2 | ! Copyright (C) 2003 PWSCF group 3 | ! This file is distributed under the terms of the 4 | ! GNU General Public License. See the file `License' 5 | ! in the root directory of the present distribution, 6 | ! or http://www.gnu.org/copyleft/gpl.txt . 7 | ! 8 | ! 9 | subroutine find_equiv_sites (nat,nsym,irt,has_equivalent, & 10 | n_diff_sites,n_equiv_atoms,equiv_atoms) 11 | ! 12 | implicit none 13 | integer :: nat, nsym, na, nb, ns, n_diff_sites, irt(48,nat), & 14 | equiv_atoms(nat,nat), n_equiv_atoms(nat), has_equivalent(nat) 15 | ! 16 | n_diff_sites = 0 17 | do na = 1,nat 18 | has_equivalent(na) = 0 19 | end do 20 | ! 21 | do na = 1,nat 22 | if (has_equivalent(na).eq.0) then 23 | n_diff_sites = n_diff_sites + 1 24 | n_equiv_atoms (n_diff_sites) = 1 25 | equiv_atoms(n_diff_sites,1) = na 26 | ! 27 | do nb = na+1,nat 28 | do ns = 1, nsym 29 | if ( irt(ns,nb) .eq. na) then 30 | has_equivalent(nb) = 1 31 | n_equiv_atoms (n_diff_sites) = & 32 | n_equiv_atoms (n_diff_sites) + 1 33 | equiv_atoms(n_diff_sites, & 34 | n_equiv_atoms(n_diff_sites)) = nb 35 | go to 10 36 | end if 37 | end do 38 | 10 continue 39 | end do 40 | end if 41 | end do 42 | ! 43 | return 44 | end subroutine find_equiv_sites 45 | -------------------------------------------------------------------------------- /PHonon/PH/initialize_ph.f90: -------------------------------------------------------------------------------- 1 | ! 2 | ! Copyright (C) 2009 Quantum ESPRESSO group 3 | ! This file is distributed under the terms of the 4 | ! GNU General Public License. See the file `License' 5 | ! in the root directory of the present distribution, 6 | ! or http://www.gnu.org/copyleft/gpl.txt . 7 | ! 8 | !----------------------------------------------------------------------- 9 | SUBROUTINE initialize_ph() 10 | !----------------------------------------------------------------------- 11 | ! 12 | ! This is a driver to the phonon initialization routines. 13 | ! 14 | USE klist, ONLY : nks, nkstot 15 | ! 16 | USE qpoint, ONLY : nksq, nksqtot, ikks, ikqs 17 | USE control_lr, ONLY : lgamma 18 | ! 19 | IMPLICIT NONE 20 | INTEGER :: ik 21 | ! 22 | ! ... nksq is the number of k-points, NOT including k+q points 23 | ! 24 | IF ( lgamma ) THEN 25 | ! 26 | nksq = nks 27 | nksqtot = nkstot 28 | ALLOCATE(ikks(nksq), ikqs(nksq)) 29 | DO ik=1,nksq 30 | ikks(ik) = ik 31 | ikqs(ik) = ik 32 | ENDDO 33 | ! 34 | ELSE 35 | ! 36 | nksq = nks / 2 37 | nksqtot = nkstot / 2 38 | ALLOCATE(ikks(nksq), ikqs(nksq)) 39 | DO ik=1,nksq 40 | ikks(ik) = 2 * ik - 1 41 | ikqs(ik) = 2 * ik 42 | ENDDO 43 | ! 44 | END IF 45 | ! 46 | ! Allocate the phonon variables 47 | ! 48 | CALL allocate_phq() 49 | ! 50 | ! Set the main control variable of the phonon code 51 | ! 52 | CALL phq_setup() 53 | ! 54 | ! Recover the status if available 55 | ! 56 | CALL phq_recover() 57 | ! 58 | ! Output summary of the main variables of the phonon code 59 | ! 60 | CALL phq_summary() 61 | ! 62 | ! Open the files of the phonon code 63 | ! 64 | CALL openfilq() 65 | ! 66 | ! Initialize all quantities which do not depend on the 67 | ! linear response to the perturbation 68 | ! 69 | CALL phq_init() 70 | ! 71 | CALL print_clock( 'PHONON' ) 72 | ! 73 | RETURN 74 | 75 | END SUBROUTINE initialize_ph 76 | -------------------------------------------------------------------------------- /PHonon/PH/io_pattern.f90: -------------------------------------------------------------------------------- 1 | ! 2 | ! Copyright (C) 2001-2008 Quantum ESPRESSO group 3 | ! This file is distributed under the terms of the 4 | ! GNU General Public License. See the file `License' 5 | ! in the root directory of the present distribution, 6 | ! or http://www.gnu.org/copyleft/gpl.txt . 7 | ! 8 | !--------------------------------------------------------------------- 9 | SUBROUTINE io_pattern (nat,fildrho,nirr,npert,u,xq,directory,iflag) 10 | !--------------------------------------------------------------------- 11 | ! 12 | USE kinds, ONLY : DP 13 | USE io_global, ONLY : stdout 14 | USE dfile_autoname, ONLY : dfile_name 15 | USE io_files, ONLY : prefix, tmp_dir, seqopn 16 | USE cell_base, ONLY : at 17 | 18 | IMPLICIT NONE 19 | ! 20 | ! the i/o variables first 21 | ! 22 | INTEGER :: nirr, iflag, nat, npert(3*nat) 23 | COMPLEX(DP) :: u(3*nat,3*nat) 24 | REAL(DP) :: xq(3) 25 | CHARACTER (len=256),INTENT(in):: directory ! where to read/write the file 26 | CHARACTER (len=*) :: fildrho ! name of the file 27 | CHARACTER (len=256):: filname ! complete name of the file 28 | ! 29 | ! here the local variables 30 | ! 31 | INTEGER :: i,iunit 32 | INTEGER, EXTERNAL :: find_free_unit 33 | LOGICAL :: exst 34 | 35 | IF (ABS(iflag).NE.1) CALL errore('io_pattern','wrong iflag',1+ABS(iflag)) 36 | 37 | iunit = find_free_unit() 38 | filname = TRIM(dfile_name(xq, at, fildrho, TRIM(directory)//prefix, (iflag>0),-1)) //".pat" 39 | CALL seqopn(iunit,filname,'formatted',exst, directory) 40 | 41 | IF (iflag.GT.0) THEN 42 | !WRITE( stdout,'(5x,"WRITING PATTERNS TO FILE ",2a)') TRIM(directory), TRIM(filname) 43 | WRITE(iunit,*) nirr 44 | WRITE(iunit,*) (npert(i),i=1,nirr) 45 | WRITE(iunit,*) u 46 | WRITE(iunit,*) xq 47 | ELSE 48 | !WRITE( *,'(5x,"READING PATTERNS FROM FILE ",2a)') TRIM(directory), TRIM(filname) 49 | READ(iunit,*) nirr 50 | READ(iunit,*) (npert(i),i=1,nirr) 51 | READ(iunit,*) u 52 | READ(iunit,*) xq 53 | END IF 54 | ! 55 | CLOSE (iunit) 56 | 57 | RETURN 58 | END SUBROUTINE io_pattern 59 | -------------------------------------------------------------------------------- /PHonon/PH/prepare_sym_analysis.f90: -------------------------------------------------------------------------------- 1 | ! 2 | ! Copyright (C) 2010 Quantum ESPRESSO group 3 | ! This file is distributed under the terms of the 4 | ! GNU General Public License. See the file `License' 5 | ! in the root directory of the present distribution, 6 | ! or http://www.gnu.org/copyleft/gpl.txt . 7 | ! 8 | SUBROUTINE prepare_sym_analysis(nsym,sr,t_rev,magnetic_sym) 9 | 10 | USE kinds, ONLY : DP 11 | USE rap_point_group, ONLY : code_group, nclass, nelem, elem, which_irr, & 12 | char_mat, name_rap, gname, name_class, ir_ram 13 | USE rap_point_group_is, ONLY : code_group_is, gname_is 14 | 15 | IMPLICIT NONE 16 | INTEGER, INTENT(IN) :: nsym 17 | REAL(DP), INTENT(IN) :: sr(3,3,nsym) 18 | INTEGER, INTENT(IN) :: t_rev(nsym) 19 | LOGICAL, INTENT(IN) :: magnetic_sym 20 | 21 | INTEGER :: nsym_is, isym 22 | REAL(DP) :: sr_is(3,3,48) 23 | ! 24 | ! Find the group name and sets its irreducible representation in the 25 | ! rap_point_group module variables 26 | ! 27 | CALL find_group(nsym,sr,gname,code_group) 28 | CALL set_irr_rap(code_group,nclass,char_mat,name_rap,name_class,ir_ram) 29 | CALL divide_class(code_group,nsym,sr,nclass,nelem,elem,which_irr) 30 | ! 31 | ! If some symmetry needs the time reversal check which group is formed 32 | ! by the operations that do not need time reversal 33 | ! 34 | IF (magnetic_sym) THEN 35 | nsym_is=0 36 | DO isym=1,nsym 37 | IF (t_rev(isym)==0) THEN 38 | nsym_is=nsym_is+1 39 | sr_is(:,:,nsym_is) = sr(:,:,isym) 40 | ENDIF 41 | ENDDO 42 | CALL find_group(nsym_is,sr_is,gname_is,code_group_is) 43 | ENDIF 44 | 45 | RETURN 46 | END SUBROUTINE prepare_sym_analysis 47 | -------------------------------------------------------------------------------- /PHonon/PH/psym_dmage.f90: -------------------------------------------------------------------------------- 1 | ! 2 | ! Copyright (C) 2009 Quantum ESPRESSO group 3 | ! This file is distributed under the terms of the 4 | ! GNU General Public License. See the file `License' 5 | ! in the root directory of the present distribution, 6 | ! or http://www.gnu.org/copyleft/gpl.txt . 7 | ! 8 | ! 9 | !----------------------------------------------------------------------- 10 | SUBROUTINE psym_dmage (dvtosym) 11 | !----------------------------------------------------------------------- 12 | ! 13 | ! ... p-symmetrize the magnetization change due to an electric field. 14 | ! 15 | USE kinds, ONLY : DP 16 | USE lsda_mod, ONLY : nspin 17 | USE mp_bands, ONLY : me_bgrp 18 | USE fft_base, ONLY : dfftp 19 | USE scatter_mod, ONLY : cgather_sym 20 | ! 21 | IMPLICIT NONE 22 | ! 23 | COMPLEX(DP) :: dvtosym (dfftp%nnr, nspin, 3) 24 | ! the potential to symmetrize 25 | !-local variable 26 | ! 27 | #if defined (__MPI) 28 | ! 29 | INTEGER :: i, is, iper, npp0 30 | 31 | COMPLEX(DP), ALLOCATABLE :: ddvtosym (:,:,:) 32 | ! the potential to symm 33 | 34 | CALL start_clock ('psym_dmage') 35 | 36 | ALLOCATE (ddvtosym ( dfftp%nr1x * dfftp%nr2x * dfftp%nr3x, nspin, 3)) 37 | npp0 = 1 38 | DO i = 1, me_bgrp 39 | npp0 = npp0 + dfftp%npp (i) * dfftp%nnp 40 | ENDDO 41 | DO iper = 1, 3 42 | DO is = 1, nspin 43 | CALL cgather_sym (dfftp,dvtosym (:, is, iper), ddvtosym (:, is, iper) ) 44 | ENDDO 45 | ENDDO 46 | 47 | CALL sym_dmage (ddvtosym) 48 | DO iper = 1, 3 49 | DO is = 1, nspin 50 | CALL zcopy (dfftp%npp (me_bgrp+1) * dfftp%nnp, ddvtosym (npp0, is, iper), & 51 | 1, dvtosym (1, is, iper), 1) 52 | ENDDO 53 | ENDDO 54 | DEALLOCATE (ddvtosym) 55 | 56 | CALL stop_clock ('psym_dmage') 57 | 58 | #else 59 | 60 | CALL sym_dmage (dvtosym) 61 | 62 | #endif 63 | 64 | RETURN 65 | 66 | END SUBROUTINE psym_dmage 67 | -------------------------------------------------------------------------------- /PHonon/PH/psyme.f90: -------------------------------------------------------------------------------- 1 | ! 2 | ! Copyright (C) 2001-2008 Quantum ESPRESSO group 3 | ! This file is distributed under the terms of the 4 | ! GNU General Public License. See the file `License' 5 | ! in the root directory of the present distribution, 6 | ! or http://www.gnu.org/copyleft/gpl.txt . 7 | ! 8 | ! 9 | !----------------------------------------------------------------------- 10 | SUBROUTINE psyme (dvtosym) 11 | !----------------------------------------------------------------------- 12 | ! 13 | ! ... p-symmetrize the charge density. 14 | ! 15 | USE kinds, ONLY : DP 16 | USE fft_base, ONLY : dfftp 17 | USE noncollin_module, ONLY : nspin_mag 18 | USE mp_bands, ONLY : me_bgrp 19 | USE fft_base, ONLY : dfftp 20 | USE scatter_mod, ONLY : cgather_sym 21 | ! 22 | IMPLICIT NONE 23 | ! 24 | COMPLEX(DP) :: dvtosym (dfftp%nnr, nspin_mag, 3) 25 | ! the potential to symmetrize 26 | !-local variable 27 | ! 28 | #if defined (__MPI) 29 | ! 30 | INTEGER :: i, is, iper, npp0 31 | COMPLEX(DP), ALLOCATABLE :: ddvtosym (:,:,:) 32 | ! the potential to symmet 33 | ! 34 | ! 35 | ALLOCATE (ddvtosym ( dfftp%nr1x * dfftp%nr2x * dfftp%nr3x, nspin_mag, 3)) 36 | npp0 = 0 37 | DO i = 1, me_bgrp 38 | npp0 = npp0 + dfftp%npp (i) 39 | ENDDO 40 | 41 | npp0 = npp0 * dfftp%nnp+1 42 | DO iper = 1, 3 43 | DO is = 1, nspin_mag 44 | CALL cgather_sym (dfftp,dvtosym (:, is, iper), ddvtosym (:, is, iper) ) 45 | ENDDO 46 | 47 | ENDDO 48 | 49 | CALL syme (ddvtosym) 50 | DO iper = 1, 3 51 | DO is = 1, nspin_mag 52 | CALL zcopy (dfftp%npp (me_bgrp+1) * dfftp%nnp, ddvtosym (npp0, is, iper), & 53 | 1, dvtosym (1, is, iper), 1) 54 | ENDDO 55 | 56 | ENDDO 57 | 58 | DEALLOCATE (ddvtosym) 59 | 60 | #else 61 | CALL syme (dvtosym) 62 | #endif 63 | 64 | RETURN 65 | 66 | END SUBROUTINE psyme 67 | -------------------------------------------------------------------------------- /PHonon/PH/psyme2.f90: -------------------------------------------------------------------------------- 1 | ! 2 | ! Copyright (C) 2001-2008 Quantum ESPRESSO group 3 | ! This file is distributed under the terms of the 4 | ! GNU General Public License. See the file `License' 5 | ! in the root directory of the present distribution, 6 | ! or http://www.gnu.org/copyleft/gpl.txt . 7 | ! 8 | ! 9 | !----------------------------------------------------------------------- 10 | subroutine psyme2 (dvtosym) 11 | !----------------------------------------------------------------------- 12 | ! p-symmetrize the second derivative of charge density. 13 | ! 14 | 15 | use kinds, only : DP 16 | USE mp_bands, ONLY: me_bgrp 17 | USE fft_base, ONLY: dfftp 18 | USE scatter_mod, ONLY: cgather_sym 19 | implicit none 20 | 21 | complex(DP) :: dvtosym (dfftp%nnr, 6) 22 | ! the potential to symmetrize 23 | !-local variable 24 | 25 | #if defined(__MPI) 26 | integer :: i, iper, npp0 27 | 28 | complex(DP), allocatable :: ddvtosym (:,:) 29 | ! the potential to symmetrize 30 | 31 | allocate (ddvtosym (dfftp%nr1x*dfftp%nr2x*dfftp%nr3x, 6)) 32 | 33 | npp0 = 0 34 | do i = 1, me_bgrp 35 | npp0 = npp0 + dfftp%npp (i) 36 | enddo 37 | npp0 = npp0 * dfftp%nnp + 1 38 | do iper = 1, 6 39 | call cgather_sym (dfftp, dvtosym (:, iper), ddvtosym (:, iper) ) 40 | enddo 41 | 42 | call syme2 (ddvtosym) 43 | 44 | do iper = 1, 6 45 | call zcopy (dfftp%npp (me_bgrp+1) * dfftp%nnp, ddvtosym (npp0, iper), 1, & 46 | dvtosym (1, iper), 1) 47 | enddo 48 | 49 | deallocate (ddvtosym) 50 | #else 51 | call syme2 (dvtosym) 52 | #endif 53 | return 54 | end subroutine psyme2 55 | -------------------------------------------------------------------------------- /PHonon/PH/ramanm.f90: -------------------------------------------------------------------------------- 1 | ! 2 | ! Copyright (C) 2001 PWSCF group 3 | ! This file is distributed under the terms of the 4 | ! GNU General Public License. See the file `License' 5 | ! in the root directory of the present distribution, 6 | ! or http://www.gnu.org/copyleft/gpl.txt . 7 | ! 8 | ! 9 | MODULE ramanm 10 | ! 11 | USE kinds, ONLY : dp 12 | ! 13 | SAVE 14 | ! 15 | REAL (dp) :: eth_rps, eth_ns 16 | REAL (DP), ALLOCATABLE :: ramtns (:,:,:,:) 17 | ! raman tensor (3, 3, 3, nat) 18 | REAL (DP) :: eloptns (3,3,3), dek 19 | ! electro-optic tensor 20 | ! delta_xk used for wavefunctions derivation 21 | 22 | LOGICAL :: lraman, elop, done_lraman=.FALSE., done_elop=.FALSE. 23 | INTEGER :: iuchf, iud2w, iuba2, lrchf, lrd2w, lrba2 24 | ! unit for chi-wavefuntion 25 | ! unit for the second derivative of the wavefunction 26 | ! unit for nscf part of the potential in scf calc. 27 | ! length of chi-wavefunction record 28 | ! length of iud2w record 29 | ! length of iuba2 record 30 | 31 | INTEGER :: jab(3,3), a1j(6), a2j(6) 32 | ! 1-D index defining a 3x3 symmetric tensor 33 | ! a1j and a2j are the two components of the 34 | ! symmetric tensor defined by jab(3,3) 35 | ! 36 | ! When dealing with a 3x3 symmetric tensor A2(i,j), the program considers a 37 | ! 6-components vector A1(k) whose components are defined by jab, a1j, a2j 38 | ! --common variables-- in the following way: A1(jab(i,j)) = A2(i,j); 39 | ! or A2(a1j(k),a2j(k)) = A2(a2j(k),a1j(k)) = A1(k) 40 | ! 41 | data jab /1, 4, 6, 4, 2, 5, 6, 5, 3/ 42 | data a1j /1, 2, 3, 1, 2, 1 / 43 | data a2j /1, 2, 3, 2, 3, 3 / 44 | ! 45 | END MODULE ramanm 46 | 47 | -------------------------------------------------------------------------------- /PHonon/PH/set_asr_c.f90: -------------------------------------------------------------------------------- 1 | ! 2 | ! Copyright (C) 2003 PWSCF group 3 | ! This file is distributed under the terms of the 4 | ! GNU General Public License. See the file `License' 5 | ! in the root directory of the present distribution, 6 | ! or http://www.gnu.org/copyleft/gpl.txt . 7 | ! 8 | ! 9 | !--------------------------------------------------------------------------- 10 | SUBROUTINE set_asr_c(nat,nasr,dyn) 11 | !--------------------------------------------------------------------------- 12 | ! 13 | ! Impose Acoustic Sum Rule on the dynamical matrix 14 | ! We assume that (3*nat-1) columns have been calculated 15 | ! and that the missing column corresponds to atom nasr 16 | ! 17 | USE kinds, ONLY : DP 18 | IMPLICIT NONE 19 | INTEGER :: nat, nasr 20 | COMPLEX(DP) :: dyn(3*nat,3*nat) 21 | ! 22 | INTEGER :: na, nb, i,j 23 | COMPLEX(DP) :: sum 24 | 25 | IF (nasr.LE.0 .OR. nasr.GT.nat) RETURN 26 | DO j=1,3 27 | DO i=1,3 28 | DO nb=1,nat 29 | sum=(0.d0,0.d0) 30 | DO na=1,nat 31 | IF (na.NE.nasr) sum = sum + dyn(3*(na-1)+i,3*(nb-1)+j) 32 | END DO 33 | dyn(3*(nasr-1)+i,3*(nb-1)+j)= -sum 34 | END DO 35 | END DO 36 | END DO 37 | 38 | RETURN 39 | END SUBROUTINE set_asr_c 40 | -------------------------------------------------------------------------------- /PHonon/PH/set_dvscf.f90: -------------------------------------------------------------------------------- 1 | ! 2 | ! Copyright (C) 2001-2008 Quantum ESPRESSO group 3 | ! This file is distributed under the terms of the 4 | ! GNU General Public License. See the file `License' 5 | ! in the root directory of the present distribution, 6 | ! or http://www.gnu.org/copyleft/gpl.txt . 7 | ! 8 | !----------------------------------------------------------------------- 9 | subroutine set_dvscf (dvscfs) 10 | !----------------------------------------------------------------------- 11 | ! 12 | ! Read the variation of the charge and 13 | ! calculates the local part of the scf potential 14 | ! 15 | 16 | use kinds, only : DP 17 | USE gvecs, ONLY : doublegrid 18 | USE fft_base, ONLY : dfftp, dffts 19 | USE lsda_mod,ONLY : nspin 20 | USE units_ph, ONLY : iudrho, lrdrho 21 | USE output, ONLY : fildrho 22 | USE dv_of_drho_lr 23 | implicit none 24 | 25 | complex(DP) :: dvscfs (dffts%nnr,3) 26 | complex(DP) , allocatable :: derho (:,:) 27 | integer :: ipl 28 | ! counter on the polarizations 29 | 30 | allocate (derho ( dfftp%nnr, nspin)) 31 | 32 | if ( fildrho.eq.' ') call errore ('set_dvscf','where is fildrho?',1) 33 | ! 34 | do ipl = 1, 3 35 | ! 36 | ! read from file the variation of the charge 37 | ! 38 | call davcio_drho (derho (1, 1), lrdrho, iudrho, ipl, -1) 39 | ! 40 | ! Calculates the local part of the scf potential 41 | ! 42 | call dv_of_drho (derho (1, 1), .false.) 43 | ! 44 | if (doublegrid) then 45 | call cinterpolate (derho (1, 1), dvscfs (1, ipl), -1) 46 | else 47 | call zcopy (dfftp%nnr, derho (1, 1), 1, dvscfs (1, ipl), 1) 48 | endif 49 | end do 50 | 51 | deallocate (derho) 52 | 53 | return 54 | end subroutine set_dvscf 55 | -------------------------------------------------------------------------------- /PHonon/PH/set_int12_nc.f90: -------------------------------------------------------------------------------- 1 | ! 2 | ! Copyright (C) 2007-2009 Quantum ESPRESSO group 3 | ! This file is distributed under the terms of the 4 | ! GNU General Public License. See the file `License' 5 | ! in the root directory of the present distribution, 6 | ! or http://www.gnu.org/copyleft/gpl.txt . 7 | 8 | !---------------------------------------------------------------------------- 9 | SUBROUTINE set_int12_nc(iflag) 10 | !---------------------------------------------------------------------------- 11 | ! 12 | ! This is a driver to call the routines that rotate and multiply 13 | ! by the Pauli matrices the integrals. 14 | ! 15 | USE ions_base, ONLY : nat, ntyp => nsp, ityp 16 | USE spin_orb, ONLY : lspinorb 17 | USE uspp_param, only: upf 18 | USE phus, ONLY : int1, int2, int1_nc, int2_so 19 | IMPLICIT NONE 20 | INTEGER :: iflag 21 | INTEGER :: np, na 22 | 23 | int1_nc=(0.d0,0.d0) 24 | IF (lspinorb) int2_so=(0.d0,0.d0) 25 | DO np = 1, ntyp 26 | IF ( upf(np)%tvanp ) THEN 27 | DO na = 1, nat 28 | IF (ityp(na)==np) THEN 29 | IF (upf(np)%has_so) THEN 30 | CALL transform_int1_so(int1,na,iflag) 31 | CALL transform_int2_so(int2,na,iflag) 32 | ELSE 33 | CALL transform_int1_nc(int1,na,iflag) 34 | IF (lspinorb) CALL transform_int2_nc(int2,na,iflag) 35 | END IF 36 | END IF 37 | END DO 38 | END IF 39 | END DO 40 | END SUBROUTINE set_int12_nc 41 | 42 | -------------------------------------------------------------------------------- /PHonon/PH/set_irr_nosym.f90: -------------------------------------------------------------------------------- 1 | ! 2 | ! Copyright (C) 2001-2012 Quantum ESPRESSO group 3 | ! This file is distributed under the terms of the 4 | ! GNU General Public License. See the file `License' 5 | ! in the root directory of the present distribution, 6 | ! or http://www.gnu.org/copyleft/gpl.txt . 7 | ! 8 | !--------------------------------------------------------------------- 9 | subroutine set_irr_nosym_new (u, npert, nirr) 10 | !--------------------------------------------------------------------- 11 | ! 12 | ! This routine substitutes set_irr when there are no symmetries. 13 | ! The irreducible representations are all one dimensional and 14 | ! we set them to the displacement of a single atom in one direction 15 | ! 16 | USE kinds, only : DP 17 | USE ions_base, ONLY : nat 18 | USE modes, ONLY : num_rap_mode, name_rap_mode 19 | USE control_ph, ONLY : search_sym 20 | IMPLICIT NONE 21 | ! 22 | INTEGER, INTENT(OUT) :: npert (3 * nat), nirr 23 | ! output: the dimension of each representation 24 | ! output: the number of representation 25 | COMPLEX(DP), INTENT(OUT) :: u( 3 * nat, 3 * nat ) 26 | ! 27 | integer :: imode, irr 28 | ! counter on modes 29 | ! counter on representations 30 | ! 31 | ! 32 | nirr = 3 * nat 33 | npert = 1 34 | 35 | u = (0.d0, 0.d0) 36 | do imode = 1, 3 * nat 37 | u (imode, imode) = (1.d0, 0.d0) 38 | enddo 39 | IF (search_sym) THEN 40 | DO imode = 1, 3 * nat 41 | num_rap_mode(imode)=1 42 | name_rap_mode(imode)='A' 43 | END DO 44 | ENDIF 45 | 46 | return 47 | end subroutine set_irr_nosym_new 48 | -------------------------------------------------------------------------------- /PHonon/PH/stop_ph.f90: -------------------------------------------------------------------------------- 1 | ! 2 | ! Copyright (C) 2001-2004 PWSCF group 3 | ! This file is distributed under the terms of the 4 | ! GNU General Public License. See the file `License' 5 | ! in the root directory of the present distribution, 6 | ! or http://www.gnu.org/copyleft/gpl.txt . 7 | ! 8 | !---------------------------------------------------------------------------- 9 | SUBROUTINE stop_ph( flag ) 10 | !---------------------------------------------------------------------------- 11 | ! 12 | ! ... Synchronize processes before stopping. 13 | ! 14 | USE kinds, ONLY : DP 15 | USE mp_global, ONLY : mp_global_end 16 | USE mp_images, ONLY : nimage 17 | USE ph_restart, ONLY : destroy_status_run 18 | USE save_ph, ONLY : clean_input_variables 19 | USE environment, ONLY : environment_end 20 | ! 21 | IMPLICIT NONE 22 | ! 23 | LOGICAL :: flag 24 | ! 25 | CALL clean_input_variables() 26 | ! 27 | CALL destroy_status_run() 28 | ! 29 | CALL deallocate_part() 30 | ! 31 | CALL print_clock_ph() 32 | ! 33 | CALL environment_end('PHONON') 34 | ! 35 | CALL mp_global_end() 36 | ! 37 | IF ( flag ) THEN 38 | ! 39 | STOP 40 | ! 41 | ELSE 42 | ! 43 | STOP 1 44 | ! 45 | ENDIF 46 | ! 47 | END SUBROUTINE stop_ph 48 | 49 | SUBROUTINE stop_smoothly_ph(flag) 50 | IMPLICIT NONE 51 | LOGICAL, INTENT(IN) :: flag 52 | 53 | CALL collect_grid_files() 54 | 55 | CALL close_phq(.FALSE.) 56 | 57 | CALL stop_ph(flag) 58 | 59 | END SUBROUTINE stop_smoothly_ph 60 | -------------------------------------------------------------------------------- /PHonon/PH/symmorphic_or_nzb.f90: -------------------------------------------------------------------------------- 1 | ! 2 | ! Copyright (C) 2013 Quantum ESPRESSO group 3 | ! This file is distributed under the terms of the 4 | ! GNU General Public License. See the file `License' 5 | ! in the root directory of the present distribution, 6 | ! or http://www.gnu.org/copyleft/gpl.txt . 7 | ! 8 | LOGICAL FUNCTION symmorphic_or_nzb() 9 | ! 10 | ! This function returns .true. if the small group of the current q is symmorphic 11 | ! or if the q point is not at zone border or if all the phase factors 12 | ! e^{i G f} are equal to one. Presently the routine that 13 | ! finds the mode symmetry works only when this function is .true.. 14 | ! 15 | USE kinds, ONLY : DP 16 | USE cell_base, ONLY : at 17 | USE fft_base, ONLY : dfftp 18 | USE symm_base, ONLY : ftau 19 | USE lr_symm_base, ONLY : gi, nsymq 20 | 21 | IMPLICIT NONE 22 | LOGICAL :: is_symmorphic, result_sym 23 | INTEGER :: isym, jsym 24 | REAL(DP) :: ft(3,nsymq) 25 | 26 | is_symmorphic=.NOT.(ANY(ftau(:,1:nsymq) /= 0)) 27 | IF (is_symmorphic) THEN 28 | symmorphic_or_nzb=.TRUE. 29 | RETURN 30 | ELSE 31 | result_sym=.TRUE. 32 | DO isym = 1, nsymq 33 | ft(1,isym) = DBLE(ftau(1,isym)) / DBLE(dfftp%nr1) 34 | ft(2,isym) = DBLE(ftau(2,isym)) / DBLE(dfftp%nr2) 35 | ft(3,isym) = DBLE(ftau(3,isym)) / DBLE(dfftp%nr3) 36 | END DO 37 | CALL cryst_to_cart(nsymq, ft, at, 1) 38 | 39 | DO isym=1,nsymq 40 | DO jsym=1,nsymq 41 | result_sym=( result_sym.AND.(ABS( gi(1,isym)*ft(1,jsym) + & 42 | gi(2,isym)*ft(2,jsym) + & 43 | gi(3,isym)*ft(3,jsym) ) < 1.D-8) ) 44 | END DO 45 | END DO 46 | symmorphic_or_nzb=result_sym 47 | END IF 48 | RETURN 49 | END FUNCTION symmorphic_or_nzb 50 | -------------------------------------------------------------------------------- /PHonon/PH/tra_write_matrix.f90: -------------------------------------------------------------------------------- 1 | ! 2 | ! Copyright (C) 2001 PWSCF group 3 | ! This file is distributed under the terms of the 4 | ! GNU General Public License. See the file `License' 5 | ! in the root directory of the present distribution, 6 | ! or http://www.gnu.org/copyleft/gpl.txt . 7 | !----------------------------------------------------------------------- 8 | subroutine tra_write_matrix (alpha, adyn, u, nat) 9 | !----------------------------------------------------------------------- 10 | USE io_global, ONLY : stdout 11 | USE kinds, ONLY : DP 12 | USE cell_base, ONLY : at, bg 13 | USE symm_base, ONLY : s, irt, invs 14 | 15 | USE lr_symm_base, ONLY : rtau, nsymq, irotmq, minus_q 16 | USE qpoint, ONLY : xq 17 | 18 | implicit none 19 | ! 20 | ! This routine writes on output the symmetrized dynamical matrix in 21 | ! cartesian coordinates. The input matrix adyn is in the basis of 22 | ! the modes. 23 | ! On output adyn is unchanged 24 | ! 25 | integer :: i, j, na, nb, nat 26 | complex(DP) :: adyn (3 * nat, 3 * nat), u (3 * nat, 3 * nat) 27 | complex(DP) :: auxdyn (3*nat, 3*nat) 28 | character (len=*) :: alpha 29 | 30 | auxdyn=adyn 31 | CALL symdyn_munu_new (auxdyn, u, xq, s, invs, rtau, irt, at, bg, & 32 | nsymq, nat, irotmq, minus_q) 33 | 34 | WRITE( stdout, '(a)') alpha 35 | do na = 1, nat 36 | do nb = 1, nat 37 | WRITE( stdout, '(2i4)') na, nb 38 | do i = 1, 3 39 | WRITE( stdout, '(6f12.7)') (auxdyn(3*(na-1)+i, 3*(nb-1)+j),j=1,3) 40 | enddo 41 | enddo 42 | enddo 43 | return 44 | end subroutine tra_write_matrix 45 | -------------------------------------------------------------------------------- /PHonon/PH/trntnsc.f90: -------------------------------------------------------------------------------- 1 | ! 2 | ! Copyright (C) 2001 PWSCF group 3 | ! This file is distributed under the terms of the 4 | ! GNU General Public License. See the file `License' 5 | ! in the root directory of the present distribution, 6 | ! or http://www.gnu.org/copyleft/gpl.txt . 7 | ! 8 | ! 9 | !----------------------------------------------------------------------- 10 | subroutine trntnsc (phi, at, bg, iflg) 11 | !----------------------------------------------------------------------- 12 | ! 13 | ! trasforms a COMPLEX tensor (like the dynamical matrix) 14 | ! from crystal to cartesian axis (iflg >= 1) or viceversa (iflg <= -1) 15 | ! 16 | USE kinds, only : DP 17 | implicit none 18 | 19 | integer :: iflg 20 | ! input: gives the versus of the trans. 21 | 22 | complex(DP) :: phi (3, 3) 23 | ! inp/out: the matrix to transform 24 | 25 | real(DP) :: at (3, 3), bg (3, 3) 26 | ! input: the direct lattice vectors 27 | ! input: the reciprocal lattice 28 | 29 | integer :: i, j, k, l 30 | ! 31 | ! counters on polarizations 32 | ! / 33 | !/ 34 | 35 | 36 | complex(DP) :: wrk (3, 3) 37 | ! a working array 38 | if (iflg.gt.0) then 39 | ! 40 | ! forward transformation (crystal to cartesian axis) 41 | ! 42 | 43 | call zcopy (9, phi, 1, wrk, 1) 44 | do i = 1, 3 45 | do j = 1, 3 46 | phi (i, j) = (0.d0, 0.d0) 47 | do k = 1, 3 48 | do l = 1, 3 49 | phi (i, j) = phi (i, j) + wrk (k, l) * bg (i, k) * bg (j, l) 50 | enddo 51 | enddo 52 | enddo 53 | enddo 54 | else 55 | ! 56 | ! backward transformation (cartesian to crystal axis) 57 | ! 58 | do i = 1, 3 59 | do j = 1, 3 60 | wrk (i, j) = (0.d0, 0.d0) 61 | do k = 1, 3 62 | do l = 1, 3 63 | wrk (i, j) = wrk (i, j) + phi (k, l) * at (k, i) * at (l, j) 64 | enddo 65 | enddo 66 | enddo 67 | enddo 68 | call zcopy (9, wrk, 1, phi, 1) 69 | endif 70 | return 71 | end subroutine trntnsc 72 | -------------------------------------------------------------------------------- /PHonon/PH/write_epsilon_and_zeu.f90: -------------------------------------------------------------------------------- 1 | ! 2 | ! Copyright (C) 2001 PWSCF group 3 | ! This file is distributed under the terms of the 4 | ! GNU General Public License. See the file `License' 5 | ! in the root directory of the present distribution, 6 | ! or http://www.gnu.org/copyleft/gpl.txt . 7 | ! 8 | !----------------------------------------------------------------------- 9 | subroutine write_epsilon_and_zeu (zstareu, epsilon, nat, iudyn) 10 | !----------------------------------------------------------------------- 11 | USE kinds, only : DP 12 | USE control_ph, ONLY : xmldyn 13 | USE io_global, ONLY : ionode 14 | implicit none 15 | ! input variables 16 | integer :: iudyn, nat 17 | ! unit number 18 | ! number of atom in the unit cell 19 | 20 | real(DP) :: zstareu (3, 3, nat), epsilon (3, 3) 21 | ! the effective charges 22 | ! the dielectric tensor 23 | ! local variables 24 | integer :: na, icar, jcar 25 | ! counter on atoms 26 | ! cartesian coordinate counters 27 | ! 28 | ! write dielectric tensor and Z(E,Us) effective charges on iudyn 29 | ! 30 | IF (.NOT.xmldyn.AND.ionode) THEN 31 | write (iudyn, '(/,5x,"Dielectric Tensor:",/)') 32 | write (iudyn, '(3f24.12)') ((epsilon(icar,jcar), jcar=1,3), icar=1,3) 33 | write (iudyn, '(/5x, "Effective Charges E-U: Z_{alpha}{s,beta}",/)') 34 | do na = 1, nat 35 | write (iudyn, '(5x,"atom # ",i4)') na 36 | write (iudyn, '(3f24.12)') ((zstareu(icar,jcar,na), jcar=1,3), icar=1,3) 37 | enddo 38 | ENDIF 39 | ! 40 | ! write dielectric tensor and Z(E,Us) effective charges on standard output 41 | ! 42 | CALL summarize_epsilon() 43 | 44 | CALL summarize_zeu() 45 | 46 | return 47 | end subroutine write_epsilon_and_zeu 48 | -------------------------------------------------------------------------------- /PHonon/PH/write_matrix.f90: -------------------------------------------------------------------------------- 1 | ! 2 | ! Copyright (C) 2001 PWSCF group 3 | ! This file is distributed under the terms of the 4 | ! GNU General Public License. See the file `License' 5 | ! in the root directory of the present distribution, 6 | ! or http://www.gnu.org/copyleft/gpl.txt . 7 | ! 8 | !----------------------------------------------------------------------- 9 | subroutine write_matrix (alpha, wdyn, nat) 10 | !----------------------------------------------------------------------- 11 | USE io_global, ONLY : stdout 12 | USE kinds, only : DP 13 | implicit none 14 | integer :: i, j, na, nb, nat 15 | complex(DP) :: wdyn (3, 3, nat, nat) 16 | 17 | character (len=*) :: alpha 18 | WRITE( stdout, '(a)') alpha 19 | do na = 1, nat 20 | do nb = 1, nat 21 | WRITE( stdout, '(2i4)') na, nb 22 | do i = 1, 3 23 | WRITE( stdout, '(6f10.5)') (wdyn (i, j, na, nb) , j = 1, 3) 24 | enddo 25 | enddo 26 | 27 | enddo 28 | return 29 | end subroutine write_matrix 30 | -------------------------------------------------------------------------------- /PHonon/PH/write_modes.f90: -------------------------------------------------------------------------------- 1 | ! 2 | ! Copyright (C) 2012 Quantum ESPRESSO group 3 | ! This file is distributed under the terms of the 4 | ! GNU General Public License. See the file `License' 5 | ! in the root directory of the present distribution, 6 | ! or http://www.gnu.org/copyleft/gpl.txt . 7 | ! 8 | SUBROUTINE write_modes_out(irr, imode0) 9 | ! 10 | ! This routine writes the displacements on the representation irr that 11 | ! starts at mode imode0 12 | ! 13 | USE kinds, ONLY : DP 14 | USE ions_base, ONLY : nat 15 | USE modes, ONLY : u, npert 16 | USE io_global, ONLY : stdout 17 | IMPLICIT NONE 18 | INTEGER, INTENT(IN) :: imode0, irr 19 | INTEGER :: mu, nu 20 | 21 | WRITE( stdout, '(5x,"Irreps are as follows:",/)') 22 | IF (npert (irr) .eq.1) THEN 23 | WRITE( stdout, '(20x," mode # ",i3)') imode0 + 1 24 | WRITE( stdout, '(20x," (",2f10.5," ) ")') ( (u (mu, nu) ,& 25 | &nu = imode0 + 1, imode0 + npert (irr) ) , mu = 1, 3 * nat) 26 | ELSEIF (npert (irr) .eq.2) THEN 27 | WRITE( stdout, '(2(10x," mode # ",i3,16x))') imode0 + 1, & 28 | imode0 + 2 29 | WRITE( stdout, '(2(10x," (",2f10.5," ) "))') ( (u (mu, nu) , nu & 30 | &= imode0 + 1, imode0 + npert (irr) ) , mu = 1, 3 * nat) 31 | ELSEIF (npert (irr) .eq.3) THEN 32 | WRITE( stdout, '(4x,3(" mode # ",i3,13x))') imode0 + 1, imode0 & 33 | + 2, imode0 + 3 34 | WRITE( stdout, '((5x,3("(",2f10.5," ) ")))') ( (u (mu, nu) , & 35 | nu = imode0 + 1, imode0 + npert (irr) ) , mu = 1, 3 * nat) 36 | ELSE 37 | WRITE( stdout, '(4x,4(" mode # ",i3,13x))') imode0 + 1, imode0 & 38 | + 2, imode0 + 4 39 | WRITE( stdout, '((5x,4("(",2f10.5," ) ")))') ( (u (mu, nu) , & 40 | nu = imode0 + 1, imode0 + npert (irr) ) , mu = 1, 3 * nat) 41 | ENDIF 42 | 43 | RETURN 44 | END SUBROUTINE write_modes_out 45 | -------------------------------------------------------------------------------- /PHonon/PH/write_ramtns.f90: -------------------------------------------------------------------------------- 1 | ! 2 | ! Copyright (C) 2001 PWSCF group 3 | ! This file is distributed under the terms of the 4 | ! GNU General Public License. See the file `License' 5 | ! in the root directory of the present distribution, 6 | ! or http://www.gnu.org/copyleft/gpl.txt . 7 | ! 8 | !----------------------------------------------------------------------- 9 | subroutine write_ramtns (iudyn, ramtns) 10 | !----------------------------------------------------------------------- 11 | USE kinds, ONLY : DP 12 | USE constants, ONLY : fpi, BOHR_RADIUS_ANGS 13 | USE cell_base, ONLY : omega 14 | USE ions_base, ONLY : nat 15 | USE control_ph, ONLY : xmldyn 16 | ! 17 | implicit none 18 | integer, intent(in) :: iudyn ! unit 19 | real(DP), intent(in) :: ramtns(3, 3, 3, nat) ! raman tensor 20 | 21 | ! local variables 22 | integer :: na, ic, jc, kc 23 | ! counters 24 | real (DP), parameter :: convfact = BOHR_RADIUS_ANGS**2 25 | ! conversion factor from au^2 to A^2 26 | ! 27 | ! write raman tensor (D chi/d tau in A^2) to iudyn 28 | ! 29 | IF (xmldyn) RETURN 30 | write(iudyn,'(/5x,"Raman tensor (A^2)",/)') 31 | do na = 1, nat 32 | do kc = 1, 3 33 | write (iudyn,'(5x,"atom # ",i4," pol.",i3)') na, kc 34 | write (iudyn, '(3e24.12)') ( (ramtns(ic, jc, kc, na) * & 35 | omega/fpi*convfact, ic = 1, 3), jc = 1, 3) 36 | enddo 37 | enddo 38 | 39 | return 40 | end subroutine write_ramtns 41 | -------------------------------------------------------------------------------- /PW/Makefile: -------------------------------------------------------------------------------- 1 | # Makefile for PW 2 | sinclude ../make.inc 3 | 4 | default: all 5 | 6 | all: pw pwtools 7 | 8 | pw: 9 | ( cd src ; $(MAKE) all || exit 1 ) 10 | 11 | pw-lib: 12 | ( cd src ; $(MAKE) libpw.a || exit 1 ) 13 | 14 | pwtools: pw 15 | ( cd tools ; $(MAKE) all || exit 1 ) 16 | 17 | doc: 18 | ( cd Doc ; $(MAKE) all || exit 1 ) 19 | 20 | doc_clean: 21 | ( cd Doc ; $(MAKE) clean ) 22 | 23 | clean : examples_clean 24 | ( cd src ; $(MAKE) clean ) 25 | ( cd tools ; $(MAKE) clean ) 26 | 27 | examples_clean: 28 | if test -d examples ; then \ 29 | ( cd examples ; ./clean_all ) ; fi 30 | 31 | distclean: clean doc_clean 32 | -------------------------------------------------------------------------------- /PW/src/acfdt_in_pw.f90: -------------------------------------------------------------------------------- 1 | ! 2 | ! Copyright (C) 2001-2010 Quantum ESPRESSO group 3 | ! This file is distributed under the terms of the 4 | ! GNU General Public License. See the file `License' 5 | ! in the root directory of the present distribution, 6 | ! or http://www.gnu.org/copyleft/gpl.txt . 7 | ! 8 | !-------------------------------------------------------------------------- 9 | ! 10 | MODULE acfdt_ener 11 | ! 12 | USE kinds, ONLY : DP 13 | ! 14 | LOGICAL :: acfdt_in_pw = .FALSE. ! the default value is .false. 15 | REAL(DP) :: acfdt_eband 16 | ! 17 | END MODULE acfdt_ener 18 | 19 | -------------------------------------------------------------------------------- /PW/src/add_paw_to_deeq.f90: -------------------------------------------------------------------------------- 1 | ! 2 | ! Copyright (C) 2010 Quantum ESPRESSO group 3 | ! This file is distributed under the terms of the 4 | ! GNU General Public License. See the file `License' 5 | ! in the root directory of the present distribution, 6 | ! or http://www.gnu.org/copyleft/gpl.txt . 7 | ! 8 | ! 9 | 10 | SUBROUTINE add_paw_to_deeq(deeq) 11 | ! Add paw contributions to deeq (computed in paw_potential) 12 | USE kinds, ONLY : DP 13 | USE ions_base, ONLY : nat, ntyp => nsp, ityp 14 | USE uspp_param, ONLY : upf, nh, nhm 15 | USE paw_variables, ONLY : okpaw, ddd_paw 16 | USE lsda_mod, ONLY : nspin 17 | IMPLICIT NONE 18 | integer :: na, nt, ih, jh, ijh 19 | REAL(kind=dp), intent(inout) :: deeq( nhm, nhm, nat, nspin ) 20 | 21 | if (okpaw) then 22 | do na=1,nat 23 | nt = ityp(na) 24 | IF (.not.upf(nt)%tpawp) cycle 25 | ijh=0 26 | do ih=1,nh(nt) 27 | do jh=ih,nh(nt) 28 | ijh=ijh+1 29 | deeq(ih,jh,na,1:nspin) = deeq(ih,jh,na,1:nspin) & 30 | + ddd_paw(ijh,na,1:nspin) 31 | deeq(jh,ih,na,1:nspin) = deeq(ih,jh,na,1:nspin) 32 | end do 33 | end do 34 | end do 35 | end IF 36 | RETURN 37 | 38 | END SUBROUTINE add_paw_to_deeq 39 | -------------------------------------------------------------------------------- /PW/src/add_vhub_to_deeq.f90: -------------------------------------------------------------------------------- 1 | ! 2 | ! Copyright (C) 2010-2013 Quantum ESPRESSO group 3 | ! This file is distributed under the terms of the 4 | ! GNU General Public License. See the file `License' 5 | ! in the root directory of the present distribution, 6 | ! or http://www.gnu.org/copyleft/gpl.txt . 7 | ! 8 | SUBROUTINE add_vhub_to_deeq(deeq) 9 | ! 10 | ! Add Hubbard contributions to deeq when U_projection is pseudo 11 | ! 12 | USE kinds, ONLY : DP 13 | USE ions_base, ONLY : nat, ntyp => nsp, ityp 14 | USE uspp_param, ONLY : nh, nhm 15 | USE lsda_mod, ONLY : nspin 16 | USE scf, ONLY : v 17 | USE ldaU, ONLY : is_hubbard, Hubbard_l, offsetU, q_ae 18 | IMPLICIT NONE 19 | REAL(KIND=DP), INTENT(INOUT) :: deeq( nhm, nhm, nat, nspin ) 20 | INTEGER :: na, nt, ih, jh, ijh, m1, m2, ow1, ow2 21 | ! 22 | ! 23 | DO na = 1, nat 24 | ! 25 | nt = ityp(na) 26 | ! 27 | ! skip atoms without Hubbard U 28 | IF ( .NOT. is_hubbard(nt) ) CYCLE 29 | ! 30 | DO ih = 1, nh(nt) 31 | DO jh = ih, nh(nt) 32 | ! 33 | DO m1 = 1, 2 * Hubbard_l(nt) + 1 34 | DO m2 = 1, 2 * Hubbard_l(nt) + 1 35 | ! 36 | ow1 = offsetU(na)+m1 37 | ow2 = offsetU(na)+m2 38 | deeq(ih,jh,na,1:nspin) = deeq(ih,jh,na,1:nspin) + & 39 | v%ns(m1,m2,1:nspin,na)*q_ae(ow1,ih,na)*q_ae(ow2,jh,na) 40 | ! 41 | ENDDO 42 | ENDDO 43 | ! 44 | deeq(jh,ih,na,1:nspin) = deeq(ih,jh,na,1:nspin) 45 | ! 46 | ENDDO 47 | ENDDO 48 | ! 49 | ENDDO 50 | ! 51 | END SUBROUTINE add_vhub_to_deeq 52 | -------------------------------------------------------------------------------- /PW/src/allocate_locpot.f90: -------------------------------------------------------------------------------- 1 | 2 | ! Copyright (C) 2001 PWSCF group 3 | ! This file is distributed under the terms of the 4 | ! GNU General Public License. See the file `License' 5 | ! in the root directory of the present distribution, 6 | ! or http://www.gnu.org/copyleft/gpl.txt . 7 | ! 8 | ! 9 | !----------------------------------------------------------------------- 10 | subroutine allocate_locpot 11 | !----------------------------------------------------------------------- 12 | ! 13 | ! dynamical allocation of arrays: 14 | ! local potential for each kind of atom, structure factor 15 | ! 16 | USE ions_base, ONLY : nat, ntyp => nsp 17 | USE vlocal, ONLY : vloc, strf 18 | USE gvect, ONLY : eigts1, eigts2, eigts3, ngm, ngl 19 | USE fft_base , ONLY : dfftp 20 | ! 21 | #ifdef USE_CUDA 22 | USE vlocal, ONLY : strf_d 23 | USE gvect, ONLY : eigts1_d, eigts2_d, eigts3_d 24 | #endif 25 | ! 26 | implicit none 27 | ! 28 | allocate (vloc( ngl, ntyp)) 29 | allocate (strf( ngm, ntyp)) 30 | 31 | allocate( eigts1(-dfftp%nr1:dfftp%nr1,nat) ) 32 | allocate( eigts2(-dfftp%nr2:dfftp%nr2,nat) ) 33 | allocate( eigts3(-dfftp%nr3:dfftp%nr3,nat) ) 34 | 35 | #ifdef USE_CUDA 36 | allocate (strf_d( ngm, ntyp)) 37 | allocate( eigts1_d(-dfftp%nr1:dfftp%nr1,nat) ) 38 | allocate( eigts2_d(-dfftp%nr2:dfftp%nr2,nat) ) 39 | allocate( eigts3_d(-dfftp%nr3:dfftp%nr3,nat) ) 40 | #endif 41 | 42 | return 43 | end subroutine allocate_locpot 44 | 45 | -------------------------------------------------------------------------------- /PW/src/atomic_wfc_mod.f90: -------------------------------------------------------------------------------- 1 | ! 2 | ! Copyright (C) 2013 Quantum ESPRESSO group 3 | ! This file is distributed under the terms of the 4 | ! GNU General Public License. See the file `License' 5 | ! in the root directory of the present distribution, 6 | ! or http://www.gnu.org/copyleft/gpl.txt . 7 | ! 8 | !-------------------------------------------------------------------------- 9 | ! 10 | MODULE basis 11 | ! 12 | ! ... The variables needed to describe atomic wavefunctions 13 | ! 14 | USE kinds, ONLY : dp 15 | SAVE 16 | ! 17 | INTEGER :: & 18 | natomwfc ! number of (starting) atomic wavefunctions 19 | COMPLEX(dp), ALLOCATABLE :: & 20 | swfcatom(:,:) ! S * (starting) atomic wavefunctions 21 | CHARACTER(len=30) :: &! 22 | starting_wfc, &! 'random','atomic','file','atomic+random' (default) 23 | starting_pot, &! 'atomic' or 'file' 24 | startingconfig ! 'input' or 'file' 25 | ! 26 | END MODULE basis 27 | -------------------------------------------------------------------------------- /PW/src/compute_rho.f90: -------------------------------------------------------------------------------- 1 | ! 2 | ! Copyright (C) 2005-2012 Quantum ESPRESSO group 3 | ! This file is distributed under the terms of the 4 | ! GNU General Public License. See the file `License' 5 | ! in the root directory of the present distribution, 6 | ! or http://www.gnu.org/copyleft/gpl.txt . 7 | ! 8 | SUBROUTINE compute_rho(rho,rhoout,segni,nrxx) 9 | ! 10 | ! This subroutine diagonalizes the spin density matrix and gives as output 11 | ! the spin up and spin down compotents of the charge 12 | ! If lsign is true up and dw are with respect to the fixed quantization 13 | ! axis ux, otherwise rho+|m| is always rhoup and rho-|m| is always 14 | ! rhodw 15 | ! 16 | USE kinds, ONLY : dp 17 | USE noncollin_module, ONLY : lsign, ux 18 | IMPLICIT NONE 19 | INTEGER :: nrxx ! input: the dimension of the mesh 20 | 21 | REAL(DP), INTENT(IN) :: rho(nrxx,4) 22 | REAL(DP), INTENT(OUT) :: rhoout(nrxx,2) 23 | REAL(DP), INTENT(OUT) :: segni(nrxx) 24 | ! input: the four components of the charge 25 | ! output: the spin up and spin down charge 26 | ! output: the orientation when needed 27 | REAL(DP) :: amag 28 | INTEGER :: ir ! counter on mesh points 29 | 30 | segni=1.0_DP 31 | IF (lsign) THEN 32 | DO ir=1,nrxx 33 | segni(ir)=SIGN(1.0_DP,rho(ir,2)*ux(1)+rho(ir,3)*ux(2)+rho(ir,4)*ux(3)) 34 | ENDDO 35 | ENDIF 36 | 37 | DO ir=1,nrxx 38 | amag=SQRT(rho(ir,2)**2+rho(ir,3)**2+rho(ir,4)**2) 39 | rhoout(ir,1)=0.5d0*(rho(ir,1)+segni(ir)*amag) 40 | rhoout(ir,2)=0.5d0*(rho(ir,1)-segni(ir)*amag) 41 | ENDDO 42 | 43 | RETURN 44 | END SUBROUTINE compute_rho 45 | -------------------------------------------------------------------------------- /PW/src/eqvect.f90: -------------------------------------------------------------------------------- 1 | ! 2 | ! Copyright (C) 2001-2008 Quantum ESPRESSO group 3 | ! This file is distributed under the terms of the 4 | ! GNU General Public License. See the file `License' 5 | ! in the root directory of the present distribution, 6 | ! or http://www.gnu.org/copyleft/gpl.txt . 7 | ! 8 | !----------------------------------------------------------------------- 9 | logical function eqvect (x, y, f, accep ) 10 | !----------------------------------------------------------------------- 11 | ! 12 | ! This function test if the difference x-y-f is an integer. 13 | ! x, y = 3d vectors in crystal axis, f = fractionary translation 14 | ! 15 | USE kinds 16 | implicit none 17 | real(DP), intent(in) :: x (3), y (3), f (3), accep 18 | ! 19 | eqvect = abs( x(1)-y(1)-f(1) - nint(x(1)-y(1)-f(1)) ) < accep .and. & 20 | abs( x(2)-y(2)-f(2) - nint(x(2)-y(2)-f(2)) ) < accep .and. & 21 | abs( x(3)-y(3)-f(3) - nint(x(3)-y(3)-f(3)) ) < accep 22 | ! 23 | return 24 | end function eqvect 25 | -------------------------------------------------------------------------------- /PW/src/g_psi_mod.f90: -------------------------------------------------------------------------------- 1 | ! 2 | ! Copyright (C) 2001-2007 PWSCF group 3 | ! This file is distributed under the terms of the 4 | ! GNU General Public License. See the file `License' 5 | ! in the root directory of the present distribution, 6 | ! or http://www.gnu.org/copyleft/gpl.txt . 7 | ! 8 | MODULE g_psi_mod 9 | ! 10 | ! ... These are the variables needed in g_psi 11 | ! 12 | USE kinds, only : DP 13 | ! 14 | IMPLICIT NONE 15 | ! 16 | REAL(DP), ALLOCATABLE :: & 17 | h_diag (:,:),& ! diagonal part of the Hamiltonian 18 | s_diag (:,:) ! diagonal part of the overlap matrix 19 | ! 20 | #ifdef USE_CUDA 21 | attributes(pinned):: h_diag,s_diag 22 | REAL(DP), DEVICE, ALLOCATABLE :: & 23 | h_diag_d (:,:),& ! diagonal part of the Hamiltonian 24 | s_diag_d (:,:) ! diagonal part of the overlap matrix 25 | #endif 26 | END MODULE g_psi_mod 27 | -------------------------------------------------------------------------------- /PW/src/multable.f90: -------------------------------------------------------------------------------- 1 | ! 2 | ! Copyright (C) 2001-2010 Quantum ESPRESSO group 3 | ! This file is distributed under the terms of the 4 | ! GNU General Public License. See the file `License' 5 | ! in the root directory of the present distribution, 6 | ! or http://www.gnu.org/copyleft/gpl.txt . 7 | ! 8 | ! 9 | !----------------------------------------------------------------------- 10 | SUBROUTINE multable (nsym, s, table) 11 | !----------------------------------------------------------------------- 12 | ! 13 | ! Checks that {S} is a group and calculates multiplication table 14 | ! 15 | IMPLICIT NONE 16 | ! 17 | INTEGER, INTENT(IN) :: nsym, s(3,3,nsym) 18 | ! nsym = number of symmetry operations 19 | ! s = rotation matrix (in crystal axis, represented by integers) 20 | INTEGER, INTENT(OUT) :: table (48, 48) 21 | ! multiplication table: S(n)*S(m) = S (table(n,m) ) 22 | ! 23 | INTEGER :: isym, jsym, ksym, ss (3, 3) 24 | LOGICAL :: found, smn 25 | ! 26 | DO isym = 1, nsym 27 | DO jsym = 1, nsym 28 | ! 29 | ss = MATMUL (s(:,:,jsym),s(:,:,isym)) 30 | ! 31 | ! here we check that the input matrices really form a group 32 | ! and we set the multiplication table 33 | ! 34 | found = .false. 35 | DO ksym = 1, nsym 36 | smn = ALL ( s(:,:,ksym) == ss(:,:) ) 37 | IF (smn) THEN 38 | IF (found) CALL errore ('multable', 'Not a group', 1) 39 | found = .true. 40 | table (jsym, isym) = ksym 41 | END IF 42 | END DO 43 | IF ( .NOT.found) CALL errore ('multable', ' Not a group', 2) 44 | END DO 45 | END DO 46 | RETURN 47 | ! 48 | END SUBROUTINE multable 49 | -------------------------------------------------------------------------------- /PW/src/n_plane_waves.f90: -------------------------------------------------------------------------------- 1 | ! 2 | ! Copyright (C) 2001-2016 Quantum ESPRESSO group 3 | ! This file is distributed under the terms of the 4 | ! GNU General Public License. See the file `License' 5 | ! in the root directory of the present distribution, 6 | ! or http://www.gnu.org/copyleft/gpl.txt . 7 | ! 8 | ! 9 | !----------------------------------------------------------------------- 10 | INTEGER FUNCTION n_plane_waves (gcutw, nks, xk, g, ngm) RESULT(npwx) 11 | !----------------------------------------------------------------------- 12 | ! 13 | ! Find maximum number of plane waves over all k-points 14 | ! 15 | USE kinds, ONLY: DP 16 | USE mp, ONLY : mp_max 17 | USE mp_pools, ONLY : inter_pool_comm 18 | IMPLICIT NONE 19 | ! 20 | INTEGER, INTENT(in) :: nks, ngm 21 | real(DP),INTENT(in) :: gcutw, xk (3, nks), g (3, ngm) 22 | ! 23 | INTEGER :: nk, ng, npw 24 | real(DP) :: q2 25 | ! 26 | npwx = 0 27 | DO nk = 1, nks 28 | npw = 0 29 | DO ng = 1, ngm 30 | q2 = (xk (1, nk) + g (1, ng) ) **2 + (xk (2, nk) + g (2, ng) ) ** & 31 | 2 + (xk (3, nk) + g (3, ng) ) **2 32 | IF (q2 <= gcutw) THEN 33 | ! 34 | ! here if |k+G|^2 <= Ecut increase the number of G inside the sphere 35 | ! 36 | npw = npw + 1 37 | ELSE 38 | IF ( sqrt (g (1, ng) **2 + g (2, ng) **2 + g (3, ng) **2) > & 39 | sqrt (xk(1, nk) **2 + xk(2, nk) **2 + xk(3, nk) **2) + & 40 | sqrt (gcutw) ) GOTO 100 41 | ! 42 | ! if |G| > |k| + sqrt(Ecut) stop search 43 | ! 44 | ENDIF 45 | ENDDO 46 | 100 npwx = max (npwx, npw ) 47 | ENDDO 48 | IF (npwx <= 0) CALL errore ('n_plane_waves', & 49 | 'No plane waves found: running on too many processors?', 1) 50 | ! 51 | ! when using pools, set npwx to the maximum value across pools 52 | ! (you may run into trouble at restart otherwise) 53 | ! 54 | CALL mp_max ( npwx, inter_pool_comm ) 55 | ! 56 | END FUNCTION n_plane_waves 57 | -------------------------------------------------------------------------------- /PW/src/plugin_clean.f90: -------------------------------------------------------------------------------- 1 | ! Copyright (C) 2013 Quantum ESPRESSO group 2 | ! This file is distributed under the terms of the 3 | ! GNU General Public License. See the file `License' 4 | ! in the root directory of the present distribution, 5 | ! or http://www.gnu.org/copyleft/gpl.txt . 6 | ! 7 | subroutine plugin_clean(lflag) 8 | ! 9 | ! This routine is used for cleaning calls 10 | ! from plugins 11 | ! DO NOT REMOVE THE TAGS ! ***ADDSON_NAME KIND_OF_PATCH*** 12 | ! 13 | USE plugin_flags 14 | ! 15 | ! ***Environ MODULES BEGIN*** 16 | ! ***Environ MODULES END*** 17 | ! 18 | implicit none 19 | ! 20 | LOGICAL, INTENT(IN) :: lflag 21 | ! 22 | ! ***Environ VARIABLES BEGIN*** 23 | ! ***Environ VARIABLES END*** 24 | ! 25 | ! ***Environ CALLS BEGIN*** 26 | ! ***Environ CALLS END*** 27 | ! 28 | end subroutine plugin_clean 29 | 30 | -------------------------------------------------------------------------------- /PW/src/plugin_clock.f90: -------------------------------------------------------------------------------- 1 | ! 2 | ! Copyright (C) 2013 Quantum ESPRESSO group 3 | ! This file is distributed under the terms of the 4 | ! GNU General Public License. See the file `License' 5 | ! in the root directory of the present distribution, 6 | ! or http://www.gnu.org/copyleft/gpl.txt . 7 | ! 8 | subroutine plugin_clock() 9 | ! 10 | ! This routine is used for printing plugins clocks 11 | ! DO NOT REMOVE THE TAGS ! ***ADDSON_NAME KIND_OF_PATCH*** 12 | ! 13 | USE plugin_flags 14 | USE io_global, ONLY : stdout 15 | ! 16 | ! ***Environ MODULES BEGIN*** 17 | ! ***Environ MODULES END*** 18 | ! 19 | implicit none 20 | ! 21 | ! ***Environ VARIABLES BEGIN*** 22 | ! ***Environ VARIABLES END*** 23 | ! 24 | ! ***Environ CALLS BEGIN*** 25 | ! ***Environ CALLS END*** 26 | ! 27 | end subroutine plugin_clock 28 | -------------------------------------------------------------------------------- /PW/src/plugin_ext_forces.f90: -------------------------------------------------------------------------------- 1 | ! 2 | ! Copyright (C) 2001-2009 Quantum ESPRESSO group 3 | ! This file is distributed under the terms of the 4 | ! GNU General Public License. See the file `License' 5 | ! in the root directory of the present distribution, 6 | ! or http://www.gnu.org/copyleft/gpl.txt . 7 | ! 8 | !---------------------------------------------------------------------------- 9 | SUBROUTINE plugin_ext_forces() 10 | !---------------------------------------------------------------------------- 11 | ! 12 | ! 13 | USE mp, ONLY : mp_bcast 14 | USE mp_images, ONLY : intra_image_comm 15 | USE io_global, ONLY : stdout, ionode, ionode_id 16 | USE kinds, ONLY : DP 17 | ! 18 | USE plugin_flags 19 | ! 20 | IMPLICIT NONE 21 | ! 22 | ! 23 | END SUBROUTINE plugin_ext_forces 24 | -------------------------------------------------------------------------------- /PW/src/plugin_init_cell.f90: -------------------------------------------------------------------------------- 1 | ! 2 | ! Copyright (C) 2014 Quantum ESPRESSO group 3 | ! This file is distributed under the terms of the 4 | ! GNU General Public License. See the file `License' 5 | ! in the root directory of the present distribution, 6 | ! or http://www.gnu.org/copyleft/gpl.txt . 7 | ! 8 | !---------------------------------------------------------------------------- 9 | SUBROUTINE plugin_init_cell() 10 | !---------------------------------------------------------------------------- 11 | ! 12 | USE kinds, ONLY : DP 13 | USE fft_base, ONLY : dfftp 14 | USE plugin_flags 15 | ! 16 | ! ***Environ MODULES BEGIN*** 17 | ! ***Environ MODULES END*** 18 | ! 19 | IMPLICIT NONE 20 | ! 21 | ! ***Environ VARIABLES BEGIN*** 22 | ! ***Environ VARIABLES END*** 23 | ! 24 | ! ***Environ CALLS BEGIN*** 25 | ! ***Environ CALLS END*** 26 | ! 27 | END SUBROUTINE plugin_init_cell 28 | -------------------------------------------------------------------------------- /PW/src/plugin_init_ions.f90: -------------------------------------------------------------------------------- 1 | ! 2 | ! Copyright (C) 2014 Quantum ESPRESSO group 3 | ! This file is distributed under the terms of the 4 | ! GNU General Public License. See the file `License' 5 | ! in the root directory of the present distribution, 6 | ! or http://www.gnu.org/copyleft/gpl.txt . 7 | ! 8 | !---------------------------------------------------------------------------- 9 | SUBROUTINE plugin_init_ions() 10 | !---------------------------------------------------------------------------- 11 | ! 12 | USE kinds, ONLY : DP 13 | USE fft_base, ONLY : dfftp 14 | USE plugin_flags 15 | ! 16 | ! ***Environ MODULES BEGIN*** 17 | ! ***Environ MODULES END*** 18 | ! 19 | IMPLICIT NONE 20 | ! 21 | ! ***Environ VARIABLES BEGIN*** 22 | ! ***Environ VARIABLES END*** 23 | ! 24 | ! ***Environ CALLS BEGIN*** 25 | ! ***Environ CALLS END*** 26 | ! 27 | END SUBROUTINE plugin_init_ions 28 | -------------------------------------------------------------------------------- /PW/src/plugin_init_potential.f90: -------------------------------------------------------------------------------- 1 | ! Copyright (C) 2013 Quantum ESPRESSO group 2 | ! This file is distributed under the terms of the 3 | ! GNU General Public License. See the file `License' 4 | ! in the root directory of the present distribution, 5 | ! or http://www.gnu.org/copyleft/gpl.txt . 6 | ! 7 | subroutine plugin_init_potential() 8 | ! 9 | ! This routine is used for initializing potentials in plugins 10 | ! DO NOT REMOVE THE TAGS ! ***ADDSON_NAME KIND_OF_PATCH*** 11 | ! 12 | USE plugin_flags 13 | USE fft_base, ONLY : dfftp 14 | USE scf, ONLY : vltot 15 | ! 16 | ! ***Environ MODULES BEGIN*** 17 | ! ***Environ MODULES END*** 18 | ! 19 | implicit none 20 | ! 21 | ! ***Environ VARIABLES BEGIN*** 22 | ! ***Environ VARIABLES END*** 23 | ! 24 | ! ***Environ CALLS BEGIN*** 25 | ! ***Environ CALLS END*** 26 | ! 27 | end subroutine plugin_init_potential 28 | 29 | -------------------------------------------------------------------------------- /PW/src/plugin_initbase.f90: -------------------------------------------------------------------------------- 1 | ! Copyright (C) 2013 Quantum ESPRESSO group 2 | ! This file is distributed under the terms of the 3 | ! GNU General Public License. See the file `License' 4 | ! in the root directory of the present distribution, 5 | ! or http://www.gnu.org/copyleft/gpl.txt . 6 | ! 7 | subroutine plugin_initbase() 8 | ! 9 | ! This routine is used for fft related quantities in plugins 10 | ! DO NOT REMOVE THE TAGS ! ***ADDSON_NAME KIND_OF_PATCH*** 11 | ! 12 | USE plugin_flags 13 | USE fft_base, ONLY : dfftp 14 | USE mp_bands, ONLY : me_bgrp 15 | ! 16 | ! ***Environ MODULES BEGIN*** 17 | ! ***Environ MODULES END*** 18 | ! 19 | implicit none 20 | ! 21 | ! ***Environ VARIABLES BEGIN*** 22 | ! ***Environ VARIABLES END*** 23 | ! 24 | ! ***Environ CALLS BEGIN*** 25 | ! ***Environ CALLS END*** 26 | ! 27 | end subroutine plugin_initbase 28 | 29 | -------------------------------------------------------------------------------- /PW/src/plugin_initialization.f90: -------------------------------------------------------------------------------- 1 | ! 2 | ! Copyright (C) 2010 Quantum ESPRESSO group 3 | ! This file is distributed under the terms of the 4 | ! GNU General Public License. See the file `License' 5 | ! in the root directory of the present distribution, 6 | ! or http://www.gnu.org/copyleft/gpl.txt . 7 | ! 8 | !---------------------------------------------------------------------------- 9 | SUBROUTINE plugin_initialization() 10 | !---------------------------------------------------------------------------- 11 | ! 12 | USE io_global, ONLY : stdout, ionode 13 | USE kinds, ONLY : DP 14 | USE io_files, ONLY : tmp_dir 15 | ! 16 | USE plugin_flags 17 | ! 18 | IMPLICIT NONE 19 | ! 20 | ! 21 | END SUBROUTINE plugin_initialization 22 | -------------------------------------------------------------------------------- /PW/src/plugin_int_forces.f90: -------------------------------------------------------------------------------- 1 | ! 2 | ! Copyright (C) 2014 Quantum ESPRESSO group 3 | ! This file is distributed under the terms of the 4 | ! GNU General Public License. See the file `License' 5 | ! in the root directory of the present distribution, 6 | ! or http://www.gnu.org/copyleft/gpl.txt . 7 | ! 8 | !---------------------------------------------------------------------------- 9 | SUBROUTINE plugin_int_forces() 10 | !---------------------------------------------------------------------------- 11 | ! 12 | ! 13 | USE mp, ONLY : mp_bcast 14 | USE mp_images, ONLY : intra_image_comm 15 | USE io_global, ONLY : stdout, ionode, ionode_id 16 | USE kinds, ONLY : DP 17 | USE cell_base, ONLY : at, bg, alat, omega 18 | USE ions_base, ONLY : nat, ntyp => nsp, ityp, tau, zv, amass 19 | USE fft_base, ONLY : dfftp 20 | USE fft_interfaces, ONLY : fwfft 21 | USE gvect, ONLY : ngm, gstart, ngl, nl, igtongl, g, gg, gcutm 22 | USE lsda_mod, ONLY : nspin 23 | USE force_mod, ONLY : force 24 | USE scf, ONLY : rho 25 | USE vlocal, ONLY : strf, vloc 26 | USE control_flags, ONLY : iverbosity, gamma_only 27 | USE martyna_tuckerman, ONLY: do_comp_mt, wg_corr_force 28 | ! 29 | USE plugin_flags 30 | ! 31 | ! ***Environ MODULES BEGIN*** 32 | ! ***Environ MODULES END*** 33 | ! 34 | IMPLICIT NONE 35 | ! 36 | ! aux is used to store a possible additional density 37 | ! now defined in real space 38 | ! 39 | COMPLEX(DP), ALLOCATABLE :: auxg(:), auxr(:) 40 | ! 41 | INTEGER :: ipol, na 42 | ! counter on polarization 43 | ! counter on atoms 44 | ! 45 | ! ***Environ VARIABLES BEGIN*** 46 | ! ***Environ VARIABLES END*** 47 | ! 48 | ! ***Environ CALLS BEGIN*** 49 | ! ***Environ CALLS END*** 50 | ! 51 | END SUBROUTINE plugin_int_forces 52 | -------------------------------------------------------------------------------- /PW/src/plugin_print_energies.f90: -------------------------------------------------------------------------------- 1 | ! 2 | ! Copyright (C) 2010 Quantum ESPRESSO group 3 | ! This file is distributed under the terms of the 4 | ! GNU General Public License. See the file `License' 5 | ! in the root directory of the present distribution, 6 | ! or http://www.gnu.org/copyleft/gpl.txt . 7 | ! 8 | !---------------------------------------------------------------------------- 9 | SUBROUTINE plugin_print_energies() 10 | !---------------------------------------------------------------------------- 11 | ! 12 | ! This routine is used for printing energy contrib from plugins 13 | ! DO NOT REMOVE THE TAGS ! ***ADDSON_NAME KIND_OF_PATCH*** 14 | ! 15 | USE io_global, ONLY : stdout, ionode 16 | USE kinds, ONLY : DP 17 | USE io_files, ONLY : tmp_dir 18 | ! 19 | USE plugin_flags 20 | ! 21 | ! 22 | ! ***Environ MODULES BEGIN*** 23 | ! ***Environ MODULES END*** 24 | ! 25 | IMPLICIT NONE 26 | ! 27 | ! ***Environ VARIABLES BEGIN*** 28 | ! ***Environ VARIABLES END*** 29 | ! 30 | ! ***Environ CALLS BEGIN*** 31 | ! ***Environ CALLS END*** 32 | ! 33 | END SUBROUTINE plugin_print_energies 34 | -------------------------------------------------------------------------------- /PW/src/plugin_read_input.f90: -------------------------------------------------------------------------------- 1 | ! 2 | ! Copyright (C) 2013 Quantum ESPRESSO group 3 | ! This file is distributed under the terms of the 4 | ! GNU General Public License. See the file `License' 5 | ! in the root directory of the present distribution, 6 | ! or http://www.gnu.org/copyleft/gpl.txt . 7 | ! 8 | subroutine plugin_read_input() 9 | ! 10 | ! This routine is used for reading 11 | ! plugin input files 12 | ! DO NOT REMOVE THE TAGS ! ***ADDSON_NAME KIND_OF_PATCH*** 13 | ! 14 | USE plugin_flags 15 | USE input_parameters, ONLY : nat, ntyp 16 | USE input_parameters, ONLY : assume_isolated, ibrav 17 | ! 18 | ! ***Environ MODULES BEGIN*** 19 | ! ***Environ MODULES END*** 20 | ! 21 | implicit none 22 | ! 23 | ! ***Environ VARIABLES BEGIN*** 24 | ! ***Environ VARIABLES END*** 25 | ! 26 | ! ***Environ CALLS BEGIN*** 27 | ! ***Environ CALLS END*** 28 | ! 29 | end subroutine plugin_read_input 30 | -------------------------------------------------------------------------------- /PW/src/plugin_scf_energy.f90: -------------------------------------------------------------------------------- 1 | ! 2 | ! Copyright (C) 2014 Quantum ESPRESSO group 3 | ! This file is distributed under the terms of the 4 | ! GNU General Public License. See the file `License' 5 | ! in the root directory of the present distribution, 6 | ! or http://www.gnu.org/copyleft/gpl.txt . 7 | ! 8 | !---------------------------------------------------------------------------- 9 | SUBROUTINE plugin_scf_energy(plugin_etot,rhoin) 10 | !---------------------------------------------------------------------------- 11 | ! This routine is used to calculate plugin energy related quantities 12 | ! that needs to be solved inside the scf cycle 13 | ! 14 | USE io_global, ONLY : stdout, ionode 15 | USE kinds, ONLY : DP 16 | USE io_files, ONLY : tmp_dir 17 | ! 18 | USE fft_base, ONLY : dfftp 19 | USE lsda_mod, ONLY : nspin 20 | USE scf, ONLY : scf_type 21 | ! 22 | USE plugin_flags 23 | ! 24 | ! ***Environ MODULES BEGIN*** 25 | ! ***Environ MODULES END*** 26 | ! 27 | IMPLICIT NONE 28 | ! 29 | real(DP), intent(inout) :: plugin_etot 30 | type(scf_type), intent(in) :: rhoin 31 | ! 32 | ! ***Environ VARIABLES BEGIN*** 33 | ! ***Environ VARIABLES END*** 34 | ! 35 | ! ***Environ CALLS BEGIN*** 36 | ! ***Environ CALLS END*** 37 | ! 38 | END SUBROUTINE plugin_scf_energy 39 | -------------------------------------------------------------------------------- /PW/src/plugin_scf_potential.f90: -------------------------------------------------------------------------------- 1 | ! 2 | ! Copyright (C) 2014 Quantum ESPRESSO group 3 | ! This file is distributed under the terms of the 4 | ! GNU General Public License. See the file `License' 5 | ! in the root directory of the present distribution, 6 | ! or http://www.gnu.org/copyleft/gpl.txt . 7 | ! 8 | !---------------------------------------------------------------------------- 9 | SUBROUTINE plugin_scf_potential(rhoin,conv_elec,dr2) 10 | !---------------------------------------------------------------------------- 11 | ! This routine is used to calculate plugin energy related quantities 12 | ! that needs to be solved inside the scf cycle 13 | ! 14 | USE io_global, ONLY : stdout, ionode 15 | USE kinds, ONLY : DP 16 | USE io_files, ONLY : tmp_dir 17 | ! 18 | USE fft_base, ONLY : dfftp 19 | USE lsda_mod, ONLY : nspin 20 | USE scf, ONLY : scf_type, vltot 21 | ! 22 | USE plugin_flags 23 | ! 24 | ! ***Environ MODULES BEGIN*** 25 | ! ***Environ MODULES END*** 26 | ! 27 | IMPLICIT NONE 28 | ! 29 | type(scf_type), intent(in) :: rhoin 30 | LOGICAL, intent(in) :: conv_elec 31 | real(DP), intent(in) :: dr2 32 | ! 33 | ! ***Environ VARIABLES BEGIN*** 34 | ! ***Environ VARIABLES END*** 35 | ! 36 | ! ***Environ CALLS BEGIN*** 37 | ! ***Environ CALLS END*** 38 | ! 39 | END SUBROUTINE plugin_scf_potential 40 | -------------------------------------------------------------------------------- /PW/src/plugin_summary.f90: -------------------------------------------------------------------------------- 1 | ! 2 | ! Copyright (C) 2013 Quantum ESPRESSO group 3 | ! This file is distributed under the terms of the 4 | ! GNU General Public License. See the file `License' 5 | ! in the root directory of the present distribution, 6 | ! or http://www.gnu.org/copyleft/gpl.txt . 7 | ! 8 | subroutine plugin_summary() 9 | ! 10 | ! This routine is used for printing 11 | ! plugins summary 12 | ! DO NOT REMOVE THE TAGS ! ***ADDSON_NAME KIND_OF_PATCH*** 13 | ! 14 | USE plugin_flags 15 | ! 16 | ! ***Environ MODULES BEGIN*** 17 | ! ***Environ MODULES END*** 18 | ! 19 | implicit none 20 | ! 21 | ! ***Environ VARIABLES BEGIN*** 22 | ! ***Environ VARIABLES END*** 23 | ! 24 | ! ***Environ CALLS BEGIN*** 25 | ! ***Environ CALLS END*** 26 | ! 27 | end subroutine plugin_summary 28 | -------------------------------------------------------------------------------- /PW/src/remove_atomic_rho.f90: -------------------------------------------------------------------------------- 1 | ! 2 | ! Copyright (C) 2001 PWSCF group 3 | ! This file is distributed under the terms of the 4 | ! GNU General Public License. See the file `License' 5 | ! in the root directory of the present distribution, 6 | ! or http://www.gnu.org/copyleft/gpl.txt . 7 | ! 8 | !----------------------------------------------------------------------- 9 | subroutine remove_atomic_rho 10 | !----------------------------------------------------------------------- 11 | USE io_global, ONLY: stdout 12 | USE io_files, ONLY: output_drho 13 | USE kinds, ONLY: DP 14 | USE fft_base, ONLY: dfftp 15 | USE lsda_mod, ONLY: nspin 16 | USE scf, ONLY: rho 17 | USE io_rho_xml, ONLY : write_rho 18 | implicit none 19 | 20 | real(DP), allocatable :: work (:,:) 21 | ! workspace, is the difference between the charge density 22 | ! and the superposition of atomic charges 23 | 24 | allocate ( work( dfftp%nnr, 1 ) ) 25 | work = 0.d0 26 | ! 27 | IF ( nspin > 1 ) CALL errore & 28 | ( 'remove_atomic_rho', 'spin polarization not allowed in drho', 1 ) 29 | 30 | WRITE( stdout, '(/5x,"remove atomic charge density from scf rho")') 31 | ! 32 | ! subtract the old atomic charge density 33 | ! 34 | call atomic_rho (work, nspin) 35 | ! 36 | work = rho%of_r - work 37 | ! 38 | call write_rho ( work, 1, output_drho ) 39 | ! 40 | deallocate(work) 41 | return 42 | 43 | end subroutine remove_atomic_rho 44 | 45 | -------------------------------------------------------------------------------- /PW/src/restart_in_electrons.f90: -------------------------------------------------------------------------------- 1 | ! 2 | ! Copyright (C) 2013 Quantum ESPRESSO group 3 | ! This file is distributed under the terms of the 4 | ! GNU General Public License. See the file `License' 5 | ! in the root directory of the present distribution, 6 | ! or http://www.gnu.org/copyleft/gpl.txt . 7 | ! 8 | !----------------------------------------------------------------------- 9 | SUBROUTINE restart_in_electrons (iter, dr2, ethr, et) 10 | !----------------------------------------------------------------------- 11 | USE kinds, ONLY: dp 12 | USE io_global, ONLY: stdout 13 | USE io_files, ONLY: iunres, seqopn 14 | USE klist, ONLY: nks 15 | USE wvfct, ONLY: nbnd 16 | ! 17 | IMPLICIT NONE 18 | ! 19 | INTEGER, INTENT (inout) :: iter 20 | REAL(dp), INTENT(inout) :: dr2, ethr, et(nbnd,nks) 21 | ! 22 | REAL(dp), ALLOCATABLE :: et_(:,:) 23 | REAL(dp):: dr2_, ethr_ 24 | INTEGER :: ios 25 | LOGICAL :: exst 26 | ! 27 | CALL seqopn (iunres, 'restart_scf', 'formatted', exst) 28 | IF ( exst ) THEN 29 | ios = 0 30 | READ (iunres, *, iostat=ios) iter, dr2_, ethr_ 31 | IF ( ios /= 0 ) THEN 32 | iter = 0 33 | ELSE IF ( iter < 1 ) THEN 34 | iter = 0 35 | ELSE 36 | ALLOCATE (et_(nbnd,nks)) 37 | READ (iunres, *, iostat=ios) et_ 38 | IF ( ios /= 0 ) THEN 39 | iter = 0 40 | ELSE 41 | WRITE( stdout, & 42 | '(5x,"Calculation restarted from scf iteration #",i6)' ) iter + 1 43 | dr2 = dr2_ 44 | ethr= ethr_ 45 | et (:,:) = et_(:,:) 46 | END IF 47 | DEALLOCATE (et_) 48 | END IF 49 | ELSE 50 | iter = 0 51 | END IF 52 | CLOSE ( unit=iunres, status='delete') 53 | ! 54 | END SUBROUTINE restart_in_electrons 55 | -------------------------------------------------------------------------------- /PW/src/save_in_electrons.f90: -------------------------------------------------------------------------------- 1 | ! 2 | ! Copyright (C) 2013 Quantum ESPRESSO group 3 | ! This file is distributed under the terms of the 4 | ! GNU General Public License. See the file `License' 5 | ! in the root directory of the present distribution, 6 | ! or http://www.gnu.org/copyleft/gpl.txt . 7 | ! 8 | !----------------------------------------------------------------------- 9 | SUBROUTINE save_in_electrons (iter, dr2, ethr, et) 10 | !----------------------------------------------------------------------- 11 | USE kinds, ONLY: dp 12 | USE io_global, ONLY: stdout 13 | USE io_files, ONLY: iunres, seqopn 14 | USE klist, ONLY: nks 15 | USE wvfct, ONLY: nbnd 16 | ! 17 | IMPLICIT NONE 18 | ! 19 | INTEGER, INTENT (in) :: iter 20 | REAL(dp), INTENT(in) :: dr2, ethr, et(nbnd,nks) 21 | ! 22 | LOGICAL :: exst 23 | ! 24 | WRITE(stdout,'(5x,"Calculation stopped in scf loop at iteration #",i6)') iter 25 | CALL seqopn (iunres, 'restart_scf', 'formatted', exst) 26 | WRITE (iunres, *) iter, dr2, ethr 27 | WRITE (iunres, *) et(1:nbnd,1:nks) 28 | CLOSE ( unit=iunres, status='keep') 29 | ! 30 | END SUBROUTINE save_in_electrons 31 | -------------------------------------------------------------------------------- /PW/src/set_kup_and_kdw.f90: -------------------------------------------------------------------------------- 1 | ! 2 | ! Copyright (C) 2001-2007 PWSCF group 3 | ! This file is distributed under the terms of the 4 | ! GNU General Public License. See the file `License' 5 | ! in the root directory of the present distribution, 6 | ! or http://www.gnu.org/copyleft/gpl.txt . 7 | ! 8 | !----------------------------------------------------------------------- 9 | subroutine set_kup_and_kdw (xk, wk, isk, nkstot, npk) 10 | !----------------------------------------------------------------------- 11 | ! This routine sets the k vectors for the up and down spin wfc 12 | ! 13 | ! on input: xk and wk contain k-points and corresponding weights 14 | ! 15 | ! on output: the number of points is doubled and xk and wk in the 16 | ! first (nkstot/2) positions correspond to up spin 17 | ! those in the second (nkstot/2) ones correspond to down spin 18 | ! 19 | USE kinds, ONLY : DP 20 | implicit none 21 | ! 22 | ! I/O variables first 23 | ! 24 | integer :: npk, isk (npk), nkstot 25 | ! input: maximum allowed number of k-points 26 | ! output: spin associated to a given k-point 27 | ! input-output: starting and ending number of k-points 28 | real(DP) :: xk (3, npk), wk (npk) 29 | ! input-output: coordinates of k points 30 | ! input-output: weights of k points 31 | ! 32 | integer :: ik, iq, ikq 33 | ! 34 | ! 35 | if (2*nkstot > npk) call errore ('set_kup_and_kdw','too many k points',nkstot) 36 | do ik = 1, nkstot 37 | xk(:,ik+nkstot)= xk(:,ik) 38 | wk (ik+nkstot) = wk(ik) 39 | isk(ik) = 1 40 | isk(ik+nkstot) = 2 41 | enddo 42 | nkstot = 2 * nkstot 43 | 44 | return 45 | 46 | end subroutine set_kup_and_kdw 47 | -------------------------------------------------------------------------------- /PW/src/sph_ind.f90: -------------------------------------------------------------------------------- 1 | ! 2 | ! Copyright (C) 2004 PWSCF group 3 | ! This file is distributed under the terms of the 4 | ! GNU General Public License. See the file `License' 5 | ! in the root directory of the present distribution, 6 | ! or http://www.gnu.org/copyleft/gpl.txt . 7 | ! 8 | function sph_ind(l,j,m,spin) 9 | ! This function calculates the m index of the spherical harmonic 10 | ! in a spinor with orbital angular momentum l, total angular 11 | ! momentum j, projection along z of the total angular momentum m+-1/2. 12 | ! Spin selects the up (spin=1) or down (spin=2) coefficient. 13 | ! 14 | use kinds 15 | implicit none 16 | 17 | integer :: sph_ind 18 | integer :: l, & ! orbital angular momentum 19 | m, & ! projection of the total angular momentum+-1/2 20 | spin ! 1 or 2 select the component 21 | 22 | real(DP) :: j ! total angular momentum 23 | 24 | if (spin.ne.1.and.spin.ne.2) call errore('sph_ind','spin direction unknown',1) 25 | if (m.lt.-l-1.or.m.gt.l) call errore('sph_ind','m not allowed',1) 26 | 27 | if (abs(j-l-0.5d0).lt.1.d-8) then 28 | if (spin.eq.1) sph_ind= m 29 | if (spin.eq.2) sph_ind= m+1 30 | elseif (abs(j-l+0.5d0).lt.1.d-8) then 31 | if (m.lt.-l+1) then 32 | sph_ind=0 33 | else 34 | if (spin.eq.1) sph_ind= m-1 35 | if (spin.eq.2) sph_ind= m 36 | endif 37 | else 38 | write(6,*) l, j 39 | call errore('sph_ind','l and j not compatible',1) 40 | endif 41 | if (sph_ind.lt.-l.or.sph_ind.gt.l) sph_ind=0 42 | 43 | return 44 | end function sph_ind 45 | -------------------------------------------------------------------------------- /PW/src/spinor.f90: -------------------------------------------------------------------------------- 1 | ! 2 | ! Copyright (C) 2004 PWSCF group 3 | ! This file is distributed under the terms of the 4 | ! GNU General Public License. See the file `License' 5 | ! in the root directory of the present distribution, 6 | ! or http://www.gnu.org/copyleft/gpl.txt . 7 | ! 8 | function spinor(l,j,m,spin) 9 | ! This function calculates the numerical coefficient of a spinor 10 | ! with orbital angular momentum l, total angular momentum j, 11 | ! projection along z of the total angular momentum m+-1/2. Spin selects 12 | ! the up (spin=1) or down (spin=2) coefficient. 13 | 14 | use kinds 15 | implicit none 16 | 17 | real(DP) :: spinor 18 | integer :: l, & ! orbital angular momentum 19 | m, & ! projection of the total angular momentum+-1/2 20 | spin ! 1 or 2 select the component 21 | 22 | real(DP) :: j ! total angular momentum 23 | real(DP) :: denom ! denominator 24 | 25 | if (spin.ne.1.and.spin.ne.2) call errore('spinor','spin direction unknown',1) 26 | if (m.lt.-l-1.or.m.gt.l) call errore('spinor','m not allowed',1) 27 | 28 | denom=1.d0/(2.d0*l+1.d0) 29 | if (abs(j-l-0.5d0).lt.1.d-8) then 30 | if (spin.eq.1) spinor= sqrt((l+m+1.d0)*denom) 31 | if (spin.eq.2) spinor= sqrt((l-m)*denom) 32 | elseif (abs(j-l+0.5d0).lt.1.d-8) then 33 | if (m.lt.-l+1) then 34 | spinor=0.d0 35 | else 36 | if (spin.eq.1) spinor= sqrt((l-m+1.d0)*denom) 37 | if (spin.eq.2) spinor= -sqrt((l+m)*denom) 38 | endif 39 | else 40 | call errore('spinor','j and l not compatible',1) 41 | endif 42 | 43 | return 44 | end function spinor 45 | -------------------------------------------------------------------------------- /PW/src/stres_nonloc_dft.f90: -------------------------------------------------------------------------------- 1 | ! 2 | ! Copyright (C) 2010- Quantum ESPRESSO group 3 | ! This file is distributed under the terms of the 4 | ! GNU General Public License. See the file `License' 5 | ! in the root directory of the present distribution, 6 | ! or http://www.gnu.org/copyleft/gpl.txt . 7 | ! 8 | ! 9 | !---------------------------------------------------------------------------- 10 | subroutine stres_nonloc_dft( rho, rho_core, nspin, sigma_nonloc_dft ) 11 | 12 | !---------------------------------------------------------------------------- 13 | ! 14 | USE kinds, ONLY : DP 15 | use funct, ONLY : get_igcc, get_inlc 16 | USE mp, ONLY : mp_sum 17 | USE fft_base, ONLY : dfftp 18 | USE vdW_DF, ONLY : stress_vdW_DF 19 | USE rVV10, ONLY : stress_rVV10 20 | ! 21 | IMPLICIT NONE 22 | ! 23 | integer, intent(in) ::nspin 24 | real(DP), intent(in) :: rho (dfftp%nnr, nspin), rho_core (dfftp%nnr) 25 | real(DP), intent(inout) :: sigma_nonloc_dft (3, 3) 26 | 27 | integer :: l, m, inlc 28 | 29 | 30 | sigma_nonloc_dft(:,:) = 0.d0 31 | inlc = get_inlc() 32 | 33 | if ( inlc==1 .or. inlc==2 .or. inlc==4 .or. inlc==5 .or. inlc==6 ) then 34 | if ( nspin>1 ) call errore ('stres_vdW_DF', 'vdW stress not implemented for nspin > 1',1) 35 | CALL stress_vdW_DF(rho, rho_core, nspin, sigma_nonloc_dft) 36 | elseif ( inlc == 3 ) then 37 | if ( nspin>2 ) call errore ('stress_rVV10', 'rVV10 stress not implemented for nspin > 2',1) 38 | CALL stress_rVV10(rho, rho_core, nspin, sigma_nonloc_dft) 39 | end if 40 | 41 | return 42 | 43 | end subroutine stres_nonloc_dft 44 | 45 | -------------------------------------------------------------------------------- /PW/src/sumkg.f90: -------------------------------------------------------------------------------- 1 | ! 2 | ! Copyright (C) 2001-2003 PWSCF group 3 | ! This file is distributed under the terms of the 4 | ! GNU General Public License. See the file `License' 5 | ! in the root directory of the present distribution, 6 | ! or http://www.gnu.org/copyleft/gpl.txt . 7 | ! 8 | ! 9 | !----------------------------------------------------------------------- 10 | function sumkg (et, nbnd, nks, wk, degauss, ngauss, e, is, isk) 11 | !----------------------------------------------------------------------- 12 | ! 13 | ! This function computes the number of states under a given energy e 14 | ! 15 | ! 16 | USE kinds 17 | USE mp_pools, ONLY : inter_pool_comm 18 | USE mp, ONLY : mp_sum 19 | implicit none 20 | ! Output variable 21 | real(DP) :: sumkg 22 | ! Input variables 23 | integer, intent(in) :: nks, nbnd, ngauss 24 | ! input: the total number of K points 25 | ! input: the number of bands 26 | ! input: the type of smearing 27 | real(DP), intent(in) :: wk (nks), et (nbnd, nks), degauss, e 28 | ! input: the weight of the k points 29 | ! input: the energy eigenvalues 30 | ! input: gaussian broadening 31 | ! input: the energy to check 32 | integer, intent(in) :: is, isk(nks) 33 | ! 34 | ! local variables 35 | ! 36 | real(DP), external :: wgauss 37 | ! function which compute the smearing 38 | real(DP) ::sum1 39 | integer :: ik, ibnd 40 | ! counter on k points 41 | ! counter on the band energy 42 | ! 43 | sumkg = 0.d0 44 | do ik = 1, nks 45 | sum1 = 0.d0 46 | if (is /= 0) then 47 | if (isk(ik).ne.is) cycle 48 | end if 49 | do ibnd = 1, nbnd 50 | sum1 = sum1 + wgauss ( (e-et (ibnd, ik) ) / degauss, ngauss) 51 | enddo 52 | sumkg = sumkg + wk (ik) * sum1 53 | enddo 54 | #if defined(__MPI) 55 | call mp_sum ( sumkg, inter_pool_comm ) 56 | #endif 57 | return 58 | end function sumkg 59 | 60 | -------------------------------------------------------------------------------- /PW/src/trnvecc.f90: -------------------------------------------------------------------------------- 1 | ! 2 | ! Copyright (C) 2001 PWSCF group 3 | ! This file is distributed under the terms of the 4 | ! GNU General Public License. See the file `License' 5 | ! in the root directory of the present distribution, 6 | ! or http://www.gnu.org/copyleft/gpl.txt . 7 | ! 8 | ! 9 | !----------------------------------------------------------------------- 10 | subroutine trnvecc (u, at, bg, iflg) 11 | !----------------------------------------------------------------------- 12 | ! 13 | ! transforms a COMPLEX vector in real space (like a displacement) 14 | ! from crystal to cartesian axis (iflag.gt.0) and viceversa (iflag.le.0 15 | ! 16 | USE kinds, only : DP 17 | implicit none 18 | 19 | integer :: iflg 20 | ! input: gives the versus of the transformatio 21 | 22 | real(DP) :: at (3, 3), bg (3, 3) 23 | ! input: the direct lattice vectors 24 | ! input: the reciprocal lattice vectors 25 | 26 | complex(DP) :: u (3) 27 | ! inp/out: the vector to transform 28 | 29 | integer :: i, k 30 | ! ! counter on polarizations 31 | 32 | !/ 33 | 34 | complex(DP) :: wrk (3) 35 | ! auxiliary variable 36 | if (iflg.gt.0) then 37 | ! 38 | ! forward transformation : 39 | ! 40 | do i = 1, 3 41 | wrk (i) = u (i) 42 | 43 | enddo 44 | do i = 1, 3 45 | u (i) = 0.d0 46 | do k = 1, 3 47 | u (i) = u (i) + wrk (k) * at (i, k) 48 | enddo 49 | enddo 50 | else 51 | ! 52 | ! backward transformation : 53 | ! 54 | do i = 1, 3 55 | wrk (i) = 0.d0 56 | do k = 1, 3 57 | wrk (i) = wrk (i) + u (k) * bg (k, i) 58 | enddo 59 | 60 | enddo 61 | do i = 1, 3 62 | u (i) = wrk (i) 63 | enddo 64 | endif 65 | return 66 | end subroutine trnvecc 67 | -------------------------------------------------------------------------------- /PW/src/wannier_clean.f90: -------------------------------------------------------------------------------- 1 | ! Copyright (C) 2008 Dmitry Korotin dmitry@korotin.name 2 | ! This file is distributed under the terms of the 3 | ! GNU General Public License. See the file `License' 4 | ! in the root directory of the present distribution, 5 | ! or http://www.gnu.org/copyleft/gpl.txt . 6 | ! 7 | #define ZERO (0.d0,0.d0) 8 | #define ONE (1.d0,0.d0) 9 | 10 | 11 | !---------------------------------------------------------------------- 12 | subroutine wannier_clean() 13 | !---------------------------------------------------------------------- 14 | ! 15 | ! ... This routine deallocates all dynamically allocated arrays for wannier calc and closes all open files 16 | ! 17 | USE wannier_new, only: wan_in, wan_pot, wannier_energy, wannier_occ, pp, coef 18 | USE io_files 19 | USE buffers 20 | USE basis, ONLY : swfcatom 21 | USE ldaU, ONLY : lda_plus_u 22 | USE fixed_occ, ONLY : one_atom_occupations 23 | 24 | IMPLICIT NONE 25 | LOGICAL :: opnd 26 | 27 | if(allocated(wan_in)) deallocate(wan_in) 28 | if(allocated(wan_pot)) deallocate(wan_pot) 29 | if(allocated(wannier_energy)) deallocate(wannier_energy) 30 | if(allocated(wannier_occ)) deallocate(wannier_occ) 31 | if(allocated(pp)) deallocate(pp) 32 | if(allocated(coef)) deallocate(coef) 33 | 34 | CALL close_buffer( iunwpp, 'keep' ) 35 | CALL close_buffer( iunwf, 'keep' ) 36 | 37 | IF ( .NOT. ( lda_plus_u .OR. one_atom_occupations ) ) THEN 38 | INQUIRE( UNIT = iunsat, OPENED = opnd ) 39 | IF ( opnd ) CALL close_buffer( iunsat, 'delete' ) 40 | END IF 41 | 42 | IF(ALLOCATED(swfcatom)) DEALLOCATE(swfcatom) 43 | 44 | return 45 | ! 46 | end subroutine wannier_clean 47 | 48 | -------------------------------------------------------------------------------- /PW/src/wannier_enrg.f90: -------------------------------------------------------------------------------- 1 | ! Copyright (C) 2006-2008 Dmitry Korotin dmitry@korotin.name 2 | ! This file is distributed under the terms of the 3 | ! GNU General Public License. See the file `License' 4 | ! in the root directory of the present distribution, 5 | ! or http://www.gnu.org/copyleft/gpl.txt . 6 | ! 7 | #define ZERO (0.d0,0.d0) 8 | #define ONE (1.d0,0.d0) 9 | 10 | !---------------------------------------------------------------------- 11 | subroutine wannier_enrg(enrg) 12 | !---------------------------------------------------------------------- 13 | ! 14 | ! ... This routine computes energy of each wannier. It is assumed that WF generated already and stored if the buffer. 15 | ! 16 | use kinds, only: DP 17 | use wannier_new, only: nwan, pp 18 | use io_global, only : stdout 19 | use wvfct, only: nbnd, et, wg 20 | use klist, only: nks, wk 21 | use lsda_mod, only: current_spin, lsda, nspin, isk 22 | USE io_files 23 | USE buffers 24 | 25 | implicit none 26 | real(DP), intent(out) :: enrg(nwan,nspin) 27 | 28 | integer :: i,j, ik 29 | 30 | enrg = ZERO 31 | current_spin = 1 32 | 33 | DO ik=1, nks 34 | IF (lsda) current_spin = isk(ik) 35 | CALL get_buffer( pp, nwordwpp, iunwpp, ik) 36 | DO i=1, nwan 37 | DO j=1, nbnd 38 | enrg(i,current_spin) = enrg(i,current_spin) + pp(i,j)*conjg(pp(i,j))*wk(ik)*et(j,ik) 39 | END DO 40 | END DO 41 | END DO 42 | 43 | IF(nspin.eq.1) enrg=enrg*0.5D0 44 | 45 | return 46 | end subroutine wannier_enrg 47 | -------------------------------------------------------------------------------- /PW/src/wannier_occ.f90: -------------------------------------------------------------------------------- 1 | ! Copyright (C) 2006-2008 Dmitry Korotin dmitry@korotin.name 2 | ! This file is distributed under the terms of the 3 | ! GNU General Public License. See the file `License' 4 | ! in the root directory of the present distribution, 5 | ! or http://www.gnu.org/copyleft/gpl.txt . 6 | ! 7 | #define ZERO (0.d0,0.d0) 8 | #define ONE (1.d0,0.d0) 9 | 10 | !---------------------------------------------------------------------- 11 | subroutine wannier_occupancies(occ) 12 | !---------------------------------------------------------------------- 13 | ! 14 | ! ... This routine computes occupation of each wannier. It is assumed that WF generated already and stored if the buffer. 15 | ! 16 | use kinds, only: DP 17 | use wannier_new, only: nwan, pp 18 | use io_global, only : stdout 19 | use wvfct, only: nbnd, et, wg 20 | use klist, only: nks 21 | use lsda_mod, only: current_spin, lsda, nspin, isk 22 | USE io_files 23 | USE buffers 24 | 25 | implicit none 26 | real(DP), intent(out) :: occ(nwan,nwan,nspin) 27 | 28 | integer :: i,j,k,ik 29 | 30 | occ = ZERO 31 | current_spin = 1 32 | 33 | DO ik=1, nks 34 | IF (lsda) current_spin = isk(ik) 35 | CALL get_buffer( pp, nwordwpp, iunwpp, ik) 36 | DO i=1, nwan 37 | DO j=1,nwan 38 | DO k=1, nbnd 39 | occ(i,j,current_spin) = occ(i,j,current_spin) + pp(i,k)*conjg(pp(j,k))*wg(k,ik) 40 | END DO 41 | END DO 42 | END DO 43 | END DO 44 | 45 | IF(nspin.eq.1) occ=occ*0.5D0 46 | 47 | return 48 | end subroutine wannier_occupancies 49 | -------------------------------------------------------------------------------- /PW/tools/Makefile: -------------------------------------------------------------------------------- 1 | # Makefile for tools 2 | 3 | include ../../make.inc 4 | 5 | # location of needed modules 6 | MODFLAGS= $(MOD_FLAG)../../iotk/src $(MOD_FLAG)../../Modules \ 7 | $(MOD_FLAG)../../FFTXlib $(MOD_FLAG)../../LAXlib $(MOD_FLAG)../src $(MOD_FLAG). 8 | 9 | PWOBJS = ../src/libpw.a 10 | QEMODS = ../../Modules/libqemod.a ../../FFTXlib/libqefft.a ../../LAXlib/libqela.a 11 | 12 | TLDEPS= bindir mods libs pw libfft libla 13 | 14 | LIBOBJS = ../../clib/clib.a ../../iotk/src/libiotk.a 15 | 16 | all : tldeps dist.x ev.x kpoints.x pwi2xsf.x 17 | 18 | dist.x : dist.o $(PWOBJS) $(QEMODS) $(LIBOBJS) 19 | $(LD) $(LDFLAGS) -o $@ \ 20 | dist.o $(PWOBJS) $(QEMODS) $(LIBOBJS) $(LIBS) 21 | - ( cd ../../bin ; ln -fs ../PW/tools/$@ . ) 22 | 23 | ev.x : ev.o ev_xml.o $(PWOBJS) $(QEMODS) $(LIBOBJS) 24 | $(LD) $(LDFLAGS) -o $@ \ 25 | ev.o ev_xml.o $(PWOBJS) $(QEMODS) $(LIBOBJS) $(LIBS) 26 | - ( cd ../../bin ; ln -fs ../PW/tools/$@ . ) 27 | 28 | kpoints.x : kpoints.o $(PWOBJS) $(QEMODS) $(LIBOBJS) 29 | $(LD) $(LDFLAGS) -o $@ \ 30 | kpoints.o $(PWOBJS) $(QEMODS) $(LIBOBJS) $(LIBS) 31 | - ( cd ../../bin ; ln -fs ../PW/tools/$@ . ) 32 | 33 | pwi2xsf.x : pwi2xsf.o $(PWOBJS) $(QEMODS) $(LIBOBJS) 34 | $(LD) $(LDFLAGS) -o $@ \ 35 | pwi2xsf.o $(PWOBJS) $(QEMODS) $(LIBOBJS) $(LIBS) 36 | - ( cd ../../bin ; ln -fs ../PW/tools/$@ . ) 37 | 38 | tldeps: 39 | if test -n "$(TLDEPS)" ; then \ 40 | ( cd ../.. ; $(MAKE) $(TLDEPS) || exit 1 ) ; fi 41 | 42 | clean : 43 | - /bin/rm -f pwi2xsf pwi2xsf_old *.x *.o *~ *_tmp.f90 *.mod *.d *.i *.L 44 | 45 | include make.depend 46 | -------------------------------------------------------------------------------- /PW/tools/make.depend: -------------------------------------------------------------------------------- 1 | dist.o : ../../Modules/cell_base.o 2 | dist.o : ../../Modules/command_line_options.o 3 | dist.o : ../../Modules/constants.o 4 | dist.o : ../../Modules/environment.o 5 | dist.o : ../../Modules/io_global.o 6 | dist.o : ../../Modules/ions_base.o 7 | dist.o : ../../Modules/kind.o 8 | dist.o : ../../Modules/mp_global.o 9 | dist.o : ../../Modules/mp_world.o 10 | dist.o : ../../Modules/read_input.o 11 | ev.o : ../../Modules/constants.o 12 | ev.o : ../../Modules/io_global.o 13 | ev.o : ../../Modules/kind.o 14 | ev.o : ../../Modules/mp.o 15 | ev.o : ../../Modules/mp_global.o 16 | ev.o : ../../Modules/mp_world.o 17 | ev.o : ../../Modules/random_numbers.o 18 | ev.o : ev_xml.o 19 | ev_xml.o : ../../Modules/constants.o 20 | ev_xml.o : ../../Modules/kind.o 21 | ev_xml.o : ../../iotk/src/iotk_module.o 22 | kpoints.o : ../../Modules/cell_base.o 23 | kpoints.o : ../../Modules/kind.o 24 | kpoints.o : ../../PW/src/symm_base.o 25 | -------------------------------------------------------------------------------- /PW/tools/mv.awk: -------------------------------------------------------------------------------- 1 | BEGIN {nr=0; nat=0; nline=0; nframe=0; label=""; print} 2 | { if ($3=="atoms/cell" && nr==0) {nat=$5 }; 3 | if ($1=="lattice" && $2=="parameter" && nr==0 ) {alat= $5*0.529177} 4 | if ($1=="Search") {label="BFGS Search" }; 5 | if ($1=="Final" && $2=="estimate") {label=$0}; 6 | if ($1=="ATOMIC_POSITIONS") {nframe=nframe+1; nr=NR; nline=nat; print "frame ",nframe,label ; print " "}; 7 | if (NR-nr>=1 && NR-nr<=nline) print $2*alat,$3*alat,$4*alat 8 | if (NR-nr==nline) {print " ";nline=0;label=""} 9 | } 10 | -------------------------------------------------------------------------------- /PW/tools/xsf2pwi.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # Usage: xsf2pwi.sh [-c] XSF-file 4 | # 5 | # Purpose: convert XSF file to PW.X input syntax 6 | # if XSF-file is not specified read from stdin 7 | 8 | coor_only=0 9 | if test x$1 = x"-c"; then 10 | # coor only option specified 11 | coor_only=1 12 | shift 13 | fi 14 | 15 | if test $# -lt 1; then 16 | input=- 17 | else 18 | input=$1 19 | fi 20 | 21 | 22 | cat $input | awk -v coor_only=$coor_only ' 23 | BEGIN { 24 | f=1.0; 25 | bohr=0.529177; 26 | } 27 | /PRIMVEC/ { 28 | if ( $2 != "bohr" ) { 29 | f = 1.0 / bohr; 30 | } 31 | 32 | if (!coor_only) { 33 | print "CELL_PARAMETERS cubic"; 34 | getline; printf " %12.6f %12.6f %12.6f\n", $1*f, $2*f, $3*f; 35 | getline; printf " %12.6f %12.6f %12.6f\n", $1*f, $2*f, $3*f; 36 | getline; printf " %12.6f %12.6f %12.6f\n", $1*f, $2*f, $3*f; 37 | print ""; 38 | } 39 | } 40 | /PRIMCOORD/ { 41 | if ( NF < 2 ) { 42 | unit="angstrom"; 43 | } else { 44 | unit=$2; 45 | } 46 | print "ATOMIC_POSITIONS ", unit; 47 | getline; 48 | nat=$1; 49 | for (i=0; i 4 | #include 5 | 6 | int copy(const char* fn_in, const char* fn_out) { 7 | 8 | FILE *fd1 = fopen(fn_in, "r"); 9 | if(!fd1) return -1; // cannot open input 10 | 11 | FILE *fd2 = fopen(fn_out, "w"); 12 | if(!fd2) { // cannot open output 13 | fclose(fd1); 14 | return -2; 15 | } 16 | 17 | size_t l1; 18 | unsigned char buffer[8192]; 19 | 20 | while((l1 = fread(buffer, 1, sizeof buffer, fd1)) > 0) { 21 | size_t l2 = fwrite(buffer, 1, l1, fd2); 22 | if(l2 == 0 || l2 < l1) { 23 | fclose(fd1); 24 | fclose(fd2); 25 | if(l2==0) return -3; // output error 26 | return -4; // disk full 27 | } 28 | } 29 | fclose(fd1); 30 | fclose(fd2); 31 | return 0; 32 | } 33 | 34 | -------------------------------------------------------------------------------- /clib/cptimer.c: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2002-2006 Quantum ESPRESSO group 3 | This file is distributed under the terms of the 4 | GNU General Public License. See the file `License' 5 | in the root directory of the present distribution, 6 | or http://www.gnu.org/copyleft/gpl.txt . 7 | */ 8 | 9 | #if defined(_WIN32) 10 | #include 11 | #include 12 | #include 13 | #else 14 | #include 15 | #include 16 | #endif 17 | #include 18 | 19 | #include "c_defs.h" 20 | 21 | double F77_FUNC(cclock,CCLOCK)() 22 | 23 | /* Return the second elapsed since Epoch (00:00:00 UTC, January 1, 1970) 24 | */ 25 | 26 | { 27 | 28 | struct timeval tmp; 29 | double sec; 30 | gettimeofday( &tmp, (struct timezone *)0 ); 31 | sec = tmp.tv_sec + ((double)tmp.tv_usec)/1000000.0; 32 | return sec; 33 | 34 | } 35 | 36 | double F77_FUNC(scnds,SCNDS) ( ) 37 | 38 | /* Return the cpu time associated to the current process 39 | */ 40 | 41 | { 42 | double sec=0.0; 43 | 44 | #if defined(_WIN32) 45 | // from MSDN docs. 46 | FILETIME ct,et,kt,ut; 47 | union { FILETIME ft; uint64_t ui; } cpu; 48 | if (GetProcessTimes(GetCurrentProcess(),&ct,&et,&kt,&ut)) { 49 | cpu.ft = ut; 50 | sec = cpu.ui * 0.0000001; 51 | } 52 | #else 53 | static struct rusage T; 54 | 55 | getrusage(RUSAGE_SELF, &T); 56 | 57 | sec = ((double)T.ru_utime.tv_sec + ((double)T.ru_utime.tv_usec)/1000000.0); 58 | #endif 59 | return sec; 60 | } 61 | 62 | -------------------------------------------------------------------------------- /clib/customize_signals.c: -------------------------------------------------------------------------------- 1 | 2 | #if defined(__TRAP_SIGUSR1) || defined(__TERMINATE_GRACEFULLY) 3 | #include 4 | #include 5 | #include 6 | 7 | int init_signal(int signum, void (*new_handler)(int)) 8 | { 9 | static struct sigaction action; 10 | 11 | action.sa_handler = new_handler; 12 | // Don't block anything. 13 | // Not sure if it's the correct behavior (or even if there is one) 14 | sigemptyset(&action.sa_mask); 15 | // This will probably make MPI happy 16 | action.sa_flags = SA_RESTART; 17 | 18 | return sigaction(signum, &action, NULL); 19 | } 20 | 21 | 22 | int init_signal_USR1(void (*new_handler)(int)) 23 | { 24 | return init_signal(SIGUSR1, new_handler); 25 | } 26 | 27 | int init_TERMINATE_GRACEFULLY(void (*new_handler)(int)) 28 | { 29 | int fail; 30 | fail = init_signal(SIGTERM, new_handler); 31 | if(fail) return -SIGTERM; 32 | fail = init_signal(SIGINT, new_handler); 33 | if(fail) return -SIGINT; 34 | fail = init_signal(SIGUSR1, new_handler); 35 | if(fail) return -SIGUSR1; 36 | fail = init_signal(SIGUSR2, new_handler); 37 | if(fail) return -SIGUSR2; 38 | fail = init_signal(SIGXCPU, new_handler); 39 | if(fail) return -SIGXCPU; 40 | return 0; 41 | } 42 | 43 | #else 44 | void dummy ( ) { } 45 | #endif 46 | -------------------------------------------------------------------------------- /clib/make.depend: -------------------------------------------------------------------------------- 1 | c_mkdir.o : ../include/c_defs.h 2 | cptimer.o : ../include/c_defs.h 3 | eval_infix.o : ../include/c_defs.h 4 | indici.o : ../include/c_defs.h 5 | md5.o : 6 | md5_from_file.o : ../include/c_defs.h 7 | md5_from_file.o : 8 | memstat.o : ../include/c_defs.h 9 | ptrace.o : ../include/c_defs.h 10 | qmmm_aux.o : ../include/c_defs.h 11 | stack.o : ../include/c_defs.h 12 | -------------------------------------------------------------------------------- /clib/memstat.c: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2002 FPMD group 3 | This file is distributed under the terms of the 4 | GNU General Public License. See the file `License' 5 | in the root directory of the present distribution, 6 | or http://www.gnu.org/copyleft/gpl.txt . 7 | */ 8 | 9 | #include "c_defs.h" 10 | 11 | /* 12 | This function return the numer of kilobytes allocated 13 | by the calling process. 14 | Auhor: Carlo Cavazzoni. 15 | */ 16 | 17 | #if defined (__SVR4) && defined (__sun) 18 | #define SUN_MALLINFO 19 | #endif 20 | 21 | #if defined(HAVE_MALLINFO) && !defined(__QK_USER__) && !defined(SUN__MALLINFO) 22 | #include 23 | 24 | void F77_FUNC(memstat,MEMSTAT)(int *kilobytes) 25 | { 26 | 27 | struct mallinfo info; 28 | info = mallinfo(); 29 | 30 | #if defined(__AIX) 31 | *kilobytes = (info.arena) / 1024 ; 32 | #else 33 | *kilobytes = (info.arena + info.hblkhd) / 1024 ; 34 | #endif 35 | 36 | #else 37 | void F77_FUNC(memstat,MEMSTAT)(int *kilobytes) 38 | { 39 | *kilobytes = -1; 40 | #endif 41 | } 42 | -------------------------------------------------------------------------------- /clib/ptrace.c: -------------------------------------------------------------------------------- 1 | #include "c_defs.h" 2 | /* 3 | Print the stack trace 4 | */ 5 | #ifdef __PTRACE 6 | #include 7 | #include 8 | #endif 9 | #include 10 | 11 | void F77_FUNC(ptrace,PTRACE)(int *kilobytes) 12 | { 13 | #ifdef __PTRACE 14 | void *array[12]; 15 | size_t size; 16 | char **strings; 17 | size_t i; 18 | 19 | size = backtrace (array, 12); 20 | strings = backtrace_symbols (array, size); 21 | 22 | printf ("Obtained %zd stack frames.\n", size); 23 | printf ("Use 'addr2line -e /where/is/code.x 0x12345' to get the source line number\n"); 24 | 25 | for (i = 0; i < size; i++) 26 | printf ("%s\n", strings[i]); 27 | 28 | free (strings); 29 | #else 30 | printf ("No stack trace available.\n"); 31 | #endif 32 | } 33 | 34 | -------------------------------------------------------------------------------- /clib/qsort.c: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2002 FPMD group 3 | This file is distributed under the terms of the 4 | GNU General Public License. See the file `License' 5 | in the root directory of the present distribution, 6 | or http://www.gnu.org/copyleft/gpl.txt . 7 | */ 8 | 9 | #include 10 | #include 11 | 12 | /* qsort - quick sort 13 | 14 | qsort(n,comp,swap) 15 | unsigned n; 16 | int (*comp)(); 17 | int (*swap)(); 18 | ***** see bsort for parameters 19 | 20 | */ 21 | 22 | static unsigned _rearr(unsigned lb,unsigned ub); 23 | static void _quick(unsigned lb,unsigned ub); 24 | static int (*_comp)(unsigned,unsigned), (*_swap)(unsigned,unsigned); 25 | 26 | void Qsort(unsigned n,int (*comp)(),int (*swap)()) 27 | { 28 | _comp = comp; 29 | _swap = swap; 30 | _quick(0,n-1); 31 | } 32 | 33 | 34 | static void _quick(unsigned lb,unsigned ub) 35 | { 36 | unsigned j; 37 | 38 | if(lb lb && (*_comp)(ub,lb) >=0) ub--; 52 | 53 | if(ub != lb) 54 | { 55 | (*_swap)(ub,lb); 56 | while(lb 11 | #include 12 | 13 | #if !defined(__WIN32) 14 | #include 15 | 16 | void remove_stack_limit_(void) { 17 | 18 | struct rlimit rlim = { RLIM_INFINITY, RLIM_INFINITY }; 19 | 20 | /* Modified according to Cesar Da Silva suggestions */ 21 | if ( setrlimit(RLIMIT_STACK, &rlim) == -1 ) { 22 | if ( getrlimit(RLIMIT_STACK, &rlim) == 0 ) { 23 | rlim.rlim_cur = rlim.rlim_max; 24 | if ( setrlimit(RLIMIT_STACK, &rlim) == 0 ) { 25 | getrlimit(RLIMIT_STACK, &rlim); 26 | } else { 27 | perror(" Cannot set stack size to new value"); 28 | } 29 | } 30 | } 31 | } 32 | 33 | #else 34 | 35 | void remove_stack_limit_(void) {;} 36 | 37 | #endif 38 | -------------------------------------------------------------------------------- /include/c_defs.h: -------------------------------------------------------------------------------- 1 | /* include/c_defs.h. Generated from c_defs.h.in by configure. */ 2 | /* 3 | Copyright (C) 2006 Quantum-ESPRESSO group 4 | This file is distributed under the terms of the 5 | GNU General Public License. See the file `License' 6 | in the root directory of the present distribution, 7 | or http://www.gnu.org/copyleft/gpl.txt . 8 | */ 9 | 10 | /* File c_defs.h.in is used by configure to generate c_defs.h 11 | Variables that configure defines should be #undef-ined in 12 | include/c_defs.h.in !!! */ 13 | 14 | /* fortran-to-C naming convention, for functions with and without 15 | underscores in the name (some compilers treat them differently) */ 16 | 17 | #define F77_FUNC(name,NAME) name ## _ 18 | #define F77_FUNC_(name,NAME) name ## _ 19 | 20 | /* do we have the mallinfo structure (see clib/memstat.c) ? */ 21 | 22 | #define HAVE_MALLINFO 1 23 | -------------------------------------------------------------------------------- /include/fft_defs.h: -------------------------------------------------------------------------------- 1 | 2 | #define C_POINTER integer*8 3 | -------------------------------------------------------------------------------- /install/Makefile.lib_eigsolve: -------------------------------------------------------------------------------- 1 | include ../../make.inc 2 | 3 | FLAGS = -O3 -mp -pgf90libs -Mcuda=cc$(GPU_ARCH),cuda$(CUDA_RUNTIME),ptxinfo -Mlarge_arrays 4 | FLAGS2 = -O3 -mp -pgf90libs -Mcuda=cc$(GPU_ARCH),cuda$(CUDA_RUNTIME),ptxinfo,nollvm -Mlarge_arrays 5 | FLAGS3 = -O3 -mp -pgf90libs -Mcuda=cc$(GPU_ARCH),cuda$(CUDA_RUNTIME),ptxinfo,maxregcount:64,nollvm -Mlarge_arrays 6 | 7 | # Uncomment to enable NVTX markers 8 | #OPTFLAGS = -DUSE_NVTX 9 | 10 | .NOTPARALLEL: all 11 | 12 | all: lib_eigsolve.a 13 | 14 | OBJS = cusolverDn_m.o eigsolve_vars.o toolbox.o zhegst_gpu.o zhemv_gpu.o zhetd2_gpu.o zhetrd_gpu.o zheevd_gpu.o zhegvdx_gpu.o \ 15 | dsygst_gpu.o dsymv_gpu.o dsytd2_gpu.o dsytrd_gpu.o dsyevd_gpu.o dsygvdx_gpu.o 16 | 17 | zhetd2_gpu.o : zhetd2_gpu.F90 18 | pgf90 -c ${FLAGS3} ${OPTFLAGS} $*.F90 -o $*.o 19 | zhetrd_gpu.o : zhetrd_gpu.F90 20 | pgf90 -c ${FLAGS2} ${OPTFLAGS} $*.F90 -o $*.o 21 | dsytd2_gpu.o : dsytd2_gpu.F90 22 | pgf90 -c ${FLAGS3} ${OPTFLAGS} $*.F90 -o $*.o 23 | dsytrd_gpu.o : dsytrd_gpu.F90 24 | pgf90 -c ${FLAGS2} ${OPTFLAGS} $*.F90 -o $*.o 25 | %.o: %.cuf 26 | pgf90 -c ${FLAGS} ${OPTFLAGS} $*.cuf -o $*.o 27 | %.o: %.F90 28 | pgf90 -c ${FLAGS} ${OPTFLAGS} $*.F90 -o $*.o 29 | 30 | lib_eigsolve.a: $(OBJS) 31 | ar -cr lib_eigsolve.a $(OBJS) 32 | 33 | clean: 34 | rm lib_eigsolve.a *.mod *.o 35 | -------------------------------------------------------------------------------- /install/README.DFLAGS: -------------------------------------------------------------------------------- 1 | 2 | PREPROCESSING OPTIONS USED IN THE SOURCES 3 | 4 | Parallel execution: 5 | __MPI MPI parallelization 6 | 7 | GPU execution: 8 | USE_CUDA Enable GPU support via CUDA FORTRAN 9 | USE_GPU_MPI Enable support to CUDA-aware MPI 10 | USE_IPC Enable intra-GPU communication via CUDA IPC primitives 11 | NO_CURAND Disable CURAND random-number generation for initialization (use slower CPU initialization) 12 | 13 | Libraries: 14 | __FFTW FFT routines from internal FFTW library 15 | __FFTW3 FFT routines from external FFTW v3 library 16 | __LINUX_ESSL Use blas/lapack/fft routines from IBM ESSL library 17 | __DFTI FFT routines from external Intel MKL 18 | __MKL When doing "relax" computations, enable work around for bug in MKL (multithreaded GEMM will hang on AVX2) 19 | 20 | IO / Reporting: 21 | __HDF5 Enable I/O using parallel HDF5 22 | (Fortran 2003 features needed to compile) 23 | __CLOCK_SECONDS Translate clock from HH:mm:ss to only seconds 24 | (default, see Modules/clocks.f90) 25 | 26 | 27 | All other preprocessing flags are for debugging purposes and should not be 28 | used unless you know what you are doing 29 | -------------------------------------------------------------------------------- /install/clean.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | \rm -f uncompress* make_blas.inc make_lapack.inc make_wannier90.sys 4 | -------------------------------------------------------------------------------- /install/includedep.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # includedep.sh -- script that computes dependencies on preprocessor includes 3 | 4 | # make sure there is no locale setting creating unneeded differences. 5 | LC_ALL=C 6 | export LC_ALL 7 | 8 | # files whose dependencies must be computed 9 | sources=`echo *.c *.f90 | 10 | sed 's/\*\.c//g 11 | s/\*\.f90//g'` # remove the "*.c" and "*.f90" that remain 12 | # # when there are no such files 13 | if test "$sources" = " " ; then exit ; fi 14 | 15 | # files that may be included 16 | # extra directories may be specified on the command line 17 | includes=`echo *.h` 18 | for dir in $* 19 | do 20 | includes="$includes `echo $dir/*.h`" 21 | done 22 | includes=`echo $includes | 23 | sed 's/[^ ]*\*\.h//g'` # remove the "dir/*.h" that remain 24 | # # when there are no such files 25 | 26 | # create list of include dependencies 27 | # each line is of the form: 28 | # file_name.o : @include_file.h@ 29 | egrep -H '^ *# *include *"' $sources | # look for #include "..." statements 30 | # # ignore #include <...> ones 31 | sed 's/f90:/o / 32 | s/c:/o / 33 | s/# *include *// 34 | s/\"/ /g' | # replace extension, insert space 35 | # # remove '# include' statements 36 | # # remove quotes 37 | awk '{print $1 " : @" $2 "@"}' | # create dependency entry 38 | sort | uniq > includedep.tmp1 # remove duplicates 39 | 40 | # create list of available include files 41 | # for each file, create a line of the form: 42 | # s/@file_name@/pathname/g 43 | echo $includes | tr " " "\n" | 44 | sed 's/\//\\\//g 45 | s/.*\/\([^/]*\)/\1 &/' | # escape slashes 46 | awk '{print "s/@" $1 "@/" $2 "/" }' > includedep.tmp2 47 | 48 | # replace file names with pathnames 49 | # by applying the file of substitution patterns just created 50 | sed -f includedep.tmp2 includedep.tmp1 51 | 52 | rm -f includedep.tmp1 includedep.tmp2 # remove temporary files 53 | -------------------------------------------------------------------------------- /install/install_utils: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2001-2016 Quantum ESPRESSO group 2 | # Copyright (C) 2017 Filippo Spiga 3 | # 4 | # This program is free software; you can redistribute it and/or 5 | # modify it under the terms of the GNU General Public License 6 | # as published by the Free Software Foundation; either version 2 7 | # of the License. See the file `License' in the root directory 8 | # of the present distribution. 9 | # 10 | # Utilities 11 | 12 | ########################################################### 13 | # Template function 14 | # $(1) = package name 15 | # $(2) = package URL 16 | # $(3) = directory name 17 | # $(4) = plugin/code name 18 | ########################################################### 19 | 20 | define download_and_unpack 21 | @(if test ! -s ../archive/`echo "$(2)" | sed 's/.*\///;s/.*=//'` && test ! -e ../$(3) ; then \ 22 | wget -O ../archive/`echo "$(2)" | sed 's/.*\///;s/.*=//'` $(2) > /dev/null 2>&1; \ 23 | if test "`echo $$?`" -ne "0" ; then \ 24 | curl -o ../archive/`echo "$(2)" | sed 's/.*\///;s/.*=//'` $(2) > /dev/null 2>&1; \ 25 | if test "`echo $$?`" -ne "0" ; then \ 26 | echo "*** Unable to download $(4). Test whether curl or wget is installed and working," ; \ 27 | echo "*** if you have direct access to internet. If not, copy into archive/ the file" ; \ 28 | echo "*** located here $(2)" ; \ 29 | exit 1 ; fi ; fi ; fi) 30 | if test ! -e ../$(3); then \ 31 | (gzip -dc ../archive/`echo "$(2)" | sed 's/.*\///;s/.*=//'` | \ 32 | (cd ../ ; tar -xvf - ; ln -s $(1) $(3)) ) ; fi 33 | endef 34 | -------------------------------------------------------------------------------- /install/make.check-cuda: -------------------------------------------------------------------------------- 1 | # check for CUDA directory and give user hint how to set it 2 | ifeq ($(CUDADIR),) 3 | cuda := $(shell which nvcc | perl -pe 's|/bin/nvcc||') 4 | ifeq ($(cuda),) 5 | cuda := /usr/local/cuda 6 | endif 7 | $(error Set $$CUDADIR, preferably in your environment, e.g., run "export CUDADIR=$(cuda)" in ~/.bashrc, or "setenv CUDADIR $(cuda)" in ~/.cshrc) 8 | endif 9 | 10 | ifeq ($(wildcard $(CUDADIR)),) 11 | $(error $$CUDADIR=$(CUDADIR) does not exist. Please set $$CUDADIR to where CUDA is installed.) 12 | endif 13 | -------------------------------------------------------------------------------- /install/make.inc_POWER_DAVIDE_CPU-ESSLSMP: -------------------------------------------------------------------------------- 1 | # For a verbose description of these fields please refer to the original 2 | # Quantum ESPRESSO make.inc file 3 | 4 | TOPDIR = $(dir $(abspath $(filter %make.inc,$(MAKEFILE_LIST)))) 5 | 6 | # See include/defs.h.README for a list of options and their meaning 7 | DFLAGS = -D__MPI -D__LINUX_ESSL 8 | FDFLAGS = $(DFLAGS) 9 | 10 | IFLAGS = -I$(TOPDIR)/include -I../include/ 11 | 12 | MOD_FLAG = -I 13 | 14 | MPIF90 = mpif90 15 | MPICC = mpicc 16 | CC = pgcc 17 | F77 = pgf90 18 | 19 | CFLAGS = -O3 -mp -Mpreprocess $(DFLAGS) $(IFLAGS) 20 | F90FLAGS = -O3 -mp -Mpreprocess -Mlarge_arrays $(FDFLAGS) $(IFLAGS) $(MODFLAGS) 21 | FFLAGS = -O3 -mp -Mpreprocess 22 | 23 | # If this flag is present some files are compiled differently as workaround for compiler bugs 24 | F90FLAGS_WORKAROUND = -O1 -Mpreprocess -Mlarge_arrays $(FDFLAGS) $(IFLAGS) $(MODFLAGS) 25 | 26 | LD = mpif90 27 | LDFLAGS = -mp -Mlarge_arrays 28 | LD_LIBS = 29 | 30 | MATH_LIBS = -L/opt/ibm/xlf/15.1.5/lib -lesslsmp -lessl -lxl -lxlf90_r -lxlfmath -L/opt/ibm/xlsmp/4.1.5/lib -lxlsmp -lxlfmath -llapack -lblas 31 | 32 | EIGENSOLVER_VERSION = 33 | 34 | 35 | # Do not edit below this line 36 | 37 | AR = ar 38 | ARFLAGS = ruv 39 | RANLIB = ranlib 40 | WGET = wget -O 41 | 42 | .SUFFIXES : 43 | .SUFFIXES : .o .c .f .f90 .F90 44 | 45 | .F90.o: 46 | $(MPIF90) $(F90FLAGS) -c $< -o $(*)_cpu.o ; 47 | ld -r $(*)_cpu.o -o $(*).o ; 48 | rm $(*)_cpu.o 49 | 50 | .f90.o: 51 | $(MPIF90) $(F90FLAGS) -c $(*).f90 -o $(*).o 52 | 53 | .f.o: 54 | $(F77) $(FFLAGS) -c $< 55 | 56 | .c.o: 57 | $(CC) $(CFLAGS) -c $< 58 | 59 | LIBOBJS = $(TOPDIR)/clib/clib.a $(TOPDIR)/iotk/src/libiotk.a 60 | LIBS = $(MATH_LIBS) $(LD_LIBS) 61 | -------------------------------------------------------------------------------- /install/make.inc_POWER_DAVIDE_CPU-ESSLSMP_SCALAPACK: -------------------------------------------------------------------------------- 1 | # For a verbose description of these fields please refer to the original 2 | # Quantum ESPRESSO make.inc file 3 | 4 | TOPDIR = $(dir $(abspath $(filter %make.inc,$(MAKEFILE_LIST)))) 5 | 6 | # See include/defs.h.README for a list of options and their meaning 7 | DFLAGS = -D__MPI -D__LINUX_ESSL -D__SCALAPACK 8 | FDFLAGS = $(DFLAGS) 9 | 10 | IFLAGS = -I$(TOPDIR)/include -I../include/ 11 | 12 | MOD_FLAG = -I 13 | 14 | MPIF90 = mpif90 15 | MPICC = mpicc 16 | CC = pgcc 17 | F77 = pgf90 18 | 19 | CFLAGS = -O3 -mp -Mpreprocess $(DFLAGS) $(IFLAGS) 20 | F90FLAGS = -O3 -mp -Mpreprocess -Mlarge_arrays $(FDFLAGS) $(IFLAGS) $(MODFLAGS) 21 | FFLAGS = -O3 -mp -Mpreprocess 22 | 23 | # If this flag is present some files are compiled differently as workaround for compiler bugs 24 | F90FLAGS_WORKAROUND = -O1 -Mpreprocess -Mlarge_arrays $(FDFLAGS) $(IFLAGS) $(MODFLAGS) 25 | 26 | LD = mpif90 27 | LDFLAGS = -mp -Mlarge_arrays 28 | LD_LIBS = 29 | 30 | SCALPACK_LIBS = /opt/pgi/linuxpower/17.4/lib/scalapack/scalapack-2.0.2/openmpi-1.10.2/lib/libscalapack.a 31 | 32 | MATH_LIBS = $(SCALPACK_LIBS) -L/opt/ibm/xlf/15.1.5/lib -lesslsmp -lessl -lxl -lxlf90_r -lxlfmath -L/opt/ibm/xlsmp/4.1.5/lib -lxlsmp -lxlfmath -llapack -lblas 33 | 34 | EIGENSOLVER_VERSION = 35 | 36 | 37 | # Do not edit below this line 38 | 39 | AR = ar 40 | ARFLAGS = ruv 41 | RANLIB = ranlib 42 | WGET = wget -O 43 | 44 | .SUFFIXES : 45 | .SUFFIXES : .o .c .f .f90 .F90 46 | 47 | .F90.o: 48 | $(MPIF90) $(F90FLAGS) -c $< -o $(*)_cpu.o ; 49 | ld -r $(*)_cpu.o -o $(*).o ; 50 | rm $(*)_cpu.o 51 | 52 | .f90.o: 53 | $(MPIF90) $(F90FLAGS) -c $(*).f90 -o $(*).o 54 | 55 | .f.o: 56 | $(F77) $(FFLAGS) -c $< 57 | 58 | .c.o: 59 | $(CC) $(CFLAGS) -c $< 60 | 61 | LIBOBJS = $(TOPDIR)/clib/clib.a $(TOPDIR)/iotk/src/libiotk.a 62 | LIBS = $(MATH_LIBS) $(LD_LIBS) 63 | -------------------------------------------------------------------------------- /install/make.inc_x86-64_CPU-only: -------------------------------------------------------------------------------- 1 | # For a verbose description of these fields please refer to the original 2 | # Quantum ESPRESSO make.inc file 3 | 4 | TOPDIR = $(dir $(abspath $(filter %make.inc,$(MAKEFILE_LIST)))) 5 | 6 | # See install/README.DFLAGS for a list of options and their meaning 7 | DFLAGS = -D__FFTW -D__MPI 8 | FDFLAGS = $(DFLAGS) $(MANUAL_DFLAGS) 9 | 10 | IFLAGS = -I$(TOPDIR)/include -I../include/ 11 | 12 | MOD_FLAG = -I 13 | 14 | MPIF90 = mpif90 15 | MPICC = mpicc 16 | CC = pgcc 17 | F77 = pgf77 18 | 19 | CFLAGS = -O3 -Mpreprocess $(DFLAGS) $(IFLAGS) 20 | F90FLAGS = -O3 -Mpreprocess -mp -Mlarge_arrays $(FDFLAGS) $(IFLAGS) $(MODFLAGS) 21 | FFLAGS = -O3 -Mpreprocess -mp 22 | 23 | LD = mpif90 24 | LDFLAGS = -pgf90libs -Mlarge_arrays 25 | LD_LIBS = 26 | 27 | MATH_LIBS = -L${MKLROOT}/lib/intel64 -lmkl_intel_lp64 -pgf90libs -lmkl_core -lmkl_pgi_thread 28 | 29 | EIGENSOLVER_VERSION = 30 | 31 | 32 | # Do not edit below this line 33 | 34 | AR = ar 35 | ARFLAGS = ruv 36 | RANLIB = ranlib 37 | WGET = wget -O 38 | 39 | .SUFFIXES : 40 | .SUFFIXES : .o .c .f .f90 .F90 41 | 42 | .F90.o: 43 | $(MPIF90) $(F90FLAGS) -c $< -o $(*)_cpu.o ; 44 | ld -r $(*)_cpu.o -o $(*).o ; 45 | rm $(*)_cpu.o 46 | 47 | .f90.o: 48 | $(MPIF90) $(F90FLAGS) -c $(*).f90 -o $(*).o 49 | 50 | .f.o: 51 | $(F77) $(FFLAGS) -c $< 52 | 53 | .c.o: 54 | $(CC) $(CFLAGS) -c $< 55 | 56 | LIBOBJS = $(TOPDIR)/clib/clib.a $(TOPDIR)/iotk/src/libiotk.a 57 | LIBS = $(MATH_LIBS) $(LD_LIBS) 58 | 59 | -------------------------------------------------------------------------------- /install/update_version: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # check if svn info available (do not write anything) 4 | svn info 2> /dev/null > /dev/null 5 | 6 | if [ $? = 0 ] ; then 7 | # svn info available: get svn revision 8 | svn_rev=$(svnversion -n) 9 | else 10 | # svn info available: revert to no info 11 | svn_rev=unknown 12 | fi 13 | 14 | # write svn into file version_tmp.f90 15 | cat version.f90.in | sed 's/unknown/'$svn_rev'/' > version.f90.tmp 16 | 17 | # check if a previous version.f90 file exists 18 | if test -f version.f90 ; then 19 | 20 | # version.f90 existing: check if new and previous files differ 21 | diff -wib version.f90.tmp version.f90 2> /dev/null > /dev/null 22 | 23 | if [ $? = 1 ] ; then 24 | # they differ: update file version.f90 25 | mv version.f90.tmp version.f90 26 | fi 27 | # do not update if files are the same (prevents useless recompilation) 28 | 29 | else 30 | 31 | # file version.f90 not existing: create one 32 | mv version.f90.tmp version.f90 33 | 34 | fi 35 | 36 | --------------------------------------------------------------------------------