Exemple #1
0
    def __check_params__(self):
        """pysimm.cassandra.upd_simulation

        Private method designed for update the fields of the GCMC object to make them conformed with each other
        """
        # Synchronizing the simulation box parameters
        if self.fxd_sst:
            dx = self.fxd_sst.dim.xhi - self.fxd_sst.dim.xlo
            dy = self.fxd_sst.dim.yhi - self.fxd_sst.dim.ylo
            dz = self.fxd_sst.dim.zhi - self.fxd_sst.dim.zlo
            if (dx == dy) and (dy == dz):
                box_type = 'cubic'
                box_dims = str(dx)
            else:
                box_type = 'orthogonal'
                box_dims = '{0:} {1:} {2:}'.format(dx, dy, dz)

            upd_vals = OrderedDict([('box_count', 1), ('box_type', box_type),
                                    ('box_size', box_dims)])
            if ('Box_Info' in self.props.keys()) and isinstance(
                    self.props['Box_Info'], InpSpec):
                self.props['Box_Info'] = InpSpec('Box_Info', upd_vals, None,
                                                 **{'new_line': True})
            else:
                self.props['Box_Info'] = upd_vals

        tmp = self.props['Box_Info'].value['box_size']
        if self.props['Box_Info'].value['box_type'] == 'cubic':
            tmp = [tmp] * 3
        self.tot_sst.dim = system.Dimension(center=True,
                                            dx=float(tmp[0]),
                                            dy=float(tmp[1]),
                                            dz=float(tmp[2]))
Exemple #2
0
def run(test=False):
    # Setup the empty cubic box with
    bx_size = 60
    sst = system.System()
    sst.dim = system.Dimension(dx=bx_size,
                               dy=bx_size,
                               dz=bx_size,
                               center=[bx_size / 2, bx_size / 2, bx_size / 2])
    sst.forcefield = 'trappe/amber'

    molec = system.read_lammps('c2h4.lmps')
    molec.forcefield = 'trappe/amber'

    cs = cassandra.Cassandra(sst)
    npt_props = cs.read_input('props.inp')
    npt_props['Pressure_Info'] = 25  # Simulated pressure in bars
    npt_props['Start_Type'] = {'start_type': 'make_config', 'species': 300}
    npt_props['Run_Type'] = {'type': 'equilibration', 'steps': [1000, 100]}
    npt_props['Simulation_Length_Info'] = {'run': 10000}
    npt_props['Property_Info'] = {
        'prop1': 'energy_total',
        'prop2': 'volume',
        'prop3': 'mass_density'
    }

    cs.add_simulation('NPT',
                      species=molec,
                      is_rigid=True,
                      out_folder='results',
                      **npt_props)

    cs.run()

    lmps.check_lmps_attr(cs.system)
    cs.system.write_lammps('final_conf.lmps')
Exemple #3
0
def run(test=False):
    # Setup the box with acetelene molecules on the regular grid
    sst = system.System()

    bx_size = 30
    sst.dim = system.Dimension(dx=bx_size,
                               dy=bx_size,
                               dz=bx_size,
                               center=[bx_size / 2, bx_size / 2, bx_size / 2])
    sst.forcefield = 'trappe/amber'

    molec = system.read_lammps('c2h4.lmps')
    molec.forcefield = 'trappe/amber'

    cs = cassandra.Cassandra(sst)
    nvt_props = cs.read_input('props.inp')

    nvt_props['Temperature_Info'] = 400
    nvt_props['Start_Type'] = {'start_type': 'make_config', 'species': 300}
    nvt_props['Simulation_Length_Info'] = {'run': 300000}
    nvt_props['Property_Info'] = {
        'prop1': 'energy_total',
        'prop2': 'pressure',
        'prop3': 'mass_density'
    }
    cs.add_nvt(species=molec, is_rigid=True, out_folder='results', **nvt_props)

    cs.run()

    lmps.check_lmps_attr(cs.system)
    cs.system.write_lammps('final_conf.lmps')
Exemple #4
0
 def setUp(self):
     self.sst = system.read_pubchem_cid(6360)
     self.sst.dim = system.Dimension(xlo=-10,
                                     ylo=-10,
                                     zlo=-10,
                                     xhi=10,
                                     yhi=10,
                                     zhi=10)
     self.sst.apply_forcefield(forcefield.Pcff(), charges='gasteiger')
     self.fname_temp = 'testfile.output.{}'
     self.fname = ''
Exemple #5
0
    def test_nonames_mc(self):
        sst = system.System()
        sst.dim = system.Dimension(dx=40, dy=40, dz=40, center=[0, 0, 0])
        sst.forcefield = 'trappe/amber'
        css = cassandra.Cassandra(sst)
        my_gcmc_props = css.read_input(osp.join(self.data_path, 'props.inp'))

        specie = system.read_lammps(osp.join(self.data_path, 'toluene_nonames.lmps'))
        specie.forcefield = 'trappe/amber'

        with pytest.raises(SystemExit) as err_back:
            css.add_gcmc(species=specie, is_rigid=True, max_ins=200,
                         chem_pot=-30.34, out_folder=self.data_path, **my_gcmc_props)
            assert err_back.type == SystemExit
Exemple #6
0
def run(test=False):
    # In order to run CASSANDRA GCMC one need to create the CASSANDRA object
    sst = system.System()
    sst.dim = system.Dimension(dx=40, dy=40, dz=45, center=[0, 0, 0])
    sst.forcefield = 'trappe/amber'
    lmps.check_lmps_attr(sst)

    css = cassandra.Cassandra(sst)

    # Read the CASSANDRA .inp parameters file -- common way to setup simulations.
    # Any of the read properties can be modified here afterwards
    my_gcmc_props = css.read_input('props.inp')

    # The prefix for the all files that will be created by this run
    my_gcmc_props['Run_Name'] = 'gas_adsorb'

    # Set the gas (gas system) to be purged in a box
    specie1 = system.read_lammps('co2.lmps')
    specie2 = system.read_lammps('ch4.lmps')
    specie3 = system.read_lammps('m-xylene.lmps')
    for s in [specie1, specie2, specie3]:
        s.forcefield = 'trappe/amber'

    css.add_gcmc(species=[specie1, specie2, specie3],
                 is_rigid=[True, False, True],
                 max_ins=[2000, 1000, 500],
                 chem_pot=[-27.34, -29.34, -24.59],
                 out_folder='gas_adsorb_results',
                 **my_gcmc_props)
    css.run()

    for pt in css.system.particle_types:
        pt.elem = pt.real_elem

    css.system.write_lammps('gas_adsorb.lmps')
    css.system.write_xyz('gas_adsorb.xyz')
Exemple #7
0
        if p.bonds.count == 4:
            p.type = o_3
        else:
            p.type = o_r
    if p.elem == 'C':
        p.type = c_r
    if p.elem == 'Zn':
        p.type = zn
    if p.elem == 'H':
        p.type = h_
f.assign_btypes(s)
f.assign_atypes(s)
f.assign_dtypes(s)
f.assign_itypes(s)

# Assign the calculation box size assuming it is cubic
cc_bnd_lngth = 1.363
dim = cc_bnd_lngth / 2 + max(df['x'].values) - min(df['x'].values)
s.dim = system.Dimension(dx=dim,
                         dy=dim,
                         dz=dim,
                         center=[dim / 2, dim / 2, dim / 2])
s.forcefield = 'dreiding-lj'
s.pair_style = 'lj'
s.bond_style = 'harmonic'
s.angle_style = 'harmonic'
s.dihedral_style = 'harmonic'
s.improper_style = 'harmonic'

s.write_lammps('irmof-14.lmps')
Exemple #8
0
from pysimm import system, cassandra
from collections import OrderedDict

# In order to run CASSANDRA GCMC one need to create the CASSANDRA object
sst = system.System()
sst.dim = system.Dimension(dx=45, dy=45, dz=45, center=[0, 0, 0])
css = cassandra.Cassandra(sst)

# Read the CASSANDRA .inp parameters file -- common way to setup simulations.
# Any of the read properties can be modified here afterwards
my_gcmc_props = css.read_input('props.inp')

# The prefix for the all files that will be created by this run
my_gcmc_props['Run_Name'] = 'gas_adsorb'

# Set the gas (gas system) to be purged in a box
specie1 = system.read_lammps('co2.lmps')
specie2 = system.read_lammps('ch4.lmps')
specie3 = system.read_lammps('m-xylene.lmps')

css.add_gcmc(species=[specie1, specie2, specie3],
             max_ins=[2000, 1000, 500],
             chem_pot=[-27.34, -29.34, -24.59],
             out_folder='gas_adsorb_results',
             **my_gcmc_props)
css.run()

for pt in css.final_sst.particle_types:
    pt.elem = pt.real_elem

css.final_sst.write_lammps('gas_adsorb.lmps')