diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 7ff1baf..5c8c493 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -39,7 +39,7 @@ jobs: - bash: echo "##vso[task.prependpath]$CONDA/bin" displayName: Add Conda to path - - bash : echo "##vso[task.prependpath]$(Build.SourcesDirectory)/mosdef_cassandra/tests/files/Cassandra_V1.2/bin" + - bash : echo "##vso[task.prependpath]$(Build.SourcesDirectory)/Cassandra-1.2.2/bin" displayName: Add Cassandra to path # On Hosted macOS, the agent user doesn't have ownership of Miniconda's installation directory/ @@ -56,35 +56,22 @@ jobs: condition: eq( variables['Agent.OS'], 'Linux' ) - bash: | - brew install gcc@8 - brew upgrade gcc@8 - gfortran-8 --version + brew install gcc + brew upgrade gcc + gfortran --version displayName: Install gfortran macOS condition: eq( variables['Agent.OS'], 'Darwin' ) - bash: | - cd mosdef_cassandra/tests/files/ - tar -xzvf Cassandra_V1.2.tar.gz - cd Cassandra_V1.2/Src + wget https://github.com/MaginnGroup/Cassandra/archive/v1.2.2.tar.gz + tar -xzvf v1.2.2.tar.gz + cd Cassandra-1.2.2/Src make -f Makefile.gfortran mkdir ../bin cp cassandra_gfortran.exe ../bin/. cp ../Scripts/Frag_Library_Setup/library_setup.py ../bin/. - cd ../../../../../ + cd ../../ displayName: Build Cassandra Linux - condition: eq( variables['Agent.OS'], 'Linux' ) - - - bash: | - cd mosdef_cassandra/tests/files/ - tar -xzvf Cassandra_V1.2.tar.gz - cd Cassandra_V1.2/Src - make -f Makefile.gfortran FC=gfortran-8 - mkdir ../bin - cp cassandra_gfortran.exe ../bin/. - cp ../Scripts/Frag_Library_Setup/library_setup.py ../bin/. - cd ../../../../../ - displayName: Build Cassandra macOS - condition: eq( variables['Agent.OS'], 'Darwin' ) - bash: | echo Working directory: @@ -154,7 +141,7 @@ jobs: imageName: 'macOS-10.14' python.version: 3.7 Python36macOS: - imageName: 'macOS-10.14' + imageName: 'macOS-latest' python.version: 3.6 pool: @@ -164,68 +151,12 @@ jobs: - bash: echo "##vso[task.prependpath]$CONDA/bin" displayName: Add Conda to path - - bash : echo "##vso[task.prependpath]$(Build.SourcesDirectory)/mosdef_cassandra/tests/files/Cassandra_V1.2/bin" - displayName: Add Cassandra to path - # On Hosted macOS, the agent user doesn't have ownership of Miniconda's installation directory/ # We need to take ownership if we want to update conda or install packages globally - bash: sudo chown -R $USER $CONDA displayName: Take ownership of conda installation condition: eq( variables['Agent.OS'], 'Darwin' ) - - bash: | - sudo apt-get update - sudo apt-get install gfortran - gfortran --version - displayName: Install gfortran Linux - condition: eq( variables['Agent.OS'], 'Linux' ) - - - bash: | - brew install gcc@8 - brew upgrade gcc@8 - gfortran-8 --version - displayName: Install gfortran macOS - condition: eq( variables['Agent.OS'], 'Darwin' ) - - - bash: | - cd mosdef_cassandra/tests/files/ - tar -xzvf Cassandra_V1.2.tar.gz - cd Cassandra_V1.2/Src - make -f Makefile.gfortran - mkdir ../bin - cp cassandra_gfortran.exe ../bin/. - cp ../Scripts/Frag_Library_Setup/library_setup.py ../bin/. - cd ../../../../../ - displayName: Build Cassandra Linux - condition: eq( variables['Agent.OS'], 'Linux' ) - - - bash: | - cd mosdef_cassandra/tests/files/ - tar -xzvf Cassandra_V1.2.tar.gz - cd Cassandra_V1.2/Src - make -f Makefile.gfortran FC=gfortran-8 - mkdir ../bin - cp cassandra_gfortran.exe ../bin/. - cp ../Scripts/Frag_Library_Setup/library_setup.py ../bin/. - cd ../../../../../ - displayName: Build Cassandra macOS - condition: eq( variables['Agent.OS'], 'Darwin' ) - - - bash: | - echo Working directory: - pwd - echo ls: - ls - echo PATH: - echo "$PATH" - echo CASSANDRA: - which cassandra_gfortran.exe - echo PYTHON2 - which python2 - echo LIBRARY_SETUP: - which library_setup.py - displayName: Check cassandra install - - bash: | conda config --set always_yes yes --set changeps1 no conda config --add channels omnia @@ -241,6 +172,8 @@ jobs: source activate test-environment echo "PYTHON VERSION:" python --version + echo "CASSANDRA EXEC:" + which cassandra.exe python -m pip install --user . displayName: clone,install foyer,mbuild; install mosdef_cassandra diff --git a/mosdef_cassandra/examples/gemc.py b/mosdef_cassandra/examples/gemc.py index 91eab33..7e00af4 100644 --- a/mosdef_cassandra/examples/gemc.py +++ b/mosdef_cassandra/examples/gemc.py @@ -33,7 +33,7 @@ def run_gemc(): thermo_props = [ "energy_total", - "energy_lj", + "energy_intervdw", "pressure", "volume", "nmols", diff --git a/mosdef_cassandra/runners/runners.py b/mosdef_cassandra/runners/runners.py index b446c98..8fddaad 100644 --- a/mosdef_cassandra/runners/runners.py +++ b/mosdef_cassandra/runners/runners.py @@ -14,7 +14,7 @@ def run(system, moves, run_type, run_length, temperature, **kwargs): # Check that the user has the Cassandra binary on their PATH # Also need library_setup.py on the PATH and python2 - py2, fraglib_setup, cassandra = detect_cassandra_binaries() + py, fraglib_setup, cassandra = detect_cassandra_binaries() # Sanity checks # TODO: Write more of these @@ -49,7 +49,7 @@ def run(system, moves, run_type, run_length, temperature, **kwargs): # Run fragment generation (again, will be removed...) print("Generating fragment libraries...") successful_fraglib = _run_fraglib_setup( - py2, + py, fraglib_setup, cassandra, inp_file, @@ -71,7 +71,7 @@ def restart(system, moves, run_type, run_length, temperature, **kwargs): # Check that the user has the Cassandra binary on their PATH # Also need library_setup.py on the PATH and python2 - py2, fraglib_setup, cassandra = detect_cassandra_binaries() + py, fraglib_setup, cassandra = detect_cassandra_binaries() kwargs["restart"] = True @@ -98,11 +98,11 @@ def restart(system, moves, run_type, run_length, temperature, **kwargs): def _run_fraglib_setup( - py2, fraglib_setup, cassandra, inp_file, log_file, nspecies + py, fraglib_setup, cassandra, inp_file, log_file, nspecies ): """Builds the fragment libraries required to run Cassandra. - Requires python2. + Requires python. """ species_pdb_files = "" @@ -110,9 +110,9 @@ def _run_fraglib_setup( species_pdb_files += "species{}.pdb ".format(isp + 1) fraglib_cmd = ( - "{py2} {fraglib_setup} {cassandra} {inp_file} " + "{py} {fraglib_setup} {cassandra} {inp_file} " "{species_pdb_files}".format( - py2=py2, + py=py, fraglib_setup=fraglib_setup, cassandra=cassandra, inp_file=inp_file, diff --git a/mosdef_cassandra/tests/files/Cassandra_V1.2.tar.gz b/mosdef_cassandra/tests/files/Cassandra_V1.2.tar.gz deleted file mode 100644 index 81fff82..0000000 Binary files a/mosdef_cassandra/tests/files/Cassandra_V1.2.tar.gz and /dev/null differ diff --git a/mosdef_cassandra/tests/test_examples.py b/mosdef_cassandra/tests/test_examples.py index 35c6dec..90e153d 100644 --- a/mosdef_cassandra/tests/test_examples.py +++ b/mosdef_cassandra/tests/test_examples.py @@ -28,7 +28,7 @@ def test_run_nvt(self): completed = False for line in log_data: - if "Energy of final" in line: + if "Cassandra simulation complete" in line: completed = True assert completed @@ -51,7 +51,7 @@ def test_run_npt(self): completed = False for line in log_data: - if "Energy of final" in line: + if "Cassandra simulation complete" in line: completed = True assert completed @@ -74,7 +74,7 @@ def test_run_gcmc(self): completed = False for line in log_data: - if "Energy of final" in line: + if "Cassandra simulation complete" in line: completed = True assert completed @@ -97,7 +97,7 @@ def test_run_gemc(self): completed = False for line in log_data: - if "Energy of final" in line: + if "Cassandra simulation complete" in line: completed = True assert completed @@ -120,7 +120,7 @@ def test_run_nvt_mixture(self): completed = False for line in log_data: - if "Energy of final" in line: + if "Cassandra simulation complete" in line: completed = True assert completed @@ -143,6 +143,6 @@ def test_run_gcmc_adsorption(self): completed = False for line in log_data: - if "Energy of final" in line: + if "Cassandra simulation complete" in line: completed = True assert completed diff --git a/mosdef_cassandra/tests/test_writers.py b/mosdef_cassandra/tests/test_writers.py index edecd39..eb61bc7 100644 --- a/mosdef_cassandra/tests/test_writers.py +++ b/mosdef_cassandra/tests/test_writers.py @@ -1399,7 +1399,7 @@ def test_property_info(self, onecomp_system, twobox_system): ) assert ( - "# Property_Info 1\nenergy_total\nenergy_lj\nenergy_elec\nenergy_intra\nenthalpy\npressure\nvolume\nnmols\nmass_density\n" + "# Property_Info 1\nenergy_total\nenergy_intra\nenergy_inter\nenthalpy\npressure\nvolume\nnmols\nmass_density\n" in inp_data ) @@ -1413,7 +1413,7 @@ def test_property_info(self, onecomp_system, twobox_system): ) assert ( - "# Property_Info 1\nenergy_total\nenergy_lj\nenergy_elec\nenergy_intra\nenthalpy\npressure\nvolume\nnmols\nmass_density\n\n# Property_Info 2\nenergy_total\nenergy_lj\nenergy_elec\nenergy_intra\nenthalpy\npressure\nvolume\nnmols\nmass_density\n" + "# Property_Info 1\nenergy_total\nenergy_intra\nenergy_inter\nenthalpy\npressure\nvolume\nnmols\nmass_density\n\n# Property_Info 2\nenergy_total\nenergy_intra\nenergy_inter\nenthalpy\npressure\nvolume\nnmols\nmass_density\n" in inp_data ) diff --git a/mosdef_cassandra/utils/detect.py b/mosdef_cassandra/utils/detect.py index d1b972f..339f5c2 100644 --- a/mosdef_cassandra/utils/detect.py +++ b/mosdef_cassandra/utils/detect.py @@ -12,7 +12,7 @@ def detect_cassandra_binaries(): "cassandra_pgfortran.exe", ] - py2_exec_names = ["python2", "python2.7"] + py_exec_names = ["python"] for name in cassandra_exec_names: cassandra = shutil.which(name) @@ -27,18 +27,18 @@ def detect_cassandra_binaries(): "'library_setup.py' must be in your PATH" ) - for name in py2_exec_names: - py2 = shutil.which(name) - if py2 is not None: + for name in py_exec_names: + py = shutil.which(name) + if py is not None: break - if py2 is None: + if py is None: raise ValueError( - "Error detecting python2. library_setup.py requires python2" + "Error detecting python. library_setup.py requires python." ) print("Using the following executables for Cassandra:") - print("Python: {}".format(py2)) + print("Python: {}".format(py)) print("library_setup: {}".format(fraglib_setup)) print("Cassandra: {}".format(cassandra)) - return py2, fraglib_setup, cassandra + return py, fraglib_setup, cassandra diff --git a/mosdef_cassandra/writers/inp_functions.py b/mosdef_cassandra/writers/inp_functions.py index 68bd272..e44f946 100755 --- a/mosdef_cassandra/writers/inp_functions.py +++ b/mosdef_cassandra/writers/inp_functions.py @@ -425,9 +425,8 @@ def generate_input(system, moves, run_type, run_length, temperature, **kwargs): else: properties = [ "energy_total", - "energy_lj", - "energy_elec", "energy_intra", + "energy_inter", "enthalpy", "pressure", "volume", @@ -1588,11 +1587,24 @@ def get_property_info(properties, nbr_boxes): valid_properties = [ "energy_total", - "energy_lj", - "energy_elec", "energy_intra", + "energy_bond", + "energy_angle", + "energy_dihedral", + "energy_improper", + "energy_intravdw", + "energy_intraq", + "energy_inter", + "energy_intervdw", + "energy_lrc", + "energy_interq", + "energy_recip", + "energy_self", "enthalpy", "pressure", + "pressure_xx", + "pressure_yy", + "pressyre_zz", "volume", "nmols", "density", diff --git a/requirements-dev.txt b/requirements-dev.txt index eab2ce4..6669dd5 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -7,3 +7,4 @@ black sphinx sphinx_rtd_theme pytest +cassandra >= 1.2.2 diff --git a/requirements-test.txt b/requirements-test.txt index 9f23973..c1f80eb 100644 --- a/requirements-test.txt +++ b/requirements-test.txt @@ -4,3 +4,4 @@ foyer >= 0.7.3 mbuild >= 0.10.5 openbabel pytest +cassandra >= 1.2.2 diff --git a/requirements.txt b/requirements.txt index 732d96e..8dcaea2 100644 --- a/requirements.txt +++ b/requirements.txt @@ -2,3 +2,4 @@ numpy parmed foyer >= 0.7.3 mbuild >= 0.10.5 +cassandra >= 1.2.2