Merge pull request #2784 from akohlmey/set-python-home

Internally set PYTHONHOME for LAMMPS on Windows
This commit is contained in:
Axel Kohlmeyer 2021-05-27 16:45:34 -04:00 committed by GitHub
commit bd1c5592ab
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 28 additions and 16 deletions

View File

@ -5,7 +5,7 @@ set(WIN_PACKAGES ASPHERE BODY CLASS2 COLLOID COMPRESS CORESHELL DIPOLE GPU
USER-COLVARS USER-DIFFRACTION USER-DPD USER-DRUDE USER-EFF USER-FEP USER-COLVARS USER-DIFFRACTION USER-DPD USER-DRUDE USER-EFF USER-FEP
USER-HDNNP USER-INTEL USER-MANIFOLD USER-MDI USER-MEAMC USER-MESODPD USER-HDNNP USER-INTEL USER-MANIFOLD USER-MDI USER-MEAMC USER-MESODPD
USER-MESONT USER-MISC USER-MGPT USER-MOFFF USER-MOLFILE USER-OMP USER-MESONT USER-MISC USER-MGPT USER-MOFFF USER-MOLFILE USER-OMP
USER-PACE USER-PHONON USER-PTM USER-QTB USER-REACTION USER-REAXC USER-PHONON USER-PTM USER-QTB USER-REACTION USER-REAXC
USER-SDPD USER-SMD USER-SMTBQ USER-SPH USER-TALLY USER-UEF USER-SDPD USER-SMD USER-SMTBQ USER-SPH USER-TALLY USER-UEF
USER-YAFF) USER-YAFF)

View File

@ -2,18 +2,20 @@ LAMMPS open-source license
-------------------------- --------------------------
LAMMPS is a freely-available open-source code, distributed under the LAMMPS is a freely-available open-source code, distributed under the
terms of the `GNU Public License <gnu_>`_, which means you can use or terms of the `GNU Public License Version 2 <gpl_>`_, which means you can
modify the code however you wish. use or modify the code however you wish for your own purposes, but have
to adhere to certain rules when redistributing it or software derived
from it or that includes parts of it.
LAMMPS comes with no warranty of any kind. As each source file states LAMMPS comes with no warranty of any kind. As each source file states
in its header, it is a copyrighted code that is distributed free-of- in its header, it is a copyrighted code that is distributed free-of-
charge, under the terms of the `GNU Public License <gnu_>`_ (GPL). This charge, under the terms of the `GNU Public License Version 2 <gpl_>`_
is often referred to as open-source distribution - see (GPLv2). This is often referred to as open-source distribution - see
`www.gnu.org <gnuorg_>`_ or `www.opensource.org <opensource_>`_. The legal `www.gnu.org <gnuorg_>`_ or `www.opensource.org <opensource_>`_. The
text of the GPL is in the LICENSE file included in the LAMMPS legal text of the GPL is in the LICENSE file included in the LAMMPS
distribution. distribution.
.. _gnu: http://www.gnu.org/copyleft/gpl.html .. _gpl: https://github.com/lammps/lammps/blob/master/LICENSE
.. _gnuorg: http://www.gnu.org .. _gnuorg: http://www.gnu.org
@ -24,14 +26,14 @@ Here is a summary of what the GPL means for LAMMPS users:
(1) Anyone is free to use, modify, or extend LAMMPS in any way they (1) Anyone is free to use, modify, or extend LAMMPS in any way they
choose, including for commercial purposes. choose, including for commercial purposes.
(2) If you distribute a modified version of LAMMPS, it must remain (2) If you **distribute** a modified version of LAMMPS, it must remain
open-source, meaning you distribute it under the terms of the GPL. open-source, meaning you distribute **all** of it under the terms of
You should clearly annotate such a code as a derivative version of the GPL. You should clearly annotate such a code as a derivative version
LAMMPS. of LAMMPS.
(3) If you release any code that includes LAMMPS source code, then it (3) If you release any code that includes or uses LAMMPS source code,
must also be open-sourced, meaning you distribute it under the terms then it must also be open-sourced, meaning you distribute it under
of the GPL. the terms of the GPL.
(4) If you give LAMMPS files to someone else, the GPL LICENSE file and (4) If you give LAMMPS files to someone else, the GPL LICENSE file and
source file headers (including the copyright and GPL notices) should source file headers (including the copyright and GPL notices) should

View File

@ -11,7 +11,7 @@ computers. It was developed originally at Sandia National
Laboratories, a US Department of Energy facility. The majority of Laboratories, a US Department of Energy facility. The majority of
funding for LAMMPS has come from the US Department of Energy (DOE). funding for LAMMPS has come from the US Department of Energy (DOE).
LAMMPS is an open-source code, distributed freely under the terms of LAMMPS is an open-source code, distributed freely under the terms of
the GNU Public License (GPL). the GNU Public License Version 2 (GPLv2).
The `LAMMPS website <lws_>`_ has a variety of information about the The `LAMMPS website <lws_>`_ has a variety of information about the
code. It includes links to an on-line version of this manual, a code. It includes links to an on-line version of this manual, a

View File

@ -130,6 +130,16 @@ LAMMPS::LAMMPS(int narg, char **arg, MPI_Comm communicator) :
init_pkg_lists(); init_pkg_lists();
#if defined(LMP_PYTHON) && defined(_WIN32)
// if the LAMMPSHOME environment variable is set, it should point
// to the location of the LAMMPS installation tree where we bundle
// the matching Python installation for use with the PYTHON package.
// this is currently only used on Windows with the windows installer packages
const char *lmpenv = getenv("LAMMPSHOME");
if (lmpenv) {
_putenv(utils::strdup(fmt::format("PYTHONHOME={}",lmpenv)));
}
#endif
// check if -mpicolor is first arg // check if -mpicolor is first arg
// if so, then 2 apps were launched with one mpirun command // if so, then 2 apps were launched with one mpirun command
// this means passed communicator (e.g. MPI_COMM_WORLD) is bigger than LAMMPS // this means passed communicator (e.g. MPI_COMM_WORLD) is bigger than LAMMPS